@@ -11,10 +11,9 @@ import {
1111 MultisigType ,
1212 multisigTypes ,
1313 MPCAlgorithm ,
14- InvalidAddressError ,
15- EDDSAMethods ,
1614 TssVerifyAddressOptions ,
1715 MPCType ,
16+ verifyEddsaTssWalletAddress ,
1817} from '@bitgo/sdk-core' ;
1918import { BaseCoin as StaticsBaseCoin , CoinFamily } from '@bitgo/statics' ;
2019import utils from './lib/utils' ;
@@ -92,29 +91,11 @@ export class Iota extends BaseCoin {
9291 * @param params
9392 */
9493 async isWalletAddress ( params : TssVerifyAddressOptions ) : Promise < boolean > {
95- const { keychains, address, index } = params ;
96-
97- if ( ! this . isValidAddress ( address ) ) {
98- throw new InvalidAddressError ( `invalid address: ${ address } ` ) ;
99- }
100-
101- if ( ! keychains ) {
102- throw new Error ( 'missing required param keychains' ) ;
103- }
104-
105- for ( const keychain of keychains ) {
106- const MPC = await EDDSAMethods . getInitializedMpcInstance ( ) ;
107- const commonKeychain = keychain . commonKeychain as string ;
108-
109- const derivationPath = 'm/' + index ;
110- const derivedPublicKey = MPC . deriveUnhardened ( commonKeychain , derivationPath ) . slice ( 0 , 64 ) ;
111- const expectedAddress = utils . getAddressFromPublicKey ( derivedPublicKey ) ;
112-
113- if ( address !== expectedAddress ) {
114- return false ;
115- }
116- }
117- return true ;
94+ return verifyEddsaTssWalletAddress (
95+ params ,
96+ ( address ) => this . isValidAddress ( address ) ,
97+ ( publicKey ) => utils . getAddressFromPublicKey ( publicKey )
98+ ) ;
11899 }
119100
120101 /**
0 commit comments