@ellipticltd/aml-utils 0.15.6 → 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.
Files changed (43) hide show
  1. package/.circleci/config.yml +6 -1
  2. package/.nyc_output/6b68ea83-db7a-45cb-b572-16338a5cea4b.json +1 -0
  3. package/.nyc_output/a74c6648-3619-4b08-bc8c-ac8cb4959f43.json +1 -0
  4. package/.nyc_output/c9b6c4ce-fddf-403b-aa2e-aac05145213c.json +1 -0
  5. package/.nyc_output/d9967655-96b8-471a-9686-a4585437f85a.json +1 -0
  6. package/.nyc_output/processinfo/6b68ea83-db7a-45cb-b572-16338a5cea4b.json +1 -0
  7. package/.nyc_output/processinfo/a74c6648-3619-4b08-bc8c-ac8cb4959f43.json +1 -0
  8. package/.nyc_output/processinfo/c9b6c4ce-fddf-403b-aa2e-aac05145213c.json +1 -0
  9. package/.nyc_output/processinfo/d9967655-96b8-471a-9686-a4585437f85a.json +1 -0
  10. package/.nyc_output/processinfo/index.json +1 -0
  11. package/coverage/base.css +224 -0
  12. package/coverage/block-navigation.js +79 -0
  13. package/coverage/errors/errors.js.html +228 -0
  14. package/coverage/errors/errors.spec.js.html +180 -0
  15. package/coverage/errors/index.html +110 -0
  16. package/coverage/file-parser/__tests/file-parser.spec.js.html +390 -0
  17. package/coverage/file-parser/__tests/index.html +123 -0
  18. package/coverage/file-parser/__tests/parse-row.spec.js.html +174 -0
  19. package/coverage/file-parser/__tests/sanitize-rows.spec.js.html +333 -0
  20. package/coverage/formatting/formatting.js.html +123 -0
  21. package/coverage/formatting/formatting.spec.js.html +204 -0
  22. package/coverage/formatting/index.html +110 -0
  23. package/coverage/index.html +175 -0
  24. package/coverage/middleware/index.html +97 -0
  25. package/coverage/middleware/middleware.js.html +144 -0
  26. package/coverage/orm-helpers/index.html +110 -0
  27. package/coverage/orm-helpers/ormHelpers.js.html +123 -0
  28. package/coverage/orm-helpers/ormHelpers.spec.js.html +192 -0
  29. package/coverage/prettify.css +1 -0
  30. package/coverage/prettify.js +2 -0
  31. package/coverage/sort-arrow-sprite.png +0 -0
  32. package/coverage/sorter.js +170 -0
  33. package/coverage/types/index.html +97 -0
  34. package/coverage/types/types.js.html +708 -0
  35. package/coverage/validations/index.html +110 -0
  36. package/coverage/validations/validations.js.html +1419 -0
  37. package/coverage/validations/validations.spec.js.html +1800 -0
  38. package/dist/validations/validations.d.ts +12 -0
  39. package/dist/validations/validations.js +16 -0
  40. package/dist/validations/validations.spec.js +22 -0
  41. package/lib/validations/validations.js +16 -0
  42. package/lib/validations/validations.spec.js +27 -0
  43. package/package.json +2 -2
@@ -212,3 +212,15 @@ export namespace tron {
212
212
  function isTxHash(str: any): any;
213
213
  function isTxHash(str: any): any;
214
214
  }
215
+ export namespace fantom {
216
+ function isAddress(str: any): any;
217
+ function isAddress(str: any): any;
218
+ function isTxHash(str: any): any;
219
+ function isTxHash(str: any): any;
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
+ }
@@ -426,6 +426,22 @@ const validations = {
426
426
  return str.length === 64 && web3.isHex(str);
427
427
  },
428
428
  },
429
+ fantom: {
430
+ isAddress(str) {
431
+ return web3.isAddress(str);
432
+ },
433
+ isTxHash(str) {
434
+ return str.length === 66 && web3.isHexStrict(str);
435
+ },
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
+ },
429
445
  };
430
446
  Object.keys(V).forEach((k) => {
431
447
  const v = V[k];
@@ -428,4 +428,26 @@ describe('Validations', () => {
428
428
  it('should correctly validate an invalid Tron hash', () => validations_1.default.tron.isTxHash('2f63fad2b3f8ccce75490545c8a0dacbb0730ebd7d551a89b015d8ca4ab458f21').should.be.false);
429
429
  });
430
430
  });
431
+ describe('Fantom', () => {
432
+ describe('isAddress', () => {
433
+ describe('isAddress', () => {
434
+ it('should return true if the address evaluates as a web3 address', () => validations_1.default.fantom.isAddress('0xa6Bc4b3fe7F2756124d30D896Fe4457711e9d214').should.be.true);
435
+ it('should return false if the address does not evaluate to a web3 address', () => validations_1.default.fantom.isAddress('Bc4b3fe7F2756124d30D896Fe4457711e9d214').should.be.false);
436
+ });
437
+ describe('isTxHash', () => {
438
+ it('should correctly validate a valid Fantom hash', () => validations_1.default.fantom.isTxHash('0xec6491abd46a1a9a71b78f4b84d96fd49525aa4f66c8d8c3588c489f2f88eb0e').should.be.true);
439
+ it('should correctly validate an incorrect Fantom hash', () => validations_1.default.fantom.isTxHash('0xec6491abd46a1a9a71b7896fd49525aa4f66c8d8c3588c489f2f88eb0e').should.be.false);
440
+ });
441
+ });
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
+ });
431
453
  });
@@ -431,6 +431,22 @@ const validations = {
431
431
  return str.length === 64 && web3.isHex(str);
432
432
  },
433
433
  },
434
+ fantom: {
435
+ isAddress(str) {
436
+ return web3.isAddress(str);
437
+ },
438
+ isTxHash(str) {
439
+ return str.length === 66 && web3.isHexStrict(str);
440
+ },
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
+ },
434
450
  };
435
451
 
436
452
  Object.keys(V).forEach((k) => {
@@ -560,4 +560,31 @@ describe('Validations', () => {
560
560
  it('should correctly validate an invalid Tron hash', () => validations.tron.isTxHash('2f63fad2b3f8ccce75490545c8a0dacbb0730ebd7d551a89b015d8ca4ab458f21').should.be.false);
561
561
  });
562
562
  });
563
+
564
+ describe('Fantom', () => {
565
+ describe('isAddress', () => {
566
+ describe('isAddress', () => {
567
+ it('should return true if the address evaluates as a web3 address', () => validations.fantom.isAddress('0xa6Bc4b3fe7F2756124d30D896Fe4457711e9d214').should.be.true);
568
+ it('should return false if the address does not evaluate to a web3 address', () => validations.fantom.isAddress('Bc4b3fe7F2756124d30D896Fe4457711e9d214').should.be.false);
569
+ });
570
+ describe('isTxHash', () => {
571
+ it('should correctly validate a valid Fantom hash', () => validations.fantom.isTxHash('0xec6491abd46a1a9a71b78f4b84d96fd49525aa4f66c8d8c3588c489f2f88eb0e').should.be.true);
572
+
573
+ it('should correctly validate an incorrect Fantom hash', () => validations.fantom.isTxHash('0xec6491abd46a1a9a71b7896fd49525aa4f66c8d8c3588c489f2f88eb0e').should.be.false);
574
+ });
575
+ });
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
+ });
563
590
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ellipticltd/aml-utils",
3
- "version": "0.15.6",
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
+ }