@ellipticltd/aml-utils 0.14.1 → 0.14.2-SCR-638-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 (39) hide show
  1. package/.nyc_output/{b2611da5-5e21-4081-a132-674726efaad6.json → 50d7e15d-d00b-4574-b361-03b3e6cbc1b6.json} +1 -1
  2. package/.nyc_output/e9e3faad-ff55-4ff3-a7d2-e47e532d4515.json +1 -0
  3. package/.nyc_output/processinfo/{b2611da5-5e21-4081-a132-674726efaad6.json → 50d7e15d-d00b-4574-b361-03b3e6cbc1b6.json} +1 -1
  4. package/.nyc_output/processinfo/98b3b25b-5caa-4b0f-8d28-d2b39efffe24.json +1 -0
  5. package/.nyc_output/processinfo/9a42d973-6534-4af1-b756-cce56e24650e.json +1 -0
  6. package/.nyc_output/processinfo/{93065070-39ad-40ac-be60-eda0553e5729.json → e9e3faad-ff55-4ff3-a7d2-e47e532d4515.json} +1 -1
  7. package/.nyc_output/processinfo/index.json +1 -1
  8. package/coverage/errors/errors.js.html +14 -14
  9. package/coverage/errors/errors.spec.js.html +14 -14
  10. package/coverage/errors/index.html +13 -13
  11. package/coverage/file-parser/__tests/file-parser.spec.js.html +63 -63
  12. package/coverage/file-parser/__tests/index.html +21 -21
  13. package/coverage/file-parser/__tests/parse-row.spec.js.html +12 -12
  14. package/coverage/file-parser/__tests/sanitize-rows.spec.js.html +17 -17
  15. package/coverage/formatting/formatting.js.html +6 -6
  16. package/coverage/formatting/formatting.spec.js.html +12 -12
  17. package/coverage/formatting/index.html +9 -9
  18. package/coverage/index.html +37 -37
  19. package/coverage/middleware/index.html +1 -1
  20. package/coverage/middleware/middleware.js.html +1 -1
  21. package/coverage/orm-helpers/index.html +9 -9
  22. package/coverage/orm-helpers/ormHelpers.js.html +5 -5
  23. package/coverage/orm-helpers/ormHelpers.spec.js.html +8 -8
  24. package/coverage/types/index.html +1 -1
  25. package/coverage/types/types.js.html +1 -1
  26. package/coverage/validations/index.html +27 -27
  27. package/coverage/validations/validations.js.html +136 -118
  28. package/coverage/validations/validations.spec.js.html +132 -84
  29. package/dist/validations/validations.d.ts +6 -0
  30. package/dist/validations/validations.js +8 -0
  31. package/dist/validations/validations.spec.js +12 -0
  32. package/lib/validations/validations.js +8 -0
  33. package/lib/validations/validations.spec.js +18 -0
  34. package/package.json +1 -1
  35. package/.nyc_output/93065070-39ad-40ac-be60-eda0553e5729.json +0 -1
  36. package/.nyc_output/processinfo/2bbc4bae-048c-48ad-a7d1-d51b8f440216.json +0 -1
  37. package/.nyc_output/processinfo/83b0845a-d0d2-4599-8398-957100225628.json +0 -1
  38. /package/.nyc_output/{2bbc4bae-048c-48ad-a7d1-d51b8f440216.json → 98b3b25b-5caa-4b0f-8d28-d2b39efffe24.json} +0 -0
  39. /package/.nyc_output/{83b0845a-d0d2-4599-8398-957100225628.json → 9a42d973-6534-4af1-b756-cce56e24650e.json} +0 -0
@@ -354,6 +354,14 @@ const validations = {
354
354
  return str.length === 64;
355
355
  },
356
356
  },
357
+ cosmos: {
358
+ isAddress(str) {
359
+ return /^cosmos{1}[a-zA-Z\d]{39}$/.test(str);
360
+ },
361
+ isTxHash(str) {
362
+ return str.length === 64 && web3.isHex(str);
363
+ },
364
+ },
357
365
  };
358
366
  Object.keys(V).forEach((k) => {
359
367
  const v = V[k];
@@ -308,4 +308,16 @@ describe('Validations', () => {
308
308
  it('should return false when passed a non-hex string', () => validations_1.default.polkadot.isTxHash('Yet again this is not a hex string').should.be.false);
309
309
  });
310
310
  });
