@ellipticltd/aml-utils 0.15.4 → 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 (46) 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/coverage/errors/errors.js.html +1 -1
  9. package/coverage/errors/errors.spec.js.html +15 -15
  10. package/coverage/errors/index.html +12 -12
  11. package/coverage/file-parser/__tests/file-parser.spec.js.html +96 -96
  12. package/coverage/file-parser/__tests/index.html +32 -32
  13. package/coverage/file-parser/__tests/parse-row.spec.js.html +36 -36
  14. package/coverage/file-parser/__tests/sanitize-rows.spec.js.html +49 -49
  15. package/coverage/formatting/formatting.js.html +21 -21
  16. package/coverage/formatting/formatting.spec.js.html +30 -30
  17. package/coverage/formatting/index.html +28 -28
  18. package/coverage/index.html +54 -54
  19. package/coverage/middleware/index.html +1 -1
  20. package/coverage/middleware/middleware.js.html +1 -1
  21. package/coverage/orm-helpers/index.html +26 -26
  22. package/coverage/orm-helpers/ormHelpers.js.html +24 -24
  23. package/coverage/orm-helpers/ormHelpers.spec.js.html +9 -9
  24. package/coverage/types/index.html +1 -1
  25. package/coverage/types/types.js.html +1 -1
  26. package/coverage/validations/index.html +30 -30
  27. package/coverage/validations/validations.js.html +545 -236
  28. package/coverage/validations/validations.spec.js.html +525 -159
  29. package/dist/validations/validations.d.ts +6 -0
  30. package/dist/validations/validations.js +8 -0
  31. package/dist/validations/validations.spec.js +11 -0
  32. package/lib/validations/validations.js +8 -0
  33. package/lib/validations/validations.spec.js +16 -0
  34. package/package.json +1 -1
  35. package/.idea/aml-utils.iml +0 -12
  36. package/.idea/inspectionProfiles/Project_Default.xml +0 -6
  37. package/.idea/modules.xml +0 -8
  38. package/.idea/vcs.xml +0 -6
  39. package/.nyc_output/62fbf615-4746-451c-aa0c-c12cb22b7a9d.json +0 -1
  40. package/.nyc_output/fd0c5a49-1dee-497a-bd75-dcf009fcab1e.json +0 -1
  41. package/.nyc_output/processinfo/1aa97f38-9e09-4229-9e02-5f7fa02f213b.json +0 -1
  42. package/.nyc_output/processinfo/62fbf615-4746-451c-aa0c-c12cb22b7a9d.json +0 -1
  43. package/.nyc_output/processinfo/b5dcfb1d-3f6e-47a0-89e4-e93e7bcc51d7.json +0 -1
  44. package/.nyc_output/processinfo/fd0c5a49-1dee-497a-bd75-dcf009fcab1e.json +0 -1
  45. /package/.nyc_output/{1aa97f38-9e09-4229-9e02-5f7fa02f213b.json → 14c71e42-4ce7-487c-be9f-95228038c7ec.json} +0 -0
  46. /package/.nyc_output/{b5dcfb1d-3f6e-47a0-89e4-e93e7bcc51d7.json → 470a2eff-bd46-45ef-bfd6-70c01fe4c9b3.json} +0 -0
@@ -206,3 +206,9 @@ export namespace arbitrum {
206
206
  function isTxHash(str: any): any;
207
207
  function isTxHash(str: any): any;
208
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
+ }
@@ -418,6 +418,14 @@ const validations = {
418
418
  return str.length === 66 && web3.isHexStrict(str);
419
419
  },
420
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
+ },
421
429
  };
422
430
  Object.keys(V).forEach((k) => {
423
431
  const v = V[k];
@@ -417,4 +417,15 @@ describe('Validations', () => {
417
417
  });
418
418
  });
419
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
+ });
420
431
  });
@@ -423,6 +423,14 @@ const validations = {
423
423
  return str.length === 66 && web3.isHexStrict(str);
424
424
  },
425
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
+ },
426
434
  };
427
435
 
428
436
  Object.keys(V).forEach((k) => {
@@ -544,4 +544,20 @@ describe('Validations', () => {
544
544
  });
545
545
  });
546
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
+ });
547
563
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ellipticltd/aml-utils",
3
- "version": "0.15.4",
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>