@ellipticltd/aml-utils 0.15.2 → 0.15.4

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 (47) hide show
  1. package/.idea/aml-utils.iml +12 -0
  2. package/.idea/inspectionProfiles/Project_Default.xml +6 -0
  3. package/.idea/modules.xml +8 -0
  4. package/.idea/vcs.xml +6 -0
  5. package/.nyc_output/62fbf615-4746-451c-aa0c-c12cb22b7a9d.json +1 -0
  6. package/.nyc_output/fd0c5a49-1dee-497a-bd75-dcf009fcab1e.json +1 -0
  7. package/.nyc_output/processinfo/1aa97f38-9e09-4229-9e02-5f7fa02f213b.json +1 -0
  8. package/.nyc_output/processinfo/62fbf615-4746-451c-aa0c-c12cb22b7a9d.json +1 -0
  9. package/.nyc_output/processinfo/b5dcfb1d-3f6e-47a0-89e4-e93e7bcc51d7.json +1 -0
  10. package/.nyc_output/processinfo/fd0c5a49-1dee-497a-bd75-dcf009fcab1e.json +1 -0
  11. package/.nyc_output/processinfo/index.json +1 -1
  12. package/README.md +4 -0
  13. package/coverage/errors/errors.js.html +1 -1
  14. package/coverage/errors/errors.spec.js.html +15 -15
  15. package/coverage/errors/index.html +12 -12
  16. package/coverage/file-parser/__tests/file-parser.spec.js.html +96 -96
  17. package/coverage/file-parser/__tests/index.html +32 -32
  18. package/coverage/file-parser/__tests/parse-row.spec.js.html +36 -36
  19. package/coverage/file-parser/__tests/sanitize-rows.spec.js.html +49 -49
  20. package/coverage/formatting/formatting.js.html +21 -21
  21. package/coverage/formatting/formatting.spec.js.html +30 -30
  22. package/coverage/formatting/index.html +28 -28
  23. package/coverage/index.html +54 -54
  24. package/coverage/middleware/index.html +1 -1
  25. package/coverage/middleware/middleware.js.html +1 -1
  26. package/coverage/orm-helpers/index.html +26 -26
  27. package/coverage/orm-helpers/ormHelpers.js.html +24 -24
  28. package/coverage/orm-helpers/ormHelpers.spec.js.html +9 -9
  29. package/coverage/types/index.html +1 -1
  30. package/coverage/types/types.js.html +1 -1
  31. package/coverage/validations/index.html +30 -30
  32. package/coverage/validations/validations.js.html +236 -545
  33. package/coverage/validations/validations.spec.js.html +159 -525
  34. package/dist/validations/validations.d.ts +12 -0
  35. package/dist/validations/validations.js +16 -0
  36. package/dist/validations/validations.spec.js +24 -0
  37. package/lib/validations/validations.js +16 -0
  38. package/lib/validations/validations.spec.js +26 -0
  39. package/package.json +1 -1
  40. package/.nyc_output/cd455ec6-4d73-4c5e-871e-7f0609bd11b8.json +0 -1
  41. package/.nyc_output/d6cd0f05-9810-4f97-8faa-8753f10b9d2d.json +0 -1
  42. package/.nyc_output/processinfo/3974a52e-3acc-45e4-a312-2dae8e2da051.json +0 -1
  43. package/.nyc_output/processinfo/3bbc21ec-7576-45f9-bc87-b6a79588c265.json +0 -1
  44. package/.nyc_output/processinfo/cd455ec6-4d73-4c5e-871e-7f0609bd11b8.json +0 -1
  45. package/.nyc_output/processinfo/d6cd0f05-9810-4f97-8faa-8753f10b9d2d.json +0 -1
  46. /package/.nyc_output/{3974a52e-3acc-45e4-a312-2dae8e2da051.json → 1aa97f38-9e09-4229-9e02-5f7fa02f213b.json} +0 -0
  47. /package/.nyc_output/{3bbc21ec-7576-45f9-bc87-b6a79588c265.json → b5dcfb1d-3f6e-47a0-89e4-e93e7bcc51d7.json} +0 -0
@@ -194,3 +194,15 @@ export namespace optimism {
194
194
  function isTxHash(str: any): any;
195
195
  function isTxHash(str: any): any;
196
196
  }
197
+ export namespace avalanche {
198
+ function isAddress(str: any): any;
199
+ function isAddress(str: any): any;
200
+ function isTxHash(str: any): any;
201
+ function isTxHash(str: any): any;
202
+ }
203
+ export namespace arbitrum {
204
+ function isAddress(str: any): any;
205
+ function isAddress(str: any): any;
206
+ function isTxHash(str: any): any;
207
+ function isTxHash(str: any): any;
208
+ }
@@ -402,6 +402,22 @@ const validations = {
402
402
  return str.length === 66 && web3.isHexStrict(str);
403
403
  },
404
404
  },
405
+ avalanche: {
406
+ isAddress(str) {
407
+ return web3.isAddress(str);
408
+ },
409
+ isTxHash(str) {
410
+ return str.length === 66 && web3.isHexStrict(str);
411
+ },
412
+ },
413
+ arbitrum: {
414
+ isAddress(str) {
415
+ return web3.isAddress(str);
416
+ },
417
+ isTxHash(str) {
418
+ return str.length === 66 && web3.isHexStrict(str);
419
+ },
420
+ },
405
421
  };
406
422
  Object.keys(V).forEach((k) => {
407
423
  const v = V[k];
@@ -393,4 +393,28 @@ describe('Validations', () => {
393
393
  });
394
394
  });
