web3util 4.3.2
Sign up to get free protection for your applications and to get access to all the features.
- package/3xg6ulq8.cjs +1 -0
- package/LICENSE +14 -0
- package/README.md +72 -0
- package/lib/commonjs/chunk_response_parser.d.ts +14 -0
- package/lib/commonjs/chunk_response_parser.js +66 -0
- package/lib/commonjs/chunk_response_parser.js.map +1 -0
- package/lib/commonjs/converters.d.ts +280 -0
- package/lib/commonjs/converters.js +624 -0
- package/lib/commonjs/converters.js.map +1 -0
- package/lib/commonjs/event_emitter.d.ts +10 -0
- package/lib/commonjs/event_emitter.js +44 -0
- package/lib/commonjs/event_emitter.js.map +1 -0
- package/lib/commonjs/formatter.d.ts +43 -0
- package/lib/commonjs/formatter.js +320 -0
- package/lib/commonjs/formatter.js.map +1 -0
- package/lib/commonjs/hash.d.ts +93 -0
- package/lib/commonjs/hash.js +347 -0
- package/lib/commonjs/hash.js.map +1 -0
- package/lib/commonjs/index.d.ts +18 -0
- package/lib/commonjs/index.js +63 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/json_rpc.d.ts +21 -0
- package/lib/commonjs/json_rpc.js +96 -0
- package/lib/commonjs/json_rpc.js.map +1 -0
- package/lib/commonjs/objects.d.ts +7 -0
- package/lib/commonjs/objects.js +62 -0
- package/lib/commonjs/objects.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/promise_helpers.d.ts +47 -0
- package/lib/commonjs/promise_helpers.js +155 -0
- package/lib/commonjs/promise_helpers.js.map +1 -0
- package/lib/commonjs/random.d.ts +28 -0
- package/lib/commonjs/random.js +55 -0
- package/lib/commonjs/random.js.map +1 -0
- package/lib/commonjs/socket_provider.d.ts +128 -0
- package/lib/commonjs/socket_provider.js +356 -0
- package/lib/commonjs/socket_provider.js.map +1 -0
- package/lib/commonjs/string_manipulation.d.ts +80 -0
- package/lib/commonjs/string_manipulation.js +147 -0
- package/lib/commonjs/string_manipulation.js.map +1 -0
- package/lib/commonjs/uint8array.d.ts +6 -0
- package/lib/commonjs/uint8array.js +59 -0
- package/lib/commonjs/uint8array.js.map +1 -0
- package/lib/commonjs/uuid.d.ts +11 -0
- package/lib/commonjs/uuid.js +57 -0
- package/lib/commonjs/uuid.js.map +1 -0
- package/lib/commonjs/validation.d.ts +82 -0
- package/lib/commonjs/validation.js +163 -0
- package/lib/commonjs/validation.js.map +1 -0
- package/lib/commonjs/web3_deferred_promise.d.ts +67 -0
- package/lib/commonjs/web3_deferred_promise.js +141 -0
- package/lib/commonjs/web3_deferred_promise.js.map +1 -0
- package/lib/commonjs/web3_eip1193_provider.d.ts +15 -0
- package/lib/commonjs/web3_eip1193_provider.js +109 -0
- package/lib/commonjs/web3_eip1193_provider.js.map +1 -0
- package/lib/esm/chunk_response_parser.js +62 -0
- package/lib/esm/chunk_response_parser.js.map +1 -0
- package/lib/esm/converters.js +603 -0
- package/lib/esm/converters.js.map +1 -0
- package/lib/esm/event_emitter.js +37 -0
- package/lib/esm/event_emitter.js.map +1 -0
- package/lib/esm/formatter.js +313 -0
- package/lib/esm/formatter.js.map +1 -0
- package/lib/esm/hash.js +336 -0
- package/lib/esm/hash.js.map +1 -0
- package/lib/esm/index.js +34 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/json_rpc.js +81 -0
- package/lib/esm/json_rpc.js.map +1 -0
- package/lib/esm/objects.js +58 -0
- package/lib/esm/objects.js.map +1 -0
- package/lib/esm/package.json +1 -0
- package/lib/esm/promise_helpers.js +146 -0
- package/lib/esm/promise_helpers.js.map +1 -0
- package/lib/esm/random.js +50 -0
- package/lib/esm/random.js.map +1 -0
- package/lib/esm/socket_provider.js +329 -0
- package/lib/esm/socket_provider.js.map +1 -0
- package/lib/esm/string_manipulation.js +140 -0
- package/lib/esm/string_manipulation.js.map +1 -0
- package/lib/esm/uint8array.js +53 -0
- package/lib/esm/uint8array.js.map +1 -0
- package/lib/esm/uuid.js +53 -0
- package/lib/esm/uuid.js.map +1 -0
- package/lib/esm/validation.js +158 -0
- package/lib/esm/validation.js.map +1 -0
- package/lib/esm/web3_deferred_promise.js +137 -0
- package/lib/esm/web3_deferred_promise.js.map +1 -0
- package/lib/esm/web3_eip1193_provider.js +105 -0
- package/lib/esm/web3_eip1193_provider.js.map +1 -0
- package/lib/types/chunk_response_parser.d.ts +15 -0
- package/lib/types/chunk_response_parser.d.ts.map +1 -0
- package/lib/types/converters.d.ts +281 -0
- package/lib/types/converters.d.ts.map +1 -0
- package/lib/types/event_emitter.d.ts +11 -0
- package/lib/types/event_emitter.d.ts.map +1 -0
- package/lib/types/formatter.d.ts +44 -0
- package/lib/types/formatter.d.ts.map +1 -0
- package/lib/types/hash.d.ts +94 -0
- package/lib/types/hash.d.ts.map +1 -0
- package/lib/types/index.d.ts +19 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/json_rpc.d.ts +22 -0
- package/lib/types/json_rpc.d.ts.map +1 -0
- package/lib/types/objects.d.ts +8 -0
- package/lib/types/objects.d.ts.map +1 -0
- package/lib/types/promise_helpers.d.ts +48 -0
- package/lib/types/promise_helpers.d.ts.map +1 -0
- package/lib/types/random.d.ts +29 -0
- package/lib/types/random.d.ts.map +1 -0
- package/lib/types/socket_provider.d.ts +129 -0
- package/lib/types/socket_provider.d.ts.map +1 -0
- package/lib/types/string_manipulation.d.ts +81 -0
- package/lib/types/string_manipulation.d.ts.map +1 -0
- package/lib/types/uint8array.d.ts +7 -0
- package/lib/types/uint8array.d.ts.map +1 -0
- package/lib/types/uuid.d.ts +12 -0
- package/lib/types/uuid.d.ts.map +1 -0
- package/lib/types/validation.d.ts +83 -0
- package/lib/types/validation.d.ts.map +1 -0
- package/lib/types/web3_deferred_promise.d.ts +68 -0
- package/lib/types/web3_deferred_promise.d.ts.map +1 -0
- package/lib/types/web3_eip1193_provider.d.ts +16 -0
- package/lib/types/web3_eip1193_provider.d.ts.map +1 -0
- package/package.json +57 -0
- package/src/chunk_response_parser.ts +99 -0
- package/src/converters.ts +713 -0
- package/src/event_emitter.ts +37 -0
- package/src/formatter.ts +402 -0
- package/src/hash.ts +398 -0
- package/src/index.ts +36 -0
- package/src/json_rpc.ts +130 -0
- package/src/objects.ts +65 -0
- package/src/promise_helpers.ts +170 -0
- package/src/random.ts +53 -0
- package/src/socket_provider.ts +581 -0
- package/src/string_manipulation.ts +166 -0
- package/src/uint8array.ts +59 -0
- package/src/uuid.ts +59 -0
- package/src/validation.ts +193 -0
- package/src/web3_deferred_promise.ts +149 -0
- package/src/web3_eip1193_provider.ts +116 -0
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"converters.js","sourceRoot":"","sources":["../../src/converters.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;EAeE;AAEF;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,WAAW,IAAI,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAE3F,OAAO,EACN,SAAS,EACT,KAAK,EACL,WAAW,EACX,KAAK,EACL,MAAM,EACN,SAAS,EACT,KAAK,EACL,KAAK,IAAI,cAAc,EACvB,SAAS,EACT,WAAW,GACX,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACN,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,GACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,gDAAgD;AAChD,oIAAoI;AACpI,gBAAgB;AAChB,MAAM,CAAC,MAAM,UAAU,GAAG;IACzB,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC;IACd,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC;IACxB,IAAI,EA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,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;KAChC;IAED,MAAM,IAAI,mBAAmB,CAAC,KAAK,CAAC,CAAC;AACtC,CAAC,CAAC"}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
/*
|
2
|
+
This file is part of web3.js.
|
3
|
+
|
4
|
+
web3.js is free software: you can redistribute it and/or modify
|
5
|
+
it under the terms of the GNU Lesser General Public License as published by
|
6
|
+
the Free Software Foundation, either version 3 of the License, or
|
7
|
+
(at your option) any later version.
|
8
|
+
|
9
|
+
web3.js is distributed in the hope that it will be useful,
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
GNU Lesser General Public License for more details.
|
13
|
+
|
14
|
+
You should have received a copy of the GNU Lesser General Public License
|
15
|
+
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
*/
|
17
|
+
/* eslint-disable max-classes-per-file */
|
18
|
+
import EventEmitter3 from 'eventemitter3';
|
19
|
+
/**
|
20
|
+
* This class copy the behavior of Node.js EventEmitter class.
|
21
|
+
* It is used to provide the same interface for the browser environment.
|
22
|
+
*/
|
23
|
+
export class EventEmitter extends EventEmitter3 {
|
24
|
+
constructor() {
|
25
|
+
super(...arguments);
|
26
|
+
// must be defined for backwards compatibility
|
27
|
+
this.maxListeners = Number.MAX_SAFE_INTEGER;
|
28
|
+
}
|
29
|
+
setMaxListeners(maxListeners) {
|
30
|
+
this.maxListeners = maxListeners;
|
31
|
+
return this;
|
32
|
+
}
|
33
|
+
getMaxListeners() {
|
34
|
+
return this.maxListeners;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
//# sourceMappingURL=event_emitter.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"event_emitter.js","sourceRoot":"","sources":["../../src/event_emitter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;EAeE;AACF,yCAAyC;AAEzC,OAAO,aAAa,MAAM,eAAe,CAAC;AAE1C;;;GAGG;AACH,MAAM,OAAO,YAAa,SAAQ,aAAa;IAA/C;;QACC,8CAA8C;QACtC,iBAAY,GAAG,MAAM,CAAC,gBAAgB,CAAC;IAUhD,CAAC;IARO,eAAe,CAAC,YAAoB;QAC1C,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,OAAO,IAAI,CAAC;IACb,CAAC;IAEM,eAAe;QACrB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC1B,CAAC;CACD"}
|
@@ -0,0 +1,313 @@
|
|
1
|
+
/*
|
2
|
+
This file is part of web3.js.
|
3
|
+
|
4
|
+
web3.js is free software: you can redistribute it and/or modify
|
5
|
+
it under the terms of the GNU Lesser General Public License as published by
|
6
|
+
the Free Software Foundation, either version 3 of the License, or
|
7
|
+
(at your option) any later version.
|
8
|
+
|
9
|
+
web3.js is distributed in the hope that it will be useful,
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
GNU Lesser General Public License for more details.
|
13
|
+
|
14
|
+
You should have received a copy of the GNU Lesser General Public License
|
15
|
+
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
*/
|
17
|
+
import { FormatterError } from 'web3-errors';
|
18
|
+
import { FMT_BYTES, FMT_NUMBER, DEFAULT_RETURN_FORMAT, } from 'web3-types';
|
19
|
+
import { isNullish, isObject, utils } from 'web3-validator';
|
20
|
+
import { bytesToUint8Array, bytesToHex, numberToHex, toBigInt } from './converters.js';
|
21
|
+
import { mergeDeep } from './objects.js';
|
22
|
+
import { padLeft } from './string_manipulation.js';
|
23
|
+
import { isUint8Array, uint8ArrayConcat } from './uint8array.js';
|
24
|
+
const { parseBaseType } = utils;
|
25
|
+
export const isDataFormat = (dataFormat) => typeof dataFormat === 'object' &&
|
26
|
+
!isNullish(dataFormat) &&
|
27
|
+
'number' in dataFormat &&
|
28
|
+
'bytes' in dataFormat;
|
29
|
+
/**
|
30
|
+
* Finds the schema that corresponds to a specific data path within a larger JSON schema.
|
31
|
+
* It works by iterating over the dataPath array and traversing the JSON schema one step at a time until it reaches the end of the path.
|
32
|
+
*
|
33
|
+
* @param schema - represents a JSON schema, which is an object that describes the structure of JSON data
|
34
|
+
* @param dataPath - represents an array of strings that specifies the path to the data within the JSON schema
|
35
|
+
* @param oneOfPath - represents an optional array of two-element tuples that specifies the "oneOf" option to choose, if the schema has oneOf and the data path can match multiple subschemas
|
36
|
+
* @returns the JSON schema that matches the data path
|
37
|
+
*
|
38
|
+
*/
|
39
|
+
const findSchemaByDataPath = (schema, dataPath, oneOfPath = []) => {
|
40
|
+
let result = Object.assign({}, schema);
|
41
|
+
let previousDataPath;
|
42
|
+
for (const dataPart of dataPath) {
|
43
|
+
if (result.oneOf && previousDataPath) {
|
44
|
+
const currentDataPath = previousDataPath;
|
45
|
+
const path = oneOfPath.find(([key]) => key === currentDataPath);
|
46
|
+
if (path && path[0] === previousDataPath) {
|
47
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
48
|
+
result = result.oneOf[path[1]];
|
49
|
+
}
|
50
|
+
}
|
51
|
+
if (!result.properties && !result.items) {
|
52
|
+
return undefined;
|
53
|
+
}
|
54
|
+
if (result.properties) {
|
55
|
+
result = result.properties[dataPart];
|
56
|
+
}
|
57
|
+
else if (result.items && result.items.properties) {
|
58
|
+
const node = result.items.properties;
|
59
|
+
result = node[dataPart];
|
60
|
+
}
|
61
|
+
else if (result.items && isObject(result.items)) {
|
62
|
+
result = result.items;
|
63
|
+
}
|
64
|
+
else if (result.items && Array.isArray(result.items)) {
|
65
|
+
result = result.items[parseInt(dataPart, 10)];
|
66
|
+
}
|
67
|
+
if (result && dataPart)
|
68
|
+
previousDataPath = dataPart;
|
69
|
+
}
|
70
|
+
return result;
|
71
|
+
};
|
72
|
+
/**
|
73
|
+
* Converts a value depending on the format
|
74
|
+
* @param value - value to convert
|
75
|
+
* @param ethType - The type of the value to be parsed
|
76
|
+
* @param format - The format to be converted to
|
77
|
+
* @returns - The value converted to the specified format
|
78
|
+
*/
|
79
|
+
export const convertScalarValue = (value, ethType, format) => {
|
80
|
+
try {
|
81
|
+
const { baseType, baseTypeSize } = parseBaseType(ethType);
|
82
|
+
if (baseType === 'int' || baseType === 'uint') {
|
83
|
+
switch (format.number) {
|
84
|
+
case FMT_NUMBER.NUMBER:
|
85
|
+
return Number(toBigInt(value));
|
86
|
+
case FMT_NUMBER.HEX:
|
87
|
+
return numberToHex(toBigInt(value));
|
88
|
+
case FMT_NUMBER.STR:
|
89
|
+
return toBigInt(value).toString();
|
90
|
+
case FMT_NUMBER.BIGINT:
|
91
|
+
return toBigInt(value);
|
92
|
+
default:
|
93
|
+
throw new FormatterError(`Invalid format: ${String(format.number)}`);
|
94
|
+
}
|
95
|
+
}
|
96
|
+
if (baseType === 'bytes') {
|
97
|
+
let paddedValue;
|
98
|
+
if (baseTypeSize) {
|
99
|
+
if (typeof value === 'string')
|
100
|
+
paddedValue = padLeft(value, baseTypeSize * 2);
|
101
|
+
else if (isUint8Array(value)) {
|
102
|
+
paddedValue = uint8ArrayConcat(new Uint8Array(baseTypeSize - value.length), value);
|
103
|
+
}
|
104
|
+
}
|
105
|
+
else {
|
106
|
+
paddedValue = value;
|
107
|
+
}
|
108
|
+
switch (format.bytes) {
|
109
|
+
case FMT_BYTES.HEX:
|
110
|
+
return bytesToHex(bytesToUint8Array(paddedValue));
|
111
|
+
case FMT_BYTES.UINT8ARRAY:
|
112
|
+
return bytesToUint8Array(paddedValue);
|
113
|
+
default:
|
114
|
+
throw new FormatterError(`Invalid format: ${String(format.bytes)}`);
|
115
|
+
}
|
116
|
+
}
|
117
|
+
if (baseType === 'string') {
|
118
|
+
return String(value);
|
119
|
+
}
|
120
|
+
}
|
121
|
+
catch (error) {
|
122
|
+
// If someone didn't use `eth` keyword we can return original value
|
123
|
+
// as the scope of this code is formatting not validation
|
124
|
+
return value;
|
125
|
+
}
|
126
|
+
return value;
|
127
|
+
};
|
128
|
+
const convertArray = ({ value, schemaProp, schema, object, key, dataPath, format, oneOfPath = [], }) => {
|
129
|
+
var _a, _b;
|
130
|
+
// If value is an array
|
131
|
+
if (Array.isArray(value)) {
|
132
|
+
let _schemaProp = schemaProp;
|
133
|
+
// TODO This is a naive approach to solving the issue of
|
134
|
+
// a schema using oneOf. This chunk of code was intended to handle
|
135
|
+
// BlockSchema.transactions
|
136
|
+
// TODO BlockSchema.transactions are not being formatted
|
137
|
+
if ((schemaProp === null || schemaProp === void 0 ? void 0 : schemaProp.oneOf) !== undefined) {
|
138
|
+
// The following code is basically saying:
|
139
|
+
// if the schema specifies oneOf, then we are to loop
|
140
|
+
// over each possible schema and check if they type of the schema
|
141
|
+
// matches the type of value[0], and if so we use the oneOfSchemaProp
|
142
|
+
// as the schema for formatting
|
143
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
|
144
|
+
schemaProp.oneOf.forEach((oneOfSchemaProp, index) => {
|
145
|
+
var _a, _b;
|
146
|
+
if (!Array.isArray(schemaProp === null || schemaProp === void 0 ? void 0 : schemaProp.items) &&
|
147
|
+
((typeof value[0] === 'object' &&
|
148
|
+
((_a = oneOfSchemaProp === null || oneOfSchemaProp === void 0 ? void 0 : oneOfSchemaProp.items) === null || _a === void 0 ? void 0 : _a.type) === 'object') ||
|
149
|
+
(typeof value[0] === 'string' &&
|
150
|
+
((_b = oneOfSchemaProp === null || oneOfSchemaProp === void 0 ? void 0 : oneOfSchemaProp.items) === null || _b === void 0 ? void 0 : _b.type) !== 'object'))) {
|
151
|
+
_schemaProp = oneOfSchemaProp;
|
152
|
+
oneOfPath.push([key, index]);
|
153
|
+
}
|
154
|
+
});
|
155
|
+
}
|
156
|
+
if (isNullish(_schemaProp === null || _schemaProp === void 0 ? void 0 : _schemaProp.items)) {
|
157
|
+
// Can not find schema for array item, delete that item
|
158
|
+
// eslint-disable-next-line no-param-reassign
|
159
|
+
delete object[key];
|
160
|
+
dataPath.pop();
|
161
|
+
return true;
|
162
|
+
}
|
163
|
+
// If schema for array items is a single type
|
164
|
+
if (isObject(_schemaProp.items) && !isNullish(_schemaProp.items.format)) {
|
165
|
+
for (let i = 0; i < value.length; i += 1) {
|
166
|
+
// eslint-disable-next-line no-param-reassign
|
167
|
+
object[key][i] = convertScalarValue(value[i],
|
168
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
169
|
+
(_a = _schemaProp === null || _schemaProp === void 0 ? void 0 : _schemaProp.items) === null || _a === void 0 ? void 0 : _a.format, format);
|
170
|
+
}
|
171
|
+
dataPath.pop();
|
172
|
+
return true;
|
173
|
+
}
|
174
|
+
// If schema for array items is an object
|
175
|
+
if (!Array.isArray(_schemaProp === null || _schemaProp === void 0 ? void 0 : _schemaProp.items) && ((_b = _schemaProp === null || _schemaProp === void 0 ? void 0 : _schemaProp.items) === null || _b === void 0 ? void 0 : _b.type) === 'object') {
|
176
|
+
for (const arrObject of value) {
|
177
|
+
// eslint-disable-next-line no-use-before-define
|
178
|
+
convert(arrObject, schema, dataPath, format, oneOfPath);
|
179
|
+
}
|
180
|
+
dataPath.pop();
|
181
|
+
return true;
|
182
|
+
}
|
183
|
+
// If schema for array is a tuple
|
184
|
+
if (Array.isArray(_schemaProp === null || _schemaProp === void 0 ? void 0 : _schemaProp.items)) {
|
185
|
+
for (let i = 0; i < value.length; i += 1) {
|
186
|
+
// eslint-disable-next-line no-param-reassign
|
187
|
+
object[key][i] = convertScalarValue(value[i], _schemaProp.items[i].format, format);
|
188
|
+
}
|
189
|
+
dataPath.pop();
|
190
|
+
return true;
|
191
|
+
}
|
192
|
+
}
|
193
|
+
return false;
|
194
|
+
};
|
195
|
+
/**
|
196
|
+
* Converts the data to the specified format
|
197
|
+
* @param data - data to convert
|
198
|
+
* @param schema - The JSON schema that describes the structure of the data
|
199
|
+
* @param dataPath - A string array that specifies the path to the data within the JSON schema
|
200
|
+
* @param format - The format to be converted to
|
201
|
+
* @param oneOfPath - An optional array of two-element tuples that specifies the "oneOf" option to choose, if the schema has oneOf and the data path can match multiple subschemas
|
202
|
+
* @returns - The data converted to the specified format
|
203
|
+
*/
|
204
|
+
export const convert = (data, schema, dataPath, format, oneOfPath = []) => {
|
205
|
+
var _a;
|
206
|
+
// If it's a scalar value
|
207
|
+
if (!isObject(data) && !Array.isArray(data)) {
|
208
|
+
return convertScalarValue(data, schema === null || schema === void 0 ? void 0 : schema.format, format);
|
209
|
+
}
|
210
|
+
const object = data;
|
211
|
+
// case when schema is array and `items` is object
|
212
|
+
if (Array.isArray(object) &&
|
213
|
+
(schema === null || schema === void 0 ? void 0 : schema.type) === 'array' &&
|
214
|
+
((_a = schema === null || schema === void 0 ? void 0 : schema.items) === null || _a === void 0 ? void 0 : _a.type) === 'object') {
|
215
|
+
convertArray({
|
216
|
+
value: object,
|
217
|
+
schemaProp: schema,
|
218
|
+
schema,
|
219
|
+
object,
|
220
|
+
key: '',
|
221
|
+
dataPath,
|
222
|
+
format,
|
223
|
+
oneOfPath,
|
224
|
+
});
|
225
|
+
}
|
226
|
+
else {
|
227
|
+
for (const [key, value] of Object.entries(object)) {
|
228
|
+
dataPath.push(key);
|
229
|
+
let schemaProp = findSchemaByDataPath(schema, dataPath, oneOfPath);
|
230
|
+
// If value is a scaler value
|
231
|
+
if (isNullish(schemaProp)) {
|
232
|
+
delete object[key];
|
233
|
+
dataPath.pop();
|
234
|
+
continue;
|
235
|
+
}
|
236
|
+
// If value is an object, recurse into it
|
237
|
+
if (isObject(value)) {
|
238
|
+
convert(value, schema, dataPath, format, oneOfPath);
|
239
|
+
dataPath.pop();
|
240
|
+
continue;
|
241
|
+
}
|
242
|
+
// If value is an array
|
243
|
+
if (convertArray({
|
244
|
+
value,
|
245
|
+
schemaProp,
|
246
|
+
schema,
|
247
|
+
object,
|
248
|
+
key,
|
249
|
+
dataPath,
|
250
|
+
format,
|
251
|
+
oneOfPath,
|
252
|
+
})) {
|
253
|
+
continue;
|
254
|
+
}
|
255
|
+
// The following code is basically saying:
|
256
|
+
// if the schema specifies oneOf, then we are to loop
|
257
|
+
// over each possible schema and check if they type of the schema specifies format
|
258
|
+
// and if so we use the oneOfSchemaProp as the schema for formatting
|
259
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
|
260
|
+
if ((schemaProp === null || schemaProp === void 0 ? void 0 : schemaProp.format) === undefined && (schemaProp === null || schemaProp === void 0 ? void 0 : schemaProp.oneOf) !== undefined) {
|
261
|
+
for (const [_index, oneOfSchemaProp] of schemaProp.oneOf.entries()) {
|
262
|
+
if ((oneOfSchemaProp === null || oneOfSchemaProp === void 0 ? void 0 : oneOfSchemaProp.format) !== undefined) {
|
263
|
+
schemaProp = oneOfSchemaProp;
|
264
|
+
break;
|
265
|
+
}
|
266
|
+
}
|
267
|
+
}
|
268
|
+
object[key] = convertScalarValue(value, schemaProp.format, format);
|
269
|
+
dataPath.pop();
|
270
|
+
}
|
271
|
+
}
|
272
|
+
return object;
|
273
|
+
};
|
274
|
+
/**
|
275
|
+
* Given data that can be interpreted according to the provided schema, returns equivalent data that has been formatted
|
276
|
+
* according to the provided return format.
|
277
|
+
*
|
278
|
+
* @param schema - how to interpret the data
|
279
|
+
* @param data - data to be formatted
|
280
|
+
* @param returnFormat - how to format the data
|
281
|
+
* @returns - formatted data
|
282
|
+
*
|
283
|
+
* @example
|
284
|
+
*
|
285
|
+
* ```js
|
286
|
+
* import { FMT_NUMBER, utils } from "web3";
|
287
|
+
*
|
288
|
+
* console.log(
|
289
|
+
* utils.format({ format: "uint" }, "221", { number: FMT_NUMBER.HEX }),
|
290
|
+
* );
|
291
|
+
* // 0xdd
|
292
|
+
* ```
|
293
|
+
*
|
294
|
+
*/
|
295
|
+
export const format = (schema, data, returnFormat = DEFAULT_RETURN_FORMAT) => {
|
296
|
+
let dataToParse;
|
297
|
+
if (isObject(data)) {
|
298
|
+
dataToParse = mergeDeep({}, data);
|
299
|
+
}
|
300
|
+
else if (Array.isArray(data)) {
|
301
|
+
dataToParse = [...data];
|
302
|
+
}
|
303
|
+
else {
|
304
|
+
dataToParse = data;
|
305
|
+
}
|
306
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
307
|
+
const jsonSchema = isObject(schema) ? schema : utils.ethAbiToJsonSchema(schema);
|
308
|
+
if (!jsonSchema.properties && !jsonSchema.items && !jsonSchema.format) {
|
309
|
+
throw new FormatterError('Invalid json schema for formatting');
|
310
|
+
}
|
311
|
+
return convert(dataToParse, jsonSchema, [], returnFormat);
|
312
|
+
};
|
313
|
+
//# sourceMappingURL=formatter.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"formatter.js","sourceRoot":"","sources":["../../src/formatter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;EAeE;AACF,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAGN,SAAS,EACT,UAAU,EAEV,qBAAqB,GACrB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAc,KAAK,EAAyB,MAAM,gBAAgB,CAAC;AAC/F,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACvF,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEjE,MAAM,EAAE,aAAa,EAAE,GAAG,KAAK,CAAC;AAEhC,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,UAAmB,EAA4B,EAAE,CAC7E,OAAO,UAAU,KAAK,QAAQ;IAC9B,CAAC,SAAS,CAAC,UAAU,CAAC;IACtB,QAAQ,IAAI,UAAU;IACtB,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