311
+ describe('ATOM', () => {
312
+ describe('isAddress', () => {
313
+ it('should correctly validate valid ATOM addresses', () => validations_1.default.cosmos.isAddress('cosmos153lf4zntqt33a4v0sm5cytrxyqn78q7kz8j8x5').should.be.true);
314
+ it('should correctly validate an incorrect ATOM address', () => validations_1.default.cosmos.isAddress('kosmos153lf4zntqt33a4v0sm5cytrxyqn78q7kz8j8x5').should.be.false);
315
+ it('should correctly validate an incorrect (too long) ATOM address', () => validations_1.default.cosmos.isAddress('cosmos153lf4zntqt33a4v0sm5cytrxyqn78q7kz8j8x50').should.be.false);
316
+ });
317
+ describe('isTxHash', () => {
318
+ it('should correctly validate a valid ATOM hash', () => validations_1.default.cosmos.isTxHash('BFA0252193CCAA0592AF2A27541473E7F6422A9AD85CFC9525CF67FA2AA2CD6F').should.be.true);
319
+ it('should correctly validate an incorrect ATOM hash', () => validations_1.default.cosmos.isTxHash('BFA0252193CCAA0592AF2A27541473E7').should.be.false);
320
+ it('should return false when passed a non-hex string', () => validations_1.default.cosmos.isTxHash('ZZA0252193CCAA0592AF2A27541473E7F6422A9AD85CFC9525CF67FA2AA2CD6F').should.be.false);
321
+ });
322
+ });
311
323
  });
@@ -359,6 +359,14 @@ const validations = {
359
359
  return str.length === 64;
360
360
  },
361
361
  },
362
+ cosmos: {
363
+ isAddress(str) {
364
+ return /^cosmos{1}[a-zA-Z\d]{39}$/.test(str);
365
+ },
366
+ isTxHash(str) {
367
+ return str.length === 64 && web3.isHex(str);
368
+ },
369
+ },
362
370
  };
363
371
 
364
372
  Object.keys(V).forEach((k) => {
@@ -398,4 +398,22 @@ describe('Validations', () => {
398
398
  it('should return false when passed a non-hex string', () => validations.polkadot.isTxHash('Yet again this is not a hex string').should.be.false);
399
399
  });
400
400
  });
401
+
402
+ describe('ATOM', () => {
403
+ describe('isAddress', () => {
404
+ it('should correctly validate valid ATOM addresses', () => validations.cosmos.isAddress('cosmos153lf4zntqt33a4v0sm5cytrxyqn78q7kz8j8x5').should.be.true);
405
+
406
+ it('should correctly validate an incorrect ATOM address', () => validations.cosmos.isAddress('kosmos153lf4zntqt33a4v0sm5cytrxyqn78q7kz8j8x5').should.be.false);
407
+
408
+ it('should correctly validate an incorrect (too long) ATOM address', () => validations.cosmos.isAddress('cosmos153lf4zntqt33a4v0sm5cytrxyqn78q7kz8j8x50').should.be.false);
409
+ });
410
+
411
+ describe('isTxHash', () => {
412
+ it('should correctly validate a valid ATOM hash', () => validations.cosmos.isTxHash('BFA0252193CCAA0592AF2A27541473E7F6422A9AD85CFC9525CF67FA2AA2CD6F').should.be.true);
413
+
414
+ it('should correctly validate an incorrect ATOM hash', () => validations.cosmos.isTxHash('BFA0252193CCAA0592AF2A27541473E7').should.be.false);
415
+
416
+ it('should return false when passed a non-hex string', () => validations.cosmos.isTxHash('ZZA0252193CCAA0592AF2A27541473E7F6422A9AD85CFC9525CF67FA2AA2CD6F').should.be.false);
417
+ });
418
+ });
401
419
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ellipticltd/aml-utils",
3
- "version": "0.14.1",
3
+ "version": "0.14.2-SCR-638-1",
4
4
  "description": "Utilities, helpers, validations, type-checking, etc",
5
5
  "engines": {
6
6
  "node": "10.1.0",