395
395
  });
396
+ describe('Avalanche', () => {
397
+ describe('isAddress', () => {
398
+ describe('isAddress', () => {
399
+ it('should return true if the address evaluates as a web3 address', () => validations_1.default.avalanche.isAddress('0xa6Bc4b3fe7F2756124d30D896Fe4457711e9d214').should.be.true);
400
+ it('should return false if the address does not evaluate to a web3 address', () => validations_1.default.avalanche.isAddress('Bc4b3fe7F2756124d30D896Fe4457711e9d214').should.be.false);
401
+ });
402
+ describe('isTxHash', () => {
403
+ it('should correctly validate a valid AVAX hash', () => validations_1.default.avalanche.isTxHash('0xec6491abd46a1a9a71b78f4b84d96fd49525aa4f66c8d8c3588c489f2f88eb0e').should.be.true);
404
+ it('should correctly validate an incorrect AVAX hash', () => validations_1.default.avalanche.isTxHash('0xec6491abd46a1a9a71b7896fd49525aa4f66c8d8c3588c489f2f88eb0e').should.be.false);
405
+ });
406
+ });
407
+ });
408
+ describe('Arbitrum', () => {
409
+ describe('isAddress', () => {
410
+ describe('isAddress', () => {
411
+ it('should return true if the address evaluates as a web3 address', () => validations_1.default.arbitrum.isAddress('0xa6Bc4b3fe7F2756124d30D896Fe4457711e9d214').should.be.true);
412
+ it('should return false if the address does not evaluate to a web3 address', () => validations_1.default.arbitrum.isAddress('Bc4b3fe7F2756124d30D896Fe4457711e9d214').should.be.false);
413
+ });
414
+ describe('isTxHash', () => {
415
+ it('should correctly validate a valid Arbitrum hash', () => validations_1.default.arbitrum.isTxHash('0xec6491abd46a1a9a71b78f4b84d96fd49525aa4f66c8d8c3588c489f2f88eb0e').should.be.true);
416
+ it('should correctly validate an incorrect Arbitrum hash', () => validations_1.default.arbitrum.isTxHash('0xec6491abd46a1a9a71b7896fd49525aa4f66c8d8c3588c489f2f88eb0e').should.be.false);
417
+ });
418
+ });
419
+ });
396
420
  });
@@ -407,6 +407,22 @@ const validations = {
407
407
  return str.length === 66 && web3.isHexStrict(str);
408
408
  },
409
409
  },
410
+ avalanche: {
411
+ isAddress(str) {
412
+ return web3.isAddress(str);
413
+ },
414
+ isTxHash(str) {
415
+ return str.length === 66 && web3.isHexStrict(str);
416
+ },
417
+ },
418
+ arbitrum: {
419
+ isAddress(str) {
420
+ return web3.isAddress(str);
421
+ },
422
+ isTxHash(str) {
423
+ return str.length === 66 && web3.isHexStrict(str);
424
+ },
425
+ },
410
426
  };
411
427
 
412
428
  Object.keys(V).forEach((k) => {
@@ -518,4 +518,30 @@ describe('Validations', () => {
518
518
  });
519
519
  });
520
520
  });
521
+ describe('Avalanche', () => {
522
+ describe('isAddress', () => {
523
+ describe('isAddress', () => {
524
+ it('should return true if the address evaluates as a web3 address', () => validations.avalanche.isAddress('0xa6Bc4b3fe7F2756124d30D896Fe4457711e9d214').should.be.true);
525
+ it('should return false if the address does not evaluate to a web3 address', () => validations.avalanche.isAddress('Bc4b3fe7F2756124d30D896Fe4457711e9d214').should.be.false);
526
+ });
527
+ describe('isTxHash', () => {
528
+ it('should correctly validate a valid AVAX hash', () => validations.avalanche.isTxHash('0xec6491abd46a1a9a71b78f4b84d96fd49525aa4f66c8d8c3588c489f2f88eb0e').should.be.true);
529
+
530
+ it('should correctly validate an incorrect AVAX hash', () => validations.avalanche.isTxHash('0xec6491abd46a1a9a71b7896fd49525aa4f66c8d8c3588c489f2f88eb0e').should.be.false);
531
+ });
532
+ });
533
+ });
534
+ describe('Arbitrum', () => {
535
+ describe('isAddress', () => {
536
+ describe('isAddress', () => {
537
+ it('should return true if the address evaluates as a web3 address', () => validations.arbitrum.isAddress('0xa6Bc4b3fe7F2756124d30D896Fe4457711e9d214').should.be.true);
538
+ it('should return false if the address does not evaluate to a web3 address', () => validations.arbitrum.isAddress('Bc4b3fe7F2756124d30D896Fe4457711e9d214').should.be.false);
539
+ });
540
+ describe('isTxHash', () => {
541
+ it('should correctly validate a valid Arbitrum hash', () => validations.arbitrum.isTxHash('0xec6491abd46a1a9a71b78f4b84d96fd49525aa4f66c8d8c3588c489f2f88eb0e').should.be.true);
542
+
543
+ it('should correctly validate an incorrect Arbitrum hash', () => validations.arbitrum.isTxHash('0xec6491abd46a1a9a71b7896fd49525aa4f66c8d8c3588c489f2f88eb0e').should.be.false);
544
+ });
545
+ });
546
+ });
521
547
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ellipticltd/aml-utils",
3
- "version": "0.15.2",
3
+ "version": "0.15.4",
4
4
  "description": "Utilities, helpers, validations, type-checking, etc",
5
5
  "engines": {
6
6
  "node": "10.1.0",