Skip to content

Commit

Permalink
fix(sdk-core): handle ContractCall intent for TSS transaction type
Browse files Browse the repository at this point in the history
Ticket: BG-78370
  • Loading branch information
ajays97 committed Aug 16, 2023
1 parent 3276e2b commit f1e6120
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions modules/sdk-core/src/bitgo/utils/tss/baseTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ export interface PrebuildTransactionWithIntentOptions extends IntentOptionsBase
lowFeeTxid?: string;
custodianTransactionId?: string;
receiveAddress?: string;
data?: string;
}
export interface IntentRecipient {
address: {
Expand Down
19 changes: 19 additions & 0 deletions modules/sdk-core/src/bitgo/wallet/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2712,6 +2712,7 @@ export class Wallet implements IWallet {
}

let txRequest: TxRequest;
console.log(`Got params.type: ${JSON.stringify(params)}`);
switch (params.type) {
case 'transfer':
txRequest = await this.tssUtils!.prebuildTxWithIntent(
Expand Down Expand Up @@ -2785,6 +2786,24 @@ export class Wallet implements IWallet {
params.preview
);
break;
case 'ContractCall':
if (!params.data) {
throw new Error(`data is missing in intent: ContractCall`);
}
txRequest = await this.tssUtils!.prebuildTxWithIntent(
{
reqId,
intentType: 'ContractCall',
comment: params.comment,
nonce: params.nonce,
receiveAddress: params.receiveAddress,
feeOptions,
data: `${params.data}`,
},
apiVersion,
params.preview
);
break;
default:
throw new Error(`transaction type not supported: ${params.type}`);
}
Expand Down

0 comments on commit f1e6120

Please sign in to comment.