Skip to content

Commit d1da69e

Browse files
committed
feat(sdk-coin-ada): add unspents and seq id in transfer token intent
Ticket: WIN-7804
1 parent 2adcba1 commit d1da69e

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

modules/bitgo/test/v2/unit/wallet.ts

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
MessageStandardType,
2222
MessageTypes,
2323
PopulatedIntent,
24+
PrebuildTransactionOptions,
2425
PrebuildTransactionWithIntentOptions,
2526
RequestTracer,
2627
SendManyOptions,
@@ -2060,6 +2061,7 @@ describe('V2 Wallet:', function () {
20602061
describe('TSS Wallets', function () {
20612062
const sandbox = sinon.createSandbox();
20622063
const tsol = bitgo.coin('tsol');
2064+
const tada = bitgo.coin('tada');
20632065
const walletData = {
20642066
id: '5b34252f1bf349930e34020a00000000',
20652067
coin: 'tsol',
@@ -2096,7 +2098,20 @@ describe('V2 Wallet:', function () {
20962098
multisigType: 'tss',
20972099
};
20982100

2101+
const adaWalletData = {
2102+
id: 'bf1897a1-e4bd-4b96-b2a4-ba02c0fc9956',
2103+
coin: 'tada',
2104+
keys: [
2105+
'598f606cd8fc24710d2ebad89dce86c2',
2106+
'598f606cc8e43aef09fcb785221d9dd2',
2107+
'5935d59cf660764331bafcade1855fd7',
2108+
],
2109+
coinSpecific: {},
2110+
multisigType: 'tss',
2111+
};
2112+
20992113
const tssSolWallet = new Wallet(bitgo, tsol, walletData);
2114+
const tssAdaWallet = new Wallet(bitgo, tada, adaWalletData);
21002115

21012116
let tssEthWallet = new Wallet(bitgo, bitgo.coin('teth'), ethWalletData);
21022117
const tssPolygonWallet = new Wallet(bitgo, bitgo.coin('tpolygon'), polygonWalletData);
@@ -3277,6 +3292,47 @@ describe('V2 Wallet:', function () {
32773292
},
32783293
});
32793294
});
3295+
3296+
it('should pass unspents and sequence id in transferToken build payload for ada token withdrawals', async function () {
3297+
const params: PrebuildTransactionOptions = {
3298+
idfSignedTimestamp: '2025-11-10T08:14:19.010Z',
3299+
idfUserId: '5cae3130f8f4561d51dfcbfdaafba9b9',
3300+
idfVersion: 1,
3301+
instant: false,
3302+
comment: '',
3303+
unspents: ['79bac2b3c43de1767f0731caf92d5cd7edfe5da433b056002df42f0c055a3023:1'],
3304+
recipients: [
3305+
{
3306+
amount: '2',
3307+
address:
3308+
'addr_test1qz4m3ms9nxra36t6rtz4lzc9zkk3d4qwcpcr3yxwhxlslpathrhqtxv8mr5h5xk9t79s29ddzm2qasrs8zgvawdlp7rs44g5hc',
3309+
tokenName: 'tada:water',
3310+
},
3311+
],
3312+
sequenceId: '4QLtXkBrZhc6AtecFZVnHCYH1UAk',
3313+
numBlocks: 2,
3314+
txFormat: 'psbt' as const,
3315+
type: 'transfertoken',
3316+
preview: true,
3317+
};
3318+
3319+
let capturedRequestBody: any;
3320+
nock(bgUrl)
3321+
.post(`/api/v2/wallet/${tssAdaWallet.id()}/txrequests`, (body) => {
3322+
capturedRequestBody = body;
3323+
return true;
3324+
})
3325+
.reply(200, { unsignedTxs: ['tx'] });
3326+
3327+
await tssAdaWallet.prebuildTransaction(params);
3328+
3329+
console.log('capturedRequestBody', capturedRequestBody);
3330+
capturedRequestBody.should.not.be.undefined();
3331+
capturedRequestBody!.intent.should.have.property('unspents');
3332+
capturedRequestBody!.intent.unspents.should.deepEqual(params.unspents);
3333+
capturedRequestBody!.intent.should.have.property('sequenceId');
3334+
capturedRequestBody!.intent.sequenceId.should.equal(params.sequenceId);
3335+
});
32803336
});
32813337

32823338
describe('Transaction signing', function () {

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3448,6 +3448,8 @@ export class Wallet implements IWallet {
34483448
recipients: params.recipients || [],
34493449
nonce: params.nonce,
34503450
feeOptions,
3451+
unspents: params.unspents,
3452+
sequenceId: params.sequenceId,
34513453
},
34523454
apiVersion,
34533455
params.preview

0 commit comments

Comments
 (0)