viem 0.0.1-alpha.9 → 0.0.1-cjs.10
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/actions/package.json +1 -1
- package/chains/package.json +1 -1
- package/clients/package.json +1 -1
- package/dist/actions/index.d.ts +3 -2
- package/dist/actions/index.js +125 -124
- package/dist/actions/index.mjs +125 -0
- package/dist/chains.d.ts +2 -2
- package/dist/chains.js +75 -76
- package/dist/chains.mjs +133 -0
- package/dist/{chunk-26WUARDL.js → chunk-2FDH6XP5.mjs} +1314 -72
- package/dist/chunk-46ZFLVHC.js +1084 -0
- package/dist/chunk-5ZBNF5WM.js +2616 -0
- package/dist/{chunk-375SRM5R.js → chunk-CWCWWGBC.mjs} +1 -1
- package/dist/{chunk-6BXRN6CQ.js → chunk-HLVCJ7RV.mjs} +48 -11
- package/dist/chunk-SGTIBKHG.js +258 -0
- package/dist/clients/index.js +23 -23
- package/dist/clients/index.mjs +23 -0
- package/dist/index.d.ts +5 -7
- package/dist/index.js +374 -374
- package/dist/index.mjs +374 -0
- package/dist/{parseGwei-64031f5e.d.ts → parseGwei-7c87ff41.d.ts} +40 -118
- package/dist/transactionRequest-08d30731.d.ts +132 -0
- package/dist/utils/index.d.ts +38 -5
- package/dist/utils/index.js +148 -138
- package/dist/utils/index.mjs +148 -0
- package/dist/{watchAsset-dc7dcdd9.d.ts → watchAsset-bc6373f4.d.ts} +15 -3
- package/dist/window.js +1 -0
- package/dist/window.mjs +0 -0
- package/package.json +9 -3
- package/utils/package.json +1 -1
- package/window/package.json +1 -1
- package/dist/chunk-7H5SPKXN.js +0 -1113
- package/dist/transactionRequest-3e463099.d.ts +0 -44
@@ -1,30 +1,842 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
3
|
+
var __publicField = (obj, key, value) => {
|
4
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
5
|
+
return value;
|
6
|
+
};
|
7
|
+
|
8
|
+
// package.json
|
9
|
+
var package_default = {
|
10
|
+
name: "viem",
|
11
|
+
description: "TypeScript (& JavaScript) Interface for Ethereum",
|
12
|
+
version: "0.0.1-alpha.9",
|
13
|
+
scripts: {
|
14
|
+
anvil: "source .env && anvil --fork-url $VITE_ANVIL_FORK_URL --fork-block-number $VITE_ANVIL_BLOCK_NUMBER --block-time $VITE_ANVIL_BLOCK_TIME",
|
15
|
+
bench: "vitest bench --no-threads",
|
16
|
+
"bench:ci": "CI=true vitest bench --no-threads",
|
17
|
+
build: "tsup",
|
18
|
+
changeset: "changeset",
|
19
|
+
"changeset:release": "pnpm build && changeset publish",
|
20
|
+
"changeset:version": "changeset version && pnpm install --lockfile-only",
|
21
|
+
dev: "DEV=true tsup",
|
22
|
+
"dev:docs": "pnpm -r --filter site dev",
|
23
|
+
format: "rome format src/ test/ --write",
|
24
|
+
lint: "rome check .",
|
25
|
+
"lint:fix": "pnpm lint --apply-suggested",
|
26
|
+
playground: "pnpm --filter playground-dev dev",
|
27
|
+
"playground:benchmark": "pnpm --filter playground-benchmark dev",
|
28
|
+
postinstall: "pnpm dev",
|
29
|
+
preinstall: "npx only-allow pnpm",
|
30
|
+
prepare: "npx simple-git-hooks",
|
31
|
+
test: "vitest dev --coverage --no-threads",
|
32
|
+
"test:ci": "CI=true vitest --coverage --no-threads",
|
33
|
+
"test:ui": "vitest dev --ui --no-threads",
|
34
|
+
typecheck: "tsc --noEmit"
|
35
|
+
},
|
36
|
+
files: [
|
37
|
+
"/actions",
|
38
|
+
"/chains",
|
39
|
+
"/dist",
|
40
|
+
"/clients",
|
41
|
+
"/types",
|
42
|
+
"/utils",
|
43
|
+
"/window"
|
44
|
+
],
|
45
|
+
exports: {
|
46
|
+
".": {
|
47
|
+
types: "./dist/index.d.ts",
|
48
|
+
module: "./dist/index.mjs",
|
49
|
+
default: "./dist/index.js"
|
50
|
+
},
|
51
|
+
"./actions": {
|
52
|
+
types: "./dist/actions/index.d.ts",
|
53
|
+
module: "./dist/actions/index.mjs",
|
54
|
+
default: "./dist/actions/index.js"
|
55
|
+
},
|
56
|
+
"./chains": {
|
57
|
+
types: "./dist/chains.d.ts",
|
58
|
+
module: "./dist/chains.mjs",
|
59
|
+
default: "./dist/chains.js"
|
60
|
+
},
|
61
|
+
"./clients": {
|
62
|
+
types: "./dist/clients/index.d.ts",
|
63
|
+
module: "./dist/clients/index.mjs",
|
64
|
+
default: "./dist/clients/index.js"
|
65
|
+
},
|
66
|
+
"./utils": {
|
67
|
+
types: "./dist/utils/index.d.ts",
|
68
|
+
module: "./dist/utils/index.mjs",
|
69
|
+
default: "./dist/utils/index.js"
|
70
|
+
},
|
71
|
+
"./window": {
|
72
|
+
types: "./dist/window.d.ts",
|
73
|
+
module: "./dist/window.mjs",
|
74
|
+
default: "./dist/window.js"
|
75
|
+
},
|
76
|
+
"./package.json": "./package.json"
|
77
|
+
},
|
78
|
+
main: "dist/index.js",
|
79
|
+
module: "dist/index.mjs",
|
80
|
+
types: "dist/index.d.ts",
|
81
|
+
sideEffects: false,
|
82
|
+
dependencies: {
|
83
|
+
"@noble/hashes": "^1.1.2",
|
84
|
+
"@wagmi/chains": "^0.1.0",
|
85
|
+
abitype: "^0.2.5"
|
86
|
+
},
|
87
|
+
devDependencies: {
|
88
|
+
"@actions/core": "^1.10.0",
|
89
|
+
"@actions/github": "^5.1.1",
|
90
|
+
"@changesets/changelog-github": "^0.4.5",
|
91
|
+
"@changesets/cli": "^2.23.2",
|
92
|
+
"@testing-library/jest-dom": "^5.16.5",
|
93
|
+
"@types/dedent": "^0.7.0",
|
94
|
+
"@types/fs-extra": "^9.0.13",
|
95
|
+
"@types/node": "^17.0.45",
|
96
|
+
"@vitest/coverage-c8": "^0.24.3",
|
97
|
+
"@vitest/ui": "^0.19.1",
|
98
|
+
bundlewatch: "^0.3.3",
|
99
|
+
dedent: "^0.7.0",
|
100
|
+
esbuild: "^0.16.12",
|
101
|
+
"esbuild-register": "^3.4.2",
|
102
|
+
"essential-eth": "^0.6.2",
|
103
|
+
ethers: "^5.7.2",
|
104
|
+
execa: "^6.1.0",
|
105
|
+
"fs-extra": "^10.1.0",
|
106
|
+
jsdom: "^20.0.0",
|
107
|
+
rome: "^11.0.0",
|
108
|
+
"simple-git-hooks": "^2.8.1",
|
109
|
+
tsup: "^6.5.0",
|
110
|
+
typescript: "^4.9.3",
|
111
|
+
vite: "^3.0.4",
|
112
|
+
vitest: "^0.25.2",
|
113
|
+
web3: "^1.8.1"
|
114
|
+
},
|
115
|
+
license: "MIT",
|
116
|
+
repository: "wagmi-dev/viem",
|
117
|
+
authors: [
|
118
|
+
"awkweb.eth",
|
119
|
+
"jxom.eth"
|
120
|
+
],
|
121
|
+
keywords: [
|
122
|
+
"eth",
|
123
|
+
"ethereum",
|
124
|
+
"dapps",
|
125
|
+
"wallet",
|
126
|
+
"web3"
|
127
|
+
],
|
128
|
+
"simple-git-hooks": {
|
129
|
+
"pre-commit": "pnpm format & pnpm lint:fix"
|
130
|
+
},
|
131
|
+
pnpm: {
|
132
|
+
patchedDependencies: {
|
133
|
+
"vitepress@1.0.0-alpha.34": "patches/vitepress@1.0.0-alpha.34.patch"
|
134
|
+
}
|
135
|
+
}
|
136
|
+
};
|
137
|
+
|
138
|
+
// src/utils/stringify.ts
|
139
|
+
function stringify(value) {
|
140
|
+
return JSON.stringify(
|
141
|
+
value,
|
142
|
+
(_, value2) => typeof value2 === "bigint" ? value2.toString() : value2
|
143
|
+
);
|
144
|
+
}
|
145
|
+
|
146
|
+
// src/errors/base.ts
|
147
|
+
var version = process.env.TEST ? "1.0.2" : package_default.version;
|
148
|
+
var BaseError = class extends Error {
|
149
|
+
constructor(humanMessage, args = {}) {
|
150
|
+
const details = args.cause instanceof BaseError ? args.cause.details : args.cause?.message ? args.cause.message : args.details;
|
151
|
+
const docsPath5 = args.cause instanceof BaseError ? args.cause.docsPath || args.docsPath : args.docsPath;
|
152
|
+
const message = [
|
153
|
+
humanMessage,
|
154
|
+
...docsPath5 ? ["", `Docs: https://viem.sh${docsPath5}`] : [],
|
155
|
+
"",
|
156
|
+
...details ? [`Details: ${details}`] : [],
|
157
|
+
`Version: viem@${version}`,
|
158
|
+
...args.cause && !(args.cause instanceof BaseError) && Object.keys(args.cause).length > 0 ? [`Internal Error: ${stringify(args.cause)}`] : []
|
159
|
+
].join("\n");
|
160
|
+
super(message);
|
161
|
+
__publicField(this, "humanMessage");
|
162
|
+
__publicField(this, "details");
|
163
|
+
__publicField(this, "docsPath");
|
164
|
+
__publicField(this, "name", "ViemError");
|
165
|
+
if (args.cause)
|
166
|
+
this.cause = args.cause;
|
167
|
+
this.details = details;
|
168
|
+
this.docsPath = docsPath5;
|
169
|
+
this.humanMessage = humanMessage;
|
170
|
+
}
|
171
|
+
};
|
172
|
+
|
173
|
+
// src/errors/abi.ts
|
174
|
+
var AbiConstructorNotFoundError = class extends BaseError {
|
175
|
+
constructor({ docsPath: docsPath5 }) {
|
176
|
+
super(
|
177
|
+
[
|
178
|
+
"A constructor was not found on the ABI.",
|
179
|
+
"Make sure you are using the correct ABI and that the constructor exists on it."
|
180
|
+
].join("\n"),
|
181
|
+
{
|
182
|
+
docsPath: docsPath5
|
183
|
+
}
|
184
|
+
);
|
185
|
+
__publicField(this, "name", "AbiConstructorNotFoundError");
|
186
|
+
}
|
187
|
+
};
|
188
|
+
var AbiConstructorParamsNotFoundError = class extends BaseError {
|
189
|
+
constructor({ docsPath: docsPath5 }) {
|
190
|
+
super(
|
191
|
+
[
|
192
|
+
"Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.",
|
193
|
+
"Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."
|
194
|
+
].join("\n"),
|
195
|
+
{
|
196
|
+
docsPath: docsPath5
|
197
|
+
}
|
198
|
+
);
|
199
|
+
__publicField(this, "name", "AbiConstructorParamsNotFoundError");
|
200
|
+
}
|
201
|
+
};
|
202
|
+
var AbiDecodingDataSizeInvalidError = class extends BaseError {
|
203
|
+
constructor(size2) {
|
204
|
+
super(
|
205
|
+
[
|
206
|
+
`Data size of ${size2} bytes is invalid.`,
|
207
|
+
"Size must be in increments of 32 bytes (size % 32 === 0)."
|
208
|
+
].join("\n")
|
209
|
+
);
|
210
|
+
__publicField(this, "name", "AbiDecodingDataSizeInvalidError");
|
211
|
+
}
|
212
|
+
};
|
213
|
+
var AbiDecodingZeroDataError = class extends BaseError {
|
214
|
+
constructor() {
|
215
|
+
super('Cannot decode zero data ("0x") with ABI parameters.');
|
216
|
+
__publicField(this, "name", "AbiDecodingZeroDataError");
|
217
|
+
}
|
218
|
+
};
|
219
|
+
var AbiEncodingArrayLengthMismatchError = class extends BaseError {
|
220
|
+
constructor({
|
221
|
+
expectedLength,
|
222
|
+
givenLength,
|
223
|
+
type
|
224
|
+
}) {
|
225
|
+
super(
|
226
|
+
[
|
227
|
+
`ABI encoding array length mismatch for type ${type}.`,
|
228
|
+
`Expected length: ${expectedLength}`,
|
229
|
+
`Given length: ${givenLength}`
|
230
|
+
].join("\n")
|
231
|
+
);
|
232
|
+
__publicField(this, "name", "AbiEncodingArrayLengthMismatchError");
|
233
|
+
}
|
234
|
+
};
|
235
|
+
var AbiEncodingLengthMismatchError = class extends BaseError {
|
236
|
+
constructor({
|
237
|
+
expectedLength,
|
238
|
+
givenLength
|
239
|
+
}) {
|
240
|
+
super(
|
241
|
+
[
|
242
|
+
"ABI encoding params/values length mismatch.",
|
243
|
+
`Expected length (params): ${expectedLength}`,
|
244
|
+
`Given length (values): ${givenLength}`
|
245
|
+
].join("\n")
|
246
|
+
);
|
247
|
+
__publicField(this, "name", "AbiEncodingLengthMismatchError");
|
248
|
+
}
|
249
|
+
};
|
250
|
+
var AbiErrorInputsNotFoundError = class extends BaseError {
|
251
|
+
constructor(errorName, { docsPath: docsPath5 }) {
|
252
|
+
super(
|
253
|
+
[
|
254
|
+
`Arguments (\`args\`) were provided to "${errorName}", but "${errorName}" on the ABI does not contain any parameters (\`inputs\`).`,
|
255
|
+
"Cannot encode error result without knowing what the parameter types are.",
|
256
|
+
"Make sure you are using the correct ABI and that the inputs exist on it."
|
257
|
+
].join("\n"),
|
258
|
+
{
|
259
|
+
docsPath: docsPath5
|
260
|
+
}
|
261
|
+
);
|
262
|
+
__publicField(this, "name", "AbiErrorInputsNotFoundError");
|
263
|
+
}
|
264
|
+
};
|
265
|
+
var AbiErrorNotFoundError = class extends BaseError {
|
266
|
+
constructor(errorName, { docsPath: docsPath5 }) {
|
267
|
+
super(
|
268
|
+
[
|
269
|
+
`Error "${errorName}" not found on ABI.`,
|
270
|
+
"Make sure you are using the correct ABI and that the error exists on it."
|
271
|
+
].join("\n"),
|
272
|
+
{
|
273
|
+
docsPath: docsPath5
|
274
|
+
}
|
275
|
+
);
|
276
|
+
__publicField(this, "name", "AbiErrorNotFoundError");
|
277
|
+
}
|
278
|
+
};
|
279
|
+
var AbiErrorSignatureNotFoundError = class extends BaseError {
|
280
|
+
constructor(signature, { docsPath: docsPath5 }) {
|
281
|
+
super(
|
282
|
+
[
|
283
|
+
`Encoded error signature "${signature}" not found on ABI.`,
|
284
|
+
"Make sure you are using the correct ABI and that the error exists on it.",
|
285
|
+
`You can look up the signature "${signature}" here: https://sig.eth.samczsun.com/.`
|
286
|
+
].join("\n"),
|
287
|
+
{
|
288
|
+
docsPath: docsPath5
|
289
|
+
}
|
290
|
+
);
|
291
|
+
__publicField(this, "name", "AbiErrorSignatureNotFoundError");
|
292
|
+
}
|
293
|
+
};
|
294
|
+
var AbiEventNotFoundError = class extends BaseError {
|
295
|
+
constructor(eventName, { docsPath: docsPath5 }) {
|
296
|
+
super(
|
297
|
+
[
|
298
|
+
`Event "${eventName}" not found on ABI.`,
|
299
|
+
"Make sure you are using the correct ABI and that the event exists on it."
|
300
|
+
].join("\n"),
|
301
|
+
{
|
302
|
+
docsPath: docsPath5
|
303
|
+
}
|
304
|
+
);
|
305
|
+
__publicField(this, "name", "AbiEventNotFoundError");
|
306
|
+
}
|
307
|
+
};
|
308
|
+
var AbiFunctionNotFoundError = class extends BaseError {
|
309
|
+
constructor(functionName, { docsPath: docsPath5 }) {
|
310
|
+
super(
|
311
|
+
[
|
312
|
+
`Function "${functionName}" not found on ABI.`,
|
313
|
+
"Make sure you are using the correct ABI and that the function exists on it."
|
314
|
+
].join("\n"),
|
315
|
+
{
|
316
|
+
docsPath: docsPath5
|
317
|
+
}
|
318
|
+
);
|
319
|
+
__publicField(this, "name", "AbiFunctionNotFoundError");
|
320
|
+
}
|
321
|
+
};
|
322
|
+
var AbiFunctionOutputsNotFoundError = class extends BaseError {
|
323
|
+
constructor(functionName, { docsPath: docsPath5 }) {
|
324
|
+
super(
|
325
|
+
[
|
326
|
+
`Function "${functionName}" does not contain any \`outputs\` on ABI.`,
|
327
|
+
"Cannot decode function result without knowing what the parameter types are.",
|
328
|
+
"Make sure you are using the correct ABI and that the function exists on it."
|
329
|
+
].join("\n"),
|
330
|
+
{
|
331
|
+
docsPath: docsPath5
|
332
|
+
}
|
333
|
+
);
|
334
|
+
__publicField(this, "name", "AbiFunctionOutputsNotFoundError");
|
335
|
+
}
|
336
|
+
};
|
337
|
+
var AbiFunctionSignatureNotFoundError = class extends BaseError {
|
338
|
+
constructor(signature, { docsPath: docsPath5 }) {
|
339
|
+
super(
|
340
|
+
[
|
341
|
+
`Encoded function signature "${signature}" not found on ABI.`,
|
342
|
+
"Make sure you are using the correct ABI and that the function exists on it.",
|
343
|
+
`You can look up the signature "${signature}" here: https://sig.eth.samczsun.com/.`
|
344
|
+
].join("\n"),
|
345
|
+
{
|
346
|
+
docsPath: docsPath5
|
347
|
+
}
|
348
|
+
);
|
349
|
+
__publicField(this, "name", "AbiFunctionSignatureNotFoundError");
|
350
|
+
}
|
351
|
+
};
|
352
|
+
var InvalidAbiEncodingTypeError = class extends BaseError {
|
353
|
+
constructor(type, { docsPath: docsPath5 }) {
|
354
|
+
super(
|
355
|
+
[
|
356
|
+
`Type "${type}" is not a valid encoding type.`,
|
357
|
+
"Please provide a valid ABI type."
|
358
|
+
].join("\n"),
|
359
|
+
{ docsPath: docsPath5 }
|
360
|
+
);
|
361
|
+
__publicField(this, "name", "InvalidAbiEncodingType");
|
362
|
+
}
|
363
|
+
};
|
364
|
+
var InvalidAbiDecodingTypeError = class extends BaseError {
|
365
|
+
constructor(type, { docsPath: docsPath5 }) {
|
366
|
+
super(
|
367
|
+
[
|
368
|
+
`Type "${type}" is not a valid decoding type.`,
|
369
|
+
"Please provide a valid ABI type."
|
370
|
+
].join("\n"),
|
371
|
+
{ docsPath: docsPath5 }
|
372
|
+
);
|
373
|
+
__publicField(this, "name", "InvalidAbiDecodingType");
|
374
|
+
}
|
375
|
+
};
|
376
|
+
var InvalidArrayError = class extends BaseError {
|
377
|
+
constructor(value) {
|
378
|
+
super([`Value "${value}" is not a valid array.`].join("\n"));
|
379
|
+
__publicField(this, "name", "InvalidArrayError");
|
380
|
+
}
|
381
|
+
};
|
382
|
+
var InvalidDefinitionTypeError = class extends BaseError {
|
383
|
+
constructor(type) {
|
384
|
+
super(
|
385
|
+
[
|
386
|
+
`"${type}" is not a valid definition type.`,
|
387
|
+
'Valid types: "function", "event", "error"'
|
388
|
+
].join("\n")
|
389
|
+
);
|
390
|
+
__publicField(this, "name", "InvalidDefinitionTypeError");
|
391
|
+
}
|
392
|
+
};
|
393
|
+
|
394
|
+
// src/errors/address.ts
|
395
|
+
var InvalidAddressError = class extends BaseError {
|
396
|
+
constructor({ address }) {
|
397
|
+
super(`Address "${address}" is invalid.`);
|
398
|
+
__publicField(this, "name", "InvalidAddressError");
|
399
|
+
}
|
400
|
+
};
|
401
|
+
|
402
|
+
// src/errors/block.ts
|
403
|
+
var BlockNotFoundError = class extends BaseError {
|
404
|
+
constructor({
|
405
|
+
blockHash,
|
406
|
+
blockNumber
|
407
|
+
}) {
|
408
|
+
let identifier = "Block";
|
409
|
+
if (blockHash)
|
410
|
+
identifier = `Block at hash "${blockHash}"`;
|
411
|
+
if (blockNumber)
|
412
|
+
identifier = `Block at number "${blockNumber}"`;
|
413
|
+
super(`${identifier} could not be found.`);
|
414
|
+
__publicField(this, "name", "BlockNotFoundError");
|
415
|
+
}
|
416
|
+
};
|
417
|
+
|
418
|
+
// src/errors/contract.ts
|
419
|
+
var ContractMethodExecutionError = class extends BaseError {
|
420
|
+
constructor(message, {
|
421
|
+
abi,
|
422
|
+
args,
|
423
|
+
cause,
|
424
|
+
contractAddress,
|
425
|
+
formattedArgs,
|
426
|
+
functionName,
|
427
|
+
functionWithParams,
|
428
|
+
sender
|
429
|
+
} = {}) {
|
430
|
+
super(
|
431
|
+
[
|
432
|
+
message,
|
433
|
+
" ",
|
434
|
+
sender && `Sender: ${sender}`,
|
435
|
+
contractAddress && `Contract: ${process.env.TEST ? "0x0000000000000000000000000000000000000000" : contractAddress}`,
|
436
|
+
functionWithParams && `Function: ${functionWithParams}`,
|
437
|
+
formattedArgs && `Arguments: ${[...Array(functionName?.length ?? 0).keys()].map(() => " ").join("")}${formattedArgs}`
|
438
|
+
].filter(Boolean).join("\n"),
|
439
|
+
{
|
440
|
+
cause
|
441
|
+
}
|
442
|
+
);
|
443
|
+
__publicField(this, "abi");
|
444
|
+
__publicField(this, "args");
|
445
|
+
__publicField(this, "contractAddress");
|
446
|
+
__publicField(this, "formattedArgs");
|
447
|
+
__publicField(this, "functionName");
|
448
|
+
__publicField(this, "reason");
|
449
|
+
__publicField(this, "sender");
|
450
|
+
__publicField(this, "name", "ContractMethodExecutionError");
|
451
|
+
if (message)
|
452
|
+
this.reason = message;
|
453
|
+
this.abi = abi;
|
454
|
+
this.args = args;
|
455
|
+
this.contractAddress = contractAddress;
|
456
|
+
this.functionName = functionName;
|
457
|
+
this.sender = sender;
|
458
|
+
}
|
459
|
+
};
|
460
|
+
var ContractMethodZeroDataError = class extends BaseError {
|
461
|
+
constructor({
|
462
|
+
abi,
|
463
|
+
args,
|
464
|
+
cause,
|
465
|
+
contractAddress,
|
466
|
+
functionName,
|
467
|
+
functionWithParams
|
468
|
+
} = {}) {
|
469
|
+
super(
|
470
|
+
[
|
471
|
+
`The contract method "${functionName}" returned no data ("0x"). This could be due to any of the following:`,
|
472
|
+
`- The contract does not have the function "${functionName}",`,
|
473
|
+
"- The parameters passed to the contract function may be invalid, or",
|
474
|
+
"- The address is not a contract.",
|
475
|
+
" ",
|
476
|
+
contractAddress && `Contract: ${process.env.TEST ? "0x0000000000000000000000000000000000000000" : contractAddress}`,
|
477
|
+
functionWithParams && `Function: ${functionWithParams}`,
|
478
|
+
functionWithParams && ` > "0x"`
|
479
|
+
].filter(Boolean).join("\n"),
|
480
|
+
{
|
481
|
+
cause
|
482
|
+
}
|
483
|
+
);
|
484
|
+
__publicField(this, "abi");
|
485
|
+
__publicField(this, "args");
|
486
|
+
__publicField(this, "contractAddress");
|
487
|
+
__publicField(this, "functionName");
|
488
|
+
__publicField(this, "functionWithParams");
|
489
|
+
__publicField(this, "name", "ContractMethodZeroDataError");
|
490
|
+
this.abi = abi;
|
491
|
+
this.args = args;
|
492
|
+
this.contractAddress = contractAddress;
|
493
|
+
this.functionName = functionName;
|
494
|
+
}
|
495
|
+
};
|
496
|
+
|
497
|
+
// src/errors/data.ts
|
498
|
+
var SizeExceedsPaddingSizeError = class extends BaseError {
|
499
|
+
constructor({
|
500
|
+
size: size2,
|
501
|
+
targetSize,
|
502
|
+
type
|
503
|
+
}) {
|
504
|
+
super(
|
505
|
+
`${type.charAt(0).toUpperCase()}${type.slice(1).toLowerCase()} size (${size2}) exceeds padding size (${targetSize}).`
|
506
|
+
);
|
507
|
+
__publicField(this, "name", "SizeExceedsPaddingSizeError");
|
508
|
+
}
|
509
|
+
};
|
510
|
+
|
511
|
+
// src/errors/encoding.ts
|
512
|
+
var DataLengthTooLongError = class extends BaseError {
|
513
|
+
constructor({ consumed, length }) {
|
514
|
+
super(
|
515
|
+
`Consumed bytes (${consumed}) is shorter than data length (${length - 1}).`
|
516
|
+
);
|
517
|
+
__publicField(this, "name", "DataLengthTooLongError");
|
518
|
+
}
|
519
|
+
};
|
520
|
+
var DataLengthTooShortError = class extends BaseError {
|
521
|
+
constructor({ length, dataLength }) {
|
522
|
+
super(
|
523
|
+
`Data length (${dataLength - 1}) is shorter than prefix length (${length - 1}).`
|
524
|
+
);
|
525
|
+
__publicField(this, "name", "DataLengthTooShortError");
|
526
|
+
}
|
527
|
+
};
|
528
|
+
var InvalidBytesBooleanError = class extends BaseError {
|
529
|
+
constructor(bytes) {
|
530
|
+
super(
|
531
|
+
`Bytes value "${bytes}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`
|
532
|
+
);
|
533
|
+
__publicField(this, "name", "InvalidBytesBooleanError");
|
534
|
+
}
|
535
|
+
};
|
536
|
+
var InvalidHexBooleanError = class extends BaseError {
|
537
|
+
constructor(hex) {
|
538
|
+
super(
|
539
|
+
`Hex value "${hex}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`
|
540
|
+
);
|
541
|
+
__publicField(this, "name", "InvalidHexBooleanError");
|
542
|
+
}
|
543
|
+
};
|
544
|
+
var InvalidHexValueError = class extends BaseError {
|
545
|
+
constructor(value) {
|
546
|
+
super(
|
547
|
+
`Hex value "${value}" is an odd length (${value.length}). It must be an even length.`
|
548
|
+
);
|
549
|
+
__publicField(this, "name", "InvalidHexValueError");
|
550
|
+
}
|
551
|
+
};
|
552
|
+
var OffsetOutOfBoundsError = class extends BaseError {
|
553
|
+
constructor({ nextOffset, offset }) {
|
554
|
+
super(
|
555
|
+
`Next offset (${nextOffset}) is greater than previous offset + consumed bytes (${offset})`
|
556
|
+
);
|
557
|
+
__publicField(this, "name", "OffsetOutOfBoundsError");
|
558
|
+
}
|
559
|
+
};
|
560
|
+
|
561
|
+
// src/errors/log.ts
|
562
|
+
var FilterTypeNotSupportedError = class extends BaseError {
|
563
|
+
constructor(type) {
|
564
|
+
super(`Filter type "${type}" is not supported.`);
|
565
|
+
__publicField(this, "name", "FilterTypeNotSupportedError");
|
566
|
+
}
|
567
|
+
};
|
568
|
+
|
569
|
+
// src/errors/request.ts
|
570
|
+
var RequestError = class extends BaseError {
|
571
|
+
constructor(err, { docsPath: docsPath5, humanMessage }) {
|
572
|
+
super(humanMessage, {
|
573
|
+
cause: err,
|
574
|
+
docsPath: docsPath5
|
575
|
+
});
|
576
|
+
this.name = err.name;
|
577
|
+
}
|
578
|
+
};
|
579
|
+
var RpcRequestError = class extends RequestError {
|
580
|
+
constructor(err, { docsPath: docsPath5, humanMessage }) {
|
581
|
+
super(err, { docsPath: docsPath5, humanMessage });
|
582
|
+
__publicField(this, "code");
|
583
|
+
this.code = err.code;
|
584
|
+
this.name = err.name;
|
585
|
+
}
|
586
|
+
};
|
587
|
+
var ParseRpcError = class extends RpcRequestError {
|
588
|
+
constructor(err) {
|
589
|
+
super(err, {
|
590
|
+
humanMessage: "Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."
|
591
|
+
});
|
592
|
+
__publicField(this, "name", "ParseRpcError");
|
593
|
+
__publicField(this, "code", -32700);
|
594
|
+
}
|
595
|
+
};
|
596
|
+
var InvalidRequestRpcError = class extends RpcRequestError {
|
597
|
+
constructor(err) {
|
598
|
+
super(err, { humanMessage: "JSON is not a valid request object." });
|
599
|
+
__publicField(this, "name", "InvalidRequestRpcError");
|
600
|
+
__publicField(this, "code", -32600);
|
601
|
+
}
|
602
|
+
};
|
603
|
+
var MethodNotFoundRpcError = class extends RpcRequestError {
|
604
|
+
constructor(err) {
|
605
|
+
super(err, {
|
606
|
+
humanMessage: "The method does not exist / is not available."
|
607
|
+
});
|
608
|
+
__publicField(this, "name", "MethodNotFoundRpcError");
|
609
|
+
__publicField(this, "code", -32601);
|
610
|
+
}
|
611
|
+
};
|
612
|
+
var InvalidParamsRpcError = class extends RpcRequestError {
|
613
|
+
constructor(err) {
|
614
|
+
super(err, {
|
615
|
+
humanMessage: [
|
616
|
+
"Invalid parameters were provided to the RPC method.",
|
617
|
+
"Double check you have provided the correct parameters."
|
618
|
+
].join("\n")
|
619
|
+
});
|
620
|
+
__publicField(this, "name", "InvalidParamsRpcError");
|
621
|
+
__publicField(this, "code", -32602);
|
622
|
+
}
|
623
|
+
};
|
624
|
+
var InternalRpcError = class extends RpcRequestError {
|
625
|
+
constructor(err) {
|
626
|
+
super(err, { humanMessage: "An internal error was received." });
|
627
|
+
__publicField(this, "name", "InternalRpcError");
|
628
|
+
__publicField(this, "code", -32603);
|
629
|
+
}
|
630
|
+
};
|
631
|
+
var InvalidInputRpcError = class extends RpcRequestError {
|
632
|
+
constructor(err) {
|
633
|
+
super(err, {
|
634
|
+
humanMessage: [
|
635
|
+
"Missing or invalid parameters.",
|
636
|
+
"Double check you have provided the correct parameters."
|
637
|
+
].join("\n")
|
638
|
+
});
|
639
|
+
__publicField(this, "name", "InvalidInputRpcError");
|
640
|
+
__publicField(this, "code", -32e3);
|
641
|
+
}
|
642
|
+
};
|
643
|
+
var ResourceNotFoundRpcError = class extends RpcRequestError {
|
644
|
+
constructor(err) {
|
645
|
+
super(err, { humanMessage: "Requested resource not found." });
|
646
|
+
__publicField(this, "name", "ResourceNotFoundRpcError");
|
647
|
+
__publicField(this, "code", -32001);
|
648
|
+
}
|
649
|
+
};
|
650
|
+
var ResourceUnavailableRpcError = class extends RpcRequestError {
|
651
|
+
constructor(err) {
|
652
|
+
super(err, { humanMessage: "Requested resource not available." });
|
653
|
+
__publicField(this, "name", "ResourceUnavailableRpcError");
|
654
|
+
__publicField(this, "code", -32002);
|
655
|
+
}
|
656
|
+
};
|
657
|
+
var TransactionRejectedRpcError = class extends RpcRequestError {
|
658
|
+
constructor(err) {
|
659
|
+
super(err, { humanMessage: "Transaction creation failed." });
|
660
|
+
__publicField(this, "name", "TransactionRejectedRpcError");
|
661
|
+
__publicField(this, "code", -32003);
|
662
|
+
}
|
663
|
+
};
|
664
|
+
var MethodNotSupportedRpcError = class extends RpcRequestError {
|
665
|
+
constructor(err) {
|
666
|
+
super(err, { humanMessage: "Method is not implemented." });
|
667
|
+
__publicField(this, "name", "MethodNotSupportedRpcError");
|
668
|
+
__publicField(this, "code", -32004);
|
669
|
+
}
|
670
|
+
};
|
671
|
+
var LimitExceededRpcError = class extends RpcRequestError {
|
672
|
+
constructor(err) {
|
673
|
+
super(err, { humanMessage: "Request exceeds defined limit." });
|
674
|
+
__publicField(this, "name", "LimitExceededRpcError");
|
675
|
+
__publicField(this, "code", -32005);
|
676
|
+
}
|
677
|
+
};
|
678
|
+
var JsonRpcVersionUnsupportedError = class extends RpcRequestError {
|
679
|
+
constructor(err) {
|
680
|
+
super(err, {
|
681
|
+
humanMessage: "Version of JSON-RPC protocol is not supported."
|
682
|
+
});
|
683
|
+
__publicField(this, "name", "JsonRpcVersionUnsupportedError");
|
684
|
+
__publicField(this, "code", -32006);
|
685
|
+
}
|
686
|
+
};
|
687
|
+
var UnknownRpcError = class extends RequestError {
|
688
|
+
constructor(err) {
|
689
|
+
super(err, {
|
690
|
+
humanMessage: "An unknown RPC error occurred."
|
691
|
+
});
|
692
|
+
__publicField(this, "name", "UnknownRpcError");
|
693
|
+
}
|
694
|
+
};
|
695
|
+
|
696
|
+
// src/errors/rpc.ts
|
697
|
+
var HttpRequestError = class extends BaseError {
|
698
|
+
constructor({
|
699
|
+
body,
|
700
|
+
details,
|
701
|
+
status,
|
702
|
+
url
|
703
|
+
}) {
|
704
|
+
super(
|
705
|
+
[
|
706
|
+
"HTTP request failed.",
|
707
|
+
"",
|
708
|
+
`Status: ${status}`,
|
709
|
+
`URL: ${url}`,
|
710
|
+
`Request body: ${stringify(body)}`
|
711
|
+
].join("\n"),
|
712
|
+
{
|
713
|
+
details
|
714
|
+
}
|
715
|
+
);
|
716
|
+
__publicField(this, "name", "HttpRequestError");
|
717
|
+
__publicField(this, "status");
|
718
|
+
this.status = status;
|
719
|
+
}
|
720
|
+
};
|
721
|
+
var WebSocketRequestError = class extends BaseError {
|
722
|
+
constructor({
|
723
|
+
body,
|
724
|
+
details,
|
725
|
+
url
|
726
|
+
}) {
|
727
|
+
super(
|
728
|
+
[
|
729
|
+
"WebSocket request failed.",
|
730
|
+
"",
|
731
|
+
`URL: ${url}`,
|
732
|
+
`Request body: ${stringify(body)}`
|
733
|
+
].join("\n"),
|
734
|
+
{
|
735
|
+
details
|
736
|
+
}
|
737
|
+
);
|
738
|
+
__publicField(this, "name", "WebSocketRequestError");
|
739
|
+
}
|
740
|
+
};
|
741
|
+
var RpcError = class extends BaseError {
|
742
|
+
constructor({
|
743
|
+
body,
|
744
|
+
error,
|
745
|
+
url
|
746
|
+
}) {
|
747
|
+
super(
|
748
|
+
[
|
749
|
+
"RPC Request failed.",
|
750
|
+
"",
|
751
|
+
`URL: ${url}`,
|
752
|
+
`Request body: ${stringify(body)}`
|
753
|
+
].join("\n"),
|
754
|
+
{
|
755
|
+
cause: error,
|
756
|
+
details: error.message
|
757
|
+
}
|
758
|
+
);
|
759
|
+
__publicField(this, "code");
|
760
|
+
__publicField(this, "name", "RpcError");
|
761
|
+
this.code = error.code;
|
762
|
+
}
|
763
|
+
};
|
764
|
+
var TimeoutError = class extends BaseError {
|
765
|
+
constructor({
|
766
|
+
body,
|
767
|
+
url
|
768
|
+
}) {
|
769
|
+
super(
|
770
|
+
[
|
771
|
+
"The request took too long to respond.",
|
772
|
+
"",
|
773
|
+
`URL: ${url}`,
|
774
|
+
`Request body: ${stringify(body)}`
|
775
|
+
].join("\n"),
|
776
|
+
{
|
777
|
+
details: "The request timed out."
|
778
|
+
}
|
779
|
+
);
|
780
|
+
__publicField(this, "name", "TimeoutError");
|
781
|
+
}
|
782
|
+
};
|
783
|
+
|
784
|
+
// src/errors/transaction.ts
|
785
|
+
var InvalidGasArgumentsError = class extends BaseError {
|
786
|
+
constructor() {
|
787
|
+
super("`maxFeePerGas` cannot be less than `maxPriorityFeePerGas`");
|
788
|
+
__publicField(this, "name", "InvalidGasArgumentsError");
|
789
|
+
}
|
790
|
+
};
|
791
|
+
var TransactionNotFoundError = class extends BaseError {
|
792
|
+
constructor({
|
793
|
+
blockHash,
|
794
|
+
blockNumber,
|
795
|
+
blockTag,
|
796
|
+
hash: hash2,
|
797
|
+
index
|
798
|
+
}) {
|
799
|
+
let identifier = "Transaction";
|
800
|
+
if (blockTag && index !== void 0)
|
801
|
+
identifier = `Transaction at block time "${blockTag}" at index "${index}"`;
|
802
|
+
if (blockHash && index !== void 0)
|
803
|
+
identifier = `Transaction at block hash "${blockHash}" at index "${index}"`;
|
804
|
+
if (blockNumber && index !== void 0)
|
805
|
+
identifier = `Transaction at block number "${blockNumber}" at index "${index}"`;
|
806
|
+
if (hash2)
|
807
|
+
identifier = `Transaction with hash "${hash2}"`;
|
808
|
+
super(`${identifier} could not be found.`);
|
809
|
+
__publicField(this, "name", "TransactionNotFoundError");
|
810
|
+
}
|
811
|
+
};
|
812
|
+
var TransactionReceiptNotFoundError = class extends BaseError {
|
813
|
+
constructor({ hash: hash2 }) {
|
814
|
+
super(
|
815
|
+
`Transaction receipt with hash "${hash2}" could not be found. The Transaction may not be processed on a block yet.`
|
816
|
+
);
|
817
|
+
__publicField(this, "name", "TransactionReceiptNotFoundError");
|
818
|
+
}
|
819
|
+
};
|
820
|
+
var WaitForTransactionReceiptTimeoutError = class extends BaseError {
|
821
|
+
constructor({ hash: hash2 }) {
|
822
|
+
super(
|
823
|
+
`Timed out while waiting for transaction with hash "${hash2}" to be confirmed.`
|
824
|
+
);
|
825
|
+
__publicField(this, "name", "WaitForTransactionReceiptTimeoutError");
|
826
|
+
}
|
827
|
+
};
|
828
|
+
|
829
|
+
// src/errors/transport.ts
|
830
|
+
var UrlRequiredError = class extends BaseError {
|
831
|
+
constructor() {
|
832
|
+
super(
|
833
|
+
"No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",
|
834
|
+
{
|
835
|
+
docsPath: "/docs/clients/intro"
|
836
|
+
}
|
837
|
+
);
|
838
|
+
}
|
839
|
+
};
|
28
840
|
|
29
841
|
// src/utils/data/concat.ts
|
30
842
|
function concat(values) {
|
@@ -426,7 +1238,7 @@ function rlpToBytes(bytes, offset = 0) {
|
|
426
1238
|
return [result, consumed];
|
427
1239
|
}
|
428
1240
|
|
429
|
-
// src/utils/
|
1241
|
+
// src/utils/contract/extractFunctionParts.ts
|
430
1242
|
var paramsRegex = /((function|event)\s)?(.*)(\((.*)\))/;
|
431
1243
|
function extractFunctionParts(def) {
|
432
1244
|
const parts = def.match(paramsRegex);
|
@@ -451,6 +1263,49 @@ function extractFunctionType(def) {
|
|
451
1263
|
return extractFunctionParts(def).type;
|
452
1264
|
}
|
453
1265
|
|
1266
|
+
// src/utils/contract/getContractError.ts
|
1267
|
+
function getContractError(err, {
|
1268
|
+
abi,
|
1269
|
+
address,
|
1270
|
+
args,
|
1271
|
+
functionName,
|
1272
|
+
sender
|
1273
|
+
}) {
|
1274
|
+
const { code, message } = err.cause || {};
|
1275
|
+
const abiItem = getAbiItem({ abi, name: functionName });
|
1276
|
+
const formattedArgs = abiItem ? formatAbiItemWithArgs({
|
1277
|
+
abiItem,
|
1278
|
+
args,
|
1279
|
+
includeFunctionName: false,
|
1280
|
+
includeName: false
|
1281
|
+
}) : void 0;
|
1282
|
+
const functionWithParams = abiItem ? formatAbiItemWithParams(abiItem, { includeName: true }) : void 0;
|
1283
|
+
if (err instanceof AbiDecodingZeroDataError) {
|
1284
|
+
return new ContractMethodZeroDataError({
|
1285
|
+
abi,
|
1286
|
+
args,
|
1287
|
+
cause: err,
|
1288
|
+
contractAddress: address,
|
1289
|
+
functionName,
|
1290
|
+
functionWithParams
|
1291
|
+
});
|
1292
|
+
}
|
1293
|
+
if (code === 3 || message?.includes("execution reverted")) {
|
1294
|
+
const message_ = message?.replace("execution reverted: ", "");
|
1295
|
+
return new ContractMethodExecutionError(message_, {
|
1296
|
+
abi,
|
1297
|
+
args,
|
1298
|
+
cause: err,
|
1299
|
+
contractAddress: address,
|
1300
|
+
formattedArgs,
|
1301
|
+
functionName,
|
1302
|
+
functionWithParams,
|
1303
|
+
sender
|
1304
|
+
});
|
1305
|
+
}
|
1306
|
+
return err;
|
1307
|
+
}
|
1308
|
+
|
454
1309
|
// src/utils/hash/keccak256.ts
|
455
1310
|
import { keccak_256 } from "@noble/hashes/sha3";
|
456
1311
|
function keccak256(value, to_) {
|
@@ -484,10 +1339,10 @@ function checksumAddress(address_) {
|
|
484
1339
|
const hash2 = keccak256(stringToBytes(hexAddress), "bytes");
|
485
1340
|
let address = hexAddress.split("");
|
486
1341
|
for (let i = 0; i < 40; i += 2) {
|
487
|
-
if (hash2?.[i >> 1] >> 4 >= 8) {
|
1342
|
+
if (hash2?.[i >> 1] >> 4 >= 8 && address[i]) {
|
488
1343
|
address[i] = address[i].toUpperCase();
|
489
1344
|
}
|
490
|
-
if ((hash2[i >> 1] & 15) >= 8) {
|
1345
|
+
if ((hash2[i >> 1] & 15) >= 8 && address[i + 1]) {
|
491
1346
|
address[i + 1] = address[i + 1].toUpperCase();
|
492
1347
|
}
|
493
1348
|
}
|
@@ -733,6 +1588,8 @@ function decodeAbi({
|
|
733
1588
|
data,
|
734
1589
|
params
|
735
1590
|
}) {
|
1591
|
+
if (data === "0x" && params.length > 0)
|
1592
|
+
throw new AbiDecodingZeroDataError();
|
736
1593
|
if (size(data) % 32 !== 0)
|
737
1594
|
throw new AbiDecodingDataSizeInvalidError(size(data));
|
738
1595
|
const values = decodeParams({
|
@@ -795,7 +1652,7 @@ function decodeParam({
|
|
795
1652
|
});
|
796
1653
|
}
|
797
1654
|
function decodeAddress(value) {
|
798
|
-
return { consumed: 32, value: checksumAddress(
|
1655
|
+
return { consumed: 32, value: checksumAddress(slice(value, -20)) };
|
799
1656
|
}
|
800
1657
|
function decodeArray(data, {
|
801
1658
|
param,
|
@@ -924,33 +1781,32 @@ function hasDynamicChild(param) {
|
|
924
1781
|
return false;
|
925
1782
|
}
|
926
1783
|
|
927
|
-
// src/utils/abi/
|
928
|
-
function
|
929
|
-
if (
|
930
|
-
throw new InvalidDefinitionTypeError(
|
931
|
-
|
932
|
-
});
|
933
|
-
return `${description.name}(${getParams(description.inputs)})`;
|
1784
|
+
// src/utils/abi/formatAbiItemWithParams.ts
|
1785
|
+
function formatAbiItemWithParams(abiItem, { includeName = false } = {}) {
|
1786
|
+
if (abiItem.type !== "function" && abiItem.type !== "event" && abiItem.type !== "error")
|
1787
|
+
throw new InvalidDefinitionTypeError(abiItem.type);
|
1788
|
+
return `${abiItem.name}(${getParams(abiItem.inputs, { includeName })})`;
|
934
1789
|
}
|
935
|
-
function getParams(params) {
|
1790
|
+
function getParams(params, { includeName }) {
|
936
1791
|
if (!params)
|
937
1792
|
return "";
|
938
|
-
return params.map(getParam).join(",");
|
1793
|
+
return params.map((param) => getParam(param, { includeName })).join(includeName ? ", " : ",");
|
939
1794
|
}
|
940
|
-
function getParam(param) {
|
1795
|
+
function getParam(param, { includeName }) {
|
941
1796
|
if (param.type.startsWith("tuple")) {
|
942
1797
|
return `(${getParams(
|
943
|
-
param.components
|
1798
|
+
param.components,
|
1799
|
+
{ includeName }
|
944
1800
|
)})${param.type.slice("tuple".length)}`;
|
945
1801
|
}
|
946
|
-
return param.type;
|
1802
|
+
return param.type + (includeName && param.name ? ` ${param.name}` : "");
|
947
1803
|
}
|
948
1804
|
|
949
1805
|
// src/utils/abi/decodeErrorResult.ts
|
950
1806
|
function decodeErrorResult({ abi, data }) {
|
951
1807
|
const signature = slice(data, 0, 4);
|
952
1808
|
const description = abi.find(
|
953
|
-
(x) => signature === getFunctionSignature(
|
1809
|
+
(x) => signature === getFunctionSignature(formatAbiItemWithParams(x))
|
954
1810
|
);
|
955
1811
|
if (!description)
|
956
1812
|
throw new AbiErrorSignatureNotFoundError(signature, {
|
@@ -966,7 +1822,7 @@ function decodeErrorResult({ abi, data }) {
|
|
966
1822
|
function decodeFunctionData({ abi, data }) {
|
967
1823
|
const signature = slice(data, 0, 4);
|
968
1824
|
const description = abi.find(
|
969
|
-
(x) => signature === getFunctionSignature(
|
1825
|
+
(x) => signature === getFunctionSignature(formatAbiItemWithParams(x))
|
970
1826
|
);
|
971
1827
|
if (!description)
|
972
1828
|
throw new AbiFunctionSignatureNotFoundError(signature, {
|
@@ -985,7 +1841,9 @@ function decodeFunctionResult({
|
|
985
1841
|
functionName,
|
986
1842
|
data
|
987
1843
|
}) {
|
988
|
-
const description = abi.find(
|
1844
|
+
const description = abi.find(
|
1845
|
+
(x) => "name" in x && x.name === functionName
|
1846
|
+
);
|
989
1847
|
if (!description)
|
990
1848
|
throw new AbiFunctionNotFoundError(functionName, { docsPath });
|
991
1849
|
if (!("outputs" in description))
|
@@ -1021,17 +1879,18 @@ function encodeDeployData({
|
|
1021
1879
|
return concatHex([bytecode, data]);
|
1022
1880
|
}
|
1023
1881
|
|
1882
|
+
// src/utils/abi/getAbiItem.ts
|
1883
|
+
function getAbiItem({ abi, name }) {
|
1884
|
+
return abi.find((x) => "name" in x && x.name === name);
|
1885
|
+
}
|
1886
|
+
|
1024
1887
|
// src/utils/abi/encodeErrorResult.ts
|
1025
1888
|
var docsPath3 = "/docs/contract/encodeErrorResult";
|
1026
|
-
function encodeErrorResult({
|
1027
|
-
abi,
|
1028
|
-
errorName,
|
1029
|
-
args
|
1030
|
-
}) {
|
1031
|
-
const description = abi.find((x) => "name" in x && x.name === errorName);
|
1889
|
+
function encodeErrorResult({ abi, errorName, args }) {
|
1890
|
+
const description = getAbiItem({ abi, name: errorName });
|
1032
1891
|
if (!description)
|
1033
1892
|
throw new AbiErrorNotFoundError(errorName, { docsPath: docsPath3 });
|
1034
|
-
const definition =
|
1893
|
+
const definition = formatAbiItemWithParams(description);
|
1035
1894
|
const signature = getFunctionSignature(definition);
|
1036
1895
|
let data = "0x";
|
1037
1896
|
if (args && args.length > 0) {
|
@@ -1043,22 +1902,18 @@ function encodeErrorResult({
|
|
1043
1902
|
}
|
1044
1903
|
|
1045
1904
|
// src/utils/abi/encodeEventTopics.ts
|
1046
|
-
function encodeEventTopics({
|
1047
|
-
abi,
|
1048
|
-
|
1049
|
-
args
|
1050
|
-
}) {
|
1051
|
-
const description = abi.find((x) => "name" in x && x.name === eventName);
|
1052
|
-
if (!description)
|
1905
|
+
function encodeEventTopics({ abi, eventName, args }) {
|
1906
|
+
const abiItem = getAbiItem({ abi, name: eventName });
|
1907
|
+
if (!abiItem)
|
1053
1908
|
throw new AbiEventNotFoundError(eventName, {
|
1054
1909
|
docsPath: "/docs/contract/encodeEventTopics"
|
1055
1910
|
});
|
1056
|
-
const definition =
|
1911
|
+
const definition = formatAbiItemWithParams(abiItem);
|
1057
1912
|
const signature = getEventSignature(definition);
|
1058
1913
|
let topics = [];
|
1059
|
-
if (args && "inputs" in
|
1060
|
-
const args_ = Array.isArray(args) ? args :
|
1061
|
-
topics =
|
1914
|
+
if (args && "inputs" in abiItem) {
|
1915
|
+
const args_ = Array.isArray(args) ? args : abiItem.inputs?.map((x) => args[x.name]) ?? [];
|
1916
|
+
topics = abiItem.inputs?.filter((param) => "indexed" in param && param.indexed).map(
|
1062
1917
|
(param, i) => Array.isArray(args_[i]) ? args_[i].map(
|
1063
1918
|
(_, j) => encodeArg({ param, value: args_[i][j] })
|
1064
1919
|
) : args_[i] ? encodeArg({ param, value: args_[i] }) : null
|
@@ -1078,17 +1933,13 @@ function encodeArg({
|
|
1078
1933
|
}
|
1079
1934
|
|
1080
1935
|
// src/utils/abi/encodeFunctionData.ts
|
1081
|
-
function encodeFunctionData({
|
1082
|
-
abi,
|
1083
|
-
args,
|
1084
|
-
functionName
|
1085
|
-
}) {
|
1086
|
-
const description = abi.find((x) => "name" in x && x.name === functionName);
|
1936
|
+
function encodeFunctionData({ abi, args, functionName }) {
|
1937
|
+
const description = getAbiItem({ abi, name: functionName });
|
1087
1938
|
if (!description)
|
1088
1939
|
throw new AbiFunctionNotFoundError(functionName, {
|
1089
1940
|
docsPath: "/docs/contract/encodeFunctionData"
|
1090
1941
|
});
|
1091
|
-
const definition =
|
1942
|
+
const definition = formatAbiItemWithParams(description);
|
1092
1943
|
const signature = getFunctionSignature(definition);
|
1093
1944
|
const data = "inputs" in description && description.inputs ? encodeAbi({
|
1094
1945
|
params: description.inputs,
|
@@ -1115,6 +1966,62 @@ function encodeFunctionResult({
|
|
1115
1966
|
return encodeAbi({ params: description.outputs, values });
|
1116
1967
|
}
|
1117
1968
|
|
1969
|
+
// src/utils/abi/formatAbiItemWithArgs.ts
|
1970
|
+
function formatAbiItemWithArgs({
|
1971
|
+
abiItem,
|
1972
|
+
args,
|
1973
|
+
includeFunctionName = true,
|
1974
|
+
includeName = false
|
1975
|
+
}) {
|
1976
|
+
if (!("name" in abiItem))
|
1977
|
+
return;
|
1978
|
+
if (!("inputs" in abiItem))
|
1979
|
+
return;
|
1980
|
+
if (!abiItem.inputs)
|
1981
|
+
return;
|
1982
|
+
return `${includeFunctionName ? abiItem.name : ""}(${abiItem.inputs.map(
|
1983
|
+
(input, i) => `${includeName && input.name ? `${input.name}: ` : ""}${typeof args[i] === "object" ? stringify(args[i]) : args[i]}`
|
1984
|
+
).join(", ")})`;
|
1985
|
+
}
|
1986
|
+
|
1987
|
+
// src/utils/buildRequest.ts
|
1988
|
+
function buildRequest(request) {
|
1989
|
+
return async (args) => {
|
1990
|
+
try {
|
1991
|
+
return await request(args);
|
1992
|
+
} catch (err_) {
|
1993
|
+
let err = err_;
|
1994
|
+
if (err.code === -32700)
|
1995
|
+
throw new ParseRpcError(err);
|
1996
|
+
if (err.code === -32600)
|
1997
|
+
throw new InvalidRequestRpcError(err);
|
1998
|
+
if (err.code === -32601)
|
1999
|
+
throw new MethodNotFoundRpcError(err);
|
2000
|
+
if (err.code === -32602)
|
2001
|
+
throw new InvalidParamsRpcError(err);
|
2002
|
+
if (err.code === -32603)
|
2003
|
+
throw new InternalRpcError(err);
|
2004
|
+
if (err.code === -32e3)
|
2005
|
+
throw new InvalidInputRpcError(err);
|
2006
|
+
if (err.code === -32001)
|
2007
|
+
throw new ResourceNotFoundRpcError(err);
|
2008
|
+
if (err.code === -32002)
|
2009
|
+
throw new ResourceUnavailableRpcError(err);
|
2010
|
+
if (err.code === -32003)
|
2011
|
+
throw new TransactionRejectedRpcError(err);
|
2012
|
+
if (err.code === -32004)
|
2013
|
+
throw new MethodNotSupportedRpcError(err);
|
2014
|
+
if (err.code === -32005)
|
2015
|
+
throw new LimitExceededRpcError(err);
|
2016
|
+
if (err.code === -32006)
|
2017
|
+
throw new JsonRpcVersionUnsupportedError(err);
|
2018
|
+
if (err_ instanceof BaseError)
|
2019
|
+
throw err_;
|
2020
|
+
throw new UnknownRpcError(err);
|
2021
|
+
}
|
2022
|
+
};
|
2023
|
+
}
|
2024
|
+
|
1118
2025
|
// src/constants.ts
|
1119
2026
|
var etherUnits = {
|
1120
2027
|
gwei: 9,
|
@@ -1241,6 +2148,278 @@ function formatTransactionRequest(transactionRequest) {
|
|
1241
2148
|
};
|
1242
2149
|
}
|
1243
2150
|
|
2151
|
+
// src/utils/promise/withCache.ts
|
2152
|
+
var promiseCache = /* @__PURE__ */ new Map();
|
2153
|
+
var responseCache = /* @__PURE__ */ new Map();
|
2154
|
+
function getCache(cacheKey) {
|
2155
|
+
const buildCache = (cacheKey2, cache) => ({
|
2156
|
+
clear: () => cache.delete(cacheKey2),
|
2157
|
+
get: () => cache.get(cacheKey2),
|
2158
|
+
set: (data) => cache.set(cacheKey2, data)
|
2159
|
+
});
|
2160
|
+
const promise = buildCache(cacheKey, promiseCache);
|
2161
|
+
const response = buildCache(
|
2162
|
+
cacheKey,
|
2163
|
+
responseCache
|
2164
|
+
);
|
2165
|
+
return {
|
2166
|
+
clear: () => {
|
2167
|
+
promise.clear();
|
2168
|
+
response.clear();
|
2169
|
+
},
|
2170
|
+
promise,
|
2171
|
+
response
|
2172
|
+
};
|
2173
|
+
}
|
2174
|
+
async function withCache(fn, { cacheKey, maxAge = Infinity }) {
|
2175
|
+
const cache = getCache(cacheKey);
|
2176
|
+
const response = cache.response.get();
|
2177
|
+
if (response && maxAge > 0) {
|
2178
|
+
const age = new Date().getTime() - response.created.getTime();
|
2179
|
+
if (age < maxAge)
|
2180
|
+
return response.data;
|
2181
|
+
}
|
2182
|
+
let promise = cache.promise.get();
|
2183
|
+
if (!promise) {
|
2184
|
+
promise = fn();
|
2185
|
+
cache.promise.set(promise);
|
2186
|
+
}
|
2187
|
+
const data = await promise;
|
2188
|
+
cache.promise.clear();
|
2189
|
+
cache.response.set({ created: new Date(), data });
|
2190
|
+
return data;
|
2191
|
+
}
|
2192
|
+
|
2193
|
+
// src/utils/wait.ts
|
2194
|
+
async function wait(time) {
|
2195
|
+
return new Promise((res) => setTimeout(res, time));
|
2196
|
+
}
|
2197
|
+
|
2198
|
+
// src/utils/promise/withRetry.ts
|
2199
|
+
function withRetry(fn, {
|
2200
|
+
delay: delay_ = 100,
|
2201
|
+
retryCount = 2,
|
2202
|
+
shouldRetryOnResponse = () => false,
|
2203
|
+
shouldRetryOnError = () => false
|
2204
|
+
} = {}) {
|
2205
|
+
return new Promise((resolve, reject) => {
|
2206
|
+
const attemptRetry = async ({ count = 0 } = {}) => {
|
2207
|
+
const retry = async ({ data } = {}) => {
|
2208
|
+
const delay = typeof delay_ === "function" ? delay_({ count, data }) : delay_;
|
2209
|
+
if (delay)
|
2210
|
+
await wait(delay);
|
2211
|
+
attemptRetry({ count: count + 1 });
|
2212
|
+
};
|
2213
|
+
try {
|
2214
|
+
const data = await fn();
|
2215
|
+
if (count < retryCount && await shouldRetryOnResponse({ count, data }))
|
2216
|
+
return retry({ data });
|
2217
|
+
resolve(data);
|
2218
|
+
} catch (err) {
|
2219
|
+
if (count < retryCount && await shouldRetryOnError({ count, error: err }))
|
2220
|
+
return retry();
|
2221
|
+
reject(err);
|
2222
|
+
}
|
2223
|
+
};
|
2224
|
+
attemptRetry();
|
2225
|
+
});
|
2226
|
+
}
|
2227
|
+
|
2228
|
+
// src/utils/promise/withTimeout.ts
|
2229
|
+
function withTimeout(fn, {
|
2230
|
+
errorInstance,
|
2231
|
+
timeout,
|
2232
|
+
signal
|
2233
|
+
}) {
|
2234
|
+
return new Promise((resolve, reject) => {
|
2235
|
+
;
|
2236
|
+
(async () => {
|
2237
|
+
let timeoutId;
|
2238
|
+
try {
|
2239
|
+
const controller = new AbortController();
|
2240
|
+
if (timeout > 0) {
|
2241
|
+
timeoutId = setTimeout(() => {
|
2242
|
+
if (signal) {
|
2243
|
+
controller.abort();
|
2244
|
+
} else {
|
2245
|
+
reject(errorInstance);
|
2246
|
+
}
|
2247
|
+
}, timeout);
|
2248
|
+
}
|
2249
|
+
resolve(await fn({ signal: controller?.signal }));
|
2250
|
+
} catch (err) {
|
2251
|
+
if (err.name === "AbortError")
|
2252
|
+
reject(errorInstance);
|
2253
|
+
reject(err);
|
2254
|
+
} finally {
|
2255
|
+
clearTimeout(timeoutId);
|
2256
|
+
}
|
2257
|
+
})();
|
2258
|
+
});
|
2259
|
+
}
|
2260
|
+
|
2261
|
+
// src/utils/rpc.ts
|
2262
|
+
var id = 0;
|
2263
|
+
async function http(url, {
|
2264
|
+
body,
|
2265
|
+
retryDelay = 100,
|
2266
|
+
retryCount = 2,
|
2267
|
+
timeout = 0
|
2268
|
+
}) {
|
2269
|
+
const response = await withRetry(
|
2270
|
+
() => withTimeout(
|
2271
|
+
async ({ signal }) => {
|
2272
|
+
const response2 = await fetch(url, {
|
2273
|
+
headers: {
|
2274
|
+
"Content-Type": "application/json"
|
2275
|
+
},
|
2276
|
+
method: "POST",
|
2277
|
+
body: stringify({ jsonrpc: "2.0", id: id++, ...body }),
|
2278
|
+
signal: timeout > 0 ? signal : void 0
|
2279
|
+
});
|
2280
|
+
return response2;
|
2281
|
+
},
|
2282
|
+
{
|
2283
|
+
errorInstance: new TimeoutError({ body, url }),
|
2284
|
+
timeout,
|
2285
|
+
signal: true
|
2286
|
+
}
|
2287
|
+
),
|
2288
|
+
{
|
2289
|
+
delay: ({ count, data: data2 }) => {
|
2290
|
+
const retryAfter = data2?.headers.get("Retry-After");
|
2291
|
+
if (retryAfter?.match(/\d/))
|
2292
|
+
return parseInt(retryAfter) * 1e3;
|
2293
|
+
return ~~((Math.random() + 0.5) * (1 << count)) * retryDelay;
|
2294
|
+
},
|
2295
|
+
retryCount,
|
2296
|
+
shouldRetryOnResponse: async ({ data: data2 }) => {
|
2297
|
+
if (data2.status >= 500)
|
2298
|
+
return true;
|
2299
|
+
if ([408, 413, 429].includes(data2.status))
|
2300
|
+
return true;
|
2301
|
+
return false;
|
2302
|
+
}
|
2303
|
+
}
|
2304
|
+
);
|
2305
|
+
let data;
|
2306
|
+
if (response.headers.get("Content-Type")?.startsWith("application/json")) {
|
2307
|
+
data = await response.json();
|
2308
|
+
} else {
|
2309
|
+
data = await response.text();
|
2310
|
+
}
|
2311
|
+
if (!response.ok) {
|
2312
|
+
throw new HttpRequestError({
|
2313
|
+
body,
|
2314
|
+
details: stringify(data.error) || response.statusText,
|
2315
|
+
status: response.status,
|
2316
|
+
url
|
2317
|
+
});
|
2318
|
+
}
|
2319
|
+
if (data.error) {
|
2320
|
+
throw new RpcError({ body, error: data.error, url });
|
2321
|
+
}
|
2322
|
+
return data;
|
2323
|
+
}
|
2324
|
+
var sockets = /* @__PURE__ */ new Map();
|
2325
|
+
async function getSocket(url_) {
|
2326
|
+
const url = new URL(url_);
|
2327
|
+
const urlKey = url.toString();
|
2328
|
+
let socket = sockets.get(urlKey);
|
2329
|
+
if (socket)
|
2330
|
+
return socket;
|
2331
|
+
const webSocket2 = new WebSocket(url);
|
2332
|
+
const requests = /* @__PURE__ */ new Map();
|
2333
|
+
const subscriptions = /* @__PURE__ */ new Map();
|
2334
|
+
const onMessage = ({ data }) => {
|
2335
|
+
const message = JSON.parse(data);
|
2336
|
+
const isSubscription = message.method === "eth_subscription";
|
2337
|
+
const id2 = isSubscription ? message.params.subscription : message.id;
|
2338
|
+
const cache = isSubscription ? subscriptions : requests;
|
2339
|
+
const callback = cache.get(id2);
|
2340
|
+
if (callback)
|
2341
|
+
callback({ data });
|
2342
|
+
if (!isSubscription)
|
2343
|
+
cache.delete(id2);
|
2344
|
+
};
|
2345
|
+
const onClose = () => {
|
2346
|
+
sockets.delete(urlKey);
|
2347
|
+
webSocket2.removeEventListener("close", onClose);
|
2348
|
+
webSocket2.removeEventListener("message", onMessage);
|
2349
|
+
};
|
2350
|
+
webSocket2.addEventListener("close", onClose);
|
2351
|
+
webSocket2.addEventListener("message", onMessage);
|
2352
|
+
if (webSocket2.readyState === WebSocket.CONNECTING) {
|
2353
|
+
await new Promise((resolve, reject) => {
|
2354
|
+
if (!webSocket2)
|
2355
|
+
return;
|
2356
|
+
webSocket2.onopen = resolve;
|
2357
|
+
webSocket2.onerror = reject;
|
2358
|
+
});
|
2359
|
+
}
|
2360
|
+
socket = Object.assign(webSocket2, {
|
2361
|
+
requests,
|
2362
|
+
subscriptions
|
2363
|
+
});
|
2364
|
+
sockets.set(urlKey, socket);
|
2365
|
+
return socket;
|
2366
|
+
}
|
2367
|
+
function webSocket(socket, {
|
2368
|
+
body,
|
2369
|
+
onData,
|
2370
|
+
onError
|
2371
|
+
}) {
|
2372
|
+
if (socket.readyState === socket.CLOSED || socket.readyState === socket.CLOSING)
|
2373
|
+
throw new WebSocketRequestError({
|
2374
|
+
body,
|
2375
|
+
url: socket.url,
|
2376
|
+
details: "Socket is closed."
|
2377
|
+
});
|
2378
|
+
const id_ = id++;
|
2379
|
+
const callback = ({ data }) => {
|
2380
|
+
const message = JSON.parse(data);
|
2381
|
+
if (typeof message.id === "number" && id_ !== message.id)
|
2382
|
+
return;
|
2383
|
+
if (message.error) {
|
2384
|
+
onError?.(new RpcError({ body, error: message.error, url: socket.url }));
|
2385
|
+
} else {
|
2386
|
+
onData?.(message);
|
2387
|
+
}
|
2388
|
+
if (body.method === "eth_subscribe" && typeof message.result === "string") {
|
2389
|
+
socket.subscriptions.set(message.result, callback);
|
2390
|
+
}
|
2391
|
+
if (body.method === "eth_unsubscribe") {
|
2392
|
+
socket.subscriptions.delete(body.params?.[0]);
|
2393
|
+
}
|
2394
|
+
};
|
2395
|
+
socket.requests.set(id_, callback);
|
2396
|
+
socket.send(JSON.stringify({ jsonrpc: "2.0", ...body, id: id_ }));
|
2397
|
+
return socket;
|
2398
|
+
}
|
2399
|
+
async function webSocketAsync(socket, {
|
2400
|
+
body,
|
2401
|
+
timeout = 0
|
2402
|
+
}) {
|
2403
|
+
return withTimeout(
|
2404
|
+
() => new Promise(
|
2405
|
+
(onData, onError) => rpc.webSocket(socket, {
|
2406
|
+
body,
|
2407
|
+
onData,
|
2408
|
+
onError
|
2409
|
+
})
|
2410
|
+
),
|
2411
|
+
{
|
2412
|
+
errorInstance: new TimeoutError({ body, url: socket.url }),
|
2413
|
+
timeout
|
2414
|
+
}
|
2415
|
+
);
|
2416
|
+
}
|
2417
|
+
var rpc = {
|
2418
|
+
http,
|
2419
|
+
webSocket,
|
2420
|
+
webSocketAsync
|
2421
|
+
};
|
2422
|
+
|
1244
2423
|
// src/utils/unit/formatUnit.ts
|
1245
2424
|
function formatUnit(value, decimals) {
|
1246
2425
|
let display = value.toString();
|
@@ -1299,6 +2478,49 @@ function parseGwei(ether, unit = "wei") {
|
|
1299
2478
|
}
|
1300
2479
|
|
1301
2480
|
export {
|
2481
|
+
stringify,
|
2482
|
+
BaseError,
|
2483
|
+
AbiConstructorNotFoundError,
|
2484
|
+
AbiConstructorParamsNotFoundError,
|
2485
|
+
AbiDecodingDataSizeInvalidError,
|
2486
|
+
AbiEncodingArrayLengthMismatchError,
|
2487
|
+
AbiEncodingLengthMismatchError,
|
2488
|
+
AbiErrorInputsNotFoundError,
|
2489
|
+
AbiErrorNotFoundError,
|
2490
|
+
AbiErrorSignatureNotFoundError,
|
2491
|
+
AbiEventNotFoundError,
|
2492
|
+
AbiFunctionNotFoundError,
|
2493
|
+
AbiFunctionOutputsNotFoundError,
|
2494
|
+
AbiFunctionSignatureNotFoundError,
|
2495
|
+
InvalidAbiEncodingTypeError,
|
2496
|
+
InvalidAbiDecodingTypeError,
|
2497
|
+
InvalidArrayError,
|
2498
|
+
InvalidDefinitionTypeError,
|
2499
|
+
InvalidAddressError,
|
2500
|
+
BlockNotFoundError,
|
2501
|
+
SizeExceedsPaddingSizeError,
|
2502
|
+
DataLengthTooLongError,
|
2503
|
+
DataLengthTooShortError,
|
2504
|
+
InvalidBytesBooleanError,
|
2505
|
+
InvalidHexBooleanError,
|
2506
|
+
InvalidHexValueError,
|
2507
|
+
OffsetOutOfBoundsError,
|
2508
|
+
FilterTypeNotSupportedError,
|
2509
|
+
RequestError,
|
2510
|
+
RpcRequestError,
|
2511
|
+
ParseRpcError,
|
2512
|
+
InvalidRequestRpcError,
|
2513
|
+
MethodNotFoundRpcError,
|
2514
|
+
InvalidParamsRpcError,
|
2515
|
+
InternalRpcError,
|
2516
|
+
InvalidInputRpcError,
|
2517
|
+
ResourceNotFoundRpcError,
|
2518
|
+
ResourceUnavailableRpcError,
|
2519
|
+
TransactionRejectedRpcError,
|
2520
|
+
MethodNotSupportedRpcError,
|
2521
|
+
LimitExceededRpcError,
|
2522
|
+
JsonRpcVersionUnsupportedError,
|
2523
|
+
UnknownRpcError,
|
1302
2524
|
isBytes,
|
1303
2525
|
isHex,
|
1304
2526
|
pad,
|
@@ -1331,9 +2553,11 @@ export {
|
|
1331
2553
|
bytesToNumber,
|
1332
2554
|
bytesToString,
|
1333
2555
|
decodeRlp,
|
2556
|
+
extractFunctionParts,
|
1334
2557
|
extractFunctionName,
|
1335
2558
|
extractFunctionParams,
|
1336
2559
|
extractFunctionType,
|
2560
|
+
getContractError,
|
1337
2561
|
keccak256,
|
1338
2562
|
getEventSignature,
|
1339
2563
|
getFunctionSignature,
|
@@ -1346,14 +2570,18 @@ export {
|
|
1346
2570
|
isAddressEqual,
|
1347
2571
|
encodeAbi,
|
1348
2572
|
decodeAbi,
|
2573
|
+
formatAbiItemWithParams,
|
1349
2574
|
decodeErrorResult,
|
1350
2575
|
decodeFunctionData,
|
1351
2576
|
decodeFunctionResult,
|
1352
2577
|
encodeDeployData,
|
2578
|
+
getAbiItem,
|
1353
2579
|
encodeErrorResult,
|
1354
2580
|
encodeEventTopics,
|
1355
2581
|
encodeFunctionData,
|
1356
2582
|
encodeFunctionResult,
|
2583
|
+
formatAbiItemWithArgs,
|
2584
|
+
buildRequest,
|
1357
2585
|
etherUnits,
|
1358
2586
|
gweiUnits,
|
1359
2587
|
weiUnits,
|
@@ -1365,10 +2593,24 @@ export {
|
|
1365
2593
|
formatLog,
|
1366
2594
|
formatTransactionReceipt,
|
1367
2595
|
formatTransactionRequest,
|
2596
|
+
getCache,
|
2597
|
+
withCache,
|
2598
|
+
wait,
|
2599
|
+
getSocket,
|
2600
|
+
rpc,
|
1368
2601
|
formatUnit,
|
1369
2602
|
formatEther,
|
1370
2603
|
formatGwei,
|
1371
2604
|
parseUnit,
|
1372
2605
|
parseEther,
|
1373
|
-
parseGwei
|
2606
|
+
parseGwei,
|
2607
|
+
HttpRequestError,
|
2608
|
+
WebSocketRequestError,
|
2609
|
+
RpcError,
|
2610
|
+
TimeoutError,
|
2611
|
+
InvalidGasArgumentsError,
|
2612
|
+
TransactionNotFoundError,
|
2613
|
+
TransactionReceiptNotFoundError,
|
2614
|
+
WaitForTransactionReceiptTimeoutError,
|
2615
|
+
UrlRequiredError
|
1374
2616
|
};
|