@ellipticltd/aml-utils 0.15.1 → 0.15.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -194,3 +194,9 @@ export namespace optimism {
|
|
|
194
194
|
function isTxHash(str: any): any;
|
|
195
195
|
function isTxHash(str: any): any;
|
|
196
196
|
}
|
|
197
|
+
export namespace avalanche {
|
|
198
|
+
function isAddress(str: any): any;
|
|
199
|
+
function isAddress(str: any): any;
|
|
200
|
+
function isTxHash(str: any): any;
|
|
201
|
+
function isTxHash(str: any): any;
|
|
202
|
+
}
|
|
@@ -348,7 +348,7 @@ const validations = {
|
|
|
348
348
|
},
|
|
349
349
|
doge: {
|
|
350
350
|
isAddress(str) {
|
|
351
|
-
return /^
|
|
351
|
+
return /^[a-zA-Z\d]{34}$/.test(str);
|
|
352
352
|
},
|
|
353
353
|
isTxHash(str) {
|
|
354
354
|
return str.length === 64;
|
|
@@ -402,6 +402,14 @@ const validations = {
|
|
|
402
402
|
return str.length === 66 && web3.isHexStrict(str);
|
|
403
403
|
},
|
|
404
404
|
},
|
|
405
|
+
avalanche: {
|
|
406
|
+
isAddress(str) {
|
|
407
|
+
return web3.isAddress(str);
|
|
408
|
+
},
|
|
409
|
+
isTxHash(str) {
|
|
410
|
+
return str.length === 66 && web3.isHexStrict(str);
|
|
411
|
+
},
|
|
412
|
+
},
|
|
405
413
|
};
|
|
406
414
|
Object.keys(V).forEach((k) => {
|
|
407
415
|
const v = V[k];
|
|
@@ -342,6 +342,20 @@ describe('Validations', () => {
|
|
|
342
342
|
it('should correctly validate an incorrect BSC hash', () => validations_1.default.binanceSmartChain.isTxHash('0x1a17145af3bec32f653d8ebd4c2c1b800214b17').should.be.false);
|
|
343
343
|
});
|
|
344
344
|
});
|
|
345
|
+
describe('Doge', () => {
|
|
346
|
+
describe('isAddress', () => {
|
|
347
|
+
it('should correctly validate valid Doge addresses', () => {
|
|
348
|
+
validations_1.default.doge.isAddress('9t3fCHSQz3j7XERcopTCUwMF3bZxJW99As').should.be.true;
|
|
349
|
+
validations_1.default.doge.isAddress('DQe2B39m3V68sXZPfUvdjv3QecYGAE2dBv').should.be.true;
|
|
350
|
+
});
|
|
351
|
+
it('should correctly validate an incorrect Doge address', () => validations_1.default.doge.isAddress('DQe2B39m3V68sXZPfUvdjv3QecYGAE2dB_').should.be.false);
|
|
352
|
+
it('should correctly validate an incorrect (too long) Doge address', () => validations_1.default.doge.isAddress('DQe2B39m3V68sXZPfUvdjv3QecYGAE2dBvQ').should.be.false);
|
|
353
|
+
});
|
|
354
|
+
describe('isTxHash', () => {
|
|
355
|
+
it('should correctly validate a valid Doge hash', () => validations_1.default.doge.isTxHash('ee3b8c45d4b84c07c7dc9e1c82752920ba6e7cda73354c0f399f81949513d418').should.be.true);
|
|
356
|
+
it('should correctly validate an incorrect Doge hash', () => validations_1.default.doge.isTxHash('ee3b8c45d4b84c07c7dc9e1c82752920ba6e7cda73354c0f399f81949513d41').should.be.false);
|
|
357
|
+
});
|
|
358
|
+
});
|
|
345
359
|
describe('Polygon', () => {
|
|
346
360
|
describe('isAddress', () => {
|
|
347
361
|
it('should correctly validate valid Polygon addresses', () => validations_1.default.polygon.isAddress('0x286c2bd6e0585f396647cbfdbfe14b92600365bb').should.be.true);
|
|
@@ -379,4 +393,16 @@ describe('Validations', () => {
|
|
|
379
393
|
});
|
|
380
394
|
});
|
|
381
395
|
});
|
|
396
|
+
describe('Avalanche', () => {
|
|
397
|
+
describe('isAddress', () => {
|
|
398
|
+
describe('isAddress', () => {
|
|
399
|
+
it('should return true if the address evaluates as a web3 address', () => validations_1.default.avalanche.isAddress('0xa6Bc4b3fe7F2756124d30D896Fe4457711e9d214').should.be.true);
|
|
400
|
+
it('should return false if the address does not evaluate to a web3 address', () => validations_1.default.avalanche.isAddress('Bc4b3fe7F2756124d30D896Fe4457711e9d214').should.be.false);
|
|
401
|
+
});
|
|
402
|
+
describe('isTxHash', () => {
|
|
403
|
+
it('should correctly validate a valid AVAX hash', () => validations_1.default.avalanche.isTxHash('0xec6491abd46a1a9a71b78f4b84d96fd49525aa4f66c8d8c3588c489f2f88eb0e').should.be.true);
|
|
404
|
+
it('should correctly validate an incorrect AVAX hash', () => validations_1.default.avalanche.isTxHash('0xec6491abd46a1a9a71b7896fd49525aa4f66c8d8c3588c489f2f88eb0e').should.be.false);
|
|
405
|
+
});
|
|
406
|
+
});
|
|
407
|
+
});
|
|
382
408
|
});
|
|
@@ -353,7 +353,7 @@ const validations = {
|
|
|
353
353
|
},
|
|
354
354
|
doge: {
|
|
355
355
|
isAddress(str) {
|
|
356
|
-
return /^
|
|
356
|
+
return /^[a-zA-Z\d]{34}$/.test(str);
|
|
357
357
|
},
|
|
358
358
|
isTxHash(str) {
|
|
359
359
|
return str.length === 64;
|
|
@@ -407,6 +407,14 @@ const validations = {
|
|
|
407
407
|
return str.length === 66 && web3.isHexStrict(str);
|
|
408
408
|
},
|
|
409
409
|
},
|
|
410
|
+
avalanche: {
|
|
411
|
+
isAddress(str) {
|
|
412
|
+
return web3.isAddress(str);
|
|
413
|
+
},
|
|
414
|
+
isTxHash(str) {
|
|
415
|
+
return str.length === 66 && web3.isHexStrict(str);
|
|
416
|
+
},
|
|
417
|
+
},
|
|
410
418
|
};
|
|
411
419
|
|
|
412
420
|
Object.keys(V).forEach((k) => {
|
|
@@ -449,6 +449,25 @@ describe('Validations', () => {
|
|
|
449
449
|
});
|
|
450
450
|
});
|
|
451
451
|
|
|
452
|
+
describe('Doge', () => {
|
|
453
|
+
describe('isAddress', () => {
|
|
454
|
+
it('should correctly validate valid Doge addresses', () => {
|
|
455
|
+
validations.doge.isAddress('9t3fCHSQz3j7XERcopTCUwMF3bZxJW99As').should.be.true;
|
|
456
|
+
validations.doge.isAddress('DQe2B39m3V68sXZPfUvdjv3QecYGAE2dBv').should.be.true;
|
|
457
|
+
});
|
|
458
|
+
|
|
459
|
+
it('should correctly validate an incorrect Doge address', () => validations.doge.isAddress('DQe2B39m3V68sXZPfUvdjv3QecYGAE2dB_').should.be.false);
|
|
460
|
+
|
|
461
|
+
it('should correctly validate an incorrect (too long) Doge address', () => validations.doge.isAddress('DQe2B39m3V68sXZPfUvdjv3QecYGAE2dBvQ').should.be.false);
|
|
462
|
+
});
|
|
463
|
+
|
|
464
|
+
describe('isTxHash', () => {
|
|
465
|
+
it('should correctly validate a valid Doge hash', () => validations.doge.isTxHash('ee3b8c45d4b84c07c7dc9e1c82752920ba6e7cda73354c0f399f81949513d418').should.be.true);
|
|
466
|
+
|
|
467
|
+
it('should correctly validate an incorrect Doge hash', () => validations.doge.isTxHash('ee3b8c45d4b84c07c7dc9e1c82752920ba6e7cda73354c0f399f81949513d41').should.be.false);
|
|
468
|
+
});
|
|
469
|
+
});
|
|
470
|
+
|
|
452
471
|
describe('Polygon', () => {
|
|
453
472
|
describe('isAddress', () => {
|
|
454
473
|
it('should correctly validate valid Polygon addresses', () => validations.polygon.isAddress('0x286c2bd6e0585f396647cbfdbfe14b92600365bb').should.be.true);
|
|
@@ -499,4 +518,17 @@ describe('Validations', () => {
|
|
|
499
518
|
});
|
|
500
519
|
});
|
|
501
520
|
});
|
|
521
|
+
describe('Avalanche', () => {
|
|
522
|
+
describe('isAddress', () => {
|
|
523
|
+
describe('isAddress', () => {
|
|
524
|
+
it('should return true if the address evaluates as a web3 address', () => validations.avalanche.isAddress('0xa6Bc4b3fe7F2756124d30D896Fe4457711e9d214').should.be.true);
|
|
525
|
+
it('should return false if the address does not evaluate to a web3 address', () => validations.avalanche.isAddress('Bc4b3fe7F2756124d30D896Fe4457711e9d214').should.be.false);
|
|
526
|
+
});
|
|
527
|
+
describe('isTxHash', () => {
|
|
528
|
+
it('should correctly validate a valid AVAX hash', () => validations.avalanche.isTxHash('0xec6491abd46a1a9a71b78f4b84d96fd49525aa4f66c8d8c3588c489f2f88eb0e').should.be.true);
|
|
529
|
+
|
|
530
|
+
it('should correctly validate an incorrect AVAX hash', () => validations.avalanche.isTxHash('0xec6491abd46a1a9a71b7896fd49525aa4f66c8d8c3588c489f2f88eb0e').should.be.false);
|
|
531
|
+
});
|
|
532
|
+
});
|
|
533
|
+
});
|
|
502
534
|
});
|