@ellipticltd/aml-utils 0.15.9-SCR-1220 → 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.
package/.releaserc.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "master",
4
4
  {
5
5
  "name": "*",
6
- "prerelease": true,
6
+ "prerelease": true
7
7
  }
8
8
  ],
9
9
  "plugins": [
@@ -224,3 +224,9 @@ export namespace celo {
224
224
  function isTxHash(str: any): any;
225
225
  function isTxHash(str: any): any;
226
226
  }
227
+ export namespace ethereumClassic {
228
+ function isAddress(str: any): any;
229
+ function isAddress(str: any): any;
230
+ function isTxHash(str: any): any;
231
+ function isTxHash(str: any): any;
232
+ }
@@ -442,6 +442,14 @@ const validations = {
442
442
  return str.length === 66 && web3.isHexStrict(str);
443
443
  },
444
444
  },
445
+ ethereumClassic: {
446
+ isAddress(str) {
447
+ return web3.isAddress(str);
448
+ },
449
+ isTxHash(str) {
450
+ return str.length === 66 && web3.isHexStrict(str);
451
+ },
452
+ },
445
453
  };
446
454
  Object.keys(V).forEach((k) => {
447
455
  const v = V[k];
@@ -440,7 +440,7 @@ describe('Validations', () => {
440
440
  });
441
441
  });
442
442
  });
443
- describe('celo', () => {
443
+ describe('CELO', () => {
444
444
  describe('isAddress', () => {
445
445
  it('should return true if the address evaluates as a web3 address', () => validations_1.default.celo.isAddress('0x711520A753A23a3760B0361e0EB8d3A0eD472326').should.be.true);
446
446
  it('should return false if the address does not evaluate to a web3 address', () => validations_1.default.celo.isAddress('0x711520A753A23a3760B0361e0EB8d3A0eD47232G').should.be.false);
@@ -450,4 +450,14 @@ describe('Validations', () => {
450
450
  it('should correctly validate an incorrect CELO hash', () => validations_1.default.celo.isTxHash('0xad90ee6159a7760fda9c594dc0bb9a3fec8b5c57dc61e391b65e4f8d0efc2faG').should.be.false);
451
451
  });
452
452
  });
453
+ describe('ETC', () => {
454
+ describe('isAddress', () => {
455
+ it('should return true if the address evaluates as a web3 address', () => validations_1.default.ethereumClassic.isAddress('0x667B248015b02f35F0dBb7e02695f9D081CC5d26').should.be.true);
456
+ it('should return false if the address does not evaluate to a web3 address', () => validations_1.default.ethereumClassic.isAddress('0x667B248015b02f35F0dBb7e02695f9D081CC5d2G').should.be.false);
457
+ });
458
+ describe('isTxHash', () => {
459
+ it('should correctly validate a valid ETC hash', () => validations_1.default.ethereumClassic.isTxHash('0x5b410a65887837fe8c2b6fadf3bad8808411cef67ed22eba27f75f6d446673de').should.be.true);
460
+ it('should correctly validate an incorrect ETC hash', () => validations_1.default.ethereumClassic.isTxHash('0x5b410a65887837fe8c2b6fadf3bad8808411cef67ed22eba27f75f6d446673de!').should.be.false);
461
+ });
462
+ });
453
463
  });
@@ -447,6 +447,14 @@ const validations = {
447
447
  return str.length === 66 && web3.isHexStrict(str);
448
448
  },
449
449
  },
450
+ ethereumClassic: {
451
+ isAddress(str) {
452
+ return web3.isAddress(str);
453
+ },
454
+ isTxHash(str) {
455
+ return str.length === 66 && web3.isHexStrict(str);
456
+ },
457
+ },
450
458
  };
451
459
 
452
460
  Object.keys(V).forEach((k) => {
@@ -575,7 +575,7 @@ describe('Validations', () => {
575
575
  });
576
576
  });
577
577
 
578
- describe('celo', () => {
578
+ describe('CELO', () => {
579
579
  describe('isAddress', () => {
580
580
  it('should return true if the address evaluates as a web3 address', () => validations.celo.isAddress('0x711520A753A23a3760B0361e0EB8d3A0eD472326').should.be.true);
581
581
  it('should return false if the address does not evaluate to a web3 address', () => validations.celo.isAddress('0x711520A753A23a3760B0361e0EB8d3A0eD47232G').should.be.false);
@@ -587,4 +587,17 @@ describe('Validations', () => {
587
587
  it('should correctly validate an incorrect CELO hash', () => validations.celo.isTxHash('0xad90ee6159a7760fda9c594dc0bb9a3fec8b5c57dc61e391b65e4f8d0efc2faG').should.be.false);
588
588
  });
589
589
  });
590
+
591
+ describe('ETC', () => {
592
+ describe('isAddress', () => {
593
+ it('should return true if the address evaluates as a web3 address', () => validations.ethereumClassic.isAddress('0x667B248015b02f35F0dBb7e02695f9D081CC5d26').should.be.true);
594
+ it('should return false if the address does not evaluate to a web3 address', () => validations.ethereumClassic.isAddress('0x667B248015b02f35F0dBb7e02695f9D081CC5d2G').should.be.false);
595
+ });
596
+
597
+ describe('isTxHash', () => {
598
+ it('should correctly validate a valid ETC hash', () => validations.ethereumClassic.isTxHash('0x5b410a65887837fe8c2b6fadf3bad8808411cef67ed22eba27f75f6d446673de').should.be.true);
599
+
600
+ it('should correctly validate an incorrect ETC hash', () => validations.ethereumClassic.isTxHash('0x5b410a65887837fe8c2b6fadf3bad8808411cef67ed22eba27f75f6d446673de!').should.be.false);
601
+ });
602
+ });
590
603
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ellipticltd/aml-utils",
3
- "version": "0.15.9-SCR-1220",
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
+ }