@@ -101,21 +101,8 @@ export class Wallets implements IWallets {
101101 throw new Error ( 'missing required string parameter label' ) ;
102102 }
103103
104- // Validate referenceWalletId parameter
105- if ( params . referenceWalletId ) {
106- if ( ! _ . isString ( params . referenceWalletId ) ) {
107- throw new Error ( 'invalid referenceWalletId argument, expecting string' ) ;
108- }
109- if ( ! this . baseCoin . isEVM ( ) ) {
110- throw new Error ( 'referenceWalletId is only supported for EVM chains' ) ;
111- }
112- }
113-
114- // For wallets with referenceWalletId, skip multisig validation as configuration is inherited
115- if ( params . referenceWalletId ) {
116- // Skip all multisig validation - configuration will be inherited from reference wallet
117- } else if ( params . type !== 'custodial' ) {
118- // Standard validation for non-custodial wallets without referenceWalletId
104+ // no need to pass keys for (single) custodial wallets
105+ if ( params . type !== 'custodial' ) {
119106 if ( Array . isArray ( params . keys ) === false || ! _ . isNumber ( params . m ) || ! _ . isNumber ( params . n ) ) {
120107 throw new Error ( 'invalid argument' ) ;
121108 }
@@ -285,10 +272,9 @@ export class Wallets implements IWallets {
285272 throw new Error ( 'missing required string parameter label' ) ;
286273 }
287274
288- const { type = 'hot' , label, passphrase, enterprise, isDistributedCustody, referenceWalletId } = params ;
275+ const { type = 'hot' , label, passphrase, enterprise, isDistributedCustody } = params ;
289276 const isTss = params . multisigType === 'tss' && this . baseCoin . supportsTss ( ) ;
290277 const canEncrypt = ! ! passphrase && typeof passphrase === 'string' ;
291- const isEVMWithReference = this . baseCoin . isEVM ( ) && referenceWalletId ;
292278
293279 const walletParams : SupplementGenerateWalletOptions = {
294280 label : label ,
@@ -298,11 +284,6 @@ export class Wallets implements IWallets {
298284 type : ! ! params . userKey && params . multisigType !== 'onchain' ? 'cold' : type ,
299285 } ;
300286
301- // Add referenceWalletId to walletParams if provided for EVM chains
302- if ( isEVMWithReference ) {
303- walletParams . referenceWalletId = referenceWalletId ;
304- }
305-
306287 if ( ! _ . isUndefined ( params . passcodeEncryptionCode ) ) {
307288 if ( ! _ . isString ( params . passcodeEncryptionCode ) ) {
308289 throw new Error ( 'passcodeEncryptionCode must be a string' ) ;
@@ -316,59 +297,15 @@ export class Wallets implements IWallets {
316297 walletParams . enterprise = enterprise ;
317298 }
318299
319- // Validate referenceWalletId for EVM keyring
320- if ( ! _ . isUndefined ( referenceWalletId ) ) {
321- if ( ! _ . isString ( referenceWalletId ) ) {
322- throw new Error ( 'invalid referenceWalletId argument, expecting string' ) ;
323- }
324- if ( ! this . baseCoin . isEVM ( ) ) {
325- throw new Error ( 'referenceWalletId is only supported for EVM chains' ) ;
326- }
327- }
328-
329300 // EVM TSS wallets must use wallet version 3, 5 and 6
330- // Skip this validation for EVM keyring wallets as they inherit version from reference wallet
331301 if (
332302 isTss &&
333303 this . baseCoin . isEVM ( ) &&
334- ! referenceWalletId &&
335304 ! ( params . walletVersion === 3 || params . walletVersion === 5 || params . walletVersion === 6 )
336305 ) {
337306 throw new Error ( 'EVM TSS wallets are only supported for wallet version 3, 5 and 6' ) ;
338307 }
339308
340- // Handle EVM keyring wallet creation with referenceWalletId
341- if ( isEVMWithReference ) {
342- // For EVM keyring wallets, multisigType will be inferred from the reference wallet
343- // No need to explicitly validate TSS requirement here as it will be handled by bgms
344-
345- // For EVM keyring wallets, we use the add method directly with referenceWalletId
346- // This bypasses the normal key generation process since keys are shared via keyring
347- const addWalletParams = {
348- label,
349- referenceWalletId,
350- } ;
351-
352- const newWallet = await this . bitgo . post ( this . baseCoin . url ( '/wallet/add' ) ) . send ( addWalletParams ) . result ( ) ;
353-
354- // For EVM keyring wallets, we need to get the keychains from the reference wallet
355- const userKeychain = this . baseCoin . keychains ( ) . get ( { id : newWallet . keys [ KeyIndices . USER ] } ) ;
356- const backupKeychain = this . baseCoin . keychains ( ) . get ( { id : newWallet . keys [ KeyIndices . BACKUP ] } ) ;
357- const bitgoKeychain = this . baseCoin . keychains ( ) . get ( { id : newWallet . keys [ KeyIndices . BITGO ] } ) ;
358-
359- const [ userKey , backupKey , bitgoKey ] = await Promise . all ( [ userKeychain , backupKeychain , bitgoKeychain ] ) ;
360-
361- const result : WalletWithKeychains = {
362- wallet : new Wallet ( this . bitgo , this . baseCoin , newWallet ) ,
363- userKeychain : userKey ,
364- backupKeychain : backupKey ,
365- bitgoKeychain : bitgoKey ,
366- responseType : 'WalletWithKeychains' ,
367- } ;
368-
369- return result ;
370- }
371-
372309 if ( isTss ) {
373310 if ( ! this . baseCoin . supportsTss ( ) ) {
374311 throw new Error ( `coin ${ this . baseCoin . getFamily ( ) } does not support TSS at this time` ) ;
0 commit comments