From edbfb4c8489e559908c28b05cd36b8316deb7a59 Mon Sep 17 00:00:00 2001 From: Pranav Jain Date: Mon, 30 Mar 2026 18:19:31 -0400 Subject: [PATCH] fix: default type to 'transfer' for TSS sendMany requests MPC sendMany requires the type parameter for TSS wallets but the schema marks it as optional. This defaults type to 'transfer' when not provided, matching the actual SDK requirement. Co-Authored-By: Claude Opus 4.6 --- src/__tests__/api/master/sendMany.test.ts | 4 ++++ src/masterBitgoExpress/handlers/handleSendMany.ts | 4 ++++ src/masterBitgoExpress/routers/sendManyRoute.ts | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/__tests__/api/master/sendMany.test.ts b/src/__tests__/api/master/sendMany.test.ts index 0218baf..d599fa3 100644 --- a/src/__tests__/api/master/sendMany.test.ts +++ b/src/__tests__/api/master/sendMany.test.ts @@ -298,6 +298,10 @@ describe('POST /api/v1/:coin/advancedwallet/:walletId/sendMany', () => { response.body.should.have.property('txid', 'test-tx-id'); response.body.should.have.property('tx', 'signed-transaction'); + // Verify that type defaults to 'transfer' for TSS wallets when not provided + const sendManyArgs = sendManyStub.firstCall.args[0] as Record; + sendManyArgs.should.have.property('type', 'transfer'); + walletGetNock.done(); keychainGetNock.done(); sinon.assert.calledOnce(sendManyStub); diff --git a/src/masterBitgoExpress/handlers/handleSendMany.ts b/src/masterBitgoExpress/handlers/handleSendMany.ts index e5fdaa5..9253bea 100644 --- a/src/masterBitgoExpress/handlers/handleSendMany.ts +++ b/src/masterBitgoExpress/handlers/handleSendMany.ts @@ -125,6 +125,10 @@ export async function handleSendMany(req: MasterApiSpecRouteRequest<'v1.wallet.s if (signingKeychain.source === 'backup') { throw new BadRequestError('Backup MPC signing not supported for sendMany'); } + // TSS wallets require type to be set; default to 'transfer' if not provided + if (!params.type) { + params.type = 'transfer'; + } const mpcSendParams = await createMPCSendParamsWithCustomSigningFns( req, awmClient, diff --git a/src/masterBitgoExpress/routers/sendManyRoute.ts b/src/masterBitgoExpress/routers/sendManyRoute.ts index 77bda70..608acdf 100644 --- a/src/masterBitgoExpress/routers/sendManyRoute.ts +++ b/src/masterBitgoExpress/routers/sendManyRoute.ts @@ -8,7 +8,7 @@ export const SendManyRequest = { */ source: t.union([t.literal('user'), t.literal('backup')]), /** - * Required for transactions from MPC wallets. + * Required for transactions from MPC wallets. Defaults to 'transfer' for TSS wallets if not provided. */ type: t.union([ t.undefined,