Skip to content

Commit

Permalink
feat: sending method to prompt handler in sendNanoContractTx
Browse files Browse the repository at this point in the history
  • Loading branch information
andreabadesso committed Jul 12, 2024
1 parent df88a9f commit e6d257c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ describe('sendNanoContractTx', () => {
it('should throw SendNanoContractTxFailure if the transaction fails', async () => {
const pinCode = '1234';
const ncData = {
method: 'initialize',
blueprintId: rpcRequest.params.blueprint_id,
ncId: rpcRequest.params.nc_id,
args: rpcRequest.params.args,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export async function sendNanoContractTx(
blueprintId,
ncId: nc_id,
actions,
method,
args,
pushTx: push_tx,
},
Expand Down Expand Up @@ -119,6 +120,10 @@ export async function sendNanoContractTx(
response,
} as RpcResponse;
} catch (err) {
throw new SendNanoContractTxFailure();
if (err instanceof Error) {
throw new SendNanoContractTxFailure(err.message);
} else {
throw new SendNanoContractTxFailure('An unknown error occurred');
}
}
}
1 change: 1 addition & 0 deletions packages/hathor-rpc-handler/src/types/prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export interface NanoContractParams {
blueprintId: string;
ncId: string | null;
actions: NanoContractAction[],
method: string;
args: unknown[];
pushTx: boolean;
}
Expand Down

0 comments on commit e6d257c

Please sign in to comment.