Skip to content

Commit

Permalink
feat(root): whitelist apiVersion for buildAccountConsolidations
Browse files Browse the repository at this point in the history
In order to start migrating TSS EdDSA to full txRequest, we need to allow this param to be passed to
use txRequest full, similar on how we do for sendMany

WP-1123

TICKET: WP-1123
  • Loading branch information
alebusse committed Dec 8, 2023
1 parent 9793ebf commit 83003de
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion modules/express/src/clientRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ function createSendParams(req: express.Request) {
}

function createTSSSendParams(req: express.Request) {
if (req.config.externalSignerUrl !== undefined) {
if (req.config?.externalSignerUrl !== undefined) {
const coin = req.bitgo.coin(req.params.coin);
if (coin.getMPCAlgorithm() === MPCType.EDDSA) {
return {
Expand Down
19 changes: 19 additions & 0 deletions modules/express/test/unit/clientRoutes/consolidateAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,25 @@ describe('Consolidate account', () => {
consolidationStub.should.be.calledOnceWith(body);
});

it('should pass the apiVersion param to bitgo api consolidate/build', async () => {
const result = { success: [], failure: [] };
const body = { apiVersion: 'full' };
const { bitgoStub, consolidationStub } = createConsolidateMocks(result, true, true);
const mockRequest = {
bitgo: bitgoStub,
params: {
coin: 'tsol',
id: '23423423423423',
},
body,
};

await handleV2ConsolidateAccount(mockRequest as express.Request & typeof mockRequest).should.be.resolvedWith(
result
);
consolidationStub.should.be.calledOnceWith(body);
});

it('should return 202 when some transactions fail', async () => {
const result = { success: [0], failure: [0] };
const body = 'testbody';
Expand Down
1 change: 1 addition & 0 deletions modules/sdk-core/src/bitgo/wallet/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ export class Wallet implements IWallet {
'validToBlock',
'preview',
'keepAlive',
'apiVersion',
];
}

Expand Down

0 comments on commit 83003de

Please sign in to comment.