Skip to content

Commit fc2168c

Browse files
committed
feat: handling new canton intent type in prebuild
CHALO-172
1 parent f4ee459 commit fc2168c

5 files changed

Lines changed: 24 additions & 0 deletions

File tree

modules/sdk-coin-canton/src/canton.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,5 +245,8 @@ export class Canton extends BaseCoin {
245245
if (params.txRequestId) {
246246
intent.txRequestId = params.txRequestId;
247247
}
248+
if (params.contractId) {
249+
intent.contractId = params.contractId;
250+
}
248251
}
249252
}

modules/sdk-core/src/bitgo/utils/mpcUtils.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ export abstract class MpcUtils {
141141
assert(params.txRequestId, `'txRequestId' is required parameter for ${params.intentType} intent`);
142142
}
143143

144+
if (params.intentType === 'transferOfferWithdrawn' && baseCoin.getFamily() === 'canton') {
145+
assert(params.contractId, `'contractId' is required parameter for ${params.intentType} intent`);
146+
}
147+
144148
if (
145149
![
146150
'acceleration',
@@ -150,6 +154,7 @@ export abstract class MpcUtils {
150154
'customTx',
151155
'transferAccept',
152156
'transferReject',
157+
'transferOfferWithdrawn',
153158
].includes(params.intentType)
154159
) {
155160
assert(params.recipients, `'recipients' is a required parameter for ${params.intentType} intent`);

modules/sdk-core/src/bitgo/utils/tss/baseTypes.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ export interface PrebuildTransactionWithIntentOptions extends IntentOptionsBase
270270
};
271271
txRequestId?: string;
272272
isTestTransaction?: boolean;
273+
contractId?: string;
273274
}
274275
export interface IntentRecipient {
275276
address: {
@@ -340,6 +341,7 @@ export interface PopulatedIntent extends PopulatedIntentBase {
340341
aptosCustomTransactionParams?: aptosCustomTransactionParams;
341342
txRequestId?: string;
342343
isTestTransaction?: boolean;
344+
contractId?: string;
343345
}
344346

345347
export type TxRequestState =

modules/sdk-core/src/bitgo/wallet/iWallet.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ export interface PrebuildTransactionOptions {
218218
};
219219
txRequestId?: string;
220220
isTestTransaction?: boolean;
221+
contractId?: string;
221222
}
222223

223224
export interface PrebuildAndSignTransactionOptions extends PrebuildTransactionOptions, WalletSignTransactionOptions {

modules/sdk-core/src/bitgo/wallet/wallet.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3714,6 +3714,19 @@ export class Wallet implements IWallet {
37143714
);
37153715
break;
37163716
}
3717+
case 'transferOfferWithdrawn': {
3718+
txRequest = await this.tssUtils!.prebuildTxWithIntent(
3719+
{
3720+
reqId,
3721+
intentType: 'transferOfferWithdrawn',
3722+
contractId: params.contractId,
3723+
sequenceId: params.contractId,
3724+
},
3725+
apiVersion,
3726+
params.preview
3727+
);
3728+
break;
3729+
}
37173730
case 'customTx':
37183731
txRequest = await this.tssUtils!.prebuildTxWithIntent(
37193732
{

0 commit comments

Comments
 (0)