@@ -18,7 +18,6 @@ import {
1818 EDDSAMethods ,
1919 EDDSAMethodTypes ,
2020 Environments ,
21- InvalidAddressError ,
2221 KeyPair ,
2322 MPCAlgorithm ,
2423 MPCRecoveryOptions ,
@@ -40,7 +39,7 @@ import {
4039 TransactionType ,
4140 TssVerifyAddressOptions ,
4241 UnexpectedAddressError ,
43- verifyMPCWalletAddress ,
42+ verifyEddsaTssWalletAddress ,
4443 VerifyTransactionOptions ,
4544} from '@bitgo/sdk-core' ;
4645import { BaseCoin as StaticsBaseCoin , CoinFamily , coins , Nep141Token , Networks } from '@bitgo/statics' ;
@@ -996,21 +995,18 @@ export class Near extends BaseCoin {
996995 }
997996
998997 /**
999- * Verify if an address belongs to a NEAR wallet using EdDSA TSS MPC derivation .
998+ * Verifies if the given address belongs to a TSS wallet for NEAR .
1000999 * For NEAR, the address is the public key directly (implicit accounts).
10011000 *
1002- * @param {TssVerifyAddressOptions } params - Verification parameters
1001+ * @param {TssVerifyNearAddressOptions } params - Verification parameters
10031002 * @returns {Promise<boolean> } True if address belongs to wallet
1004- * @throws {InvalidAddressError } If address format is invalid or doesn't match derived address
1005- * @throws {Error } If invalid parameters
1003+ * @throws {UnexpectedAddressError } If address doesn't match derived address
1004+ * @throws {Error } If invalid parameters or root address verification with wrong index
10061005 */
10071006 async isWalletAddress ( params : TssVerifyNearAddressOptions ) : Promise < boolean > {
10081007 const { address, rootAddress } = params ;
10091008
1010- if ( ! this . isValidAddress ( address ) ) {
1011- throw new InvalidAddressError ( `invalid address: ${ address } ` ) ;
1012- }
1013-
1009+ // Root address verification requires index 0
10141010 const isVerifyingRootAddress = rootAddress && address === rootAddress ;
10151011 if ( isVerifyingRootAddress ) {
10161012 const index = typeof params . index === 'string' ? parseInt ( params . index , 10 ) : params . index ;
@@ -1019,14 +1015,14 @@ export class Near extends BaseCoin {
10191015 }
10201016 }
10211017
1022- const result = await verifyMPCWalletAddress (
1023- { ... params , keyCurve : 'ed25519' } ,
1024- this . isValidAddress . bind ( this ) ,
1025- ( pubKey ) => pubKey
1018+ const result = await verifyEddsaTssWalletAddress (
1019+ params ,
1020+ ( address ) => this . isValidAddress ( address ) ,
1021+ ( publicKey ) => publicKey
10261022 ) ;
10271023
10281024 if ( ! result ) {
1029- throw new UnexpectedAddressError ( `address validation failure: address ${ address } is not a wallet address` ) ;
1025+ throw new UnexpectedAddressError ( `address validation failure: address ${ params . address } is not a wallet address` ) ;
10301026 }
10311027
10321028 return true ;
0 commit comments