@ellipticltd/aml-utils 0.14.2 → 0.14.3-SCR-759
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.
|
@@ -176,3 +176,9 @@ export namespace binanceSmartChain {
|
|
|
176
176
|
function isTxHash(str: any): any;
|
|
177
177
|
function isTxHash(str: any): any;
|
|
178
178
|
}
|
|
179
|
+
export namespace polygon {
|
|
180
|
+
function isAddress(str: any): any;
|
|
181
|
+
function isAddress(str: any): any;
|
|
182
|
+
function isTxHash(str: any): any;
|
|
183
|
+
function isTxHash(str: any): any;
|
|
184
|
+
}
|
|
@@ -378,6 +378,14 @@ const validations = {
|
|
|
378
378
|
return str.length === 66 && web3.isHexStrict(str);
|
|
379
379
|
},
|
|
380
380
|
},
|
|
381
|
+
polygon: {
|
|
382
|
+
isAddress(str) {
|
|
383
|
+
return web3.isAddress(str);
|
|
384
|
+
},
|
|
385
|
+
isTxHash(str) {
|
|
386
|
+
return str.length === 66 && web3.isHexStrict(str);
|
|
387
|
+
},
|
|
388
|
+
},
|
|
381
389
|
};
|
|
382
390
|
Object.keys(V).forEach((k) => {
|
|
383
391
|
const v = V[k];
|
|
@@ -342,4 +342,15 @@ 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('Polygon', () => {
|
|
346
|
+
describe('isAddress', () => {
|
|
347
|
+
it('should correctly validate valid Polygon addresses', () => validations_1.default.polygon.isAddress('0x286c2bd6e0585f396647cbfdbfe14b92600365bb').should.be.true);
|
|
348
|
+
it('should correctly validate an incorrect Polygon address', () => validations_1.default.polygon.isAddress('0xz286c2bd6e0585f396647cbfdbfe14b92600365bb').should.be.false);
|
|
349
|
+
it('should correctly validate an incorrect (too long) Polygon address', () => validations_1.default.polygon.isAddress('0x286c2bd6e0585f396647cbfdbfe14b92600365bba').should.be.false);
|
|
350
|
+
});
|
|
351
|
+
describe('isTxHash', () => {
|
|
352
|
+
it('should correctly validate a valid Polygon hash', () => validations_1.default.polygon.isTxHash('0x45a491048477568dd2047a0a9b6be9cc491382e74823ea1bd53bbc67db54a867').should.be.true);
|
|
353
|
+
it('should correctly validate an incorrect Polygon hash', () => validations_1.default.polygon.isTxHash('0x45a491048477568dd2047a0a9b6be9cc491382e74823e').should.be.false);
|
|
354
|
+
});
|
|
355
|
+
});
|
|
345
356
|
});
|
|
@@ -383,6 +383,14 @@ const validations = {
|
|
|
383
383
|
return str.length === 66 && web3.isHexStrict(str);
|
|
384
384
|
},
|
|
385
385
|
},
|
|
386
|
+
polygon: {
|
|
387
|
+
isAddress(str) {
|
|
388
|
+
return web3.isAddress(str);
|
|
389
|
+
},
|
|
390
|
+
isTxHash(str) {
|
|
391
|
+
return str.length === 66 && web3.isHexStrict(str);
|
|
392
|
+
},
|
|
393
|
+
},
|
|
386
394
|
};
|
|
387
395
|
|
|
388
396
|
Object.keys(V).forEach((k) => {
|
|
@@ -448,4 +448,20 @@ describe('Validations', () => {
|
|
|
448
448
|
it('should correctly validate an incorrect BSC hash', () => validations.binanceSmartChain.isTxHash('0x1a17145af3bec32f653d8ebd4c2c1b800214b17').should.be.false);
|
|
449
449
|
});
|
|
450
450
|
});
|
|
451
|
+
|
|
452
|
+
describe('Polygon', () => {
|
|
453
|
+
describe('isAddress', () => {
|
|
454
|
+
it('should correctly validate valid Polygon addresses', () => validations.polygon.isAddress('0x286c2bd6e0585f396647cbfdbfe14b92600365bb').should.be.true);
|
|
455
|
+
|
|
456
|
+
it('should correctly validate an incorrect Polygon address', () => validations.polygon.isAddress('0xz286c2bd6e0585f396647cbfdbfe14b92600365bb').should.be.false);
|
|
457
|
+
|
|
458
|
+
it('should correctly validate an incorrect (too long) Polygon address', () => validations.polygon.isAddress('0x286c2bd6e0585f396647cbfdbfe14b92600365bba').should.be.false);
|
|
459
|
+
});
|
|
460
|
+
|
|
461
|
+
describe('isTxHash', () => {
|
|
462
|
+
it('should correctly validate a valid Polygon hash', () => validations.polygon.isTxHash('0x45a491048477568dd2047a0a9b6be9cc491382e74823ea1bd53bbc67db54a867').should.be.true);
|
|
463
|
+
|
|
464
|
+
it('should correctly validate an incorrect Polygon hash', () => validations.polygon.isTxHash('0x45a491048477568dd2047a0a9b6be9cc491382e74823e').should.be.false);
|
|
465
|
+
});
|
|
466
|
+
});
|
|
451
467
|
});
|