File tree Expand file tree Collapse file tree 2 files changed +4
-17
lines changed
Expand file tree Collapse file tree 2 files changed +4
-17
lines changed Original file line number Diff line number Diff line change @@ -1004,25 +1004,14 @@ export class Near extends BaseCoin {
10041004 * @throws {Error } If invalid parameters or root address verification with wrong index
10051005 */
10061006 async isWalletAddress ( params : TssVerifyNearAddressOptions ) : Promise < boolean > {
1007- const { address, rootAddress } = params ;
1008-
1009- // Root address verification requires index 0
1010- const isVerifyingRootAddress = rootAddress && address === rootAddress ;
1011- if ( isVerifyingRootAddress ) {
1012- const index = typeof params . index === 'string' ? parseInt ( params . index , 10 ) : params . index ;
1013- if ( index !== 0 ) {
1014- throw new Error ( `Root address verification requires index 0, but got index ${ params . index } .` ) ;
1015- }
1016- }
1017-
10181007 const result = await verifyEddsaTssWalletAddress (
10191008 params ,
10201009 ( address ) => this . isValidAddress ( address ) ,
10211010 ( publicKey ) => publicKey
10221011 ) ;
10231012
10241013 if ( ! result ) {
1025- throw new UnexpectedAddressError ( `address validation failure: address ${ params . address } is not a wallet address ` ) ;
1014+ throw new UnexpectedAddressError ( `address validation failure` ) ;
10261015 }
10271016
10281017 return true ;
Original file line number Diff line number Diff line change @@ -199,7 +199,7 @@ describe('NEAR:', function () {
199199 keychains : keychains ,
200200 index : 0 ,
201201 } ;
202- await basecoin . isWalletAddress ( params ) . should . be . rejected ( ) ;
202+ await basecoin . isWalletAddress ( params ) . should . be . rejectedWith ( 'address validation failure' ) ;
203203 } ) ;
204204
205205 it ( 'should throw error when verifying root address with wrong index' , async function ( ) {
@@ -209,9 +209,7 @@ describe('NEAR:', function () {
209209 keychains : keychains ,
210210 index : 1 ,
211211 } ;
212- await basecoin
213- . isWalletAddress ( params )
214- . should . be . rejectedWith ( 'Root address verification requires index 0, but got index 1.' ) ;
212+ await basecoin . isWalletAddress ( params ) . should . be . rejectedWith ( 'address validation failure' ) ;
215213 } ) ;
216214
217215 it ( 'should throw error when keychains is missing' , async function ( ) {
@@ -230,7 +228,7 @@ describe('NEAR:', function () {
230228 keychains : keychains ,
231229 index : 0 ,
232230 } ;
233- await basecoin . isWalletAddress ( params ) . should . be . rejected ( ) ;
231+ await basecoin . isWalletAddress ( params ) . should . be . rejectedWith ( 'address validation failure' ) ;
234232 } ) ;
235233
236234 it ( 'should handle string index' , async function ( ) {
You can’t perform that action at this time.
0 commit comments