@ellipticltd/aml-utils 0.7.0 → 0.8.0-EN-2570.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 (85) hide show
  1. package/.circleci/config.yml +37 -4
  2. package/.eslintrc +30 -6
  3. package/.huskyrc +5 -0
  4. package/.mocharc.json +3 -0
  5. package/.releaserc.json +18 -0
  6. package/README.md +39 -0
  7. package/commitlint.config.js +1 -0
  8. package/dist/errors/errors.d.ts +9 -0
  9. package/dist/errors/errors.js +42 -0
  10. package/dist/errors/errors.spec.d.ts +1 -0
  11. package/dist/errors/errors.spec.js +23 -0
  12. package/dist/file-parser/__tests/file-parser.spec.d.ts +1 -0
  13. package/dist/file-parser/__tests/file-parser.spec.js +113 -0
  14. package/dist/file-parser/__tests/parse-row.spec.d.ts +1 -0
  15. package/dist/file-parser/__tests/parse-row.spec.js +29 -0
  16. package/dist/file-parser/__tests/sanitize-rows.spec.d.ts +1 -0
  17. package/dist/file-parser/__tests/sanitize-rows.spec.js +78 -0
  18. package/dist/file-parser/errors.d.ts +3 -0
  19. package/dist/file-parser/errors.js +11 -0
  20. package/dist/file-parser/file-parser.d.ts +8 -0
  21. package/dist/file-parser/file-parser.js +68 -0
  22. package/dist/file-parser/parse-row.d.ts +2 -0
  23. package/dist/file-parser/parse-row.js +39 -0
  24. package/dist/file-parser/sanitzeRows.d.ts +3 -0
  25. package/dist/file-parser/sanitzeRows.js +18 -0
  26. package/dist/formatting/formatting.d.ts +2 -0
  27. package/dist/formatting/formatting.js +17 -0
  28. package/dist/formatting/formatting.spec.d.ts +1 -0
  29. package/dist/formatting/formatting.spec.js +37 -0
  30. package/dist/index.d.ts +8 -0
  31. package/dist/index.js +20 -0
  32. package/dist/middleware/middleware.d.ts +4 -0
  33. package/dist/middleware/middleware.js +22 -0
  34. package/dist/orm-helpers/ormHelpers.d.ts +1 -0
  35. package/dist/orm-helpers/ormHelpers.js +17 -0
  36. package/dist/orm-helpers/ormHelpers.spec.d.ts +1 -0
  37. package/dist/orm-helpers/ormHelpers.spec.js +38 -0
  38. package/dist/types/types.d.ts +17 -0
  39. package/dist/types/types.js +203 -0
  40. package/dist/validations/validations.d.ts +116 -0
  41. package/dist/validations/validations.js +296 -0
  42. package/dist/validations/validations.spec.d.ts +1 -0
  43. package/dist/validations/validations.spec.js +272 -0
  44. package/lib/errors/errors.spec.js +37 -0
  45. package/lib/file-parser/__tests/file-parser.spec.js +101 -0
  46. package/lib/file-parser/__tests/parse-row.spec.js +35 -0
  47. package/lib/file-parser/__tests/sanitize-rows.spec.js +88 -0
  48. package/lib/file-parser/errors.ts +7 -0
  49. package/lib/file-parser/file-parser.ts +84 -0
  50. package/lib/file-parser/parse-row.ts +52 -0
  51. package/lib/file-parser/sanitzeRows.ts +32 -0
  52. package/lib/formatting/formatting.spec.js +45 -0
  53. package/lib/index.ts +17 -0
  54. package/lib/{middleware.js → middleware/middleware.js} +1 -1
  55. package/lib/orm-helpers/ormHelpers.spec.js +41 -0
  56. package/lib/{types.js → types/types.js} +2 -2
  57. package/lib/{validations.js → validations/validations.js} +39 -7
  58. package/lib/validations/validations.spec.js +354 -0
  59. package/package.json +28 -13
  60. package/tsconfig.json +26 -0
  61. package/.nyc_output/0d2fdad3-7c58-4fdd-8d13-1bcb090f6cc6.json +0 -1
  62. package/.nyc_output/c8a4acec-3daa-459a-8aa3-cefb11e1430a.json +0 -1
  63. package/.nyc_output/dd0765ec-ad3f-4e3c-bbe6-12057d31a820.json +0 -1
  64. package/.nyc_output/ede345bb-a053-4be5-b26d-46cc26104776.json +0 -1
  65. package/.nyc_output/processinfo/0d2fdad3-7c58-4fdd-8d13-1bcb090f6cc6.json +0 -1
  66. package/.nyc_output/processinfo/c8a4acec-3daa-459a-8aa3-cefb11e1430a.json +0 -1
  67. package/.nyc_output/processinfo/dd0765ec-ad3f-4e3c-bbe6-12057d31a820.json +0 -1
  68. package/.nyc_output/processinfo/ede345bb-a053-4be5-b26d-46cc26104776.json +0 -1
  69. package/.nyc_output/processinfo/index.json +0 -1
  70. package/coverage/base.css +0 -224
  71. package/coverage/block-navigation.js +0 -79
  72. package/coverage/errors.js.html +0 -228
  73. package/coverage/formatting.js.html +0 -123
  74. package/coverage/index.html +0 -136
  75. package/coverage/ormHelpers.js.html +0 -123
  76. package/coverage/prettify.css +0 -1
  77. package/coverage/prettify.js +0 -2
  78. package/coverage/sort-arrow-sprite.png +0 -0
  79. package/coverage/sorter.js +0 -170
  80. package/coverage/validations.js.html +0 -882
  81. package/index.d.ts +0 -1
  82. package/index.js +0 -8
  83. /package/lib/{errors.js → errors/errors.js} +0 -0
  84. /package/lib/{formatting.js → formatting/formatting.js} +0 -0
  85. /package/lib/{ormHelpers.js → orm-helpers/ormHelpers.js} +0 -0
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const sensicalRowCheck = (cells) => (cells.some((cell) => !!cell));
4
+ function sanitizeRows(parsedRows, processRow) {
5
+ const firstSensicalRowIndex = parsedRows
6
+ .findIndex(sensicalRowCheck);
7
+ const lastSensicalRowIndex = [...parsedRows]
8
+ .reverse()
9
+ .findIndex(sensicalRowCheck);
10
+ const sanitizedRows = parsedRows
11
+ .splice(firstSensicalRowIndex, parsedRows.length - firstSensicalRowIndex - lastSensicalRowIndex);
12
+ const firstRow = processRow(sanitizedRows[0]);
13
+ if (firstRow.isValid) {
14
+ return sanitizedRows;
15
+ }
16
+ return sanitizedRows.splice(1);
17
+ }
18
+ exports.default = sanitizeRows;
@@ -0,0 +1,2 @@
1
+ export function rethrowError(fnName: any, e: any): string;
2
+ export function sqlEscapeWildcard(str: any): any;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ const _ = require('lodash');
3
+ const rethrowError = (fnName, e) => {
4
+ let formattedError;
5
+ if (_.isPlainObject(e.error) || _.isArray(e.error)) {
6
+ formattedError = `\n${JSON.stringify(e.error, null, 2)}`;
7
+ }
8
+ else {
9
+ formattedError = e.error;
10
+ }
11
+ return `${fnName} - ${e.name}: ${e.statusCode} - ${formattedError}`;
12
+ };
13
+ const sqlEscapeWildcard = (str) => str.replace(/_|%|\\/g, (x) => `\\${x}`);
14
+ module.exports = {
15
+ rethrowError,
16
+ sqlEscapeWildcard,
17
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ const chai = require('chai');
3
+ const { sqlEscapeWildcard, rethrowError } = require('./formatting');
4
+ const { expect } = chai;
5
+ describe('formatting.sqlEscapeWildcard', () => {
6
+ describe('when passed an empty string', () => {
7
+ it('returns an empty string', () => sqlEscapeWildcard('').should.equal(''));
8
+ });
9
+ describe('when passed a string with no sql wildcards', () => {
10
+ it('returns the same string', () => {
11
+ const str = 'foo bar';
12
+ return sqlEscapeWildcard(str).should.equal(str);
13
+ });
14
+ });
15
+ return describe('when passed a string with sql wildcards', () => {
16
+ it('returns the string with \\ % _ escaped', () => {
17
+ const str = 'foo\\dfs_erwr%rewr';
18
+ return sqlEscapeWildcard(str).should.equal('foo\\\\dfs\\_erwr\\%rewr');
19
+ });
20
+ });
21
+ });
22
+ describe('rethrowError', () => {
23
+ it('returns an error when given a string', () => rethrowError('myFunc', { error: 'Oh dear, myFunc is broken' })
24
+ .should.equal('myFunc - undefined: undefined - Oh dear, myFunc is broken'));
25
+ it('returns an error when passed an error object', () => rethrowError('myFunc', {
26
+ name: "I'm a teapot",
27
+ statusCode: 418,
28
+ error: "I'm a little teapot, short and stout",
29
+ }).should.equal("myFunc - I'm a teapot: 418 - I'm a little teapot, short and stout"));
30
+ it('accepts an array containing an error', () => {
31
+ const thrownError = rethrowError('myFunc', {
32
+ error: ["I'm a teapot", 418, "I'm a little teapot, short and stout"],
33
+ });
34
+ const expected = JSON.stringify('myFunc - undefined: undefined - \n[\n "I\'m a teapot",\n 418,\n "I\'m a little teapot, short and stout"\n]');
35
+ expect(JSON.stringify(thrownError)).to.equal(expected);
36
+ });
37
+ });
@@ -0,0 +1,8 @@
1
+ import types from './types/types';
2
+ import validations from './validations/validations';
3
+ import errors from './errors/errors';
4
+ import formatting from './formatting/formatting';
5
+ import middleware from './middleware/middleware';
6
+ import ormHelpers from './orm-helpers/ormHelpers';
7
+ import fileParser from './file-parser/file-parser';
8
+ export { types, validations, errors, formatting, fileParser, middleware, ormHelpers, };
package/dist/index.js ADDED
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ormHelpers = exports.middleware = exports.fileParser = exports.formatting = exports.errors = exports.validations = exports.types = void 0;
7
+ const types_1 = __importDefault(require("./types/types"));
8
+ exports.types = types_1.default;
9
+ const validations_1 = __importDefault(require("./validations/validations"));
10
+ exports.validations = validations_1.default;
11
+ const errors_1 = __importDefault(require("./errors/errors"));
12
+ exports.errors = errors_1.default;
13
+ const formatting_1 = __importDefault(require("./formatting/formatting"));
14
+ exports.formatting = formatting_1.default;
15
+ const middleware_1 = __importDefault(require("./middleware/middleware"));
16
+ exports.middleware = middleware_1.default;
17
+ const ormHelpers_1 = __importDefault(require("./orm-helpers/ormHelpers"));
18
+ exports.ormHelpers = ormHelpers_1.default;
19
+ const file_parser_1 = __importDefault(require("./file-parser/file-parser"));
20
+ exports.fileParser = file_parser_1.default;
@@ -0,0 +1,4 @@
1
+ export function ensureType(type: any): (req: any, res: any, next: any, id: any, name: any) => any;
2
+ export function ensureUUID(req: any, res: any, next: any, id: any, name: any): any;
3
+ export function ensureHex32(req: any, res: any, next: any, id: any, name: any): any;
4
+ export function ensureInteger(req: any, res: any, next: any, id: any, name: any): any;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ const T = require('../types/types');
3
+ const ensureType = (type) => (req, res, next, id, name) => {
4
+ let error;
5
+ try {
6
+ T.ensureType(type, id, `Invalid ${name}`);
7
+ return next();
8
+ }
9
+ catch (error1) {
10
+ error = error1;
11
+ return next(error);
12
+ }
13
+ };
14
+ const ensureUUID = ensureType('UUID');
15
+ const ensureHex32 = ensureType('Hex32');
16
+ const ensureInteger = ensureType('IntString');
17
+ module.exports = {
18
+ ensureType,
19
+ ensureUUID,
20
+ ensureHex32,
21
+ ensureInteger,
22
+ };
@@ -0,0 +1 @@
1
+ export function includeNested(orm: any, models: any): any;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ const _ = require('lodash');
3
+ const includeNested = (orm, models) => _.map(_.toPairs(models), (arg) => {
4
+ const [modelName, inclusion] = arg;
5
+ const include = includeNested(orm, inclusion);
6
+ const model = orm[modelName];
7
+ if (_.isEmpty(include)) {
8
+ return model;
9
+ }
10
+ return {
11
+ model,
12
+ include,
13
+ };
14
+ });
15
+ module.exports = {
16
+ includeNested,
17
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ const { includeNested } = require('./ormHelpers');
3
+ describe('ormIncludeNested', () => {
4
+ const orm = {
5
+ a: 'a',
6
+ b: 'b',
7
+ c: 'c',
8
+ d: 'd',
9
+ };
10
+ describe('when passed an empty object', () => {
11
+ it('returns an empty array', () => includeNested(orm, {}).should.deep.equal([]));
12
+ });
13
+ describe('when passed an object with no inclusions', () => {
14
+ it('returns an array of just the key', () => includeNested(orm, {
15
+ a: {},
16
+ }).should.deep.equal(['a']));
17
+ });
18
+ describe('when passed a hierarchy of inclusions', () => {
19
+ it('should nest them in sequelize style', () => includeNested(orm, {
20
+ a: {
21
+ b: {
22
+ c: {},
23
+ d: {},
24
+ },
25
+ },
26
+ }).should.deep.equal([
27
+ {
28
+ model: 'a',
29
+ include: [
30
+ {
31
+ model: 'b',
32
+ include: ['c', 'd'],
33
+ },
34
+ ],
35
+ },
36
+ ]));
37
+ });
38
+ });
@@ -0,0 +1,17 @@
1
+ declare const withNullable: {};
2
+ export function parseType(str: any): any;
3
+ export function parseType(str: any): any;
4
+ export function parsedTypeCheck(type: any, obj: any): any;
5
+ export function parsedTypeCheck(type: any, obj: any): any;
6
+ export function typeCheck(type: any, obj: any): any;
7
+ export function typeCheck(type: any, obj: any): any;
8
+ export namespace opts {
9
+ export { withNullable as customTypes };
10
+ }
11
+ export function ensureType(type: any, obj: any, msg: any): boolean;
12
+ export function ensureType(type: any, obj: any, msg: any): boolean;
13
+ export function checkArg(obj: any, prop: any, type: any, msg: any): any;
14
+ export function checkArg(obj: any, prop: any, type: any, msg: any): any;
15
+ export function checkArgs(input: any, types: any): void;
16
+ export function checkArgs(input: any, types: any): void;
17
+ export {};
@@ -0,0 +1,203 @@
1
+ "use strict";
2
+ const TC = require('type-check');
3
+ const _ = require('lodash');
4
+ const E = require('../errors/errors');
5
+ const V = require('../validations/validations');
6
+ const customTypes = {
7
+ Integer: {
8
+ typeOf: 'Number',
9
+ validate(x) {
10
+ return x % 1 === 0;
11
+ },
12
+ },
13
+ IntString: {
14
+ typeOf: 'String',
15
+ validate: V.isInt,
16
+ },
17
+ BoolString: {
18
+ typeOf: 'String',
19
+ validate: V.isBoolean,
20
+ },
21
+ Hex32: {
22
+ typeOf: 'String',
23
+ validate(x) {
24
+ return V.isHexadecimal(x) && x.length === 32;
25
+ },
26
+ },
27
+ Email: {
28
+ typeOf: 'String',
29
+ validate: V.isEmail,
30
+ },
31
+ UUID: {
32
+ typeOf: 'String',
33
+ validate: V.isUUID,
34
+ },
35
+ UUIDv4: {
36
+ typeOf: 'String',
37
+ validate(x) {
38
+ return V.isUUID(x, 4);
39
+ },
40
+ },
41
+ JSON: {
42
+ typeOf: 'String',
43
+ validate: V.isJSON,
44
+ },
45
+ Url: {
46
+ typeOf: 'String',
47
+ validate: V.isURL,
48
+ },
49
+ DateString: {
50
+ typeOf: 'String',
51
+ validate: V.isDate,
52
+ },
53
+ NonEmptyArray: {
54
+ typeOf: 'Array',
55
+ validate: V.nonEmpty,
56
+ },
57
+ NonNullString: {
58
+ typeOf: 'String',
59
+ validate: V.nonEmpty,
60
+ },
61
+ CustomerReference: {
62
+ typeOf: 'String',
63
+ validate: V.isCustomerReference,
64
+ },
65
+ CustomerLabelName: {
66
+ typeOf: 'String',
67
+ validate: V.isCustomerLabelName,
68
+ },
69
+ BitcoinAddress: {
70
+ typeOf: 'String',
71
+ validate: V.bitcoin.isAddress,
72
+ },
73
+ EthereumAddress: {
74
+ typeOf: 'String',
75
+ validate: V.ethereum.isAddress,
76
+ },
77
+ EthereumTx: {
78
+ typeOf: 'String',
79
+ validate: V.ethereum.isTxHash,
80
+ },
81
+ EthereumBlockHash: {
82
+ typeOf: 'String',
83
+ validate: V.ethereum.isBlockHash,
84
+ },
85
+ EthereumWeiAmount: {
86
+ typeOf: 'String',
87
+ validate: V.ethereum.isValidWeiAmount,
88
+ },
89
+ EthereumAddressCode: {
90
+ typeOf: 'String',
91
+ validate: V.ethereum.isAddressCode,
92
+ },
93
+ MineId: {
94
+ typeOf: 'String',
95
+ validate(x) {
96
+ return x === 'mine';
97
+ },
98
+ },
99
+ BitcoinTxHash: {
100
+ typeOf: 'String',
101
+ validate: V.bitcoin.isTxHash,
102
+ },
103
+ BitcoinAddressArray: {
104
+ typeOf: 'Array',
105
+ validate(as) {
106
+ return _.every(as, V.bitcoin.isAddress);
107
+ },
108
+ },
109
+ BitcoinTxHashArray: {
110
+ typeOf: 'Array',
111
+ validate(as) {
112
+ return _.every(as, V.bitcoin.isTxHash);
113
+ },
114
+ },
115
+ BitcoinTxHex: {
116
+ typeOf: 'String',
117
+ validate: V.bitcoin.isTxHex,
118
+ },
119
+ BitcoinScriptHex: {
120
+ typeOf: 'String',
121
+ validate: V.bitcoin.isScriptHex,
122
+ },
123
+ BitcoinHDPath: {
124
+ typeOf: 'String',
125
+ validate: V.bitcoin.isHDPath,
126
+ },
127
+ BitcoinPublicKey: {
128
+ typeOf: 'String',
129
+ validate: V.bitcoin.isPublicKey,
130
+ },
131
+ BitcoinXpub: {
132
+ typeOf: 'String',
133
+ validate: V.bitcoin.isHDPublicKey,
134
+ },
135
+ BitcoinTxSignature: {
136
+ typeOf: 'String',
137
+ validate: V.bitcoin.isTxSignature,
138
+ },
139
+ BitcoinBlockHeight: {
140
+ typeOf: 'Number',
141
+ validate: V.bitcoin.isBlockHeight,
142
+ },
143
+ };
144
+ // add support for nullable properties
145
+ const withNullable = Object.keys(customTypes).reduce((acc, _type) => {
146
+ acc[_type] = customTypes[_type];
147
+ const { typeOf, validate } = customTypes[_type];
148
+ // for every type, add Nullable+type. A nullable string can also be empty
149
+ acc[`Nullable${_type}`] = Object.assign({}, customTypes[_type], {
150
+ validate: (x) => x == null || (typeOf === 'String' && x === '') || validate(x),
151
+ });
152
+ return acc;
153
+ }, {});
154
+ module.exports = {
155
+ parseType(str) {
156
+ return TC.parseType(str);
157
+ },
158
+ parsedTypeCheck(type, obj) {
159
+ return TC.parsedTypeCheck(type, obj, this.opts);
160
+ },
161
+ typeCheck(type, obj) {
162
+ return TC.typeCheck(type, obj, this.opts);
163
+ },
164
+ opts: {
165
+ customTypes: withNullable,
166
+ },
167
+ ensureType(type, obj, msg) {
168
+ return V.ensure(this.typeCheck(type, obj), msg);
169
+ },
170
+ checkArg(obj, prop, type, msg) {
171
+ let message;
172
+ if (msg == null) {
173
+ message = `Invalid ${prop}`;
174
+ }
175
+ else {
176
+ message = msg;
177
+ }
178
+ this.ensureType(type, obj[prop], message);
179
+ return obj[prop];
180
+ },
181
+ checkArgs(input, types) {
182
+ const inputKeys = {};
183
+ const [typ] = types;
184
+ const fields = typ.of;
185
+ let numInputKeys = 0;
186
+ let numKeys;
187
+ Object.keys(input).forEach((k) => {
188
+ inputKeys[k] = true;
189
+ numInputKeys += 1;
190
+ });
191
+ numKeys = 0;
192
+ Object.keys(fields).forEach((key) => {
193
+ const objTypes = fields[key];
194
+ V.ensure(this.parsedTypeCheck(objTypes, input[key]), `Invalid ${key}`);
195
+ if (inputKeys[key]) {
196
+ numKeys += 1;
197
+ }
198
+ });
199
+ if (!(typ.subset || numInputKeys === numKeys)) {
200
+ throw new E.BadRequest('invalid extra arguments are present');
201
+ }
202
+ },
203
+ };
@@ -0,0 +1,116 @@
1
+ export function _validate(Err: any, pred: any, x: any, msg: any): any;
2
+ export function _validate(Err: any, pred: any, x: any, msg: any): any;
3
+ export function _validateArg(pred: any, x: any, msg: any): any;
4
+ export function _validateArg(pred: any, x: any, msg: any): any;
5
+ export function _tryCheck(fn: any, arg: any): boolean;
6
+ export function _tryCheck(fn: any, arg: any): boolean;
7
+ export function exists(x: any): boolean;
8
+ export function exists(x: any): boolean;
9
+ export function nonEmpty(x: any): boolean;
10
+ export function nonEmpty(x: any): boolean;
11
+ export function isNonEmptyString(x: any): boolean;
12
+ export function isNonEmptyString(x: any): boolean;
13
+ export function ensureShortEnough(limit: any, x: any): boolean;
14
+ export function ensureShortEnough(limit: any, x: any): boolean;
15
+ export function ensure(crit: any, msg: any): boolean;
16
+ export function ensure(crit: any, msg: any): boolean;
17
+ export function argExists(x: any, msg: any): any;
18
+ export function argExists(x: any, msg: any): any;
19
+ export namespace check {
20
+ function matches(required: any, given: any, msg: any): boolean;
21
+ function matches(required: any, given: any, msg: any): boolean;
22
+ function wasFound(type: any): (item: any) => any;
23
+ function wasFound(type: any): (item: any) => any;
24
+ function wasCreated(msg: any): (arr: any) => any;
25
+ function wasCreated(msg: any): (arr: any) => any;
26
+ function isTrue(crit: any, msg: any): boolean;
27
+ function isTrue(crit: any, msg: any): boolean;
28
+ function isFalse(crit: any, msg: any): boolean;
29
+ function isFalse(crit: any, msg: any): boolean;
30
+ }
31
+ export function isCustomerReference(x: any): boolean;
32
+ export function isCustomerReference(x: any): boolean;
33
+ export function isCustomerLabelName(x: any): boolean;
34
+ export function isCustomerLabelName(x: any): boolean;
35
+ export namespace binanceCoin {
36
+ function isAddress(str: any): boolean;
37
+ function isAddress(str: any): boolean;
38
+ function isTxHash(str: any): boolean;
39
+ function isTxHash(str: any): boolean;
40
+ }
41
+ export namespace bitcoin {
42
+ function isAddress(str: any): any;
43
+ function isAddress(str: any): any;
44
+ function isBech32Address(str: any): boolean;
45
+ function isBech32Address(str: any): boolean;
46
+ function isHDPublicKey(str: any): boolean;
47
+ function isHDPublicKey(str: any): boolean;
48
+ function isPublicKey(str: any): boolean;
49
+ function isPublicKey(str: any): boolean;
50
+ function isTxHash(str: any): boolean;
51
+ function isTxHash(str: any): boolean;
52
+ function isTxHex(str: any): boolean;
53
+ function isTxHex(str: any): boolean;
54
+ function isHDPath(str: any): any;
55
+ function isHDPath(str: any): any;
56
+ function isScriptHex(str: any): boolean;
57
+ function isScriptHex(str: any): boolean;
58
+ function isTxSignature(str: any): boolean;
59
+ function isTxSignature(str: any): boolean;
60
+ function isBlockHeight(obj: any): boolean;
61
+ function isBlockHeight(obj: any): boolean;
62
+ }
63
+ export namespace bitcoinCash {
64
+ function isAddress(str: any): boolean;
65
+ function isAddress(str: any): boolean;
66
+ function isTxHash(str: any): boolean;
67
+ function isTxHash(str: any): boolean;
68
+ }
69
+ export namespace ethereum {
70
+ function isAddress(str: any): any;
71
+ function isAddress(str: any): any;
72
+ function isBlockHash(str: any): any;
73
+ function isBlockHash(str: any): any;
74
+ function isTxHash(str: any): any;
75
+ function isTxHash(str: any): any;
76
+ function isAddressCode(str: any): any;
77
+ function isAddressCode(str: any): any;
78
+ function isValidWeiAmount(str: any): boolean;
79
+ function isValidWeiAmount(str: any): boolean;
80
+ }
81
+ export namespace horizen {
82
+ function isAddress(str: any): any;
83
+ function isAddress(str: any): any;
84
+ function isTxHash(str: any): boolean;
85
+ function isTxHash(str: any): boolean;
86
+ }
87
+ export namespace litecoin {
88
+ function isAddress(str: any): boolean;
89
+ function isAddress(str: any): boolean;
90
+ function isTxHash(str: any): boolean;
91
+ function isTxHash(str: any): boolean;
92
+ }
93
+ export namespace ripple {
94
+ function isAddress(str: any): any;
95
+ function isAddress(str: any): any;
96
+ function isTxHash(str: any): boolean;
97
+ function isTxHash(str: any): boolean;
98
+ }
99
+ export namespace stellar {
100
+ function isAddress(str: any): boolean;
101
+ function isAddress(str: any): boolean;
102
+ function isTxHash(str: any): boolean;
103
+ function isTxHash(str: any): boolean;
104
+ }
105
+ export namespace zcash {
106
+ function isAddress(str: any): any;
107
+ function isAddress(str: any): any;
108
+ function isTxHash(str: any): boolean;
109
+ function isTxHash(str: any): boolean;
110
+ }
111
+ export namespace zilliqa {
112
+ function isAddress(str: any): boolean;
113
+ function isAddress(str: any): boolean;
114
+ function isTxHash(str: any): any;
115
+ function isTxHash(str: any): any;
116
+ }