@@ -27,7 +27,7 @@ describe('ain-js', function() {
27
27
it ( 'chainId' , function ( ) {
28
28
expect ( ain . chainId ) . toBe ( 0 ) ;
29
29
expect ( ain . wallet . chainId ) . toBe ( 0 ) ;
30
- ain . setProvider ( test_node_1 , 2 ) ;
30
+ ain . setProvider ( test_node_1 , null , 2 ) ;
31
31
expect ( ain . chainId ) . toBe ( 2 ) ;
32
32
expect ( ain . wallet . chainId ) . toBe ( 2 ) ;
33
33
} ) ;
@@ -273,7 +273,7 @@ describe('ain-js', function() {
273
273
ain . wallet . setDefaultAccount ( TEST_ADDR ) ;
274
274
const sig = ain . wallet . sign ( message ) ;
275
275
const addr :string = String ( ain . wallet . defaultAccount ! . address ) ;
276
- expect ( Ain . utils . ecVerifySig ( message , sig , addr ) ) . toBe ( true ) ;
276
+ expect ( ain . wallet . verifySignature ( message , sig , addr ) ) . toBe ( true ) ;
277
277
} ) ;
278
278
279
279
it ( 'signTransaction' , function ( ) {
@@ -289,7 +289,7 @@ describe('ain-js', function() {
289
289
}
290
290
const sig = ain . wallet . signTransaction ( tx ) ;
291
291
const addr :string = String ( ain . wallet . defaultAccount ! . address ) ;
292
- expect ( Ain . utils . ecVerifySig ( tx , sig , addr ) ) . toBe ( true ) ;
292
+ expect ( ain . wallet . verifySignature ( tx , sig , addr ) ) . toBe ( true ) ;
293
293
} ) ;
294
294
295
295
it ( 'recover' , function ( ) {
@@ -401,7 +401,7 @@ describe('ain-js', function() {
401
401
402
402
it ( 'chainId' , function ( ) {
403
403
// chainId = 0
404
- ain . setProvider ( test_node_2 , 0 ) ;
404
+ ain . setProvider ( test_node_2 , null , 0 ) ;
405
405
let tx : TransactionBody = {
406
406
nonce : 17 ,
407
407
gas_price : 500 ,
@@ -415,11 +415,11 @@ describe('ain-js', function() {
415
415
let sig = ain . wallet . signTransaction ( tx ) ;
416
416
let addr :string = String ( ain . wallet . defaultAccount ! . address ) ;
417
417
expect ( ain . wallet . verifySignature ( tx , sig , addr ) ) . toBe ( true ) ;
418
- expect ( ( ) => Ain . utils . ecVerifySig ( tx , sig , addr , 2 ) ) . toThrow ( '[ain-util] ecRecoverPub: Invalid signature v value' ) ;
418
+ expect ( ain . wallet . verifySignature ( tx , sig , addr , 2 ) ) . toBe ( false ) ;
419
419
expect ( ain . wallet . recover ( sig ) ) . toBe ( addr ) ;
420
420
421
421
// chainId = 2
422
- ain . setProvider ( test_node_2 , 2 ) ;
422
+ ain . setProvider ( test_node_2 , null , 2 ) ;
423
423
tx = {
424
424
nonce : 17 ,
425
425
timestamp : Date . now ( ) ,
@@ -432,7 +432,7 @@ describe('ain-js', function() {
432
432
sig = ain . wallet . signTransaction ( tx ) ;
433
433
addr = String ( ain . wallet . defaultAccount ! . address ) ;
434
434
expect ( ain . wallet . verifySignature ( tx , sig , addr ) ) . toBe ( true ) ;
435
- expect ( ( ) => Ain . utils . ecVerifySig ( tx , sig , addr , 0 ) ) . toThrow ( '[ain-util] ecRecoverPub: Invalid signature v value' ) ;
435
+ expect ( ain . wallet . verifySignature ( tx , sig , addr , 0 ) ) . toBe ( false ) ;
436
436
expect ( ain . wallet . recover ( sig ) ) . toBe ( addr ) ;
437
437
} ) ;
438
438
} ) ;
@@ -476,7 +476,7 @@ describe('ain-js', function() {
476
476
}
477
477
478
478
beforeAll ( async ( ) => {
479
- ain . setProvider ( test_node_2 , 0 ) ;
479
+ ain . setProvider ( test_node_2 , null , 0 ) ;
480
480
const newAccounts = ain . wallet . create ( 2 ) ;
481
481
defaultAddr = ain . wallet . defaultAccount ! . address as string ;
482
482
addr1 = newAccounts [ 0 ] ;
0 commit comments