@ellipticltd/aml-utils 0.15.0-SCR-882 → 0.15.1

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 (46) 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/coverage/errors/errors.js.html +1 -1
  13. package/coverage/errors/errors.spec.js.html +15 -15
  14. package/coverage/errors/index.html +12 -12
  15. package/coverage/file-parser/__tests/file-parser.spec.js.html +96 -96
  16. package/coverage/file-parser/__tests/index.html +32 -32
  17. package/coverage/file-parser/__tests/parse-row.spec.js.html +36 -36
  18. package/coverage/file-parser/__tests/sanitize-rows.spec.js.html +49 -49
  19. package/coverage/formatting/formatting.js.html +21 -21
  20. package/coverage/formatting/formatting.spec.js.html +30 -30
  21. package/coverage/formatting/index.html +28 -28
  22. package/coverage/index.html +54 -54
  23. package/coverage/middleware/index.html +1 -1
  24. package/coverage/middleware/middleware.js.html +1 -1
  25. package/coverage/orm-helpers/index.html +26 -26
  26. package/coverage/orm-helpers/ormHelpers.js.html +24 -24
  27. package/coverage/orm-helpers/ormHelpers.spec.js.html +9 -9
  28. package/coverage/types/index.html +1 -1
  29. package/coverage/types/types.js.html +1 -1
  30. package/coverage/validations/index.html +30 -30
  31. package/coverage/validations/validations.js.html +236 -545
  32. package/coverage/validations/validations.spec.js.html +159 -525
  33. package/dist/validations/validations.d.ts +6 -0
  34. package/dist/validations/validations.js +8 -0
  35. package/dist/validations/validations.spec.js +12 -0
  36. package/lib/validations/validations.js +8 -0
  37. package/lib/validations/validations.spec.js +13 -0
  38. package/package.json +1 -1
  39. package/.nyc_output/cd455ec6-4d73-4c5e-871e-7f0609bd11b8.json +0 -1
  40. package/.nyc_output/d6cd0f05-9810-4f97-8faa-8753f10b9d2d.json +0 -1
  41. package/.nyc_output/processinfo/3974a52e-3acc-45e4-a312-2dae8e2da051.json +0 -1
  42. package/.nyc_output/processinfo/3bbc21ec-7576-45f9-bc87-b6a79588c265.json +0 -1
  43. package/.nyc_output/processinfo/cd455ec6-4d73-4c5e-871e-7f0609bd11b8.json +0 -1
  44. package/.nyc_output/processinfo/d6cd0f05-9810-4f97-8faa-8753f10b9d2d.json +0 -1
  45. /package/.nyc_output/{3974a52e-3acc-45e4-a312-2dae8e2da051.json → 1aa97f38-9e09-4229-9e02-5f7fa02f213b.json} +0 -0
  46. /package/.nyc_output/{3bbc21ec-7576-45f9-bc87-b6a79588c265.json → b5dcfb1d-3f6e-47a0-89e4-e93e7bcc51d7.json} +0 -0
@@ -188,3 +188,9 @@ export namespace filecoin {
188
188
  function isTxHash(str: any): boolean;
189
189
  function isTxHash(str: any): boolean;
190
190
  }
191
+ export namespace optimism {
192
+ function isAddress(str: any): any;
193
+ function isAddress(str: any): any;
194
+ function isTxHash(str: any): any;
195
+ function isTxHash(str: any): any;
196
+ }
@@ -394,6 +394,14 @@ const validations = {
394
394
  return str.length === 62 && /^bafy2bza/.test(str);
395
395
  },
396
396
  },
397
+ optimism: {
398
+ isAddress(str) {
399
+ return web3.isAddress(str);
400
+ },
401
+ isTxHash(str) {
402
+ return str.length === 66 && web3.isHexStrict(str);
403
+ },
404
+ },
397
405
  };
398
406
  Object.keys(V).forEach((k) => {
399
407
  const v = V[k];
@@ -367,4 +367,16 @@ describe('Validations', () => {
367
367
  it('should correctly validate an invalid Filecoin hash', () => validations_1.default.filecoin.isTxHash('fafy2bzacedcrpcs76f2ws445wnjix2kktsgca4vv6qbd7zua7pc5mnkpveg7m').should.be.false);
368
368
  });
369
369
  });
370
+ describe('Optimism', () => {
371
+ describe('isAddress', () => {
372
+ describe('isAddress', () => {
373
+ it('should return true if the address evaluates as a web3 address', () => validations_1.default.optimism.isAddress('0xa6Bc4b3fe7F2756124d30D896Fe4457711e9d214').should.be.true);
374
+ it('should return false if the address does not evaluate to a web3 address', () => validations_1.default.optimism.isAddress('Bc4b3fe7F2756124d30D896Fe4457711e9d214').should.be.false);
375
+ });
376
+ describe('isTxHash', () => {
377
+ it('should correctly validate a valid OP hash', () => validations_1.default.optimism.isTxHash('0xec6491abd46a1a9a71b78f4b84d96fd49525aa4f66c8d8c3588c489f2f88eb0e').should.be.true);
378
+ it('should correctly validate an incorrect OP hash', () => validations_1.default.optimism.isTxHash('0xec6491abd46a1a9a71b7896fd49525aa4f66c8d8c3588c489f2f88eb0e').should.be.false);
379
+ });
380
+ });
381
+ });
370
382
  });
@@ -399,6 +399,14 @@ const validations = {
399
399
  return str.length === 62 && /^bafy2bza/.test(str);
400
400
  },
401
401
  },
402
+ optimism: {
403
+ isAddress(str) {
404
+ return web3.isAddress(str);
405
+ },
406
+ isTxHash(str) {
407
+ return str.length === 66 && web3.isHexStrict(str);
408
+ },
409
+ },
402
410
  };
403
411
 
404
412
  Object.keys(V).forEach((k) => {
@@ -486,4 +486,17 @@ describe('Validations', () => {
486
486
  it('should correctly validate an invalid Filecoin hash', () => validations.filecoin.isTxHash('fafy2bzacedcrpcs76f2ws445wnjix2kktsgca4vv6qbd7zua7pc5mnkpveg7m').should.be.false);
487
487
  });
488
488
  });
489
+ describe('Optimism', () => {
490
+ describe('isAddress', () => {
491
+ describe('isAddress', () => {
492
+ it('should return true if the address evaluates as a web3 address', () => validations.optimism.isAddress('0xa6Bc4b3fe7F2756124d30D896Fe4457711e9d214').should.be.true);
493
+ it('should return false if the address does not evaluate to a web3 address', () => validations.optimism.isAddress('Bc4b3fe7F2756124d30D896Fe4457711e9d214').should.be.false);
494
+ });
495
+ describe('isTxHash', () => {
496
+ it('should correctly validate a valid OP hash', () => validations.optimism.isTxHash('0xec6491abd46a1a9a71b78f4b84d96fd49525aa4f66c8d8c3588c489f2f88eb0e').should.be.true);
497
+
498
+ it('should correctly validate an incorrect OP hash', () => validations.optimism.isTxHash('0xec6491abd46a1a9a71b7896fd49525aa4f66c8d8c3588c489f2f88eb0e').should.be.false);
499
+ });
500
+ });
501
+ });
489
502
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ellipticltd/aml-utils",
3
- "version": "0.15.0-SCR-882",
3
+ "version": "0.15.1",
4
4
  "description": "Utilities, helpers, validations, type-checking, etc",
5
5
  "engines": {
6
6
  "node": "10.1.0",