@ellipticltd/aml-utils 0.15.3 → 0.15.5-SCR-812

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/.nyc_output/43e358d0-76a0-402c-b32e-26a347513bb4.json +1 -0
  2. package/.nyc_output/f8c694f5-2b17-4e37-9079-32079e715296.json +1 -0
  3. package/.nyc_output/processinfo/14c71e42-4ce7-487c-be9f-95228038c7ec.json +1 -0
  4. package/.nyc_output/processinfo/43e358d0-76a0-402c-b32e-26a347513bb4.json +1 -0
  5. package/.nyc_output/processinfo/470a2eff-bd46-45ef-bfd6-70c01fe4c9b3.json +1 -0
  6. package/.nyc_output/processinfo/f8c694f5-2b17-4e37-9079-32079e715296.json +1 -0
  7. package/.nyc_output/processinfo/index.json +1 -1
  8. package/README.md +4 -0
  9. package/coverage/errors/errors.js.html +1 -1
  10. package/coverage/errors/errors.spec.js.html +15 -15
  11. package/coverage/errors/index.html +12 -12
  12. package/coverage/file-parser/__tests/file-parser.spec.js.html +96 -96
  13. package/coverage/file-parser/__tests/index.html +32 -32
  14. package/coverage/file-parser/__tests/parse-row.spec.js.html +36 -36
  15. package/coverage/file-parser/__tests/sanitize-rows.spec.js.html +49 -49
  16. package/coverage/formatting/formatting.js.html +21 -21
  17. package/coverage/formatting/formatting.spec.js.html +30 -30
  18. package/coverage/formatting/index.html +28 -28
  19. package/coverage/index.html +54 -54
  20. package/coverage/middleware/index.html +1 -1
  21. package/coverage/middleware/middleware.js.html +1 -1
  22. package/coverage/orm-helpers/index.html +26 -26
  23. package/coverage/orm-helpers/ormHelpers.js.html +24 -24
  24. package/coverage/orm-helpers/ormHelpers.spec.js.html +9 -9
  25. package/coverage/types/index.html +1 -1
  26. package/coverage/types/types.js.html +1 -1
  27. package/coverage/validations/index.html +30 -30
  28. package/coverage/validations/validations.js.html +545 -236
  29. package/coverage/validations/validations.spec.js.html +525 -159
  30. package/dist/validations/validations.d.ts +12 -0
  31. package/dist/validations/validations.js +16 -0
  32. package/dist/validations/validations.spec.js +23 -0
  33. package/lib/validations/validations.js +16 -0
  34. package/lib/validations/validations.spec.js +29 -0
  35. package/package.json +1 -1
  36. package/.idea/aml-utils.iml +0 -12
  37. package/.idea/inspectionProfiles/Project_Default.xml +0 -6
  38. package/.idea/modules.xml +0 -8
  39. package/.idea/vcs.xml +0 -6
  40. package/.nyc_output/62fbf615-4746-451c-aa0c-c12cb22b7a9d.json +0 -1
  41. package/.nyc_output/fd0c5a49-1dee-497a-bd75-dcf009fcab1e.json +0 -1
  42. package/.nyc_output/processinfo/1aa97f38-9e09-4229-9e02-5f7fa02f213b.json +0 -1
  43. package/.nyc_output/processinfo/62fbf615-4746-451c-aa0c-c12cb22b7a9d.json +0 -1
  44. package/.nyc_output/processinfo/b5dcfb1d-3f6e-47a0-89e4-e93e7bcc51d7.json +0 -1
  45. package/.nyc_output/processinfo/fd0c5a49-1dee-497a-bd75-dcf009fcab1e.json +0 -1
  46. /package/.nyc_output/{1aa97f38-9e09-4229-9e02-5f7fa02f213b.json → 14c71e42-4ce7-487c-be9f-95228038c7ec.json} +0 -0
  47. /package/.nyc_output/{b5dcfb1d-3f6e-47a0-89e4-e93e7bcc51d7.json → 470a2eff-bd46-45ef-bfd6-70c01fe4c9b3.json} +0 -0
@@ -200,3 +200,15 @@ export namespace avalanche {
200
200
  function isTxHash(str: any): any;
201
201
  function isTxHash(str: any): any;
202
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
+ }
209
+ export namespace tron {
210
+ function isAddress(str: any): any;
211
+ function isAddress(str: any): any;
212
+ function isTxHash(str: any): any;
213
+ function isTxHash(str: any): any;
214
+ }
@@ -410,6 +410,22 @@ const validations = {
410
410
  return str.length === 66 && web3.isHexStrict(str);
411
411
  },
412
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
+ },
421
+ tron: {
422
+ isAddress(str) {
423
+ return addressValidator.validate(str, 'tron');
424
+ },
425
+ isTxHash(str) {
426
+ return str.length === 64 && web3.isHex(str);
427
+ },
428
+ },
413
429
  };
