Skip to content

Commit

Permalink
Merge pull request #4135 from BitGo/WP-1123-whitelist-apiVersion-for-…
Browse files Browse the repository at this point in the history
…buildAccountConsolidations

feat(root): whitelist apiVersion for buildAccountConsolidations
  • Loading branch information
alebusse authored Dec 15, 2023
2 parents 97af937 + 83003de commit 18b87d1
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 @@ -200,6 +200,7 @@ export class Wallet implements IWallet {
'validToBlock',
'preview',
'keepAlive',
'apiVersion',
];
}

Expand Down

0 comments on commit 18b87d1

Please sign in to comment.