@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.
- package/.nyc_output/{b2611da5-5e21-4081-a132-674726efaad6.json → 50d7e15d-d00b-4574-b361-03b3e6cbc1b6.json} +1 -1
- package/.nyc_output/e9e3faad-ff55-4ff3-a7d2-e47e532d4515.json +1 -0
- package/.nyc_output/processinfo/{b2611da5-5e21-4081-a132-674726efaad6.json → 50d7e15d-d00b-4574-b361-03b3e6cbc1b6.json} +1 -1
- package/.nyc_output/processinfo/98b3b25b-5caa-4b0f-8d28-d2b39efffe24.json +1 -0
- package/.nyc_output/processinfo/9a42d973-6534-4af1-b756-cce56e24650e.json +1 -0
- package/.nyc_output/processinfo/{93065070-39ad-40ac-be60-eda0553e5729.json → e9e3faad-ff55-4ff3-a7d2-e47e532d4515.json} +1 -1
- package/.nyc_output/processinfo/index.json +1 -1
- package/coverage/errors/errors.js.html +14 -14
- package/coverage/errors/errors.spec.js.html +14 -14
- package/coverage/errors/index.html +13 -13
- package/coverage/file-parser/__tests/file-parser.spec.js.html +63 -63
- package/coverage/file-parser/__tests/index.html +21 -21
- package/coverage/file-parser/__tests/parse-row.spec.js.html +12 -12
- package/coverage/file-parser/__tests/sanitize-rows.spec.js.html +17 -17
- package/coverage/formatting/formatting.js.html +6 -6
- package/coverage/formatting/formatting.spec.js.html +12 -12
- package/coverage/formatting/index.html +9 -9
- package/coverage/index.html +37 -37
- package/coverage/middleware/index.html +1 -1
- package/coverage/middleware/middleware.js.html +1 -1
- package/coverage/orm-helpers/index.html +9 -9
- package/coverage/orm-helpers/ormHelpers.js.html +5 -5
- package/coverage/orm-helpers/ormHelpers.spec.js.html +8 -8
- package/coverage/types/index.html +1 -1
- package/coverage/types/types.js.html +1 -1
- package/coverage/validations/index.html +27 -27
- package/coverage/validations/validations.js.html +136 -118
- package/coverage/validations/validations.spec.js.html +132 -84
- package/dist/validations/validations.d.ts +6 -0
- package/dist/validations/validations.js +8 -0
- package/dist/validations/validations.spec.js +12 -0
- package/lib/validations/validations.js +8 -0
- package/lib/validations/validations.spec.js +18 -0
- package/package.json +1 -1
- package/.nyc_output/93065070-39ad-40ac-be60-eda0553e5729.json +0 -1
- package/.nyc_output/processinfo/2bbc4bae-048c-48ad-a7d1-d51b8f440216.json +0 -1
- package/.nyc_output/processinfo/83b0845a-d0d2-4599-8398-957100225628.json +0 -1
- /package/.nyc_output/{2bbc4bae-048c-48ad-a7d1-d51b8f440216.json → 98b3b25b-5caa-4b0f-8d28-d2b39efffe24.json} +0 -0
- /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
|
});
|