@ellipticltd/aml-utils 0.15.8 → 0.15.9
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.
|
@@ -218,6 +218,12 @@ export namespace fantom {
|
|
|
218
218
|
function isTxHash(str: any): any;
|
|
219
219
|
function isTxHash(str: any): any;
|
|
220
220
|
}
|
|
221
|
+
export namespace celo {
|
|
222
|
+
function isAddress(str: any): any;
|
|
223
|
+
function isAddress(str: any): any;
|
|
224
|
+
function isTxHash(str: any): any;
|
|
225
|
+
function isTxHash(str: any): any;
|
|
226
|
+
}
|
|
221
227
|
export namespace ethereumClassic {
|
|
222
228
|
function isAddress(str: any): any;
|
|
223
229
|
function isAddress(str: any): any;
|
|
@@ -434,6 +434,14 @@ const validations = {
|
|
|
434
434
|
return str.length === 66 && web3.isHexStrict(str);
|
|
435
435
|
},
|
|
436
436
|
},
|
|
437
|
+
celo: {
|
|
438
|
+
isAddress(str) {
|
|
439
|
+
return web3.isAddress(str);
|
|
440
|
+
},
|
|
441
|
+
isTxHash(str) {
|
|
442
|
+
return str.length === 66 && web3.isHexStrict(str);
|
|
443
|
+
},
|
|
444
|
+
},
|
|
437
445
|
ethereumClassic: {
|
|
438
446
|
isAddress(str) {
|
|
439
447
|
return web3.isAddress(str);
|
|
@@ -440,6 +440,16 @@ describe('Validations', () => {
|
|
|
440
440
|
});
|
|
441
441
|
});
|
|
442
442
|
});
|
|
443
|
+
describe('CELO', () => {
|
|
444
|
+
describe('isAddress', () => {
|
|
445
|
+
it('should return true if the address evaluates as a web3 address', () => validations_1.default.celo.isAddress('0x711520A753A23a3760B0361e0EB8d3A0eD472326').should.be.true);
|
|
446
|
+
it('should return false if the address does not evaluate to a web3 address', () => validations_1.default.celo.isAddress('0x711520A753A23a3760B0361e0EB8d3A0eD47232G').should.be.false);
|
|
447
|
+
});
|
|
448
|
+
describe('isTxHash', () => {
|
|
449
|
+
it('should correctly validate a valid CELO hash', () => validations_1.default.celo.isTxHash('0xad90ee6159a7760fda9c594dc0bb9a3fec8b5c57dc61e391b65e4f8d0efc2fab').should.be.true);
|
|
450
|
+
it('should correctly validate an incorrect CELO hash', () => validations_1.default.celo.isTxHash('0xad90ee6159a7760fda9c594dc0bb9a3fec8b5c57dc61e391b65e4f8d0efc2faG').should.be.false);
|
|
451
|
+
});
|
|
452
|
+
});
|
|
443
453
|
describe('ETC', () => {
|
|
444
454
|
describe('isAddress', () => {
|
|
445
455
|
it('should return true if the address evaluates as a web3 address', () => validations_1.default.ethereumClassic.isAddress('0x667B248015b02f35F0dBb7e02695f9D081CC5d26').should.be.true);
|
|
@@ -439,6 +439,14 @@ const validations = {
|
|
|
439
439
|
return str.length === 66 && web3.isHexStrict(str);
|
|
440
440
|
},
|
|
441
441
|
},
|
|
442
|
+
celo: {
|
|
443
|
+
isAddress(str) {
|
|
444
|
+
return web3.isAddress(str);
|
|
445
|
+
},
|
|
446
|
+
isTxHash(str) {
|
|
447
|
+
return str.length === 66 && web3.isHexStrict(str);
|
|
448
|
+
},
|
|
449
|
+
},
|
|
442
450
|
ethereumClassic: {
|
|
443
451
|
isAddress(str) {
|
|
444
452
|
return web3.isAddress(str);
|
|
@@ -575,6 +575,19 @@ describe('Validations', () => {
|
|
|
575
575
|
});
|
|
576
576
|
});
|
|
577
577
|
|
|
578
|
+
describe('CELO', () => {
|
|
579
|
+
describe('isAddress', () => {
|
|
580
|
+
it('should return true if the address evaluates as a web3 address', () => validations.celo.isAddress('0x711520A753A23a3760B0361e0EB8d3A0eD472326').should.be.true);
|
|
581
|
+
it('should return false if the address does not evaluate to a web3 address', () => validations.celo.isAddress('0x711520A753A23a3760B0361e0EB8d3A0eD47232G').should.be.false);
|
|
582
|
+
});
|
|
583
|
+
|
|
584
|
+
describe('isTxHash', () => {
|
|
585
|
+
it('should correctly validate a valid CELO hash', () => validations.celo.isTxHash('0xad90ee6159a7760fda9c594dc0bb9a3fec8b5c57dc61e391b65e4f8d0efc2fab').should.be.true);
|
|
586
|
+
|
|
587
|
+
it('should correctly validate an incorrect CELO hash', () => validations.celo.isTxHash('0xad90ee6159a7760fda9c594dc0bb9a3fec8b5c57dc61e391b65e4f8d0efc2faG').should.be.false);
|
|
588
|
+
});
|
|
589
|
+
});
|
|
590
|
+
|
|
578
591
|
describe('ETC', () => {
|
|
579
592
|
describe('isAddress', () => {
|
|
580
593
|
it('should return true if the address evaluates as a web3 address', () => validations.ethereumClassic.isAddress('0x667B248015b02f35F0dBb7e02695f9D081CC5d26').should.be.true);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ellipticltd/aml-utils",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.9",
|
|
4
4
|
"description": "Utilities, helpers, validations, type-checking, etc",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": "10.1.0",
|
|
@@ -67,4 +67,4 @@
|
|
|
67
67
|
"typescript": "^4.0.5"
|
|
68
68
|
},
|
|
69
69
|
"snyk": true
|
|
70
|
-
}
|
|
70
|
+
}
|