From b73b34e91e343c9549b4654f3b08f55508943f76 Mon Sep 17 00:00:00 2001 From: "arunchockalingam504@bitgo.com" Date: Thu, 25 Jun 2026 16:14:20 +0000 Subject: [PATCH] fix(sdk-coin-flrp): custody wallets no longer require a password MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FLRP (Flare P-Chain) is a TSS-only coin — its statics define CoinFeature.TSS and CoinFeature.MPCV2 but not CoinFeature.MULTISIG. Custody wallets for FLRP must therefore be created with multisigType='tss', and signing is handled server-side with no user key material on the client. Previously, getDefaultMultisigType() returned 'onchain'. This caused generateWallet({ type: 'custodial' }) to take the onchain-custodial code path in wallets.ts (line 548), which creates a wallet object whose multisigType the platform rejects ("Source FLR P wallet is not MPC (multisigType: onchain)"). Any caller that did pass multisigType:'tss' explicitly would correctly use generateCustodialMpcWallet (no passphrase), but without a matching default the omission silently produced a broken wallet. Fix: return multisigTypes.tss from getDefaultMultisigType(), matching the behaviour of sdk-coin-flr (FLR C-Chain), which correctly defaults to TSS and has working custody wallets. With this default, generateWallet({ type: 'custodial' }) for FLRP now routes through generateCustodialMpcWallet, which creates the wallet server-side and requires no passphrase. Ticket: CECHO-1451 Session-Id: 7a278a4a-2a01-4004-b7bf-1ec86294141e Task-Id: f3d71be2-ccd9-4342-a175-d342d5857ebe --- modules/bitgo/test/v2/unit/wallets.ts | 38 +++++++++++++++++++++++++ modules/sdk-coin-flrp/src/flrp.ts | 2 +- modules/sdk-coin-flrp/test/unit/flrp.ts | 2 +- 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/modules/bitgo/test/v2/unit/wallets.ts b/modules/bitgo/test/v2/unit/wallets.ts index d950e7c2a2..ae41d528c1 100644 --- a/modules/bitgo/test/v2/unit/wallets.ts +++ b/modules/bitgo/test/v2/unit/wallets.ts @@ -810,6 +810,44 @@ describe('V2 Wallets:', function () { walletNock.isDone().should.be.true(); }); + it('should create a new FLRP TSS custodial wallet without requiring a passphrase', async function () { + const keys = ['1', '2', '3']; + const tflrp = bitgo.coin('tflrp'); + + const walletParams: GenerateWalletOptions = { + label: 'flrp custodial wallet', + enterprise: 'enterprise', + type: 'custodial', + // No multisigType specified — should default to 'tss' for FLRP + // No passphrase — custodial wallets must not require one + }; + + // FLRP is ECDSA, so generateCustodialMpcWallet fetches TSS settings + nock('https://bitgo.fakeurl') + .get('/api/v2/tss/settings') + .reply(200, { coinSettings: { flrp: { walletCreationSettings: {} } } }); + + const walletNock = nock('https://bitgo.fakeurl') + .post('/api/v2/tflrp/wallet/add') + .times(1) + .reply(200, { ...walletParams, multisigType: 'tss', keys }); + + const flrpWallets = new Wallets(bitgo, tflrp); + + const res = await flrpWallets.generateWallet(walletParams); + if (!isWalletWithKeychains(res)) { + throw new Error('wallet missing required keychains'); + } + res.wallet.label().should.equal(walletParams.label); + should.equal(res.wallet.type(), walletParams.type); + res.wallet.multisigType().should.equal('tss'); + res.userKeychain.id.should.equal(keys[0]); + res.backupKeychain.id.should.equal(keys[1]); + res.bitgoKeychain.id.should.equal(keys[2]); + + walletNock.isDone().should.be.true(); + }); + it('should create a new TSS SMC wallet', async function () { const commonKeychain = 'longstring'; const seed = 'seed'; diff --git a/modules/sdk-coin-flrp/src/flrp.ts b/modules/sdk-coin-flrp/src/flrp.ts index 951f4a03f3..b86d04d3d5 100644 --- a/modules/sdk-coin-flrp/src/flrp.ts +++ b/modules/sdk-coin-flrp/src/flrp.ts @@ -68,7 +68,7 @@ export class Flrp extends BaseCoin { /** inherited doc */ getDefaultMultisigType(): MultisigType { - return multisigTypes.onchain; + return multisigTypes.tss; } /** @inheritdoc */ diff --git a/modules/sdk-coin-flrp/test/unit/flrp.ts b/modules/sdk-coin-flrp/test/unit/flrp.ts index 74cb887464..2227818755 100644 --- a/modules/sdk-coin-flrp/test/unit/flrp.ts +++ b/modules/sdk-coin-flrp/test/unit/flrp.ts @@ -64,7 +64,7 @@ describe('Flrp test cases', function () { }); it('should return default multisig type', function () { - basecoin.getDefaultMultisigType().should.equal('onchain'); + basecoin.getDefaultMultisigType().should.equal('tss'); }); it('should support TSS', function () {