Skip to content

Commit

Permalink
fix mock provider
Browse files Browse the repository at this point in the history
  • Loading branch information
gyroflaw committed Oct 16, 2023
1 parent 228aacf commit 93ed3a6
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions e2e/nctl/Provider.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const processDeploy = async (
req.params = DeployUtil.deployToJson(signedDeploy);
// const jrpcResult = await sendRpcRequestToChain(req, rpcTarget);
const jrpcResult = { deploy_hash: '0x123', rpcTarget };
return jrpcResult
return jrpcResult;
}
throw new Error('Failed to parse deploy');
};
Expand All @@ -107,7 +107,7 @@ export class MockProvider {
this.client = new CasperClient(rpcTarget);
}

async sendAsync(req: JRPCRequest<unknown>): Promise<any> {
async request(req: JRPCRequest<unknown>): Promise<any> {
// we are intercepting 'account_put_deploy' (ie. signing the deploy and then submitting the signed deploy
// to blockchain)
// for rest of rpc calls we are simply sending rpc call to blockchain and returning the result.
Expand All @@ -116,13 +116,17 @@ export class MockProvider {
} else {
try {
const jrpcResult = await sendRpcRequestToChain(req, this.rpcTarget);
return jrpcResult
return jrpcResult;
} catch (error) {
throw error;
}
}
}

async sendAsync(req: JRPCRequest<unknown>): Promise<any> {
return this.request(req);
}

// currently we only use sendAsync in provider transport, so we live it unimplemented here.
send(_: JRPCRequest<unknown>, __: SendCallBack<any>): void {
return;
Expand Down

0 comments on commit 93ed3a6

Please sign in to comment.