viem 0.2.0-canary.20230313T210957 → 0.2.0-canary.20230314T023056
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/dist/abi.d.ts +3 -3
- package/dist/abi.js +2 -2
- package/dist/abi.mjs +1 -1
- package/dist/{chain-0ce17567.d.ts → chain-3a97fb0b.d.ts} +1 -1
- package/dist/{chain-5b8fb5eb.d.ts → chain-94e42876.d.ts} +1 -1
- package/dist/chains.d.ts +3 -3
- package/dist/chains.js +63 -63
- package/dist/chains.mjs +1 -1
- package/dist/{chunk-5VPFUJ4Y.mjs → chunk-4EKORTIH.mjs} +2 -2
- package/dist/{chunk-CTJIELK4.js → chunk-E6DS7ZIH.js} +104 -80
- package/dist/chunk-E6DS7ZIH.js.map +1 -0
- package/dist/{chunk-BWEZYOFM.js → chunk-XPAZ5N5B.js} +19 -19
- package/dist/{chunk-FC2S2WWT.mjs → chunk-YJVNIQSC.mjs} +91 -67
- package/dist/chunk-YJVNIQSC.mjs.map +1 -0
- package/dist/contract.d.ts +7 -7
- package/dist/contract.js +2 -2
- package/dist/contract.mjs +1 -1
- package/dist/{createClient-98b1c2e7.d.ts → createClient-ddc3fa22.d.ts} +2 -2
- package/dist/{createPublicClient-812a1dae.d.ts → createPublicClient-6792b8e9.d.ts} +3 -3
- package/dist/{eip1193-44504199.d.ts → eip1193-343f2a94.d.ts} +1 -1
- package/dist/{encodeFunctionResult-e491eb56.d.ts → encodeFunctionResult-4d3bafb8.d.ts} +2 -2
- package/dist/{encodePacked-d7942f6b.d.ts → encodePacked-a51cd55a.d.ts} +1 -1
- package/dist/ens.d.ts +4 -4
- package/dist/ens.js +3 -3
- package/dist/ens.mjs +2 -2
- package/dist/ethers.d.ts +4 -4
- package/dist/ethers.js +3 -3
- package/dist/ethers.mjs +1 -1
- package/dist/{formatAbiItem-29a73545.d.ts → formatAbiItem-e5d7437a.d.ts} +1 -1
- package/dist/{getAbiItem-779cb566.d.ts → getAbiItem-de2d6ac0.d.ts} +1 -1
- package/dist/index.d.ts +20 -14
- package/dist/index.js +92 -90
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -2
- package/dist/index.mjs.map +1 -1
- package/dist/{parseGwei-75956089.d.ts → parseGwei-21da474e.d.ts} +3 -3
- package/dist/public.d.ts +4 -4
- package/dist/public.js +2 -2
- package/dist/public.mjs +1 -1
- package/dist/{test-d0a36452.d.ts → test-07a99259.d.ts} +3 -3
- package/dist/test.d.ts +5 -5
- package/dist/test.js +2 -2
- package/dist/test.mjs +1 -1
- package/dist/utils/index.d.ts +13 -13
- package/dist/utils/index.js +2 -2
- package/dist/utils/index.mjs +1 -1
- package/dist/wallet.d.ts +4 -4
- package/dist/wallet.js +2 -2
- package/dist/wallet.mjs +1 -1
- package/dist/window.d.ts +2 -2
- package/package.json +1 -1
- package/dist/chunk-CTJIELK4.js.map +0 -1
- package/dist/chunk-FC2S2WWT.mjs.map +0 -1
- /package/dist/{chunk-5VPFUJ4Y.mjs.map → chunk-4EKORTIH.mjs.map} +0 -0
- /package/dist/{chunk-BWEZYOFM.js.map → chunk-XPAZ5N5B.js.map} +0 -0
@@ -11,27 +11,27 @@
|
|
11
11
|
|
12
12
|
|
13
13
|
|
14
|
-
var
|
14
|
+
var _chunkE6DS7ZIHjs = require('./chunk-E6DS7ZIH.js');
|
15
15
|
|
16
16
|
// src/utils/ens/labelhash.ts
|
17
17
|
function labelhash(label) {
|
18
18
|
let result = new Uint8Array(32).fill(0);
|
19
19
|
if (!label)
|
20
|
-
return
|
21
|
-
return
|
20
|
+
return _chunkE6DS7ZIHjs.bytesToHex.call(void 0, result);
|
21
|
+
return _chunkE6DS7ZIHjs.keccak256.call(void 0, _chunkE6DS7ZIHjs.stringToBytes.call(void 0, label));
|
22
22
|
}
|
23
23
|
|
24
24
|
// src/utils/ens/namehash.ts
|
25
25
|
function namehash(name) {
|
26
26
|
let result = new Uint8Array(32).fill(0);
|
27
27
|
if (!name)
|
28
|
-
return
|
28
|
+
return _chunkE6DS7ZIHjs.bytesToHex.call(void 0, result);
|
29
29
|
const labels = name.split(".");
|
30
30
|
for (let i = labels.length - 1; i >= 0; i -= 1) {
|
31
|
-
const hashed =
|
32
|
-
result =
|
31
|
+
const hashed = _chunkE6DS7ZIHjs.keccak256.call(void 0, _chunkE6DS7ZIHjs.stringToBytes.call(void 0, labels[i]), "bytes");
|
32
|
+
result = _chunkE6DS7ZIHjs.keccak256.call(void 0, _chunkE6DS7ZIHjs.concat.call(void 0, [result, hashed]), "bytes");
|
33
33
|
}
|
34
|
-
return
|
34
|
+
return _chunkE6DS7ZIHjs.bytesToHex.call(void 0, result);
|
35
35
|
}
|
36
36
|
|
37
37
|
// src/utils/ens/packetToBytes.ts
|
@@ -39,7 +39,7 @@ function packetToBytes(packet) {
|
|
39
39
|
function length(value2) {
|
40
40
|
if (value2 === "." || value2 === "..")
|
41
41
|
return 1;
|
42
|
-
return
|
42
|
+
return _chunkE6DS7ZIHjs.toBytes.call(void 0, value2.replace(/^\.|\.$/gm, "")).length + 2;
|
43
43
|
}
|
44
44
|
const bytes = new Uint8Array(length(packet));
|
45
45
|
const value = packet.replace(/^\.|\.$/gm, "");
|
@@ -48,7 +48,7 @@ function packetToBytes(packet) {
|
|
48
48
|
let offset = 0;
|
49
49
|
const list = value.split(".");
|
50
50
|
for (let i = 0; i < list.length; i++) {
|
51
|
-
const encoded =
|
51
|
+
const encoded = _chunkE6DS7ZIHjs.toBytes.call(void 0, list[i]);
|
52
52
|
bytes[offset] = encoded.length;
|
53
53
|
bytes.set(encoded, offset + 1);
|
54
54
|
offset += encoded.length + 1;
|
@@ -69,13 +69,13 @@ async function getEnsAddress(client, {
|
|
69
69
|
throw new Error(
|
70
70
|
"client chain not configured. universalResolverAddress is required."
|
71
71
|
);
|
72
|
-
universalResolverAddress =
|
72
|
+
universalResolverAddress = _chunkE6DS7ZIHjs.getChainContractAddress.call(void 0, {
|
73
73
|
blockNumber,
|
74
74
|
chain: client.chain,
|
75
75
|
contract: "ensUniversalResolver"
|
76
76
|
});
|
77
77
|
}
|
78
|
-
const res = await
|
78
|
+
const res = await _chunkE6DS7ZIHjs.readContract.call(void 0, client, {
|
79
79
|
address: universalResolverAddress,
|
80
80
|
abi: [
|
81
81
|
{
|
@@ -94,8 +94,8 @@ async function getEnsAddress(client, {
|
|
94
94
|
],
|
95
95
|
functionName: "resolve",
|
96
96
|
args: [
|
97
|
-
|
98
|
-
|
97
|
+
_chunkE6DS7ZIHjs.toHex.call(void 0, packetToBytes(name)),
|
98
|
+
_chunkE6DS7ZIHjs.encodeFunctionData.call(void 0, {
|
99
99
|
abi: [
|
100
100
|
{
|
101
101
|
name: "addr",
|
@@ -112,7 +112,7 @@ async function getEnsAddress(client, {
|
|
112
112
|
blockNumber,
|
113
113
|
blockTag
|
114
114
|
});
|
115
|
-
return
|
115
|
+
return _chunkE6DS7ZIHjs.decodeFunctionResult.call(void 0, {
|
116
116
|
abi: [
|
117
117
|
{
|
118
118
|
name: "addr",
|
@@ -140,7 +140,7 @@ async function getEnsName(client, {
|
|
140
140
|
throw new Error(
|
141
141
|
"client chain not configured. universalResolverAddress is required."
|
142
142
|
);
|
143
|
-
universalResolverAddress =
|
143
|
+
universalResolverAddress = _chunkE6DS7ZIHjs.getChainContractAddress.call(void 0, {
|
144
144
|
blockNumber,
|
145
145
|
chain: client.chain,
|
146
146
|
contract: "ensUniversalResolver"
|
@@ -148,7 +148,7 @@ async function getEnsName(client, {
|
|
148
148
|
}
|
149
149
|
const reverseNode = `${address.toLowerCase().substring(2)}.addr.reverse`;
|
150
150
|
try {
|
151
|
-
const res = await
|
151
|
+
const res = await _chunkE6DS7ZIHjs.readContract.call(void 0, client, {
|
152
152
|
address: universalResolverAddress,
|
153
153
|
abi: [
|
154
154
|
{
|
@@ -165,13 +165,13 @@ async function getEnsName(client, {
|
|
165
165
|
}
|
166
166
|
],
|
167
167
|
functionName: "reverse",
|
168
|
-
args: [
|
168
|
+
args: [_chunkE6DS7ZIHjs.toHex.call(void 0, packetToBytes(reverseNode))],
|
169
169
|
blockNumber,
|
170
170
|
blockTag
|
171
171
|
});
|
172
172
|
return res[0];
|
173
173
|
} catch (error) {
|
174
|
-
if (error instanceof
|
174
|
+
if (error instanceof _chunkE6DS7ZIHjs.ContractFunctionExecutionError && error.cause.reason === _chunkE6DS7ZIHjs.panicReasons[50])
|
175
175
|
return null;
|
176
176
|
throw error;
|
177
177
|
}
|
@@ -183,4 +183,4 @@ async function getEnsName(client, {
|
|
183
183
|
|
184
184
|
|
185
185
|
exports.labelhash = labelhash; exports.namehash = namehash; exports.getEnsAddress = getEnsAddress; exports.getEnsName = getEnsName;
|
186
|
-
//# sourceMappingURL=chunk-
|
186
|
+
//# sourceMappingURL=chunk-XPAZ5N5B.js.map
|
@@ -17,7 +17,7 @@ import {
|
|
17
17
|
var package_default = {
|
18
18
|
name: "viem",
|
19
19
|
description: "TypeScript Interface for Ethereum",
|
20
|
-
version: "0.1.
|
20
|
+
version: "0.1.15",
|
21
21
|
scripts: {
|
22
22
|
anvil: "source .env && anvil --fork-url $VITE_ANVIL_FORK_URL --fork-block-number $VITE_ANVIL_BLOCK_NUMBER --block-time $VITE_ANVIL_BLOCK_TIME",
|
23
23
|
bench: "vitest bench --no-threads",
|
@@ -209,12 +209,12 @@ var getVersion = () => `${package_default.name}@${package_default.version}`;
|
|
209
209
|
var BaseError = class extends Error {
|
210
210
|
constructor(shortMessage, args = {}) {
|
211
211
|
const details = args.cause instanceof BaseError ? args.cause.details : args.cause?.message ? args.cause.message : args.details;
|
212
|
-
const
|
212
|
+
const docsPath6 = args.cause instanceof BaseError ? args.cause.docsPath || args.docsPath : args.docsPath;
|
213
213
|
const message = [
|
214
214
|
shortMessage || "An error occurred.",
|
215
215
|
"",
|
216
216
|
...args.metaMessages ? [...args.metaMessages, ""] : [],
|
217
|
-
...
|
217
|
+
...docsPath6 ? [`Docs: https://viem.sh${docsPath6}.html`] : [],
|
218
218
|
...details ? [`Details: ${details}`] : [],
|
219
219
|
`Version: ${getVersion()}`
|
220
220
|
].join("\n");
|
@@ -227,7 +227,7 @@ var BaseError = class extends Error {
|
|
227
227
|
if (args.cause)
|
228
228
|
this.cause = args.cause;
|
229
229
|
this.details = details;
|
230
|
-
this.docsPath =
|
230
|
+
this.docsPath = docsPath6;
|
231
231
|
this.metaMessages = args.metaMessages;
|
232
232
|
this.shortMessage = shortMessage;
|
233
233
|
}
|
@@ -235,28 +235,28 @@ var BaseError = class extends Error {
|
|
235
235
|
|
236
236
|
// src/errors/abi.ts
|
237
237
|
var AbiConstructorNotFoundError = class extends BaseError {
|
238
|
-
constructor({ docsPath:
|
238
|
+
constructor({ docsPath: docsPath6 }) {
|
239
239
|
super(
|
240
240
|
[
|
241
241
|
"A constructor was not found on the ABI.",
|
242
242
|
"Make sure you are using the correct ABI and that the constructor exists on it."
|
243
243
|
].join("\n"),
|
244
244
|
{
|
245
|
-
docsPath:
|
245
|
+
docsPath: docsPath6
|
246
246
|
}
|
247
247
|
);
|
248
248
|
__publicField(this, "name", "AbiConstructorNotFoundError");
|
249
249
|
}
|
250
250
|
};
|
251
251
|
var AbiConstructorParamsNotFoundError = class extends BaseError {
|
252
|
-
constructor({ docsPath:
|
252
|
+
constructor({ docsPath: docsPath6 }) {
|
253
253
|
super(
|
254
254
|
[
|
255
255
|
"Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.",
|
256
256
|
"Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."
|
257
257
|
].join("\n"),
|
258
258
|
{
|
259
|
-
docsPath:
|
259
|
+
docsPath: docsPath6
|
260
260
|
}
|
261
261
|
);
|
262
262
|
__publicField(this, "name", "AbiConstructorParamsNotFoundError");
|
@@ -321,7 +321,7 @@ var AbiEncodingLengthMismatchError = class extends BaseError {
|
|
321
321
|
}
|
322
322
|
};
|
323
323
|
var AbiErrorInputsNotFoundError = class extends BaseError {
|
324
|
-
constructor(errorName, { docsPath:
|
324
|
+
constructor(errorName, { docsPath: docsPath6 }) {
|
325
325
|
super(
|
326
326
|
[
|
327
327
|
`Arguments (\`args\`) were provided to "${errorName}", but "${errorName}" on the ABI does not contain any parameters (\`inputs\`).`,
|
@@ -329,28 +329,28 @@ var AbiErrorInputsNotFoundError = class extends BaseError {
|
|
329
329
|
"Make sure you are using the correct ABI and that the inputs exist on it."
|
330
330
|
].join("\n"),
|
331
331
|
{
|
332
|
-
docsPath:
|
332
|
+
docsPath: docsPath6
|
333
333
|
}
|
334
334
|
);
|
335
335
|
__publicField(this, "name", "AbiErrorInputsNotFoundError");
|
336
336
|
}
|
337
337
|
};
|
338
338
|
var AbiErrorNotFoundError = class extends BaseError {
|
339
|
-
constructor(errorName, { docsPath:
|
339
|
+
constructor(errorName, { docsPath: docsPath6 }) {
|
340
340
|
super(
|
341
341
|
[
|
342
342
|
`Error "${errorName}" not found on ABI.`,
|
343
343
|
"Make sure you are using the correct ABI and that the error exists on it."
|
344
344
|
].join("\n"),
|
345
345
|
{
|
346
|
-
docsPath:
|
346
|
+
docsPath: docsPath6
|
347
347
|
}
|
348
348
|
);
|
349
349
|
__publicField(this, "name", "AbiErrorNotFoundError");
|
350
350
|
}
|
351
351
|
};
|
352
352
|
var AbiErrorSignatureNotFoundError = class extends BaseError {
|
353
|
-
constructor(signature, { docsPath:
|
353
|
+
constructor(signature, { docsPath: docsPath6 }) {
|
354
354
|
super(
|
355
355
|
[
|
356
356
|
`Encoded error signature "${signature}" not found on ABI.`,
|
@@ -358,14 +358,22 @@ var AbiErrorSignatureNotFoundError = class extends BaseError {
|
|
358
358
|
`You can look up the signature here: https://openchain.xyz/signatures?query=${signature}.`
|
359
359
|
].join("\n"),
|
360
360
|
{
|
361
|
-
docsPath:
|
361
|
+
docsPath: docsPath6
|
362
362
|
}
|
363
363
|
);
|
364
364
|
__publicField(this, "name", "AbiErrorSignatureNotFoundError");
|
365
365
|
}
|
366
366
|
};
|
367
|
+
var AbiEventSignatureEmptyTopicsError = class extends BaseError {
|
368
|
+
constructor({ docsPath: docsPath6 }) {
|
369
|
+
super("Cannot extract event signature from empty topics.", {
|
370
|
+
docsPath: docsPath6
|
371
|
+
});
|
372
|
+
__publicField(this, "name", "AbiEventSignatureEmptyTopicsError");
|
373
|
+
}
|
374
|
+
};
|
367
375
|
var AbiEventSignatureNotFoundError = class extends BaseError {
|
368
|
-
constructor(signature, { docsPath:
|
376
|
+
constructor(signature, { docsPath: docsPath6 }) {
|
369
377
|
super(
|
370
378
|
[
|
371
379
|
`Encoded event signature "${signature}" not found on ABI.`,
|
@@ -373,42 +381,42 @@ var AbiEventSignatureNotFoundError = class extends BaseError {
|
|
373
381
|
`You can look up the signature here: https://openchain.xyz/signatures?query=${signature}.`
|
374
382
|
].join("\n"),
|
375
383
|
{
|
376
|
-
docsPath:
|
384
|
+
docsPath: docsPath6
|
377
385
|
}
|
378
386
|
);
|
379
387
|
__publicField(this, "name", "AbiEventSignatureNotFoundError");
|
380
388
|
}
|
381
389
|
};
|
382
390
|
var AbiEventNotFoundError = class extends BaseError {
|
383
|
-
constructor(eventName, { docsPath:
|
391
|
+
constructor(eventName, { docsPath: docsPath6 }) {
|
384
392
|
super(
|
385
393
|
[
|
386
394
|
`Event "${eventName}" not found on ABI.`,
|
387
395
|
"Make sure you are using the correct ABI and that the event exists on it."
|
388
396
|
].join("\n"),
|
389
397
|
{
|
390
|
-
docsPath:
|
398
|
+
docsPath: docsPath6
|
391
399
|
}
|
392
400
|
);
|
393
401
|
__publicField(this, "name", "AbiEventNotFoundError");
|
394
402
|
}
|
395
403
|
};
|
396
404
|
var AbiFunctionNotFoundError = class extends BaseError {
|
397
|
-
constructor(functionName, { docsPath:
|
405
|
+
constructor(functionName, { docsPath: docsPath6 }) {
|
398
406
|
super(
|
399
407
|
[
|
400
408
|
`Function "${functionName}" not found on ABI.`,
|
401
409
|
"Make sure you are using the correct ABI and that the function exists on it."
|
402
410
|
].join("\n"),
|
403
411
|
{
|
404
|
-
docsPath:
|
412
|
+
docsPath: docsPath6
|
405
413
|
}
|
406
414
|
);
|
407
415
|
__publicField(this, "name", "AbiFunctionNotFoundError");
|
408
416
|
}
|
409
417
|
};
|
410
418
|
var AbiFunctionOutputsNotFoundError = class extends BaseError {
|
411
|
-
constructor(functionName, { docsPath:
|
419
|
+
constructor(functionName, { docsPath: docsPath6 }) {
|
412
420
|
super(
|
413
421
|
[
|
414
422
|
`Function "${functionName}" does not contain any \`outputs\` on ABI.`,
|
@@ -416,14 +424,14 @@ var AbiFunctionOutputsNotFoundError = class extends BaseError {
|
|
416
424
|
"Make sure you are using the correct ABI and that the function exists on it."
|
417
425
|
].join("\n"),
|
418
426
|
{
|
419
|
-
docsPath:
|
427
|
+
docsPath: docsPath6
|
420
428
|
}
|
421
429
|
);
|
422
430
|
__publicField(this, "name", "AbiFunctionOutputsNotFoundError");
|
423
431
|
}
|
424
432
|
};
|
425
433
|
var AbiFunctionSignatureNotFoundError = class extends BaseError {
|
426
|
-
constructor(signature, { docsPath:
|
434
|
+
constructor(signature, { docsPath: docsPath6 }) {
|
427
435
|
super(
|
428
436
|
[
|
429
437
|
`Encoded function signature "${signature}" not found on ABI.`,
|
@@ -431,7 +439,7 @@ var AbiFunctionSignatureNotFoundError = class extends BaseError {
|
|
431
439
|
`You can look up the signature here: https://openchain.xyz/signatures?query=${signature}.`
|
432
440
|
].join("\n"),
|
433
441
|
{
|
434
|
-
docsPath:
|
442
|
+
docsPath: docsPath6
|
435
443
|
}
|
436
444
|
);
|
437
445
|
__publicField(this, "name", "AbiFunctionSignatureNotFoundError");
|
@@ -460,25 +468,25 @@ var DecodeLogTopicsMismatch = class extends BaseError {
|
|
460
468
|
}
|
461
469
|
};
|
462
470
|
var InvalidAbiEncodingTypeError = class extends BaseError {
|
463
|
-
constructor(type, { docsPath:
|
471
|
+
constructor(type, { docsPath: docsPath6 }) {
|
464
472
|
super(
|
465
473
|
[
|
466
474
|
`Type "${type}" is not a valid encoding type.`,
|
467
475
|
"Please provide a valid ABI type."
|
468
476
|
].join("\n"),
|
469
|
-
{ docsPath:
|
477
|
+
{ docsPath: docsPath6 }
|
470
478
|
);
|
471
479
|
__publicField(this, "name", "InvalidAbiEncodingType");
|
472
480
|
}
|
473
481
|
};
|
474
482
|
var InvalidAbiDecodingTypeError = class extends BaseError {
|
475
|
-
constructor(type, { docsPath:
|
483
|
+
constructor(type, { docsPath: docsPath6 }) {
|
476
484
|
super(
|
477
485
|
[
|
478
486
|
`Type "${type}" is not a valid decoding type.`,
|
479
487
|
"Please provide a valid ABI type."
|
480
488
|
].join("\n"),
|
481
|
-
{ docsPath:
|
489
|
+
{ docsPath: docsPath6 }
|
482
490
|
);
|
483
491
|
__publicField(this, "name", "InvalidAbiDecodingType");
|
484
492
|
}
|
@@ -688,7 +696,7 @@ var FeeConflictError = class extends BaseError {
|
|
688
696
|
var TransactionExecutionError = class extends BaseError {
|
689
697
|
constructor(cause, {
|
690
698
|
account,
|
691
|
-
docsPath:
|
699
|
+
docsPath: docsPath6,
|
692
700
|
chain,
|
693
701
|
data,
|
694
702
|
gas,
|
@@ -713,7 +721,7 @@ var TransactionExecutionError = class extends BaseError {
|
|
713
721
|
});
|
714
722
|
super(cause.shortMessage, {
|
715
723
|
cause,
|
716
|
-
docsPath:
|
724
|
+
docsPath: docsPath6,
|
717
725
|
metaMessages: [
|
718
726
|
...cause.metaMessages ? [...cause.metaMessages, " "] : [],
|
719
727
|
"Request Arguments:",
|
@@ -767,7 +775,7 @@ var WaitForTransactionReceiptTimeoutError = class extends BaseError {
|
|
767
775
|
var CallExecutionError = class extends BaseError {
|
768
776
|
constructor(cause, {
|
769
777
|
account,
|
770
|
-
docsPath:
|
778
|
+
docsPath: docsPath6,
|
771
779
|
chain,
|
772
780
|
data,
|
773
781
|
gas,
|
@@ -791,7 +799,7 @@ var CallExecutionError = class extends BaseError {
|
|
791
799
|
});
|
792
800
|
super(cause.shortMessage, {
|
793
801
|
cause,
|
794
|
-
docsPath:
|
802
|
+
docsPath: docsPath6,
|
795
803
|
metaMessages: [
|
796
804
|
...cause.metaMessages ? [...cause.metaMessages, " "] : [],
|
797
805
|
"Raw Call Arguments:",
|
@@ -808,7 +816,7 @@ var ContractFunctionExecutionError = class extends BaseError {
|
|
808
816
|
abi,
|
809
817
|
args,
|
810
818
|
contractAddress,
|
811
|
-
docsPath:
|
819
|
+
docsPath: docsPath6,
|
812
820
|
functionName,
|
813
821
|
sender
|
814
822
|
}) {
|
@@ -830,7 +838,7 @@ var ContractFunctionExecutionError = class extends BaseError {
|
|
830
838
|
cause.shortMessage || `An unknown error occurred while executing the contract function "${functionName}".`,
|
831
839
|
{
|
832
840
|
cause,
|
833
|
-
docsPath:
|
841
|
+
docsPath: docsPath6,
|
834
842
|
metaMessages: [
|
835
843
|
...cause.metaMessages ? [...cause.metaMessages, " "] : [],
|
836
844
|
"Contract Call:",
|
@@ -1008,7 +1016,7 @@ var OffsetOutOfBoundsError = class extends BaseError {
|
|
1008
1016
|
var EstimateGasExecutionError = class extends BaseError {
|
1009
1017
|
constructor(cause, {
|
1010
1018
|
account,
|
1011
|
-
docsPath:
|
1019
|
+
docsPath: docsPath6,
|
1012
1020
|
chain,
|
1013
1021
|
data,
|
1014
1022
|
gas,
|
@@ -1032,7 +1040,7 @@ var EstimateGasExecutionError = class extends BaseError {
|
|
1032
1040
|
});
|
1033
1041
|
super(cause.shortMessage, {
|
1034
1042
|
cause,
|
1035
|
-
docsPath:
|
1043
|
+
docsPath: docsPath6,
|
1036
1044
|
metaMessages: [
|
1037
1045
|
...cause.metaMessages ? [...cause.metaMessages, " "] : [],
|
1038
1046
|
"Estimate Gas Arguments:",
|
@@ -1221,21 +1229,21 @@ var UnknownNodeError = class extends BaseError {
|
|
1221
1229
|
// src/errors/request.ts
|
1222
1230
|
var RequestError = class extends BaseError {
|
1223
1231
|
constructor(err, {
|
1224
|
-
docsPath:
|
1232
|
+
docsPath: docsPath6,
|
1225
1233
|
metaMessages,
|
1226
1234
|
shortMessage
|
1227
1235
|
}) {
|
1228
1236
|
super(shortMessage, {
|
1229
1237
|
cause: err,
|
1230
|
-
docsPath:
|
1238
|
+
docsPath: docsPath6,
|
1231
1239
|
metaMessages
|
1232
1240
|
});
|
1233
1241
|
this.name = err.name;
|
1234
1242
|
}
|
1235
1243
|
};
|
1236
1244
|
var RpcRequestError = class extends RequestError {
|
1237
|
-
constructor(err, { docsPath:
|
1238
|
-
super(err, { docsPath:
|
1245
|
+
constructor(err, { docsPath: docsPath6, shortMessage }) {
|
1246
|
+
super(err, { docsPath: docsPath6, metaMessages: err.metaMessages, shortMessage });
|
1239
1247
|
__publicField(this, "code");
|
1240
1248
|
this.code = err.code;
|
1241
1249
|
this.name = err.name;
|
@@ -2428,18 +2436,23 @@ function decodeErrorResult({
|
|
2428
2436
|
}
|
2429
2437
|
|
2430
2438
|
// src/utils/abi/decodeEventLog.ts
|
2439
|
+
var docsPath = "/docs/contract/decodeEventLog";
|
2431
2440
|
function decodeEventLog({
|
2432
2441
|
abi,
|
2433
2442
|
data,
|
2434
2443
|
topics
|
2435
2444
|
}) {
|
2436
2445
|
const [signature, ...argTopics] = topics;
|
2446
|
+
if (!signature)
|
2447
|
+
throw new AbiEventSignatureEmptyTopicsError({
|
2448
|
+
docsPath
|
2449
|
+
});
|
2437
2450
|
const abiItem = abi.find(
|
2438
2451
|
(x) => x.type === "event" && signature === getEventSelector(formatAbiItem(x))
|
2439
2452
|
);
|
2440
2453
|
if (!(abiItem && "name" in abiItem))
|
2441
2454
|
throw new AbiEventSignatureNotFoundError(signature, {
|
2442
|
-
docsPath
|
2455
|
+
docsPath
|
2443
2456
|
});
|
2444
2457
|
const { name, inputs } = abiItem;
|
2445
2458
|
const isUnnamed = inputs?.some((x) => !("name" in x && x.name));
|
@@ -2578,7 +2591,7 @@ function isArgOfType(arg, abiParameter) {
|
|
2578
2591
|
}
|
2579
2592
|
|
2580
2593
|
// src/utils/abi/decodeFunctionResult.ts
|
2581
|
-
var
|
2594
|
+
var docsPath2 = "/docs/contract/decodeFunctionResult";
|
2582
2595
|
function decodeFunctionResult({
|
2583
2596
|
abi,
|
2584
2597
|
args,
|
@@ -2591,9 +2604,9 @@ function decodeFunctionResult({
|
|
2591
2604
|
name: functionName
|
2592
2605
|
});
|
2593
2606
|
if (!description)
|
2594
|
-
throw new AbiFunctionNotFoundError(functionName, { docsPath });
|
2607
|
+
throw new AbiFunctionNotFoundError(functionName, { docsPath: docsPath2 });
|
2595
2608
|
if (!("outputs" in description))
|
2596
|
-
throw new AbiFunctionOutputsNotFoundError(functionName, { docsPath });
|
2609
|
+
throw new AbiFunctionOutputsNotFoundError(functionName, { docsPath: docsPath2 });
|
2597
2610
|
const values = decodeAbiParameters(description.outputs, data);
|
2598
2611
|
if (values && values.length > 1)
|
2599
2612
|
return values;
|
@@ -2603,7 +2616,7 @@ function decodeFunctionResult({
|
|
2603
2616
|
}
|
2604
2617
|
|
2605
2618
|
// src/utils/abi/encodeDeployData.ts
|
2606
|
-
var
|
2619
|
+
var docsPath3 = "/docs/contract/encodeDeployData";
|
2607
2620
|
function encodeDeployData({
|
2608
2621
|
abi,
|
2609
2622
|
args,
|
@@ -2615,11 +2628,11 @@ function encodeDeployData({
|
|
2615
2628
|
(x) => "type" in x && x.type === "constructor"
|
2616
2629
|
);
|
2617
2630
|
if (!description)
|
2618
|
-
throw new AbiConstructorNotFoundError({ docsPath:
|
2631
|
+
throw new AbiConstructorNotFoundError({ docsPath: docsPath3 });
|
2619
2632
|
if (!("inputs" in description))
|
2620
|
-
throw new AbiConstructorParamsNotFoundError({ docsPath:
|
2633
|
+
throw new AbiConstructorParamsNotFoundError({ docsPath: docsPath3 });
|
2621
2634
|
if (!description.inputs || description.inputs.length === 0)
|
2622
|
-
throw new AbiConstructorParamsNotFoundError({ docsPath:
|
2635
|
+
throw new AbiConstructorParamsNotFoundError({ docsPath: docsPath3 });
|
2623
2636
|
const data = encodeAbiParameters(
|
2624
2637
|
description.inputs,
|
2625
2638
|
args
|
@@ -2628,7 +2641,7 @@ function encodeDeployData({
|
|
2628
2641
|
}
|
2629
2642
|
|
2630
2643
|
// src/utils/abi/encodeErrorResult.ts
|
2631
|
-
var
|
2644
|
+
var docsPath4 = "/docs/contract/encodeErrorResult";
|
2632
2645
|
function encodeErrorResult({ abi, errorName, args }) {
|
2633
2646
|
const description = getAbiItem({
|
2634
2647
|
abi,
|
@@ -2636,13 +2649,13 @@ function encodeErrorResult({ abi, errorName, args }) {
|
|
2636
2649
|
name: errorName
|
2637
2650
|
});
|
2638
2651
|
if (!description)
|
2639
|
-
throw new AbiErrorNotFoundError(errorName, { docsPath:
|
2652
|
+
throw new AbiErrorNotFoundError(errorName, { docsPath: docsPath4 });
|
2640
2653
|
const definition = formatAbiItem(description);
|
2641
2654
|
const signature = getFunctionSelector(definition);
|
2642
2655
|
let data = "0x";
|
2643
2656
|
if (args && args.length > 0) {
|
2644
2657
|
if (!("inputs" in description && description.inputs))
|
2645
|
-
throw new AbiErrorInputsNotFoundError(errorName, { docsPath:
|
2658
|
+
throw new AbiErrorInputsNotFoundError(errorName, { docsPath: docsPath4 });
|
2646
2659
|
data = encodeAbiParameters(description.inputs, args);
|
2647
2660
|
}
|
2648
2661
|
return concatHex([signature, data]);
|
@@ -2708,7 +2721,7 @@ function encodeFunctionData({
|
|
2708
2721
|
}
|
2709
2722
|
|
2710
2723
|
// src/utils/abi/encodeFunctionResult.ts
|
2711
|
-
var
|
2724
|
+
var docsPath5 = "/docs/contract/encodeFunctionResult";
|
2712
2725
|
function encodeFunctionResult({
|
2713
2726
|
abi,
|
2714
2727
|
functionName,
|
@@ -2718,9 +2731,9 @@ function encodeFunctionResult({
|
|
2718
2731
|
(x) => "name" in x && x.name === functionName
|
2719
2732
|
);
|
2720
2733
|
if (!description)
|
2721
|
-
throw new AbiFunctionNotFoundError(functionName, { docsPath:
|
2734
|
+
throw new AbiFunctionNotFoundError(functionName, { docsPath: docsPath5 });
|
2722
2735
|
if (!("outputs" in description))
|
2723
|
-
throw new AbiFunctionOutputsNotFoundError(functionName, { docsPath:
|
2736
|
+
throw new AbiFunctionOutputsNotFoundError(functionName, { docsPath: docsPath5 });
|
2724
2737
|
let values = Array.isArray(result) ? result : [result];
|
2725
2738
|
if (description.outputs.length === 0 && !values[0])
|
2726
2739
|
values = [];
|
@@ -3238,14 +3251,14 @@ function getNodeError(err, args) {
|
|
3238
3251
|
|
3239
3252
|
// src/utils/errors/getCallError.ts
|
3240
3253
|
function getCallError(err, {
|
3241
|
-
docsPath:
|
3254
|
+
docsPath: docsPath6,
|
3242
3255
|
...args
|
3243
3256
|
}) {
|
3244
3257
|
let cause = err;
|
3245
3258
|
if (containsNodeError(err))
|
3246
3259
|
cause = getNodeError(err, args);
|
3247
3260
|
return new CallExecutionError(cause, {
|
3248
|
-
docsPath:
|
3261
|
+
docsPath: docsPath6,
|
3249
3262
|
...args
|
3250
3263
|
});
|
3251
3264
|
}
|
@@ -3256,7 +3269,7 @@ function getContractError(err, {
|
|
3256
3269
|
abi,
|
3257
3270
|
address,
|
3258
3271
|
args,
|
3259
|
-
docsPath:
|
3272
|
+
docsPath: docsPath6,
|
3260
3273
|
functionName,
|
3261
3274
|
sender
|
3262
3275
|
}) {
|
@@ -3276,7 +3289,7 @@ function getContractError(err, {
|
|
3276
3289
|
abi,
|
3277
3290
|
args,
|
3278
3291
|
contractAddress: address,
|
3279
|
-
docsPath:
|
3292
|
+
docsPath: docsPath6,
|
3280
3293
|
functionName,
|
3281
3294
|
sender
|
3282
3295
|
});
|
@@ -3284,28 +3297,28 @@ function getContractError(err, {
|
|
3284
3297
|
|
3285
3298
|
// src/utils/errors/getEstimateGasError.ts
|
3286
3299
|
function getEstimateGasError(err, {
|
3287
|
-
docsPath:
|
3300
|
+
docsPath: docsPath6,
|
3288
3301
|
...args
|
3289
3302
|
}) {
|
3290
3303
|
let cause = err;
|
3291
3304
|
if (containsNodeError(err))
|
3292
3305
|
cause = getNodeError(err, args);
|
3293
3306
|
return new EstimateGasExecutionError(cause, {
|
3294
|
-
docsPath:
|
3307
|
+
docsPath: docsPath6,
|
3295
3308
|
...args
|
3296
3309
|
});
|
3297
3310
|
}
|
3298
3311
|
|
3299
3312
|
// src/utils/errors/getTransactionError.ts
|
3300
3313
|
function getTransactionError(err, {
|
3301
|
-
docsPath:
|
3314
|
+
docsPath: docsPath6,
|
3302
3315
|
...args
|
3303
3316
|
}) {
|
3304
3317
|
let cause = err;
|
3305
3318
|
if (containsNodeError(err))
|
3306
3319
|
cause = getNodeError(err, args);
|
3307
3320
|
return new TransactionExecutionError(cause, {
|
3308
|
-
docsPath:
|
3321
|
+
docsPath: docsPath6,
|
3309
3322
|
...args
|
3310
3323
|
});
|
3311
3324
|
}
|
@@ -4371,8 +4384,10 @@ function watchBlockNumber(client, {
|
|
4371
4384
|
}
|
4372
4385
|
}
|
4373
4386
|
}
|
4374
|
-
prevBlockNumber
|
4375
|
-
|
4387
|
+
if (!prevBlockNumber || blockNumber > prevBlockNumber) {
|
4388
|
+
emit.onBlockNumber(blockNumber, prevBlockNumber);
|
4389
|
+
prevBlockNumber = blockNumber;
|
4390
|
+
}
|
4376
4391
|
} catch (err) {
|
4377
4392
|
emit.onError?.(err);
|
4378
4393
|
}
|
@@ -4428,8 +4443,16 @@ function watchBlocks(client, {
|
|
4428
4443
|
}
|
4429
4444
|
}
|
4430
4445
|
}
|
4431
|
-
|
4432
|
-
|
4446
|
+
if (
|
4447
|
+
// If no previous block exists, emit.
|
4448
|
+
!prevBlock?.number || // If the block tag is "pending" with no block number, emit.
|
4449
|
+
blockTag === "pending" && !block?.number || // If the next block number is greater than the previous block number, emit.
|
4450
|
+
// We don't want to emit blocks in the past.
|
4451
|
+
block.number && block.number > prevBlock.number
|
4452
|
+
) {
|
4453
|
+
emit.onBlock(block, prevBlock);
|
4454
|
+
prevBlock = block;
|
4455
|
+
}
|
4433
4456
|
} catch (err) {
|
4434
4457
|
emit.onError?.(err);
|
4435
4458
|
}
|
@@ -5261,6 +5284,7 @@ export {
|
|
5261
5284
|
AbiErrorInputsNotFoundError,
|
5262
5285
|
AbiErrorNotFoundError,
|
5263
5286
|
AbiErrorSignatureNotFoundError,
|
5287
|
+
AbiEventSignatureEmptyTopicsError,
|
5264
5288
|
AbiEventSignatureNotFoundError,
|
5265
5289
|
AbiEventNotFoundError,
|
5266
5290
|
AbiFunctionNotFoundError,
|
@@ -5509,4 +5533,4 @@ export {
|
|
5509
5533
|
formatGwei,
|
5510
5534
|
parseEther
|
5511
5535
|
};
|
5512
|
-
//# sourceMappingURL=chunk-
|
5536
|
+
//# sourceMappingURL=chunk-YJVNIQSC.mjs.map
|