Skip to content

Commit 82b9189

Browse files
authored
Merge pull request #185 from BitGo/WP-8438-transfer-type
fix: default type to 'transfer' for TSS sendMany requests
2 parents 22a1270 + edbfb4c commit 82b9189

3 files changed

Lines changed: 9 additions & 1 deletion

File tree

src/__tests__/api/master/sendMany.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,10 @@ describe('POST /api/v1/:coin/advancedwallet/:walletId/sendMany', () => {
298298
response.body.should.have.property('txid', 'test-tx-id');
299299
response.body.should.have.property('tx', 'signed-transaction');
300300

301+
// Verify that type defaults to 'transfer' for TSS wallets when not provided
302+
const sendManyArgs = sendManyStub.firstCall.args[0] as Record<string, unknown>;
303+
sendManyArgs.should.have.property('type', 'transfer');
304+
301305
walletGetNock.done();
302306
keychainGetNock.done();
303307
sinon.assert.calledOnce(sendManyStub);

src/masterBitgoExpress/handlers/handleSendMany.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ export async function handleSendMany(req: MasterApiSpecRouteRequest<'v1.wallet.s
125125
if (signingKeychain.source === 'backup') {
126126
throw new BadRequestError('Backup MPC signing not supported for sendMany');
127127
}
128+
// TSS wallets require type to be set; default to 'transfer' if not provided
129+
if (!params.type) {
130+
params.type = 'transfer';
131+
}
128132
const mpcSendParams = await createMPCSendParamsWithCustomSigningFns(
129133
req,
130134
awmClient,

src/masterBitgoExpress/routers/sendManyRoute.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const SendManyRequest = {
88
*/
99
source: t.union([t.literal('user'), t.literal('backup')]),
1010
/**
11-
* Required for transactions from MPC wallets.
11+
* Required for transactions from MPC wallets. Defaults to 'transfer' for TSS wallets if not provided.
1212
*/
1313
type: t.union([
1414
t.undefined,

0 commit comments

Comments
 (0)