diff --git a/modules/bitgo/test/v2/unit/wallets.ts b/modules/bitgo/test/v2/unit/wallets.ts index c9e2c3999f..9cf3ee964a 100644 --- a/modules/bitgo/test/v2/unit/wallets.ts +++ b/modules/bitgo/test/v2/unit/wallets.ts @@ -788,6 +788,10 @@ describe('V2 Wallets:', function () { type: 'custodial', }; + nock('https://bitgo.fakeurl') + .get('/api/v2/tss/settings') + .reply(200, { coinSettings: { sol: { walletCreationSettings: {} } } }); + const walletNock = nock('https://bitgo.fakeurl') .post('/api/v2/tsol/wallet/add') .times(1) @@ -1420,11 +1424,12 @@ describe('V2 Wallets:', function () { sol: { walletCreationSettings: { multiSigTypeVersion: 'MPCv2', + custodialMultiSigTypeVersion: 'MPCv2', }, }, }, }; - nock('https://bitgo.fakeurl').get(`/api/v2/tss/settings`).times(2).reply(200, tssSettings); + nock('https://bitgo.fakeurl').get(`/api/v2/tss/settings`).times(3).reply(200, tssSettings); }); afterEach(function () { @@ -1534,6 +1539,38 @@ describe('V2 Wallets:', function () { assert.ok(response.encryptedWalletPassphrase); assert.ok(response.wallet); }); + + it('should create a new tsol TSS EdDSA MPCv2 custodial wallet', async function () { + const keys = ['1', '2', '3']; + const testCoin = bitgo.coin('tsol'); + + const walletParams: GenerateWalletOptions = { + label: 'tss eddsa mpcv2 custodial wallet', + multisigType: 'tss', + enterprise: 'enterprise', + type: 'custodial', + }; + + const walletNock = nock('https://bitgo.fakeurl') + .post('/api/v2/tsol/wallet/add') + .times(1) + .reply(200, { ...walletParams, keys }); + + const wallets = new Wallets(bitgo, testCoin); + + const res = await wallets.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(walletParams.multisigType); + 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(); + }); }); describe('Sharing', () => { diff --git a/modules/sdk-core/src/bitgo/wallet/wallets.ts b/modules/sdk-core/src/bitgo/wallet/wallets.ts index 9a27d73e7b..62b8e5871e 100644 --- a/modules/sdk-core/src/bitgo/wallet/wallets.ts +++ b/modules/sdk-core/src/bitgo/wallet/wallets.ts @@ -2013,13 +2013,16 @@ export class Wallets implements IWallets { const reqId = new RequestTracer(); this.bitgo.setRequestTracer(reqId); - if (multisigType === 'tss' && this.baseCoin.getMPCAlgorithm() === 'ecdsa') { + if (multisigType === 'tss') { const tssSettings: TssSettings = await this.bitgo .get(this.bitgo.microservicesUrl('/api/v2/tss/settings')) .result(); const multisigTypeVersion = tssSettings.coinSettings[this.baseCoin.getFamily()]?.walletCreationSettings?.custodialMultiSigTypeVersion; - walletVersion = this.determineEcdsaMpcWalletVersion(walletVersion, multisigTypeVersion); + + if (this.baseCoin.getMPCAlgorithm() === 'ecdsa') { + walletVersion = this.determineEcdsaMpcWalletVersion(walletVersion, multisigTypeVersion); + } } const finalWalletParams = {