From 5611cc0dd68494fe30eb3d2c3c7f38d0be6310d5 Mon Sep 17 00:00:00 2001 From: Prabhsharan Singh Date: Wed, 10 Jun 2026 09:08:56 +0000 Subject: [PATCH] fix(sdk-core): add tokenName to prebuildConsolidateAccountParams whitelist ERC-20 token consolidation via consolidateAccount/build was failing for TSS wallets because tokenName was stripped before being forwarded to the build API. Add tokenName to the whitelist so token consolidation requests reach the server correctly. Ticket: COINS-367 Co-Authored-By: Claude Fable 5 Session-Id: c19bb44d-feb9-4b14-b800-daab9f206490 Task-Id: f2e56cc2-ad97-433d-9490-6c1f9f20de34 --- .../bitgo/test/v2/unit/accountConsolidations.ts | 14 ++++++++++++++ modules/sdk-core/src/bitgo/wallet/wallet.ts | 1 + 2 files changed, 15 insertions(+) diff --git a/modules/bitgo/test/v2/unit/accountConsolidations.ts b/modules/bitgo/test/v2/unit/accountConsolidations.ts index 431103d61a..63953d50e1 100644 --- a/modules/bitgo/test/v2/unit/accountConsolidations.ts +++ b/modules/bitgo/test/v2/unit/accountConsolidations.ts @@ -64,6 +64,20 @@ describe('Account Consolidations:', function () { scope.isDone().should.be.True(); }); + it('should forward tokenName to the build request', async function () { + const tokenName = 'talgo:USDt'; + const scope = nock(bgUrl) + .post(`/api/v2/${wallet.coin()}/wallet/${wallet.id()}/consolidateAccount/build`, { tokenName }) + .query({}) + .reply(200, fixtures.buildAccountConsolidation); + + const accountConsolidationBuild = await wallet.buildAccountConsolidations({ tokenName }); + + accountConsolidationBuild.length.should.equal(2); + + scope.isDone().should.be.True(); + }); + it('should throw if the result is an empty array', async function () { const scope = nock(bgUrl) .post(`/api/v2/${wallet.coin()}/wallet/${wallet.id()}/consolidateAccount/build`) diff --git a/modules/sdk-core/src/bitgo/wallet/wallet.ts b/modules/sdk-core/src/bitgo/wallet/wallet.ts index c466ce8b7f..4c5a35088f 100644 --- a/modules/sdk-core/src/bitgo/wallet/wallet.ts +++ b/modules/sdk-core/src/bitgo/wallet/wallet.ts @@ -306,6 +306,7 @@ export class Wallet implements IWallet { prebuildConsolidateAccountParams(): string[] { return [ 'consolidateAddresses', + 'tokenName', 'nftCollectionId', 'nftId', 'feeRate',