414
430
  Object.keys(V).forEach((k) => {
415
431
  const v = V[k];
@@ -405,4 +405,27 @@ describe('Validations', () => {
405
405
  });
406
406
  });
407
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
+ });
420
+ describe('Tron', () => {
421
+ describe('isAddress', () => {
422
+ it('should correctly validate a valid Tron address', () => validations_1.default.tron.isAddress('TPCCPf13PDPp5nEGCiMrE7WXKstpZhmfDw').should.be.true);
423
+ it('should correctly validate an invalid Tron address', () => validations_1.default.tron.isAddress('TPCCPf13PDPp5nEGCiMrE7WXKstpZhmfDwZ').should.be.false);
424
+ });
425
+ describe('isTxHash', () => {
426
+ it('should correctly validate a valid Tron hash', () => validations_1.default.tron.isTxHash('2f63fad2b3f8ccce75490545c8a0dacbb0730ebd7d551a89b015d8ca4ab458f2').should.be.true);
427
+ it('should correctly validate an invalid Tron hash', () => validations_1.default.tron.isTxHash('2f63fad2b3f8ccce75490545c8a0dacbb0730ebd7d551a89b015d8ca4ab458fz').should.be.false);
428
+ it('should correctly validate an invalid Tron hash', () => validations_1.default.tron.isTxHash('2f63fad2b3f8ccce75490545c8a0dacbb0730ebd7d551a89b015d8ca4ab458f21').should.be.false);
429
+ });
430
+ });
408
431
  });
@@ -415,6 +415,22 @@ const validations = {
415
415
  return str.length === 66 && web3.isHexStrict(str);
416
416
  },
417
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
+ },
426
+ tron: {
427
+ isAddress(str) {
428
+ return addressValidator.validate(str, 'tron');
429
+ },
430
+ isTxHash(str) {
431
+ return str.length === 64 && web3.isHex(str);
432
+ },
433
+ },
418
434
  };
419
435
 
420
436
  Object.keys(V).forEach((k) => {
@@ -531,4 +531,33 @@ describe('Validations', () => {
531
531
  });
532
532
  });
533
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
+ });
547
+
548
+ describe('Tron', () => {
549
+ describe('isAddress', () => {
550
+ it('should correctly validate a valid Tron address', () => validations.tron.isAddress('TPCCPf13PDPp5nEGCiMrE7WXKstpZhmfDw').should.be.true);
551
+
552
+ it('should correctly validate an invalid Tron address', () => validations.tron.isAddress('TPCCPf13PDPp5nEGCiMrE7WXKstpZhmfDwZ').should.be.false);
553
+ });
554
+
555
+ describe('isTxHash', () => {
556
+ it('should correctly validate a valid Tron hash', () => validations.tron.isTxHash('2f63fad2b3f8ccce75490545c8a0dacbb0730ebd7d551a89b015d8ca4ab458f2').should.be.true);
557
+
558
+ it('should correctly validate an invalid Tron hash', () => validations.tron.isTxHash('2f63fad2b3f8ccce75490545c8a0dacbb0730ebd7d551a89b015d8ca4ab458fz').should.be.false);
559
+
560
+ it('should correctly validate an invalid Tron hash', () => validations.tron.isTxHash('2f63fad2b3f8ccce75490545c8a0dacbb0730ebd7d551a89b015d8ca4ab458f21').should.be.false);
561
+ });
562
+ });
534
563
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ellipticltd/aml-utils",
3
- "version": "0.15.3",
3
+ "version": "0.15.5-SCR-812",
4
4
  "description": "Utilities, helpers, validations, type-checking, etc",
5
5
  "engines": {
6
6
  "node": "10.1.0",
@@ -1,12 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="WEB_MODULE" version="4">
3
- <component name="NewModuleRootManager">
4
- <content url="file://$MODULE_DIR$">
5
- <excludeFolder url="file://$MODULE_DIR$/temp" />
6
- <excludeFolder url="file://$MODULE_DIR$/.tmp" />
7
- <excludeFolder url="file://$MODULE_DIR$/tmp" />
8
- </content>
9
- <orderEntry type="inheritedJdk" />
10
- <orderEntry type="sourceFolder" forTests="false" />
11
- </component>
12
- </module>
@@ -1,6 +0,0 @@
1
- <component name="InspectionProjectProfileManager">
2
- <profile version="1.0">
3
- <option name="myName" value="Project Default" />
4
- <inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
5
- </profile>
6
- </component>
package/.idea/modules.xml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/aml-utils.iml" filepath="$PROJECT_DIR$/.idea/aml-utils.iml" />
6
- </modules>
7
- </component>
8
- </project>
package/.idea/vcs.xml DELETED
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
- </component>
6
- </project>