@ellipticltd/aml-utils 0.15.7 → 0.15.8-SCR-1266

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,3 +218,9 @@ export namespace fantom {
218
218
  function isTxHash(str: any): any;
219
219
  function isTxHash(str: any): any;
220
220
  }
221
+ export namespace ethereum_classic {
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
+ }
@@ -434,6 +434,14 @@ const validations = {
434
434
  return str.length === 66 && web3.isHexStrict(str);
435
435
  },
436
436
  },
437
+ ethereum_classic: {
438
+ isAddress(str) {
439
+ return web3.isAddress(str);
440
+ },
441
+ isTxHash(str) {
442
+ return str.length === 66 && web3.isHexStrict(str);
443
+ },
444
+ },
437
445
  };
438
446
  Object.keys(V).forEach((k) => {
439
447
  const v = V[k];
@@ -440,4 +440,14 @@ describe('Validations', () => {
440
440
  });
441
441
  });
442
442
  });
443
+ describe('ETC', () => {
444
+ describe('isAddress', () => {
445
+ it('should return true if the address evaluates as a web3 address', () => validations_1.default.ethereum_classic.isAddress('0x667B248015b02f35F0dBb7e02695f9D081CC5d26').should.be.true);
446
+ it('should return false if the address does not evaluate to a web3 address', () => validations_1.default.ethereum_classic.isAddress('0x667B248015b02f35F0dBb7e02695f9D081CC5d2G').should.be.false);
447
+ });
448
+ describe('isTxHash', () => {
449
+ it('should correctly validate a valid ETC hash', () => validations_1.default.ethereum_classic.isTxHash('0x5b410a65887837fe8c2b6fadf3bad8808411cef67ed22eba27f75f6d446673de').should.be.true);
450
+ it('should correctly validate an incorrect ETC hash', () => validations_1.default.ethereum_classic.isTxHash('0x5b410a65887837fe8c2b6fadf3bad8808411cef67ed22eba27f75f6d446673de!').should.be.false);
451
+ });
452
+ });
443
453
  });
@@ -439,6 +439,14 @@ const validations = {
439
439
  return str.length === 66 && web3.isHexStrict(str);
440
440
  },
441
441
  },
442
+ ethereum_classic: {
443
+ isAddress(str) {
444
+ return web3.isAddress(str);
445
+ },
446
+ isTxHash(str) {
447
+ return str.length === 66 && web3.isHexStrict(str);
448
+ },
449
+ },
442
450
  };
443
451
 
444
452
  Object.keys(V).forEach((k) => {
@@ -574,4 +574,17 @@ describe('Validations', () => {
574
574
  });
575
575
  });
576
576
  });
577
+
578
+ describe('ETC', () => {
579
+ describe('isAddress', () => {
580
+ it('should return true if the address evaluates as a web3 address', () => validations.ethereum_classic.isAddress('0x667B248015b02f35F0dBb7e02695f9D081CC5d26').should.be.true);
581
+ it('should return false if the address does not evaluate to a web3 address', () => validations.ethereum_classic.isAddress('0x667B248015b02f35F0dBb7e02695f9D081CC5d2G').should.be.false);
582
+ });
583
+
584
+ describe('isTxHash', () => {
585
+ it('should correctly validate a valid ETC hash', () => validations.ethereum_classic.isTxHash('0x5b410a65887837fe8c2b6fadf3bad8808411cef67ed22eba27f75f6d446673de').should.be.true);
586
+
587
+ it('should correctly validate an incorrect ETC hash', () => validations.ethereum_classic.isTxHash('0x5b410a65887837fe8c2b6fadf3bad8808411cef67ed22eba27f75f6d446673de!').should.be.false);
588
+ });
589
+ });
577
590
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ellipticltd/aml-utils",
3
- "version": "0.15.7",
3
+ "version": "0.15.8-SCR-1266",
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
+ }