x402-proxy 0.10.12 → 0.11.0
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/README.md +3 -3
- package/dist/{Credential-0iRzpJkF.js → Mcp-CKylLH8N.js} +209 -211
- package/dist/accounts-D5u2KBgr.js +4 -0
- package/dist/{hashTypedData-CtEdfx4y.js → accounts-D9KsVVpJ.js} +228 -3
- package/dist/{auth-J9VuNMoG.js → auth-CaCZiNCk.js} +3 -3
- package/dist/bin/cli.js +46 -51
- package/dist/{decodeFunctionData-JPOUdvil.js → call-CNxk2xpg.js} +2084 -144
- package/dist/{decodeFunctionData-DuFcwhC_.js → call-DdUUzMfg.js} +11 -16
- package/dist/{ccip-C6CQOJYv.js → ccip-Cc1Fdazz.js} +1 -1
- package/dist/{ccip-Bx-zoUCJ.js → ccip-IumNC20V.js} +13 -3
- package/dist/{ccip-C2k1DD1T.js → ccip-JDVib6lf.js} +1 -1
- package/dist/{ccip-RZzsZ5Mv.js → ccip-RzF9aX_O.js} +3 -4
- package/dist/{chain-CafcHffR.js → chain-C_3Km9Dx.js} +1 -1
- package/dist/{client-Bcl2uC6u.js → client-C2DwSbYN.js} +1 -2
- package/dist/{Sse-DGR-tH7K.js → client-DqtxTnu6.js} +10249 -6224
- package/dist/client-DuqEc8Iw.js +3 -0
- package/dist/{client-DZV1cVsW.js → client-uAaF6lv2.js} +2 -2
- package/dist/{derive-DNUl8LU9.js → config-cyNyKO4-.js} +1024 -919
- package/dist/{dist-DM5_F3r5.js → dist-CFt2UZ4W.js} +1 -1
- package/dist/{dist-DxJCYyL5.js → dist-Cwt2qrTK.js} +2 -2
- package/dist/{helpers-ChcFbdC0.js → helpers-DebIs_21.js} +2 -2
- package/dist/{sendRawTransactionSync-DvSkhZtW.js → http-J0KYM-2Y.js} +2186 -169
- package/dist/index.d.ts +0 -1
- package/dist/index.js +30107 -771
- package/dist/{index.node-l8K03uWn.js → index.node-xc-jRJ78.js} +1 -1
- package/dist/{localBatchGatewayRequest-DOdQ9bR7.js → localBatchGatewayRequest-0gr8vzH3.js} +14 -2
- package/dist/{localBatchGatewayRequest-DQkbZaSy.js → localBatchGatewayRequest-CBsFXIAU.js} +2 -2
- package/dist/{localBatchGatewayRequest-C-RPJyDO.js → localBatchGatewayRequest-CPqqSJcB.js} +2 -2
- package/dist/{schemas-BxMFYNbH.js → schemas-DzZjufD1.js} +1 -1
- package/dist/{secp256k1-BZpiyffY.js → secp256k1-Bp7LcNvI.js} +2 -7
- package/dist/secp256k1-BsaSkXlH.js +2 -0
- package/dist/{secp256k1-BjenrLl5.js → secp256k1-BwSAYyif.js} +2 -2
- package/dist/secp256k1-CHAXu2gP.js +3 -0
- package/dist/{server-D2apWWY9.js → server-Dbsk9dql.js} +2 -2
- package/dist/setup-BdSfEdx4.js +3 -0
- package/dist/{setup-BY4J49Lv.js → setup-C10O8N36.js} +16 -33
- package/dist/{hmac-59IlS_by.js → sha2-XLg3s2a9.js} +81 -81
- package/dist/{sha256-FAs0qeni.js → sha256-DCLdwsRU.js} +1 -1
- package/dist/{sha3-DbMJRJ3C.js → sha3-03id956K.js} +1 -1
- package/dist/{sha3-CYkWM8Xa.js → sha3-VSia5eGE.js} +1 -1
- package/dist/{sse-qIEKrJEZ.js → sse-kba68iqF.js} +2 -2
- package/dist/status-B2xUewrq.js +3 -0
- package/dist/{status-CD_fCzGf.js → status-DjZdIeES.js} +2 -3
- package/dist/{stdio-BfDjLLnd.js → stdio-CdmkLt8r.js} +3 -3
- package/dist/{streamableHttp-BkayeoEQ.js → streamableHttp-DRntYTFN.js} +2 -2
- package/dist/{types-BmyZIQ8G.js → types-BQ17ZF7g.js} +1 -1
- package/dist/{types-DlqDf-zE.js → types-DH9rDVeP.js} +1 -1
- package/dist/{utils-SeGHMW9O.js → utils-psFtUKLa.js} +53 -53
- package/dist/wallet-BsCgqUun.js +3 -0
- package/dist/{wallet-C4RiduwM.js → wallet-CUCoLEqs.js} +179 -147
- package/package.json +1 -1
- package/dist/Mcp-CSyD7Hxz.js +0 -10
- package/dist/Sse-C-KDPYh0.js +0 -16482
- package/dist/accounts-DsuvWwph.js +0 -232
- package/dist/accounts-DzvAlQRn.js +0 -5
- package/dist/accounts-IG-Cmrwy.js +0 -229
- package/dist/chain-DwfP5RGZ.js +0 -1968
- package/dist/chunk-DBEY4PJZ.js +0 -16
- package/dist/client-1XQsO-Eh.js +0 -5152
- package/dist/client-Co7Fg1lv.js +0 -6388
- package/dist/config-BUQsit4s.js +0 -3
- package/dist/config-DR1Fs_wL.js +0 -6600
- package/dist/config-rvKA3SYT.js +0 -96
- package/dist/hashTypedData-BHmP9dBd.js +0 -859
- package/dist/http-BAtucMbS.js +0 -2060
- package/dist/isAddressEqual-BLrd1Hg1.js +0 -9
- package/dist/isAddressEqual-DsAqfQOD.js +0 -10
- package/dist/parseUnits-CApwcKSD.js +0 -49
- package/dist/parseUnits-cMO2udMe.js +0 -48
- package/dist/secp256k1-CLPUX17u.js +0 -3
- package/dist/setup-wMOAgrsN.js +0 -3
- package/dist/status-_TcPMyzr.js +0 -3
- package/dist/tempo-BcTkftHK.js +0 -17
- package/dist/tempo-Bs_aydgm.js +0 -18
- package/dist/wallet-BymEHYms.js +0 -3
- /package/dist/{api-CUzmQvTQ.js → api-B5mo8tpE.js} +0 -0
- /package/dist/{dist-C2YO6HSQ.js → dist-CvV4mGO6.js} +0 -0
- /package/dist/{index.node-DPDV8w2j.js → index.node-DCvOPMK7.js} +0 -0
- /package/dist/{utils-BYjkXZDF.js → utils-B1qOlJzL.js} +0 -0
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { f as equalBytes } from "./utils-
|
|
2
|
-
import {
|
|
1
|
+
import { f as equalBytes } from "./utils-B1qOlJzL.js";
|
|
2
|
+
import { t as keccak_256 } from "./sha3-03id956K.js";
|
|
3
3
|
//#region node_modules/.pnpm/abitype@1.2.3_typescript@5.9.3_zod@4.3.6/node_modules/abitype/dist/esm/version.js
|
|
4
|
-
const version$
|
|
4
|
+
const version$2 = "1.2.3";
|
|
5
5
|
//#endregion
|
|
6
6
|
//#region node_modules/.pnpm/abitype@1.2.3_typescript@5.9.3_zod@4.3.6/node_modules/abitype/dist/esm/errors.js
|
|
7
|
-
var BaseError$
|
|
7
|
+
var BaseError$2 = class BaseError$2 extends Error {
|
|
8
8
|
constructor(shortMessage, args = {}) {
|
|
9
|
-
const details = args.cause instanceof BaseError$
|
|
10
|
-
const docsPath = args.cause instanceof BaseError$
|
|
9
|
+
const details = args.cause instanceof BaseError$2 ? args.cause.details : args.cause?.message ? args.cause.message : args.details;
|
|
10
|
+
const docsPath = args.cause instanceof BaseError$2 ? args.cause.docsPath || args.docsPath : args.docsPath;
|
|
11
11
|
const message = [
|
|
12
12
|
shortMessage || "An error occurred.",
|
|
13
13
|
"",
|
|
14
14
|
...args.metaMessages ? [...args.metaMessages, ""] : [],
|
|
15
15
|
...docsPath ? [`Docs: https://abitype.dev${docsPath}`] : [],
|
|
16
16
|
...details ? [`Details: ${details}`] : [],
|
|
17
|
-
`Version: abitype@${version$
|
|
17
|
+
`Version: abitype@${version$2}`
|
|
18
18
|
].join("\n");
|
|
19
19
|
super(message);
|
|
20
20
|
Object.defineProperty(this, "details", {
|
|
@@ -59,8 +59,8 @@ var BaseError$1 = class BaseError$1 extends Error {
|
|
|
59
59
|
function execTyped(regex, string) {
|
|
60
60
|
return regex.exec(string)?.groups;
|
|
61
61
|
}
|
|
62
|
-
const bytesRegex = /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/;
|
|
63
|
-
const integerRegex = /^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;
|
|
62
|
+
const bytesRegex$1 = /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/;
|
|
63
|
+
const integerRegex$1 = /^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;
|
|
64
64
|
const isTupleRegex = /^\(.+?\).*?$/;
|
|
65
65
|
//#endregion
|
|
66
66
|
//#region node_modules/.pnpm/abitype@1.2.3_typescript@5.9.3_zod@4.3.6/node_modules/abitype/dist/esm/human-readable/formatAbiParameter.js
|
|
@@ -129,7 +129,7 @@ function formatAbiParameters(abiParameters) {
|
|
|
129
129
|
* @param abiItem - ABI item
|
|
130
130
|
* @returns Human-readable ABI item
|
|
131
131
|
*/
|
|
132
|
-
function formatAbiItem(abiItem) {
|
|
132
|
+
function formatAbiItem$1(abiItem) {
|
|
133
133
|
if (abiItem.type === "function") return `function ${abiItem.name}(${formatAbiParameters(abiItem.inputs)})${abiItem.stateMutability && abiItem.stateMutability !== "nonpayable" ? ` ${abiItem.stateMutability}` : ""}${abiItem.outputs?.length ? ` returns (${formatAbiParameters(abiItem.outputs)})` : ""}`;
|
|
134
134
|
if (abiItem.type === "event") return `event ${abiItem.name}(${formatAbiParameters(abiItem.inputs)})`;
|
|
135
135
|
if (abiItem.type === "error") return `error ${abiItem.name}(${formatAbiParameters(abiItem.inputs)})`;
|
|
@@ -199,7 +199,7 @@ const functionModifiers = new Set([
|
|
|
199
199
|
]);
|
|
200
200
|
//#endregion
|
|
201
201
|
//#region node_modules/.pnpm/abitype@1.2.3_typescript@5.9.3_zod@4.3.6/node_modules/abitype/dist/esm/human-readable/errors/abiItem.js
|
|
202
|
-
var UnknownTypeError = class extends BaseError$
|
|
202
|
+
var UnknownTypeError = class extends BaseError$2 {
|
|
203
203
|
constructor({ type }) {
|
|
204
204
|
super("Unknown type.", { metaMessages: [`Type "${type}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`] });
|
|
205
205
|
Object.defineProperty(this, "name", {
|
|
@@ -210,7 +210,7 @@ var UnknownTypeError = class extends BaseError$1 {
|
|
|
210
210
|
});
|
|
211
211
|
}
|
|
212
212
|
};
|
|
213
|
-
var UnknownSolidityTypeError = class extends BaseError$
|
|
213
|
+
var UnknownSolidityTypeError = class extends BaseError$2 {
|
|
214
214
|
constructor({ type }) {
|
|
215
215
|
super("Unknown type.", { metaMessages: [`Type "${type}" is not a valid ABI type.`] });
|
|
216
216
|
Object.defineProperty(this, "name", {
|
|
@@ -223,7 +223,7 @@ var UnknownSolidityTypeError = class extends BaseError$1 {
|
|
|
223
223
|
};
|
|
224
224
|
//#endregion
|
|
225
225
|
//#region node_modules/.pnpm/abitype@1.2.3_typescript@5.9.3_zod@4.3.6/node_modules/abitype/dist/esm/human-readable/errors/abiParameter.js
|
|
226
|
-
var InvalidAbiParametersError = class extends BaseError$
|
|
226
|
+
var InvalidAbiParametersError = class extends BaseError$2 {
|
|
227
227
|
constructor({ params }) {
|
|
228
228
|
super("Failed to parse ABI parameters.", {
|
|
229
229
|
details: `parseAbiParameters(${JSON.stringify(params, null, 2)})`,
|
|
@@ -237,7 +237,7 @@ var InvalidAbiParametersError = class extends BaseError$1 {
|
|
|
237
237
|
});
|
|
238
238
|
}
|
|
239
239
|
};
|
|
240
|
-
var InvalidParameterError = class extends BaseError$
|
|
240
|
+
var InvalidParameterError = class extends BaseError$2 {
|
|
241
241
|
constructor({ param }) {
|
|
242
242
|
super("Invalid ABI parameter.", { details: param });
|
|
243
243
|
Object.defineProperty(this, "name", {
|
|
@@ -248,7 +248,7 @@ var InvalidParameterError = class extends BaseError$1 {
|
|
|
248
248
|
});
|
|
249
249
|
}
|
|
250
250
|
};
|
|
251
|
-
var SolidityProtectedKeywordError = class extends BaseError$
|
|
251
|
+
var SolidityProtectedKeywordError = class extends BaseError$2 {
|
|
252
252
|
constructor({ param, name }) {
|
|
253
253
|
super("Invalid ABI parameter.", {
|
|
254
254
|
details: param,
|
|
@@ -262,7 +262,7 @@ var SolidityProtectedKeywordError = class extends BaseError$1 {
|
|
|
262
262
|
});
|
|
263
263
|
}
|
|
264
264
|
};
|
|
265
|
-
var InvalidModifierError = class extends BaseError$
|
|
265
|
+
var InvalidModifierError = class extends BaseError$2 {
|
|
266
266
|
constructor({ param, type, modifier }) {
|
|
267
267
|
super("Invalid ABI parameter.", {
|
|
268
268
|
details: param,
|
|
@@ -276,7 +276,7 @@ var InvalidModifierError = class extends BaseError$1 {
|
|
|
276
276
|
});
|
|
277
277
|
}
|
|
278
278
|
};
|
|
279
|
-
var InvalidFunctionModifierError = class extends BaseError$
|
|
279
|
+
var InvalidFunctionModifierError = class extends BaseError$2 {
|
|
280
280
|
constructor({ param, type, modifier }) {
|
|
281
281
|
super("Invalid ABI parameter.", {
|
|
282
282
|
details: param,
|
|
@@ -290,7 +290,7 @@ var InvalidFunctionModifierError = class extends BaseError$1 {
|
|
|
290
290
|
});
|
|
291
291
|
}
|
|
292
292
|
};
|
|
293
|
-
var InvalidAbiTypeParameterError = class extends BaseError$
|
|
293
|
+
var InvalidAbiTypeParameterError = class extends BaseError$2 {
|
|
294
294
|
constructor({ abiParameter }) {
|
|
295
295
|
super("Invalid ABI parameter.", {
|
|
296
296
|
details: JSON.stringify(abiParameter, null, 2),
|
|
@@ -306,7 +306,7 @@ var InvalidAbiTypeParameterError = class extends BaseError$1 {
|
|
|
306
306
|
};
|
|
307
307
|
//#endregion
|
|
308
308
|
//#region node_modules/.pnpm/abitype@1.2.3_typescript@5.9.3_zod@4.3.6/node_modules/abitype/dist/esm/human-readable/errors/signature.js
|
|
309
|
-
var InvalidSignatureError = class extends BaseError$
|
|
309
|
+
var InvalidSignatureError = class extends BaseError$2 {
|
|
310
310
|
constructor({ signature, type }) {
|
|
311
311
|
super(`Invalid ${type} signature.`, { details: signature });
|
|
312
312
|
Object.defineProperty(this, "name", {
|
|
@@ -317,7 +317,7 @@ var InvalidSignatureError = class extends BaseError$1 {
|
|
|
317
317
|
});
|
|
318
318
|
}
|
|
319
319
|
};
|
|
320
|
-
var UnknownSignatureError = class extends BaseError$
|
|
320
|
+
var UnknownSignatureError = class extends BaseError$2 {
|
|
321
321
|
constructor({ signature }) {
|
|
322
322
|
super("Unknown signature.", { details: signature });
|
|
323
323
|
Object.defineProperty(this, "name", {
|
|
@@ -328,7 +328,7 @@ var UnknownSignatureError = class extends BaseError$1 {
|
|
|
328
328
|
});
|
|
329
329
|
}
|
|
330
330
|
};
|
|
331
|
-
var InvalidStructSignatureError = class extends BaseError$
|
|
331
|
+
var InvalidStructSignatureError = class extends BaseError$2 {
|
|
332
332
|
constructor({ signature }) {
|
|
333
333
|
super("Invalid struct signature.", {
|
|
334
334
|
details: signature,
|
|
@@ -344,7 +344,7 @@ var InvalidStructSignatureError = class extends BaseError$1 {
|
|
|
344
344
|
};
|
|
345
345
|
//#endregion
|
|
346
346
|
//#region node_modules/.pnpm/abitype@1.2.3_typescript@5.9.3_zod@4.3.6/node_modules/abitype/dist/esm/human-readable/errors/struct.js
|
|
347
|
-
var CircularReferenceError = class extends BaseError$
|
|
347
|
+
var CircularReferenceError = class extends BaseError$2 {
|
|
348
348
|
constructor({ type }) {
|
|
349
349
|
super("Circular reference detected.", { metaMessages: [`Struct "${type}" is a circular reference.`] });
|
|
350
350
|
Object.defineProperty(this, "name", {
|
|
@@ -357,7 +357,7 @@ var CircularReferenceError = class extends BaseError$1 {
|
|
|
357
357
|
};
|
|
358
358
|
//#endregion
|
|
359
359
|
//#region node_modules/.pnpm/abitype@1.2.3_typescript@5.9.3_zod@4.3.6/node_modules/abitype/dist/esm/human-readable/errors/splitParameters.js
|
|
360
|
-
var InvalidParenthesisError = class extends BaseError$
|
|
360
|
+
var InvalidParenthesisError = class extends BaseError$2 {
|
|
361
361
|
constructor({ current, depth }) {
|
|
362
362
|
super("Unbalanced parentheses.", {
|
|
363
363
|
metaMessages: [`"${current.trim()}" has too many ${depth > 0 ? "opening" : "closing"} parentheses.`],
|
|
@@ -699,12 +699,12 @@ function splitParameters(params, result = [], current = "", depth = 0) {
|
|
|
699
699
|
return result;
|
|
700
700
|
}
|
|
701
701
|
function isSolidityType(type) {
|
|
702
|
-
return type === "address" || type === "bool" || type === "function" || type === "string" || bytesRegex.test(type) || integerRegex.test(type);
|
|
702
|
+
return type === "address" || type === "bool" || type === "function" || type === "string" || bytesRegex$1.test(type) || integerRegex$1.test(type);
|
|
703
703
|
}
|
|
704
704
|
const protectedKeywordsRegex = /^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/;
|
|
705
705
|
/** @internal */
|
|
706
706
|
function isSolidityKeyword(name) {
|
|
707
|
-
return name === "address" || name === "bool" || name === "function" || name === "string" || name === "tuple" || bytesRegex.test(name) || integerRegex.test(name) || protectedKeywordsRegex.test(name);
|
|
707
|
+
return name === "address" || name === "bool" || name === "function" || name === "string" || name === "tuple" || bytesRegex$1.test(name) || integerRegex$1.test(name) || protectedKeywordsRegex.test(name);
|
|
708
708
|
}
|
|
709
709
|
/** @internal */
|
|
710
710
|
function isValidDataLocation(type, isArray) {
|
|
@@ -795,100 +795,1398 @@ function parseAbi(signatures) {
|
|
|
795
795
|
return abi;
|
|
796
796
|
}
|
|
797
797
|
//#endregion
|
|
798
|
-
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/
|
|
799
|
-
|
|
800
|
-
function
|
|
801
|
-
return
|
|
798
|
+
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/abi/formatAbiItem.js
|
|
799
|
+
function formatAbiItem(abiItem, { includeName = false } = {}) {
|
|
800
|
+
if (abiItem.type !== "function" && abiItem.type !== "event" && abiItem.type !== "error") throw new InvalidDefinitionTypeError(abiItem.type);
|
|
801
|
+
return `${abiItem.name}(${formatAbiParams(abiItem.inputs, { includeName })})`;
|
|
802
|
+
}
|
|
803
|
+
function formatAbiParams(params, { includeName = false } = {}) {
|
|
804
|
+
if (!params) return "";
|
|
805
|
+
return params.map((param) => formatAbiParam(param, { includeName })).join(includeName ? ", " : ",");
|
|
806
|
+
}
|
|
807
|
+
function formatAbiParam(param, { includeName }) {
|
|
808
|
+
if (param.type.startsWith("tuple")) return `(${formatAbiParams(param.components, { includeName })})${param.type.slice(5)}`;
|
|
809
|
+
return param.type + (includeName && param.name ? ` ${param.name}` : "");
|
|
802
810
|
}
|
|
803
811
|
//#endregion
|
|
804
|
-
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/
|
|
805
|
-
function
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
let result = "";
|
|
810
|
-
let valid = false;
|
|
811
|
-
for (let i = 0; i < signature.length; i++) {
|
|
812
|
-
const char = signature[i];
|
|
813
|
-
if ([
|
|
814
|
-
"(",
|
|
815
|
-
")",
|
|
816
|
-
","
|
|
817
|
-
].includes(char)) active = true;
|
|
818
|
-
if (char === "(") level++;
|
|
819
|
-
if (char === ")") level--;
|
|
820
|
-
if (!active) continue;
|
|
821
|
-
if (level === 0) {
|
|
822
|
-
if (char === " " && [
|
|
823
|
-
"event",
|
|
824
|
-
"function",
|
|
825
|
-
""
|
|
826
|
-
].includes(result)) result = "";
|
|
827
|
-
else {
|
|
828
|
-
result += char;
|
|
829
|
-
if (char === ")") {
|
|
830
|
-
valid = true;
|
|
831
|
-
break;
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
continue;
|
|
835
|
-
}
|
|
836
|
-
if (char === " ") {
|
|
837
|
-
if (signature[i - 1] !== "," && current !== "," && current !== ",(") {
|
|
838
|
-
current = "";
|
|
839
|
-
active = false;
|
|
840
|
-
}
|
|
841
|
-
continue;
|
|
842
|
-
}
|
|
843
|
-
result += char;
|
|
844
|
-
current += char;
|
|
845
|
-
}
|
|
846
|
-
if (!valid) throw new BaseError$2("Unable to normalize signature.");
|
|
847
|
-
return result;
|
|
812
|
+
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/data/isHex.js
|
|
813
|
+
function isHex(value, { strict = true } = {}) {
|
|
814
|
+
if (!value) return false;
|
|
815
|
+
if (typeof value !== "string") return false;
|
|
816
|
+
return strict ? /^0x[0-9a-fA-F]*$/.test(value) : value.startsWith("0x");
|
|
848
817
|
}
|
|
849
818
|
//#endregion
|
|
850
|
-
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/
|
|
819
|
+
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/data/size.js
|
|
851
820
|
/**
|
|
852
|
-
*
|
|
853
|
-
*
|
|
854
|
-
* @example
|
|
855
|
-
* const signature = toSignature('function ownerOf(uint256 tokenId)')
|
|
856
|
-
* // 'ownerOf(uint256)'
|
|
821
|
+
* @description Retrieves the size of the value (in bytes).
|
|
857
822
|
*
|
|
858
|
-
* @
|
|
859
|
-
*
|
|
860
|
-
* name: 'ownerOf',
|
|
861
|
-
* type: 'function',
|
|
862
|
-
* inputs: [{ name: 'tokenId', type: 'uint256' }],
|
|
863
|
-
* outputs: [],
|
|
864
|
-
* stateMutability: 'view',
|
|
865
|
-
* })
|
|
866
|
-
* // 'ownerOf(uint256)'
|
|
823
|
+
* @param value The value (hex or byte array) to retrieve the size of.
|
|
824
|
+
* @returns The size of the value (in bytes).
|
|
867
825
|
*/
|
|
868
|
-
|
|
869
|
-
return
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
})());
|
|
873
|
-
};
|
|
826
|
+
function size$2(value) {
|
|
827
|
+
if (isHex(value, { strict: false })) return Math.ceil((value.length - 2) / 2);
|
|
828
|
+
return value.length;
|
|
829
|
+
}
|
|
874
830
|
//#endregion
|
|
875
|
-
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
831
|
+
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/errors/version.js
|
|
832
|
+
const version$1 = "2.47.6";
|
|
833
|
+
//#endregion
|
|
834
|
+
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/errors/base.js
|
|
835
|
+
let errorConfig = {
|
|
836
|
+
getDocsUrl: ({ docsBaseUrl, docsPath = "", docsSlug }) => docsPath ? `${docsBaseUrl ?? "https://viem.sh"}${docsPath}${docsSlug ? `#${docsSlug}` : ""}` : void 0,
|
|
837
|
+
version: `viem@${version$1}`
|
|
838
|
+
};
|
|
839
|
+
var BaseError$1 = class BaseError$1 extends Error {
|
|
840
|
+
constructor(shortMessage, args = {}) {
|
|
841
|
+
const details = (() => {
|
|
842
|
+
if (args.cause instanceof BaseError$1) return args.cause.details;
|
|
843
|
+
if (args.cause?.message) return args.cause.message;
|
|
844
|
+
return args.details;
|
|
845
|
+
})();
|
|
846
|
+
const docsPath = (() => {
|
|
847
|
+
if (args.cause instanceof BaseError$1) return args.cause.docsPath || args.docsPath;
|
|
848
|
+
return args.docsPath;
|
|
849
|
+
})();
|
|
850
|
+
const docsUrl = errorConfig.getDocsUrl?.({
|
|
851
|
+
...args,
|
|
852
|
+
docsPath
|
|
853
|
+
});
|
|
854
|
+
const message = [
|
|
855
|
+
shortMessage || "An error occurred.",
|
|
856
|
+
"",
|
|
857
|
+
...args.metaMessages ? [...args.metaMessages, ""] : [],
|
|
858
|
+
...docsUrl ? [`Docs: ${docsUrl}`] : [],
|
|
859
|
+
...details ? [`Details: ${details}`] : [],
|
|
860
|
+
...errorConfig.version ? [`Version: ${errorConfig.version}`] : []
|
|
861
|
+
].join("\n");
|
|
862
|
+
super(message, args.cause ? { cause: args.cause } : void 0);
|
|
863
|
+
Object.defineProperty(this, "details", {
|
|
864
|
+
enumerable: true,
|
|
865
|
+
configurable: true,
|
|
866
|
+
writable: true,
|
|
867
|
+
value: void 0
|
|
868
|
+
});
|
|
869
|
+
Object.defineProperty(this, "docsPath", {
|
|
870
|
+
enumerable: true,
|
|
871
|
+
configurable: true,
|
|
872
|
+
writable: true,
|
|
873
|
+
value: void 0
|
|
874
|
+
});
|
|
875
|
+
Object.defineProperty(this, "metaMessages", {
|
|
876
|
+
enumerable: true,
|
|
877
|
+
configurable: true,
|
|
878
|
+
writable: true,
|
|
879
|
+
value: void 0
|
|
880
|
+
});
|
|
881
|
+
Object.defineProperty(this, "shortMessage", {
|
|
882
|
+
enumerable: true,
|
|
883
|
+
configurable: true,
|
|
884
|
+
writable: true,
|
|
885
|
+
value: void 0
|
|
886
|
+
});
|
|
887
|
+
Object.defineProperty(this, "version", {
|
|
888
|
+
enumerable: true,
|
|
889
|
+
configurable: true,
|
|
890
|
+
writable: true,
|
|
891
|
+
value: void 0
|
|
892
|
+
});
|
|
893
|
+
Object.defineProperty(this, "name", {
|
|
894
|
+
enumerable: true,
|
|
895
|
+
configurable: true,
|
|
896
|
+
writable: true,
|
|
897
|
+
value: "BaseError"
|
|
898
|
+
});
|
|
899
|
+
this.details = details;
|
|
900
|
+
this.docsPath = docsPath;
|
|
901
|
+
this.metaMessages = args.metaMessages;
|
|
902
|
+
this.name = args.name ?? this.name;
|
|
903
|
+
this.shortMessage = shortMessage;
|
|
904
|
+
this.version = version$1;
|
|
905
|
+
}
|
|
906
|
+
walk(fn) {
|
|
907
|
+
return walk$1(this, fn);
|
|
908
|
+
}
|
|
909
|
+
};
|
|
910
|
+
function walk$1(err, fn) {
|
|
911
|
+
if (fn?.(err)) return err;
|
|
912
|
+
if (err && typeof err === "object" && "cause" in err && err.cause !== void 0) return walk$1(err.cause, fn);
|
|
913
|
+
return fn ? null : err;
|
|
881
914
|
}
|
|
882
915
|
//#endregion
|
|
883
|
-
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
916
|
+
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/errors/abi.js
|
|
917
|
+
var AbiConstructorNotFoundError = class extends BaseError$1 {
|
|
918
|
+
constructor({ docsPath }) {
|
|
919
|
+
super(["A constructor was not found on the ABI.", "Make sure you are using the correct ABI and that the constructor exists on it."].join("\n"), {
|
|
920
|
+
docsPath,
|
|
921
|
+
name: "AbiConstructorNotFoundError"
|
|
922
|
+
});
|
|
923
|
+
}
|
|
924
|
+
};
|
|
925
|
+
var AbiConstructorParamsNotFoundError = class extends BaseError$1 {
|
|
926
|
+
constructor({ docsPath }) {
|
|
927
|
+
super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.", "Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join("\n"), {
|
|
928
|
+
docsPath,
|
|
929
|
+
name: "AbiConstructorParamsNotFoundError"
|
|
930
|
+
});
|
|
931
|
+
}
|
|
932
|
+
};
|
|
933
|
+
var AbiDecodingDataSizeTooSmallError = class extends BaseError$1 {
|
|
934
|
+
constructor({ data, params, size }) {
|
|
935
|
+
super([`Data size of ${size} bytes is too small for given parameters.`].join("\n"), {
|
|
936
|
+
metaMessages: [`Params: (${formatAbiParams(params, { includeName: true })})`, `Data: ${data} (${size} bytes)`],
|
|
937
|
+
name: "AbiDecodingDataSizeTooSmallError"
|
|
938
|
+
});
|
|
939
|
+
Object.defineProperty(this, "data", {
|
|
940
|
+
enumerable: true,
|
|
941
|
+
configurable: true,
|
|
942
|
+
writable: true,
|
|
943
|
+
value: void 0
|
|
944
|
+
});
|
|
945
|
+
Object.defineProperty(this, "params", {
|
|
946
|
+
enumerable: true,
|
|
947
|
+
configurable: true,
|
|
948
|
+
writable: true,
|
|
949
|
+
value: void 0
|
|
950
|
+
});
|
|
951
|
+
Object.defineProperty(this, "size", {
|
|
952
|
+
enumerable: true,
|
|
953
|
+
configurable: true,
|
|
954
|
+
writable: true,
|
|
955
|
+
value: void 0
|
|
956
|
+
});
|
|
957
|
+
this.data = data;
|
|
958
|
+
this.params = params;
|
|
959
|
+
this.size = size;
|
|
960
|
+
}
|
|
961
|
+
};
|
|
962
|
+
var AbiDecodingZeroDataError = class extends BaseError$1 {
|
|
963
|
+
constructor({ cause } = {}) {
|
|
964
|
+
super("Cannot decode zero data (\"0x\") with ABI parameters.", {
|
|
965
|
+
name: "AbiDecodingZeroDataError",
|
|
966
|
+
cause
|
|
967
|
+
});
|
|
968
|
+
}
|
|
969
|
+
};
|
|
970
|
+
var AbiEncodingArrayLengthMismatchError = class extends BaseError$1 {
|
|
971
|
+
constructor({ expectedLength, givenLength, type }) {
|
|
972
|
+
super([
|
|
973
|
+
`ABI encoding array length mismatch for type ${type}.`,
|
|
974
|
+
`Expected length: ${expectedLength}`,
|
|
975
|
+
`Given length: ${givenLength}`
|
|
976
|
+
].join("\n"), { name: "AbiEncodingArrayLengthMismatchError" });
|
|
977
|
+
}
|
|
978
|
+
};
|
|
979
|
+
var AbiEncodingBytesSizeMismatchError = class extends BaseError$1 {
|
|
980
|
+
constructor({ expectedSize, value }) {
|
|
981
|
+
super(`Size of bytes "${value}" (bytes${size$2(value)}) does not match expected size (bytes${expectedSize}).`, { name: "AbiEncodingBytesSizeMismatchError" });
|
|
982
|
+
}
|
|
983
|
+
};
|
|
984
|
+
var AbiEncodingLengthMismatchError = class extends BaseError$1 {
|
|
985
|
+
constructor({ expectedLength, givenLength }) {
|
|
986
|
+
super([
|
|
987
|
+
"ABI encoding params/values length mismatch.",
|
|
988
|
+
`Expected length (params): ${expectedLength}`,
|
|
989
|
+
`Given length (values): ${givenLength}`
|
|
990
|
+
].join("\n"), { name: "AbiEncodingLengthMismatchError" });
|
|
991
|
+
}
|
|
992
|
+
};
|
|
993
|
+
var AbiErrorInputsNotFoundError = class extends BaseError$1 {
|
|
994
|
+
constructor(errorName, { docsPath }) {
|
|
995
|
+
super([
|
|
996
|
+
`Arguments (\`args\`) were provided to "${errorName}", but "${errorName}" on the ABI does not contain any parameters (\`inputs\`).`,
|
|
997
|
+
"Cannot encode error result without knowing what the parameter types are.",
|
|
998
|
+
"Make sure you are using the correct ABI and that the inputs exist on it."
|
|
999
|
+
].join("\n"), {
|
|
1000
|
+
docsPath,
|
|
1001
|
+
name: "AbiErrorInputsNotFoundError"
|
|
1002
|
+
});
|
|
1003
|
+
}
|
|
1004
|
+
};
|
|
1005
|
+
var AbiErrorNotFoundError = class extends BaseError$1 {
|
|
1006
|
+
constructor(errorName, { docsPath } = {}) {
|
|
1007
|
+
super([`Error ${errorName ? `"${errorName}" ` : ""}not found on ABI.`, "Make sure you are using the correct ABI and that the error exists on it."].join("\n"), {
|
|
1008
|
+
docsPath,
|
|
1009
|
+
name: "AbiErrorNotFoundError"
|
|
1010
|
+
});
|
|
1011
|
+
}
|
|
1012
|
+
};
|
|
1013
|
+
var AbiErrorSignatureNotFoundError = class extends BaseError$1 {
|
|
1014
|
+
constructor(signature, { docsPath, cause }) {
|
|
1015
|
+
super([
|
|
1016
|
+
`Encoded error signature "${signature}" not found on ABI.`,
|
|
1017
|
+
"Make sure you are using the correct ABI and that the error exists on it.",
|
|
1018
|
+
`You can look up the decoded signature here: https://4byte.sourcify.dev/?q=${signature}.`
|
|
1019
|
+
].join("\n"), {
|
|
1020
|
+
docsPath,
|
|
1021
|
+
name: "AbiErrorSignatureNotFoundError",
|
|
1022
|
+
cause
|
|
1023
|
+
});
|
|
1024
|
+
Object.defineProperty(this, "signature", {
|
|
1025
|
+
enumerable: true,
|
|
1026
|
+
configurable: true,
|
|
1027
|
+
writable: true,
|
|
1028
|
+
value: void 0
|
|
1029
|
+
});
|
|
1030
|
+
this.signature = signature;
|
|
1031
|
+
}
|
|
1032
|
+
};
|
|
1033
|
+
var AbiEventSignatureEmptyTopicsError = class extends BaseError$1 {
|
|
1034
|
+
constructor({ docsPath }) {
|
|
1035
|
+
super("Cannot extract event signature from empty topics.", {
|
|
1036
|
+
docsPath,
|
|
1037
|
+
name: "AbiEventSignatureEmptyTopicsError"
|
|
1038
|
+
});
|
|
1039
|
+
}
|
|
1040
|
+
};
|
|
1041
|
+
var AbiEventSignatureNotFoundError = class extends BaseError$1 {
|
|
1042
|
+
constructor(signature, { docsPath }) {
|
|
1043
|
+
super([
|
|
1044
|
+
`Encoded event signature "${signature}" not found on ABI.`,
|
|
1045
|
+
"Make sure you are using the correct ABI and that the event exists on it.",
|
|
1046
|
+
`You can look up the signature here: https://4byte.sourcify.dev/?q=${signature}.`
|
|
1047
|
+
].join("\n"), {
|
|
1048
|
+
docsPath,
|
|
1049
|
+
name: "AbiEventSignatureNotFoundError"
|
|
1050
|
+
});
|
|
1051
|
+
}
|
|
1052
|
+
};
|
|
1053
|
+
var AbiFunctionNotFoundError = class extends BaseError$1 {
|
|
1054
|
+
constructor(functionName, { docsPath } = {}) {
|
|
1055
|
+
super([`Function ${functionName ? `"${functionName}" ` : ""}not found on ABI.`, "Make sure you are using the correct ABI and that the function exists on it."].join("\n"), {
|
|
1056
|
+
docsPath,
|
|
1057
|
+
name: "AbiFunctionNotFoundError"
|
|
1058
|
+
});
|
|
1059
|
+
}
|
|
1060
|
+
};
|
|
1061
|
+
var AbiFunctionOutputsNotFoundError = class extends BaseError$1 {
|
|
1062
|
+
constructor(functionName, { docsPath }) {
|
|
1063
|
+
super([
|
|
1064
|
+
`Function "${functionName}" does not contain any \`outputs\` on ABI.`,
|
|
1065
|
+
"Cannot decode function result without knowing what the parameter types are.",
|
|
1066
|
+
"Make sure you are using the correct ABI and that the function exists on it."
|
|
1067
|
+
].join("\n"), {
|
|
1068
|
+
docsPath,
|
|
1069
|
+
name: "AbiFunctionOutputsNotFoundError"
|
|
1070
|
+
});
|
|
1071
|
+
}
|
|
1072
|
+
};
|
|
1073
|
+
var AbiFunctionSignatureNotFoundError = class extends BaseError$1 {
|
|
1074
|
+
constructor(signature, { docsPath }) {
|
|
1075
|
+
super([
|
|
1076
|
+
`Encoded function signature "${signature}" not found on ABI.`,
|
|
1077
|
+
"Make sure you are using the correct ABI and that the function exists on it.",
|
|
1078
|
+
`You can look up the signature here: https://4byte.sourcify.dev/?q=${signature}.`
|
|
1079
|
+
].join("\n"), {
|
|
1080
|
+
docsPath,
|
|
1081
|
+
name: "AbiFunctionSignatureNotFoundError"
|
|
1082
|
+
});
|
|
1083
|
+
}
|
|
1084
|
+
};
|
|
1085
|
+
var AbiItemAmbiguityError = class extends BaseError$1 {
|
|
1086
|
+
constructor(x, y) {
|
|
1087
|
+
super("Found ambiguous types in overloaded ABI items.", {
|
|
1088
|
+
metaMessages: [
|
|
1089
|
+
`\`${x.type}\` in \`${formatAbiItem(x.abiItem)}\`, and`,
|
|
1090
|
+
`\`${y.type}\` in \`${formatAbiItem(y.abiItem)}\``,
|
|
1091
|
+
"",
|
|
1092
|
+
"These types encode differently and cannot be distinguished at runtime.",
|
|
1093
|
+
"Remove one of the ambiguous items in the ABI."
|
|
1094
|
+
],
|
|
1095
|
+
name: "AbiItemAmbiguityError"
|
|
1096
|
+
});
|
|
1097
|
+
}
|
|
1098
|
+
};
|
|
1099
|
+
var BytesSizeMismatchError = class extends BaseError$1 {
|
|
1100
|
+
constructor({ expectedSize, givenSize }) {
|
|
1101
|
+
super(`Expected bytes${expectedSize}, got bytes${givenSize}.`, { name: "BytesSizeMismatchError" });
|
|
1102
|
+
}
|
|
1103
|
+
};
|
|
1104
|
+
var DecodeLogDataMismatch = class extends BaseError$1 {
|
|
1105
|
+
constructor({ abiItem, data, params, size }) {
|
|
1106
|
+
super([`Data size of ${size} bytes is too small for non-indexed event parameters.`].join("\n"), {
|
|
1107
|
+
metaMessages: [`Params: (${formatAbiParams(params, { includeName: true })})`, `Data: ${data} (${size} bytes)`],
|
|
1108
|
+
name: "DecodeLogDataMismatch"
|
|
1109
|
+
});
|
|
1110
|
+
Object.defineProperty(this, "abiItem", {
|
|
1111
|
+
enumerable: true,
|
|
1112
|
+
configurable: true,
|
|
1113
|
+
writable: true,
|
|
1114
|
+
value: void 0
|
|
1115
|
+
});
|
|
1116
|
+
Object.defineProperty(this, "data", {
|
|
1117
|
+
enumerable: true,
|
|
1118
|
+
configurable: true,
|
|
1119
|
+
writable: true,
|
|
1120
|
+
value: void 0
|
|
1121
|
+
});
|
|
1122
|
+
Object.defineProperty(this, "params", {
|
|
1123
|
+
enumerable: true,
|
|
1124
|
+
configurable: true,
|
|
1125
|
+
writable: true,
|
|
1126
|
+
value: void 0
|
|
1127
|
+
});
|
|
1128
|
+
Object.defineProperty(this, "size", {
|
|
1129
|
+
enumerable: true,
|
|
1130
|
+
configurable: true,
|
|
1131
|
+
writable: true,
|
|
1132
|
+
value: void 0
|
|
1133
|
+
});
|
|
1134
|
+
this.abiItem = abiItem;
|
|
1135
|
+
this.data = data;
|
|
1136
|
+
this.params = params;
|
|
1137
|
+
this.size = size;
|
|
1138
|
+
}
|
|
1139
|
+
};
|
|
1140
|
+
var DecodeLogTopicsMismatch = class extends BaseError$1 {
|
|
1141
|
+
constructor({ abiItem, param }) {
|
|
1142
|
+
super([`Expected a topic for indexed event parameter${param.name ? ` "${param.name}"` : ""} on event "${formatAbiItem(abiItem, { includeName: true })}".`].join("\n"), { name: "DecodeLogTopicsMismatch" });
|
|
1143
|
+
Object.defineProperty(this, "abiItem", {
|
|
1144
|
+
enumerable: true,
|
|
1145
|
+
configurable: true,
|
|
1146
|
+
writable: true,
|
|
1147
|
+
value: void 0
|
|
1148
|
+
});
|
|
1149
|
+
this.abiItem = abiItem;
|
|
1150
|
+
}
|
|
1151
|
+
};
|
|
1152
|
+
var InvalidAbiEncodingTypeError = class extends BaseError$1 {
|
|
1153
|
+
constructor(type, { docsPath }) {
|
|
1154
|
+
super([`Type "${type}" is not a valid encoding type.`, "Please provide a valid ABI type."].join("\n"), {
|
|
1155
|
+
docsPath,
|
|
1156
|
+
name: "InvalidAbiEncodingType"
|
|
1157
|
+
});
|
|
1158
|
+
}
|
|
1159
|
+
};
|
|
1160
|
+
var InvalidAbiDecodingTypeError = class extends BaseError$1 {
|
|
1161
|
+
constructor(type, { docsPath }) {
|
|
1162
|
+
super([`Type "${type}" is not a valid decoding type.`, "Please provide a valid ABI type."].join("\n"), {
|
|
1163
|
+
docsPath,
|
|
1164
|
+
name: "InvalidAbiDecodingType"
|
|
1165
|
+
});
|
|
1166
|
+
}
|
|
1167
|
+
};
|
|
1168
|
+
var InvalidArrayError = class extends BaseError$1 {
|
|
1169
|
+
constructor(value) {
|
|
1170
|
+
super([`Value "${value}" is not a valid array.`].join("\n"), { name: "InvalidArrayError" });
|
|
1171
|
+
}
|
|
1172
|
+
};
|
|
1173
|
+
var InvalidDefinitionTypeError = class extends BaseError$1 {
|
|
1174
|
+
constructor(type) {
|
|
1175
|
+
super([`"${type}" is not a valid definition type.`, "Valid types: \"function\", \"event\", \"error\""].join("\n"), { name: "InvalidDefinitionTypeError" });
|
|
1176
|
+
}
|
|
1177
|
+
};
|
|
1178
|
+
//#endregion
|
|
1179
|
+
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/errors/data.js
|
|
1180
|
+
var SliceOffsetOutOfBoundsError$2 = class extends BaseError$1 {
|
|
1181
|
+
constructor({ offset, position, size }) {
|
|
1182
|
+
super(`Slice ${position === "start" ? "starting" : "ending"} at offset "${offset}" is out-of-bounds (size: ${size}).`, { name: "SliceOffsetOutOfBoundsError" });
|
|
1183
|
+
}
|
|
1184
|
+
};
|
|
1185
|
+
var SizeExceedsPaddingSizeError$2 = class extends BaseError$1 {
|
|
1186
|
+
constructor({ size, targetSize, type }) {
|
|
1187
|
+
super(`${type.charAt(0).toUpperCase()}${type.slice(1).toLowerCase()} size (${size}) exceeds padding size (${targetSize}).`, { name: "SizeExceedsPaddingSizeError" });
|
|
1188
|
+
}
|
|
1189
|
+
};
|
|
1190
|
+
var InvalidBytesLengthError = class extends BaseError$1 {
|
|
1191
|
+
constructor({ size, targetSize, type }) {
|
|
1192
|
+
super(`${type.charAt(0).toUpperCase()}${type.slice(1).toLowerCase()} is expected to be ${targetSize} ${type} long, but is ${size} ${type} long.`, { name: "InvalidBytesLengthError" });
|
|
1193
|
+
}
|
|
1194
|
+
};
|
|
1195
|
+
//#endregion
|
|
1196
|
+
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/data/pad.js
|
|
1197
|
+
function pad$2(hexOrBytes, { dir, size = 32 } = {}) {
|
|
1198
|
+
if (typeof hexOrBytes === "string") return padHex(hexOrBytes, {
|
|
1199
|
+
dir,
|
|
1200
|
+
size
|
|
1201
|
+
});
|
|
1202
|
+
return padBytes(hexOrBytes, {
|
|
1203
|
+
dir,
|
|
1204
|
+
size
|
|
1205
|
+
});
|
|
1206
|
+
}
|
|
1207
|
+
function padHex(hex_, { dir, size = 32 } = {}) {
|
|
1208
|
+
if (size === null) return hex_;
|
|
1209
|
+
const hex = hex_.replace("0x", "");
|
|
1210
|
+
if (hex.length > size * 2) throw new SizeExceedsPaddingSizeError$2({
|
|
1211
|
+
size: Math.ceil(hex.length / 2),
|
|
1212
|
+
targetSize: size,
|
|
1213
|
+
type: "hex"
|
|
1214
|
+
});
|
|
1215
|
+
return `0x${hex[dir === "right" ? "padEnd" : "padStart"](size * 2, "0")}`;
|
|
1216
|
+
}
|
|
1217
|
+
function padBytes(bytes, { dir, size = 32 } = {}) {
|
|
1218
|
+
if (size === null) return bytes;
|
|
1219
|
+
if (bytes.length > size) throw new SizeExceedsPaddingSizeError$2({
|
|
1220
|
+
size: bytes.length,
|
|
1221
|
+
targetSize: size,
|
|
1222
|
+
type: "bytes"
|
|
1223
|
+
});
|
|
1224
|
+
const paddedBytes = new Uint8Array(size);
|
|
1225
|
+
for (let i = 0; i < size; i++) {
|
|
1226
|
+
const padEnd = dir === "right";
|
|
1227
|
+
paddedBytes[padEnd ? i : size - i - 1] = bytes[padEnd ? i : bytes.length - i - 1];
|
|
1228
|
+
}
|
|
1229
|
+
return paddedBytes;
|
|
1230
|
+
}
|
|
1231
|
+
//#endregion
|
|
1232
|
+
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/errors/encoding.js
|
|
1233
|
+
var IntegerOutOfRangeError$1 = class extends BaseError$1 {
|
|
1234
|
+
constructor({ max, min, signed, size, value }) {
|
|
1235
|
+
super(`Number "${value}" is not in safe ${size ? `${size * 8}-bit ${signed ? "signed" : "unsigned"} ` : ""}integer range ${max ? `(${min} to ${max})` : `(above ${min})`}`, { name: "IntegerOutOfRangeError" });
|
|
1236
|
+
}
|
|
1237
|
+
};
|
|
1238
|
+
var InvalidBytesBooleanError$1 = class extends BaseError$1 {
|
|
1239
|
+
constructor(bytes) {
|
|
1240
|
+
super(`Bytes value "${bytes}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`, { name: "InvalidBytesBooleanError" });
|
|
1241
|
+
}
|
|
1242
|
+
};
|
|
1243
|
+
var InvalidHexBooleanError = class extends BaseError$1 {
|
|
1244
|
+
constructor(hex) {
|
|
1245
|
+
super(`Hex value "${hex}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`, { name: "InvalidHexBooleanError" });
|
|
1246
|
+
}
|
|
1247
|
+
};
|
|
1248
|
+
var InvalidHexValueError$1 = class extends BaseError$1 {
|
|
1249
|
+
constructor(value) {
|
|
1250
|
+
super(`Hex value "${value}" is an odd length (${value.length}). It must be an even length.`, { name: "InvalidHexValueError" });
|
|
1251
|
+
}
|
|
1252
|
+
};
|
|
1253
|
+
var SizeOverflowError$2 = class extends BaseError$1 {
|
|
1254
|
+
constructor({ givenSize, maxSize }) {
|
|
1255
|
+
super(`Size cannot exceed ${maxSize} bytes. Given size: ${givenSize} bytes.`, { name: "SizeOverflowError" });
|
|
1256
|
+
}
|
|
1257
|
+
};
|
|
1258
|
+
//#endregion
|
|
1259
|
+
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/data/trim.js
|
|
1260
|
+
function trim$2(hexOrBytes, { dir = "left" } = {}) {
|
|
1261
|
+
let data = typeof hexOrBytes === "string" ? hexOrBytes.replace("0x", "") : hexOrBytes;
|
|
1262
|
+
let sliceLength = 0;
|
|
1263
|
+
for (let i = 0; i < data.length - 1; i++) if (data[dir === "left" ? i : data.length - i - 1].toString() === "0") sliceLength++;
|
|
1264
|
+
else break;
|
|
1265
|
+
data = dir === "left" ? data.slice(sliceLength) : data.slice(0, data.length - sliceLength);
|
|
1266
|
+
if (typeof hexOrBytes === "string") {
|
|
1267
|
+
if (data.length === 1 && dir === "right") data = `${data}0`;
|
|
1268
|
+
return `0x${data.length % 2 === 1 ? `0${data}` : data}`;
|
|
1269
|
+
}
|
|
1270
|
+
return data;
|
|
1271
|
+
}
|
|
1272
|
+
//#endregion
|
|
1273
|
+
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/encoding/fromHex.js
|
|
1274
|
+
function assertSize$2(hexOrBytes, { size }) {
|
|
1275
|
+
if (size$2(hexOrBytes) > size) throw new SizeOverflowError$2({
|
|
1276
|
+
givenSize: size$2(hexOrBytes),
|
|
1277
|
+
maxSize: size
|
|
1278
|
+
});
|
|
1279
|
+
}
|
|
1280
|
+
/**
|
|
1281
|
+
* Decodes a hex value into a bigint.
|
|
1282
|
+
*
|
|
1283
|
+
* - Docs: https://viem.sh/docs/utilities/fromHex#hextobigint
|
|
1284
|
+
*
|
|
1285
|
+
* @param hex Hex value to decode.
|
|
1286
|
+
* @param opts Options.
|
|
1287
|
+
* @returns BigInt value.
|
|
1288
|
+
*
|
|
1289
|
+
* @example
|
|
1290
|
+
* import { hexToBigInt } from 'viem'
|
|
1291
|
+
* const data = hexToBigInt('0x1a4', { signed: true })
|
|
1292
|
+
* // 420n
|
|
1293
|
+
*
|
|
1294
|
+
* @example
|
|
1295
|
+
* import { hexToBigInt } from 'viem'
|
|
1296
|
+
* const data = hexToBigInt('0x00000000000000000000000000000000000000000000000000000000000001a4', { size: 32 })
|
|
1297
|
+
* // 420n
|
|
1298
|
+
*/
|
|
1299
|
+
function hexToBigInt(hex, opts = {}) {
|
|
1300
|
+
const { signed } = opts;
|
|
1301
|
+
if (opts.size) assertSize$2(hex, { size: opts.size });
|
|
1302
|
+
const value = BigInt(hex);
|
|
1303
|
+
if (!signed) return value;
|
|
1304
|
+
const size = (hex.length - 2) / 2;
|
|
1305
|
+
if (value <= (1n << BigInt(size) * 8n - 1n) - 1n) return value;
|
|
1306
|
+
return value - BigInt(`0x${"f".padStart(size * 2, "f")}`) - 1n;
|
|
1307
|
+
}
|
|
1308
|
+
/**
|
|
1309
|
+
* Decodes a hex value into a boolean.
|
|
1310
|
+
*
|
|
1311
|
+
* - Docs: https://viem.sh/docs/utilities/fromHex#hextobool
|
|
1312
|
+
*
|
|
1313
|
+
* @param hex Hex value to decode.
|
|
1314
|
+
* @param opts Options.
|
|
1315
|
+
* @returns Boolean value.
|
|
1316
|
+
*
|
|
1317
|
+
* @example
|
|
1318
|
+
* import { hexToBool } from 'viem'
|
|
1319
|
+
* const data = hexToBool('0x01')
|
|
1320
|
+
* // true
|
|
1321
|
+
*
|
|
1322
|
+
* @example
|
|
1323
|
+
* import { hexToBool } from 'viem'
|
|
1324
|
+
* const data = hexToBool('0x0000000000000000000000000000000000000000000000000000000000000001', { size: 32 })
|
|
1325
|
+
* // true
|
|
1326
|
+
*/
|
|
1327
|
+
function hexToBool(hex_, opts = {}) {
|
|
1328
|
+
let hex = hex_;
|
|
1329
|
+
if (opts.size) {
|
|
1330
|
+
assertSize$2(hex, { size: opts.size });
|
|
1331
|
+
hex = trim$2(hex);
|
|
1332
|
+
}
|
|
1333
|
+
if (trim$2(hex) === "0x00") return false;
|
|
1334
|
+
if (trim$2(hex) === "0x01") return true;
|
|
1335
|
+
throw new InvalidHexBooleanError(hex);
|
|
1336
|
+
}
|
|
1337
|
+
/**
|
|
1338
|
+
* Decodes a hex string into a number.
|
|
1339
|
+
*
|
|
1340
|
+
* - Docs: https://viem.sh/docs/utilities/fromHex#hextonumber
|
|
1341
|
+
*
|
|
1342
|
+
* @param hex Hex value to decode.
|
|
1343
|
+
* @param opts Options.
|
|
1344
|
+
* @returns Number value.
|
|
1345
|
+
*
|
|
1346
|
+
* @example
|
|
1347
|
+
* import { hexToNumber } from 'viem'
|
|
1348
|
+
* const data = hexToNumber('0x1a4')
|
|
1349
|
+
* // 420
|
|
1350
|
+
*
|
|
1351
|
+
* @example
|
|
1352
|
+
* import { hexToNumber } from 'viem'
|
|
1353
|
+
* const data = hexToBigInt('0x00000000000000000000000000000000000000000000000000000000000001a4', { size: 32 })
|
|
1354
|
+
* // 420
|
|
1355
|
+
*/
|
|
1356
|
+
function hexToNumber(hex, opts = {}) {
|
|
1357
|
+
const value = hexToBigInt(hex, opts);
|
|
1358
|
+
const number = Number(value);
|
|
1359
|
+
if (!Number.isSafeInteger(number)) throw new IntegerOutOfRangeError$1({
|
|
1360
|
+
max: `${Number.MAX_SAFE_INTEGER}`,
|
|
1361
|
+
min: `${Number.MIN_SAFE_INTEGER}`,
|
|
1362
|
+
signed: opts.signed,
|
|
1363
|
+
size: opts.size,
|
|
1364
|
+
value: `${value}n`
|
|
1365
|
+
});
|
|
1366
|
+
return number;
|
|
1367
|
+
}
|
|
1368
|
+
//#endregion
|
|
1369
|
+
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/encoding/toHex.js
|
|
1370
|
+
const hexes$1 = /* @__PURE__ */ Array.from({ length: 256 }, (_v, i) => i.toString(16).padStart(2, "0"));
|
|
1371
|
+
/**
|
|
1372
|
+
* Encodes a string, number, bigint, or ByteArray into a hex string
|
|
1373
|
+
*
|
|
1374
|
+
* - Docs: https://viem.sh/docs/utilities/toHex
|
|
1375
|
+
* - Example: https://viem.sh/docs/utilities/toHex#usage
|
|
1376
|
+
*
|
|
1377
|
+
* @param value Value to encode.
|
|
1378
|
+
* @param opts Options.
|
|
1379
|
+
* @returns Hex value.
|
|
1380
|
+
*
|
|
1381
|
+
* @example
|
|
1382
|
+
* import { toHex } from 'viem'
|
|
1383
|
+
* const data = toHex('Hello world')
|
|
1384
|
+
* // '0x48656c6c6f20776f726c6421'
|
|
1385
|
+
*
|
|
1386
|
+
* @example
|
|
1387
|
+
* import { toHex } from 'viem'
|
|
1388
|
+
* const data = toHex(420)
|
|
1389
|
+
* // '0x1a4'
|
|
1390
|
+
*
|
|
1391
|
+
* @example
|
|
1392
|
+
* import { toHex } from 'viem'
|
|
1393
|
+
* const data = toHex('Hello world', { size: 32 })
|
|
1394
|
+
* // '0x48656c6c6f20776f726c64210000000000000000000000000000000000000000'
|
|
1395
|
+
*/
|
|
1396
|
+
function toHex(value, opts = {}) {
|
|
1397
|
+
if (typeof value === "number" || typeof value === "bigint") return numberToHex(value, opts);
|
|
1398
|
+
if (typeof value === "string") return stringToHex(value, opts);
|
|
1399
|
+
if (typeof value === "boolean") return boolToHex(value, opts);
|
|
1400
|
+
return bytesToHex(value, opts);
|
|
1401
|
+
}
|
|
1402
|
+
/**
|
|
1403
|
+
* Encodes a boolean into a hex string
|
|
1404
|
+
*
|
|
1405
|
+
* - Docs: https://viem.sh/docs/utilities/toHex#booltohex
|
|
1406
|
+
*
|
|
1407
|
+
* @param value Value to encode.
|
|
1408
|
+
* @param opts Options.
|
|
1409
|
+
* @returns Hex value.
|
|
1410
|
+
*
|
|
1411
|
+
* @example
|
|
1412
|
+
* import { boolToHex } from 'viem'
|
|
1413
|
+
* const data = boolToHex(true)
|
|
1414
|
+
* // '0x1'
|
|
1415
|
+
*
|
|
1416
|
+
* @example
|
|
1417
|
+
* import { boolToHex } from 'viem'
|
|
1418
|
+
* const data = boolToHex(false)
|
|
1419
|
+
* // '0x0'
|
|
1420
|
+
*
|
|
1421
|
+
* @example
|
|
1422
|
+
* import { boolToHex } from 'viem'
|
|
1423
|
+
* const data = boolToHex(true, { size: 32 })
|
|
1424
|
+
* // '0x0000000000000000000000000000000000000000000000000000000000000001'
|
|
1425
|
+
*/
|
|
1426
|
+
function boolToHex(value, opts = {}) {
|
|
1427
|
+
const hex = `0x${Number(value)}`;
|
|
1428
|
+
if (typeof opts.size === "number") {
|
|
1429
|
+
assertSize$2(hex, { size: opts.size });
|
|
1430
|
+
return pad$2(hex, { size: opts.size });
|
|
1431
|
+
}
|
|
1432
|
+
return hex;
|
|
1433
|
+
}
|
|
1434
|
+
/**
|
|
1435
|
+
* Encodes a bytes array into a hex string
|
|
1436
|
+
*
|
|
1437
|
+
* - Docs: https://viem.sh/docs/utilities/toHex#bytestohex
|
|
1438
|
+
*
|
|
1439
|
+
* @param value Value to encode.
|
|
1440
|
+
* @param opts Options.
|
|
1441
|
+
* @returns Hex value.
|
|
1442
|
+
*
|
|
1443
|
+
* @example
|
|
1444
|
+
* import { bytesToHex } from 'viem'
|
|
1445
|
+
* const data = bytesToHex(Uint8Array.from([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33])
|
|
1446
|
+
* // '0x48656c6c6f20576f726c6421'
|
|
1447
|
+
*
|
|
1448
|
+
* @example
|
|
1449
|
+
* import { bytesToHex } from 'viem'
|
|
1450
|
+
* const data = bytesToHex(Uint8Array.from([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33]), { size: 32 })
|
|
1451
|
+
* // '0x48656c6c6f20576f726c64210000000000000000000000000000000000000000'
|
|
1452
|
+
*/
|
|
1453
|
+
function bytesToHex(value, opts = {}) {
|
|
1454
|
+
let string = "";
|
|
1455
|
+
for (let i = 0; i < value.length; i++) string += hexes$1[value[i]];
|
|
1456
|
+
const hex = `0x${string}`;
|
|
1457
|
+
if (typeof opts.size === "number") {
|
|
1458
|
+
assertSize$2(hex, { size: opts.size });
|
|
1459
|
+
return pad$2(hex, {
|
|
1460
|
+
dir: "right",
|
|
1461
|
+
size: opts.size
|
|
1462
|
+
});
|
|
1463
|
+
}
|
|
1464
|
+
return hex;
|
|
1465
|
+
}
|
|
1466
|
+
/**
|
|
1467
|
+
* Encodes a number or bigint into a hex string
|
|
1468
|
+
*
|
|
1469
|
+
* - Docs: https://viem.sh/docs/utilities/toHex#numbertohex
|
|
1470
|
+
*
|
|
1471
|
+
* @param value Value to encode.
|
|
1472
|
+
* @param opts Options.
|
|
1473
|
+
* @returns Hex value.
|
|
1474
|
+
*
|
|
1475
|
+
* @example
|
|
1476
|
+
* import { numberToHex } from 'viem'
|
|
1477
|
+
* const data = numberToHex(420)
|
|
1478
|
+
* // '0x1a4'
|
|
1479
|
+
*
|
|
1480
|
+
* @example
|
|
1481
|
+
* import { numberToHex } from 'viem'
|
|
1482
|
+
* const data = numberToHex(420, { size: 32 })
|
|
1483
|
+
* // '0x00000000000000000000000000000000000000000000000000000000000001a4'
|
|
1484
|
+
*/
|
|
1485
|
+
function numberToHex(value_, opts = {}) {
|
|
1486
|
+
const { signed, size } = opts;
|
|
1487
|
+
const value = BigInt(value_);
|
|
1488
|
+
let maxValue;
|
|
1489
|
+
if (size) if (signed) maxValue = (1n << BigInt(size) * 8n - 1n) - 1n;
|
|
1490
|
+
else maxValue = 2n ** (BigInt(size) * 8n) - 1n;
|
|
1491
|
+
else if (typeof value_ === "number") maxValue = BigInt(Number.MAX_SAFE_INTEGER);
|
|
1492
|
+
const minValue = typeof maxValue === "bigint" && signed ? -maxValue - 1n : 0;
|
|
1493
|
+
if (maxValue && value > maxValue || value < minValue) {
|
|
1494
|
+
const suffix = typeof value_ === "bigint" ? "n" : "";
|
|
1495
|
+
throw new IntegerOutOfRangeError$1({
|
|
1496
|
+
max: maxValue ? `${maxValue}${suffix}` : void 0,
|
|
1497
|
+
min: `${minValue}${suffix}`,
|
|
1498
|
+
signed,
|
|
1499
|
+
size,
|
|
1500
|
+
value: `${value_}${suffix}`
|
|
1501
|
+
});
|
|
1502
|
+
}
|
|
1503
|
+
const hex = `0x${(signed && value < 0 ? (1n << BigInt(size * 8)) + BigInt(value) : value).toString(16)}`;
|
|
1504
|
+
if (size) return pad$2(hex, { size });
|
|
1505
|
+
return hex;
|
|
1506
|
+
}
|
|
1507
|
+
const encoder$3 = /* @__PURE__ */ new TextEncoder();
|
|
1508
|
+
/**
|
|
1509
|
+
* Encodes a UTF-8 string into a hex string
|
|
1510
|
+
*
|
|
1511
|
+
* - Docs: https://viem.sh/docs/utilities/toHex#stringtohex
|
|
1512
|
+
*
|
|
1513
|
+
* @param value Value to encode.
|
|
1514
|
+
* @param opts Options.
|
|
1515
|
+
* @returns Hex value.
|
|
1516
|
+
*
|
|
1517
|
+
* @example
|
|
1518
|
+
* import { stringToHex } from 'viem'
|
|
1519
|
+
* const data = stringToHex('Hello World!')
|
|
1520
|
+
* // '0x48656c6c6f20576f726c6421'
|
|
1521
|
+
*
|
|
1522
|
+
* @example
|
|
1523
|
+
* import { stringToHex } from 'viem'
|
|
1524
|
+
* const data = stringToHex('Hello World!', { size: 32 })
|
|
1525
|
+
* // '0x48656c6c6f20576f726c64210000000000000000000000000000000000000000'
|
|
1526
|
+
*/
|
|
1527
|
+
function stringToHex(value_, opts = {}) {
|
|
1528
|
+
return bytesToHex(encoder$3.encode(value_), opts);
|
|
1529
|
+
}
|
|
1530
|
+
//#endregion
|
|
1531
|
+
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/encoding/toBytes.js
|
|
1532
|
+
const encoder$2 = /* @__PURE__ */ new TextEncoder();
|
|
1533
|
+
/**
|
|
1534
|
+
* Encodes a UTF-8 string, hex value, bigint, number or boolean to a byte array.
|
|
1535
|
+
*
|
|
1536
|
+
* - Docs: https://viem.sh/docs/utilities/toBytes
|
|
1537
|
+
* - Example: https://viem.sh/docs/utilities/toBytes#usage
|
|
1538
|
+
*
|
|
1539
|
+
* @param value Value to encode.
|
|
1540
|
+
* @param opts Options.
|
|
1541
|
+
* @returns Byte array value.
|
|
1542
|
+
*
|
|
1543
|
+
* @example
|
|
1544
|
+
* import { toBytes } from 'viem'
|
|
1545
|
+
* const data = toBytes('Hello world')
|
|
1546
|
+
* // Uint8Array([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33])
|
|
1547
|
+
*
|
|
1548
|
+
* @example
|
|
1549
|
+
* import { toBytes } from 'viem'
|
|
1550
|
+
* const data = toBytes(420)
|
|
1551
|
+
* // Uint8Array([1, 164])
|
|
1552
|
+
*
|
|
1553
|
+
* @example
|
|
1554
|
+
* import { toBytes } from 'viem'
|
|
1555
|
+
* const data = toBytes(420, { size: 4 })
|
|
1556
|
+
* // Uint8Array([0, 0, 1, 164])
|
|
1557
|
+
*/
|
|
1558
|
+
function toBytes$1(value, opts = {}) {
|
|
1559
|
+
if (typeof value === "number" || typeof value === "bigint") return numberToBytes(value, opts);
|
|
1560
|
+
if (typeof value === "boolean") return boolToBytes(value, opts);
|
|
1561
|
+
if (isHex(value)) return hexToBytes(value, opts);
|
|
1562
|
+
return stringToBytes(value, opts);
|
|
1563
|
+
}
|
|
1564
|
+
/**
|
|
1565
|
+
* Encodes a boolean into a byte array.
|
|
1566
|
+
*
|
|
1567
|
+
* - Docs: https://viem.sh/docs/utilities/toBytes#booltobytes
|
|
1568
|
+
*
|
|
1569
|
+
* @param value Boolean value to encode.
|
|
1570
|
+
* @param opts Options.
|
|
1571
|
+
* @returns Byte array value.
|
|
1572
|
+
*
|
|
1573
|
+
* @example
|
|
1574
|
+
* import { boolToBytes } from 'viem'
|
|
1575
|
+
* const data = boolToBytes(true)
|
|
1576
|
+
* // Uint8Array([1])
|
|
1577
|
+
*
|
|
1578
|
+
* @example
|
|
1579
|
+
* import { boolToBytes } from 'viem'
|
|
1580
|
+
* const data = boolToBytes(true, { size: 32 })
|
|
1581
|
+
* // Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1])
|
|
1582
|
+
*/
|
|
1583
|
+
function boolToBytes(value, opts = {}) {
|
|
1584
|
+
const bytes = new Uint8Array(1);
|
|
1585
|
+
bytes[0] = Number(value);
|
|
1586
|
+
if (typeof opts.size === "number") {
|
|
1587
|
+
assertSize$2(bytes, { size: opts.size });
|
|
1588
|
+
return pad$2(bytes, { size: opts.size });
|
|
1589
|
+
}
|
|
1590
|
+
return bytes;
|
|
1591
|
+
}
|
|
1592
|
+
const charCodeMap$1 = {
|
|
1593
|
+
zero: 48,
|
|
1594
|
+
nine: 57,
|
|
1595
|
+
A: 65,
|
|
1596
|
+
F: 70,
|
|
1597
|
+
a: 97,
|
|
1598
|
+
f: 102
|
|
1599
|
+
};
|
|
1600
|
+
function charCodeToBase16$1(char) {
|
|
1601
|
+
if (char >= charCodeMap$1.zero && char <= charCodeMap$1.nine) return char - charCodeMap$1.zero;
|
|
1602
|
+
if (char >= charCodeMap$1.A && char <= charCodeMap$1.F) return char - (charCodeMap$1.A - 10);
|
|
1603
|
+
if (char >= charCodeMap$1.a && char <= charCodeMap$1.f) return char - (charCodeMap$1.a - 10);
|
|
1604
|
+
}
|
|
1605
|
+
/**
|
|
1606
|
+
* Encodes a hex string into a byte array.
|
|
1607
|
+
*
|
|
1608
|
+
* - Docs: https://viem.sh/docs/utilities/toBytes#hextobytes
|
|
1609
|
+
*
|
|
1610
|
+
* @param hex Hex string to encode.
|
|
1611
|
+
* @param opts Options.
|
|
1612
|
+
* @returns Byte array value.
|
|
1613
|
+
*
|
|
1614
|
+
* @example
|
|
1615
|
+
* import { hexToBytes } from 'viem'
|
|
1616
|
+
* const data = hexToBytes('0x48656c6c6f20776f726c6421')
|
|
1617
|
+
* // Uint8Array([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33])
|
|
1618
|
+
*
|
|
1619
|
+
* @example
|
|
1620
|
+
* import { hexToBytes } from 'viem'
|
|
1621
|
+
* const data = hexToBytes('0x48656c6c6f20776f726c6421', { size: 32 })
|
|
1622
|
+
* // Uint8Array([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
|
|
1623
|
+
*/
|
|
1624
|
+
function hexToBytes(hex_, opts = {}) {
|
|
1625
|
+
let hex = hex_;
|
|
1626
|
+
if (opts.size) {
|
|
1627
|
+
assertSize$2(hex, { size: opts.size });
|
|
1628
|
+
hex = pad$2(hex, {
|
|
1629
|
+
dir: "right",
|
|
1630
|
+
size: opts.size
|
|
1631
|
+
});
|
|
1632
|
+
}
|
|
1633
|
+
let hexString = hex.slice(2);
|
|
1634
|
+
if (hexString.length % 2) hexString = `0${hexString}`;
|
|
1635
|
+
const length = hexString.length / 2;
|
|
1636
|
+
const bytes = new Uint8Array(length);
|
|
1637
|
+
for (let index = 0, j = 0; index < length; index++) {
|
|
1638
|
+
const nibbleLeft = charCodeToBase16$1(hexString.charCodeAt(j++));
|
|
1639
|
+
const nibbleRight = charCodeToBase16$1(hexString.charCodeAt(j++));
|
|
1640
|
+
if (nibbleLeft === void 0 || nibbleRight === void 0) throw new BaseError$1(`Invalid byte sequence ("${hexString[j - 2]}${hexString[j - 1]}" in "${hexString}").`);
|
|
1641
|
+
bytes[index] = nibbleLeft * 16 + nibbleRight;
|
|
1642
|
+
}
|
|
1643
|
+
return bytes;
|
|
1644
|
+
}
|
|
1645
|
+
/**
|
|
1646
|
+
* Encodes a number into a byte array.
|
|
1647
|
+
*
|
|
1648
|
+
* - Docs: https://viem.sh/docs/utilities/toBytes#numbertobytes
|
|
1649
|
+
*
|
|
1650
|
+
* @param value Number to encode.
|
|
1651
|
+
* @param opts Options.
|
|
1652
|
+
* @returns Byte array value.
|
|
1653
|
+
*
|
|
1654
|
+
* @example
|
|
1655
|
+
* import { numberToBytes } from 'viem'
|
|
1656
|
+
* const data = numberToBytes(420)
|
|
1657
|
+
* // Uint8Array([1, 164])
|
|
1658
|
+
*
|
|
1659
|
+
* @example
|
|
1660
|
+
* import { numberToBytes } from 'viem'
|
|
1661
|
+
* const data = numberToBytes(420, { size: 4 })
|
|
1662
|
+
* // Uint8Array([0, 0, 1, 164])
|
|
1663
|
+
*/
|
|
1664
|
+
function numberToBytes(value, opts) {
|
|
1665
|
+
return hexToBytes(numberToHex(value, opts));
|
|
1666
|
+
}
|
|
1667
|
+
/**
|
|
1668
|
+
* Encodes a UTF-8 string into a byte array.
|
|
1669
|
+
*
|
|
1670
|
+
* - Docs: https://viem.sh/docs/utilities/toBytes#stringtobytes
|
|
1671
|
+
*
|
|
1672
|
+
* @param value String to encode.
|
|
1673
|
+
* @param opts Options.
|
|
1674
|
+
* @returns Byte array value.
|
|
1675
|
+
*
|
|
1676
|
+
* @example
|
|
1677
|
+
* import { stringToBytes } from 'viem'
|
|
1678
|
+
* const data = stringToBytes('Hello world!')
|
|
1679
|
+
* // Uint8Array([72, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 33])
|
|
1680
|
+
*
|
|
1681
|
+
* @example
|
|
1682
|
+
* import { stringToBytes } from 'viem'
|
|
1683
|
+
* const data = stringToBytes('Hello world!', { size: 32 })
|
|
1684
|
+
* // Uint8Array([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
|
|
1685
|
+
*/
|
|
1686
|
+
function stringToBytes(value, opts = {}) {
|
|
1687
|
+
const bytes = encoder$2.encode(value);
|
|
1688
|
+
if (typeof opts.size === "number") {
|
|
1689
|
+
assertSize$2(bytes, { size: opts.size });
|
|
1690
|
+
return pad$2(bytes, {
|
|
1691
|
+
dir: "right",
|
|
1692
|
+
size: opts.size
|
|
1693
|
+
});
|
|
1694
|
+
}
|
|
1695
|
+
return bytes;
|
|
1696
|
+
}
|
|
1697
|
+
//#endregion
|
|
1698
|
+
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/hash/keccak256.js
|
|
1699
|
+
function keccak256(value, to_) {
|
|
1700
|
+
const to = to_ || "hex";
|
|
1701
|
+
const bytes = keccak_256(isHex(value, { strict: false }) ? toBytes$1(value) : value);
|
|
1702
|
+
if (to === "bytes") return bytes;
|
|
1703
|
+
return toHex(bytes);
|
|
1704
|
+
}
|
|
1705
|
+
//#endregion
|
|
1706
|
+
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/hash/hashSignature.js
|
|
1707
|
+
const hash = (value) => keccak256(toBytes$1(value));
|
|
1708
|
+
function hashSignature(sig) {
|
|
1709
|
+
return hash(sig);
|
|
1710
|
+
}
|
|
1711
|
+
//#endregion
|
|
1712
|
+
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/hash/normalizeSignature.js
|
|
1713
|
+
function normalizeSignature(signature) {
|
|
1714
|
+
let active = true;
|
|
1715
|
+
let current = "";
|
|
1716
|
+
let level = 0;
|
|
1717
|
+
let result = "";
|
|
1718
|
+
let valid = false;
|
|
1719
|
+
for (let i = 0; i < signature.length; i++) {
|
|
1720
|
+
const char = signature[i];
|
|
1721
|
+
if ([
|
|
1722
|
+
"(",
|
|
1723
|
+
")",
|
|
1724
|
+
","
|
|
1725
|
+
].includes(char)) active = true;
|
|
1726
|
+
if (char === "(") level++;
|
|
1727
|
+
if (char === ")") level--;
|
|
1728
|
+
if (!active) continue;
|
|
1729
|
+
if (level === 0) {
|
|
1730
|
+
if (char === " " && [
|
|
1731
|
+
"event",
|
|
1732
|
+
"function",
|
|
1733
|
+
""
|
|
1734
|
+
].includes(result)) result = "";
|
|
1735
|
+
else {
|
|
1736
|
+
result += char;
|
|
1737
|
+
if (char === ")") {
|
|
1738
|
+
valid = true;
|
|
1739
|
+
break;
|
|
1740
|
+
}
|
|
1741
|
+
}
|
|
1742
|
+
continue;
|
|
1743
|
+
}
|
|
1744
|
+
if (char === " ") {
|
|
1745
|
+
if (signature[i - 1] !== "," && current !== "," && current !== ",(") {
|
|
1746
|
+
current = "";
|
|
1747
|
+
active = false;
|
|
1748
|
+
}
|
|
1749
|
+
continue;
|
|
1750
|
+
}
|
|
1751
|
+
result += char;
|
|
1752
|
+
current += char;
|
|
1753
|
+
}
|
|
1754
|
+
if (!valid) throw new BaseError$1("Unable to normalize signature.");
|
|
1755
|
+
return result;
|
|
1756
|
+
}
|
|
1757
|
+
//#endregion
|
|
1758
|
+
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/hash/toSignature.js
|
|
1759
|
+
/**
|
|
1760
|
+
* Returns the signature for a given function or event definition.
|
|
1761
|
+
*
|
|
1762
|
+
* @example
|
|
1763
|
+
* const signature = toSignature('function ownerOf(uint256 tokenId)')
|
|
1764
|
+
* // 'ownerOf(uint256)'
|
|
1765
|
+
*
|
|
1766
|
+
* @example
|
|
1767
|
+
* const signature_3 = toSignature({
|
|
1768
|
+
* name: 'ownerOf',
|
|
1769
|
+
* type: 'function',
|
|
1770
|
+
* inputs: [{ name: 'tokenId', type: 'uint256' }],
|
|
1771
|
+
* outputs: [],
|
|
1772
|
+
* stateMutability: 'view',
|
|
1773
|
+
* })
|
|
1774
|
+
* // 'ownerOf(uint256)'
|
|
1775
|
+
*/
|
|
1776
|
+
const toSignature = (def) => {
|
|
1777
|
+
return normalizeSignature((() => {
|
|
1778
|
+
if (typeof def === "string") return def;
|
|
1779
|
+
return formatAbiItem$1(def);
|
|
1780
|
+
})());
|
|
1781
|
+
};
|
|
1782
|
+
//#endregion
|
|
1783
|
+
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/hash/toSignatureHash.js
|
|
1784
|
+
/**
|
|
1785
|
+
* Returns the hash (of the function/event signature) for a given event or function definition.
|
|
1786
|
+
*/
|
|
1787
|
+
function toSignatureHash(fn) {
|
|
1788
|
+
return hashSignature(toSignature(fn));
|
|
1789
|
+
}
|
|
1790
|
+
//#endregion
|
|
1791
|
+
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/hash/toEventSelector.js
|
|
1792
|
+
/**
|
|
1793
|
+
* Returns the event selector for a given event definition.
|
|
1794
|
+
*
|
|
1795
|
+
* @example
|
|
1796
|
+
* const selector = toEventSelector('Transfer(address indexed from, address indexed to, uint256 amount)')
|
|
1797
|
+
* // 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef
|
|
1798
|
+
*/
|
|
1799
|
+
const toEventSelector = toSignatureHash;
|
|
1800
|
+
//#endregion
|
|
1801
|
+
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/errors/address.js
|
|
1802
|
+
var InvalidAddressError = class extends BaseError$1 {
|
|
1803
|
+
constructor({ address }) {
|
|
1804
|
+
super(`Address "${address}" is invalid.`, {
|
|
1805
|
+
metaMessages: ["- Address must be a hex value of 20 bytes (40 hex characters).", "- Address must match its checksum counterpart."],
|
|
1806
|
+
name: "InvalidAddressError"
|
|
1807
|
+
});
|
|
1808
|
+
}
|
|
1809
|
+
};
|
|
1810
|
+
//#endregion
|
|
1811
|
+
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/lru.js
|
|
1812
|
+
/**
|
|
1813
|
+
* Map with a LRU (Least recently used) policy.
|
|
1814
|
+
*
|
|
1815
|
+
* @link https://en.wikipedia.org/wiki/Cache_replacement_policies#LRU
|
|
1816
|
+
*/
|
|
1817
|
+
var LruMap = class extends Map {
|
|
1818
|
+
constructor(size) {
|
|
1819
|
+
super();
|
|
1820
|
+
Object.defineProperty(this, "maxSize", {
|
|
1821
|
+
enumerable: true,
|
|
1822
|
+
configurable: true,
|
|
1823
|
+
writable: true,
|
|
1824
|
+
value: void 0
|
|
1825
|
+
});
|
|
1826
|
+
this.maxSize = size;
|
|
1827
|
+
}
|
|
1828
|
+
get(key) {
|
|
1829
|
+
const value = super.get(key);
|
|
1830
|
+
if (super.has(key)) {
|
|
1831
|
+
super.delete(key);
|
|
1832
|
+
super.set(key, value);
|
|
1833
|
+
}
|
|
1834
|
+
return value;
|
|
1835
|
+
}
|
|
1836
|
+
set(key, value) {
|
|
1837
|
+
if (super.has(key)) super.delete(key);
|
|
1838
|
+
super.set(key, value);
|
|
1839
|
+
if (this.maxSize && this.size > this.maxSize) {
|
|
1840
|
+
const firstKey = super.keys().next().value;
|
|
1841
|
+
if (firstKey !== void 0) super.delete(firstKey);
|
|
1842
|
+
}
|
|
1843
|
+
return this;
|
|
1844
|
+
}
|
|
1845
|
+
};
|
|
1846
|
+
//#endregion
|
|
1847
|
+
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/address/getAddress.js
|
|
1848
|
+
const checksumAddressCache = /* @__PURE__ */ new LruMap(8192);
|
|
1849
|
+
function checksumAddress(address_, chainId) {
|
|
1850
|
+
if (checksumAddressCache.has(`${address_}.${chainId}`)) return checksumAddressCache.get(`${address_}.${chainId}`);
|
|
1851
|
+
const hexAddress = chainId ? `${chainId}${address_.toLowerCase()}` : address_.substring(2).toLowerCase();
|
|
1852
|
+
const hash = keccak256(stringToBytes(hexAddress), "bytes");
|
|
1853
|
+
const address = (chainId ? hexAddress.substring(`${chainId}0x`.length) : hexAddress).split("");
|
|
1854
|
+
for (let i = 0; i < 40; i += 2) {
|
|
1855
|
+
if (hash[i >> 1] >> 4 >= 8 && address[i]) address[i] = address[i].toUpperCase();
|
|
1856
|
+
if ((hash[i >> 1] & 15) >= 8 && address[i + 1]) address[i + 1] = address[i + 1].toUpperCase();
|
|
1857
|
+
}
|
|
1858
|
+
const result = `0x${address.join("")}`;
|
|
1859
|
+
checksumAddressCache.set(`${address_}.${chainId}`, result);
|
|
1860
|
+
return result;
|
|
1861
|
+
}
|
|
1862
|
+
function getAddress(address, chainId) {
|
|
1863
|
+
if (!isAddress(address, { strict: false })) throw new InvalidAddressError({ address });
|
|
1864
|
+
return checksumAddress(address, chainId);
|
|
1865
|
+
}
|
|
1866
|
+
//#endregion
|
|
1867
|
+
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/address/isAddress.js
|
|
1868
|
+
const addressRegex = /^0x[a-fA-F0-9]{40}$/;
|
|
1869
|
+
/** @internal */
|
|
1870
|
+
const isAddressCache = /* @__PURE__ */ new LruMap(8192);
|
|
1871
|
+
function isAddress(address, options) {
|
|
1872
|
+
const { strict = true } = options ?? {};
|
|
1873
|
+
const cacheKey = `${address}.${strict}`;
|
|
1874
|
+
if (isAddressCache.has(cacheKey)) return isAddressCache.get(cacheKey);
|
|
1875
|
+
const result = (() => {
|
|
1876
|
+
if (!addressRegex.test(address)) return false;
|
|
1877
|
+
if (address.toLowerCase() === address) return true;
|
|
1878
|
+
if (strict) return checksumAddress(address) === address;
|
|
1879
|
+
return true;
|
|
1880
|
+
})();
|
|
1881
|
+
isAddressCache.set(cacheKey, result);
|
|
1882
|
+
return result;
|
|
1883
|
+
}
|
|
1884
|
+
//#endregion
|
|
1885
|
+
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/data/concat.js
|
|
1886
|
+
function concat$2(values) {
|
|
1887
|
+
if (typeof values[0] === "string") return concatHex(values);
|
|
1888
|
+
return concatBytes(values);
|
|
1889
|
+
}
|
|
1890
|
+
function concatBytes(values) {
|
|
1891
|
+
let length = 0;
|
|
1892
|
+
for (const arr of values) length += arr.length;
|
|
1893
|
+
const result = new Uint8Array(length);
|
|
1894
|
+
let offset = 0;
|
|
1895
|
+
for (const arr of values) {
|
|
1896
|
+
result.set(arr, offset);
|
|
1897
|
+
offset += arr.length;
|
|
1898
|
+
}
|
|
1899
|
+
return result;
|
|
1900
|
+
}
|
|
1901
|
+
function concatHex(values) {
|
|
1902
|
+
return `0x${values.reduce((acc, x) => acc + x.replace("0x", ""), "")}`;
|
|
1903
|
+
}
|
|
1904
|
+
//#endregion
|
|
1905
|
+
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/data/slice.js
|
|
1906
|
+
/**
|
|
1907
|
+
* @description Returns a section of the hex or byte array given a start/end bytes offset.
|
|
1908
|
+
*
|
|
1909
|
+
* @param value The hex or byte array to slice.
|
|
1910
|
+
* @param start The start offset (in bytes).
|
|
1911
|
+
* @param end The end offset (in bytes).
|
|
1912
|
+
*/
|
|
1913
|
+
function slice$2(value, start, end, { strict } = {}) {
|
|
1914
|
+
if (isHex(value, { strict: false })) return sliceHex(value, start, end, { strict });
|
|
1915
|
+
return sliceBytes(value, start, end, { strict });
|
|
1916
|
+
}
|
|
1917
|
+
function assertStartOffset$2(value, start) {
|
|
1918
|
+
if (typeof start === "number" && start > 0 && start > size$2(value) - 1) throw new SliceOffsetOutOfBoundsError$2({
|
|
1919
|
+
offset: start,
|
|
1920
|
+
position: "start",
|
|
1921
|
+
size: size$2(value)
|
|
1922
|
+
});
|
|
1923
|
+
}
|
|
1924
|
+
function assertEndOffset$2(value, start, end) {
|
|
1925
|
+
if (typeof start === "number" && typeof end === "number" && size$2(value) !== end - start) throw new SliceOffsetOutOfBoundsError$2({
|
|
1926
|
+
offset: end,
|
|
1927
|
+
position: "end",
|
|
1928
|
+
size: size$2(value)
|
|
1929
|
+
});
|
|
1930
|
+
}
|
|
1931
|
+
/**
|
|
1932
|
+
* @description Returns a section of the byte array given a start/end bytes offset.
|
|
1933
|
+
*
|
|
1934
|
+
* @param value The byte array to slice.
|
|
1935
|
+
* @param start The start offset (in bytes).
|
|
1936
|
+
* @param end The end offset (in bytes).
|
|
1937
|
+
*/
|
|
1938
|
+
function sliceBytes(value_, start, end, { strict } = {}) {
|
|
1939
|
+
assertStartOffset$2(value_, start);
|
|
1940
|
+
const value = value_.slice(start, end);
|
|
1941
|
+
if (strict) assertEndOffset$2(value, start, end);
|
|
1942
|
+
return value;
|
|
1943
|
+
}
|
|
1944
|
+
/**
|
|
1945
|
+
* @description Returns a section of the hex value given a start/end bytes offset.
|
|
1946
|
+
*
|
|
1947
|
+
* @param value The hex value to slice.
|
|
1948
|
+
* @param start The start offset (in bytes).
|
|
1949
|
+
* @param end The end offset (in bytes).
|
|
1950
|
+
*/
|
|
1951
|
+
function sliceHex(value_, start, end, { strict } = {}) {
|
|
1952
|
+
assertStartOffset$2(value_, start);
|
|
1953
|
+
const value = `0x${value_.replace("0x", "").slice((start ?? 0) * 2, (end ?? value_.length) * 2)}`;
|
|
1954
|
+
if (strict) assertEndOffset$2(value, start, end);
|
|
1955
|
+
return value;
|
|
1956
|
+
}
|
|
1957
|
+
//#endregion
|
|
1958
|
+
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/regex.js
|
|
1959
|
+
const bytesRegex = /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/;
|
|
1960
|
+
const integerRegex = /^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;
|
|
1961
|
+
//#endregion
|
|
1962
|
+
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/abi/encodeAbiParameters.js
|
|
1963
|
+
/**
|
|
1964
|
+
* @description Encodes a list of primitive values into an ABI-encoded hex value.
|
|
1965
|
+
*
|
|
1966
|
+
* - Docs: https://viem.sh/docs/abi/encodeAbiParameters#encodeabiparameters
|
|
1967
|
+
*
|
|
1968
|
+
* Generates ABI encoded data using the [ABI specification](https://docs.soliditylang.org/en/latest/abi-spec), given a set of ABI parameters (inputs/outputs) and their corresponding values.
|
|
1969
|
+
*
|
|
1970
|
+
* @param params - a set of ABI Parameters (params), that can be in the shape of the inputs or outputs attribute of an ABI Item.
|
|
1971
|
+
* @param values - a set of values (values) that correspond to the given params.
|
|
1972
|
+
* @example
|
|
1973
|
+
* ```typescript
|
|
1974
|
+
* import { encodeAbiParameters } from 'viem'
|
|
1975
|
+
*
|
|
1976
|
+
* const encodedData = encodeAbiParameters(
|
|
1977
|
+
* [
|
|
1978
|
+
* { name: 'x', type: 'string' },
|
|
1979
|
+
* { name: 'y', type: 'uint' },
|
|
1980
|
+
* { name: 'z', type: 'bool' }
|
|
1981
|
+
* ],
|
|
1982
|
+
* ['wagmi', 420n, true]
|
|
1983
|
+
* )
|
|
1984
|
+
* ```
|
|
1985
|
+
*
|
|
1986
|
+
* You can also pass in Human Readable parameters with the parseAbiParameters utility.
|
|
1987
|
+
*
|
|
1988
|
+
* @example
|
|
1989
|
+
* ```typescript
|
|
1990
|
+
* import { encodeAbiParameters, parseAbiParameters } from 'viem'
|
|
1991
|
+
*
|
|
1992
|
+
* const encodedData = encodeAbiParameters(
|
|
1993
|
+
* parseAbiParameters('string x, uint y, bool z'),
|
|
1994
|
+
* ['wagmi', 420n, true]
|
|
1995
|
+
* )
|
|
1996
|
+
* ```
|
|
1997
|
+
*/
|
|
1998
|
+
function encodeAbiParameters(params, values) {
|
|
1999
|
+
if (params.length !== values.length) throw new AbiEncodingLengthMismatchError({
|
|
2000
|
+
expectedLength: params.length,
|
|
2001
|
+
givenLength: values.length
|
|
2002
|
+
});
|
|
2003
|
+
const data = encodeParams(prepareParams({
|
|
2004
|
+
params,
|
|
2005
|
+
values
|
|
2006
|
+
}));
|
|
2007
|
+
if (data.length === 0) return "0x";
|
|
2008
|
+
return data;
|
|
2009
|
+
}
|
|
2010
|
+
function prepareParams({ params, values }) {
|
|
2011
|
+
const preparedParams = [];
|
|
2012
|
+
for (let i = 0; i < params.length; i++) preparedParams.push(prepareParam({
|
|
2013
|
+
param: params[i],
|
|
2014
|
+
value: values[i]
|
|
2015
|
+
}));
|
|
2016
|
+
return preparedParams;
|
|
2017
|
+
}
|
|
2018
|
+
function prepareParam({ param, value }) {
|
|
2019
|
+
const arrayComponents = getArrayComponents(param.type);
|
|
2020
|
+
if (arrayComponents) {
|
|
2021
|
+
const [length, type] = arrayComponents;
|
|
2022
|
+
return encodeArray(value, {
|
|
2023
|
+
length,
|
|
2024
|
+
param: {
|
|
2025
|
+
...param,
|
|
2026
|
+
type
|
|
2027
|
+
}
|
|
2028
|
+
});
|
|
2029
|
+
}
|
|
2030
|
+
if (param.type === "tuple") return encodeTuple(value, { param });
|
|
2031
|
+
if (param.type === "address") return encodeAddress(value);
|
|
2032
|
+
if (param.type === "bool") return encodeBool(value);
|
|
2033
|
+
if (param.type.startsWith("uint") || param.type.startsWith("int")) {
|
|
2034
|
+
const signed = param.type.startsWith("int");
|
|
2035
|
+
const [, , size = "256"] = integerRegex.exec(param.type) ?? [];
|
|
2036
|
+
return encodeNumber(value, {
|
|
2037
|
+
signed,
|
|
2038
|
+
size: Number(size)
|
|
2039
|
+
});
|
|
2040
|
+
}
|
|
2041
|
+
if (param.type.startsWith("bytes")) return encodeBytes(value, { param });
|
|
2042
|
+
if (param.type === "string") return encodeString(value);
|
|
2043
|
+
throw new InvalidAbiEncodingTypeError(param.type, { docsPath: "/docs/contract/encodeAbiParameters" });
|
|
2044
|
+
}
|
|
2045
|
+
function encodeParams(preparedParams) {
|
|
2046
|
+
let staticSize = 0;
|
|
2047
|
+
for (let i = 0; i < preparedParams.length; i++) {
|
|
2048
|
+
const { dynamic, encoded } = preparedParams[i];
|
|
2049
|
+
if (dynamic) staticSize += 32;
|
|
2050
|
+
else staticSize += size$2(encoded);
|
|
2051
|
+
}
|
|
2052
|
+
const staticParams = [];
|
|
2053
|
+
const dynamicParams = [];
|
|
2054
|
+
let dynamicSize = 0;
|
|
2055
|
+
for (let i = 0; i < preparedParams.length; i++) {
|
|
2056
|
+
const { dynamic, encoded } = preparedParams[i];
|
|
2057
|
+
if (dynamic) {
|
|
2058
|
+
staticParams.push(numberToHex(staticSize + dynamicSize, { size: 32 }));
|
|
2059
|
+
dynamicParams.push(encoded);
|
|
2060
|
+
dynamicSize += size$2(encoded);
|
|
2061
|
+
} else staticParams.push(encoded);
|
|
2062
|
+
}
|
|
2063
|
+
return concat$2([...staticParams, ...dynamicParams]);
|
|
2064
|
+
}
|
|
2065
|
+
function encodeAddress(value) {
|
|
2066
|
+
if (!isAddress(value)) throw new InvalidAddressError({ address: value });
|
|
2067
|
+
return {
|
|
2068
|
+
dynamic: false,
|
|
2069
|
+
encoded: padHex(value.toLowerCase())
|
|
2070
|
+
};
|
|
2071
|
+
}
|
|
2072
|
+
function encodeArray(value, { length, param }) {
|
|
2073
|
+
const dynamic = length === null;
|
|
2074
|
+
if (!Array.isArray(value)) throw new InvalidArrayError(value);
|
|
2075
|
+
if (!dynamic && value.length !== length) throw new AbiEncodingArrayLengthMismatchError({
|
|
2076
|
+
expectedLength: length,
|
|
2077
|
+
givenLength: value.length,
|
|
2078
|
+
type: `${param.type}[${length}]`
|
|
2079
|
+
});
|
|
2080
|
+
let dynamicChild = false;
|
|
2081
|
+
const preparedParams = [];
|
|
2082
|
+
for (let i = 0; i < value.length; i++) {
|
|
2083
|
+
const preparedParam = prepareParam({
|
|
2084
|
+
param,
|
|
2085
|
+
value: value[i]
|
|
2086
|
+
});
|
|
2087
|
+
if (preparedParam.dynamic) dynamicChild = true;
|
|
2088
|
+
preparedParams.push(preparedParam);
|
|
2089
|
+
}
|
|
2090
|
+
if (dynamic || dynamicChild) {
|
|
2091
|
+
const data = encodeParams(preparedParams);
|
|
2092
|
+
if (dynamic) {
|
|
2093
|
+
const length = numberToHex(preparedParams.length, { size: 32 });
|
|
2094
|
+
return {
|
|
2095
|
+
dynamic: true,
|
|
2096
|
+
encoded: preparedParams.length > 0 ? concat$2([length, data]) : length
|
|
2097
|
+
};
|
|
2098
|
+
}
|
|
2099
|
+
if (dynamicChild) return {
|
|
2100
|
+
dynamic: true,
|
|
2101
|
+
encoded: data
|
|
2102
|
+
};
|
|
2103
|
+
}
|
|
2104
|
+
return {
|
|
2105
|
+
dynamic: false,
|
|
2106
|
+
encoded: concat$2(preparedParams.map(({ encoded }) => encoded))
|
|
2107
|
+
};
|
|
2108
|
+
}
|
|
2109
|
+
function encodeBytes(value, { param }) {
|
|
2110
|
+
const [, paramSize] = param.type.split("bytes");
|
|
2111
|
+
const bytesSize = size$2(value);
|
|
2112
|
+
if (!paramSize) {
|
|
2113
|
+
let value_ = value;
|
|
2114
|
+
if (bytesSize % 32 !== 0) value_ = padHex(value_, {
|
|
2115
|
+
dir: "right",
|
|
2116
|
+
size: Math.ceil((value.length - 2) / 2 / 32) * 32
|
|
2117
|
+
});
|
|
2118
|
+
return {
|
|
2119
|
+
dynamic: true,
|
|
2120
|
+
encoded: concat$2([padHex(numberToHex(bytesSize, { size: 32 })), value_])
|
|
2121
|
+
};
|
|
2122
|
+
}
|
|
2123
|
+
if (bytesSize !== Number.parseInt(paramSize, 10)) throw new AbiEncodingBytesSizeMismatchError({
|
|
2124
|
+
expectedSize: Number.parseInt(paramSize, 10),
|
|
2125
|
+
value
|
|
2126
|
+
});
|
|
2127
|
+
return {
|
|
2128
|
+
dynamic: false,
|
|
2129
|
+
encoded: padHex(value, { dir: "right" })
|
|
2130
|
+
};
|
|
2131
|
+
}
|
|
2132
|
+
function encodeBool(value) {
|
|
2133
|
+
if (typeof value !== "boolean") throw new BaseError$1(`Invalid boolean value: "${value}" (type: ${typeof value}). Expected: \`true\` or \`false\`.`);
|
|
2134
|
+
return {
|
|
2135
|
+
dynamic: false,
|
|
2136
|
+
encoded: padHex(boolToHex(value))
|
|
2137
|
+
};
|
|
2138
|
+
}
|
|
2139
|
+
function encodeNumber(value, { signed, size = 256 }) {
|
|
2140
|
+
if (typeof size === "number") {
|
|
2141
|
+
const max = 2n ** (BigInt(size) - (signed ? 1n : 0n)) - 1n;
|
|
2142
|
+
const min = signed ? -max - 1n : 0n;
|
|
2143
|
+
if (value > max || value < min) throw new IntegerOutOfRangeError$1({
|
|
2144
|
+
max: max.toString(),
|
|
2145
|
+
min: min.toString(),
|
|
2146
|
+
signed,
|
|
2147
|
+
size: size / 8,
|
|
2148
|
+
value: value.toString()
|
|
2149
|
+
});
|
|
2150
|
+
}
|
|
2151
|
+
return {
|
|
2152
|
+
dynamic: false,
|
|
2153
|
+
encoded: numberToHex(value, {
|
|
2154
|
+
size: 32,
|
|
2155
|
+
signed
|
|
2156
|
+
})
|
|
2157
|
+
};
|
|
2158
|
+
}
|
|
2159
|
+
function encodeString(value) {
|
|
2160
|
+
const hexValue = stringToHex(value);
|
|
2161
|
+
const partsLength = Math.ceil(size$2(hexValue) / 32);
|
|
2162
|
+
const parts = [];
|
|
2163
|
+
for (let i = 0; i < partsLength; i++) parts.push(padHex(slice$2(hexValue, i * 32, (i + 1) * 32), { dir: "right" }));
|
|
2164
|
+
return {
|
|
2165
|
+
dynamic: true,
|
|
2166
|
+
encoded: concat$2([padHex(numberToHex(size$2(hexValue), { size: 32 })), ...parts])
|
|
2167
|
+
};
|
|
2168
|
+
}
|
|
2169
|
+
function encodeTuple(value, { param }) {
|
|
2170
|
+
let dynamic = false;
|
|
2171
|
+
const preparedParams = [];
|
|
2172
|
+
for (let i = 0; i < param.components.length; i++) {
|
|
2173
|
+
const param_ = param.components[i];
|
|
2174
|
+
const preparedParam = prepareParam({
|
|
2175
|
+
param: param_,
|
|
2176
|
+
value: value[Array.isArray(value) ? i : param_.name]
|
|
2177
|
+
});
|
|
2178
|
+
preparedParams.push(preparedParam);
|
|
2179
|
+
if (preparedParam.dynamic) dynamic = true;
|
|
2180
|
+
}
|
|
2181
|
+
return {
|
|
2182
|
+
dynamic,
|
|
2183
|
+
encoded: dynamic ? encodeParams(preparedParams) : concat$2(preparedParams.map(({ encoded }) => encoded))
|
|
2184
|
+
};
|
|
2185
|
+
}
|
|
2186
|
+
function getArrayComponents(type) {
|
|
2187
|
+
const matches = type.match(/^(.*)\[(\d+)?\]$/);
|
|
2188
|
+
return matches ? [matches[2] ? Number(matches[2]) : null, matches[1]] : void 0;
|
|
2189
|
+
}
|
|
892
2190
|
//#endregion
|
|
893
2191
|
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/hash/toFunctionSelector.js
|
|
894
2192
|
/**
|
|
@@ -983,6 +2281,15 @@ function getAmbiguousTypes(sourceParameters, targetParameters, args) {
|
|
|
983
2281
|
}
|
|
984
2282
|
}
|
|
985
2283
|
//#endregion
|
|
2284
|
+
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/accounts/utils/parseAccount.js
|
|
2285
|
+
function parseAccount(account) {
|
|
2286
|
+
if (typeof account === "string") return {
|
|
2287
|
+
address: account,
|
|
2288
|
+
type: "json-rpc"
|
|
2289
|
+
};
|
|
2290
|
+
return account;
|
|
2291
|
+
}
|
|
2292
|
+
//#endregion
|
|
986
2293
|
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/abi/prepareEncodeFunctionData.js
|
|
987
2294
|
const docsPath$2 = "/docs/contract/encodeFunctionData";
|
|
988
2295
|
function prepareEncodeFunctionData(parameters) {
|
|
@@ -1000,7 +2307,7 @@ function prepareEncodeFunctionData(parameters) {
|
|
|
1000
2307
|
if (abiItem.type !== "function") throw new AbiFunctionNotFoundError(void 0, { docsPath: docsPath$2 });
|
|
1001
2308
|
return {
|
|
1002
2309
|
abi: [abiItem],
|
|
1003
|
-
functionName: toFunctionSelector(formatAbiItem
|
|
2310
|
+
functionName: toFunctionSelector(formatAbiItem(abiItem))
|
|
1004
2311
|
};
|
|
1005
2312
|
}
|
|
1006
2313
|
//#endregion
|
|
@@ -1044,6 +2351,186 @@ const solidityPanic = {
|
|
|
1044
2351
|
type: "error"
|
|
1045
2352
|
};
|
|
1046
2353
|
//#endregion
|
|
2354
|
+
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/errors/cursor.js
|
|
2355
|
+
var NegativeOffsetError = class extends BaseError$1 {
|
|
2356
|
+
constructor({ offset }) {
|
|
2357
|
+
super(`Offset \`${offset}\` cannot be negative.`, { name: "NegativeOffsetError" });
|
|
2358
|
+
}
|
|
2359
|
+
};
|
|
2360
|
+
var PositionOutOfBoundsError = class extends BaseError$1 {
|
|
2361
|
+
constructor({ length, position }) {
|
|
2362
|
+
super(`Position \`${position}\` is out of bounds (\`0 < position < ${length}\`).`, { name: "PositionOutOfBoundsError" });
|
|
2363
|
+
}
|
|
2364
|
+
};
|
|
2365
|
+
var RecursiveReadLimitExceededError = class extends BaseError$1 {
|
|
2366
|
+
constructor({ count, limit }) {
|
|
2367
|
+
super(`Recursive read limit of \`${limit}\` exceeded (recursive read count: \`${count}\`).`, { name: "RecursiveReadLimitExceededError" });
|
|
2368
|
+
}
|
|
2369
|
+
};
|
|
2370
|
+
//#endregion
|
|
2371
|
+
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/cursor.js
|
|
2372
|
+
const staticCursor = {
|
|
2373
|
+
bytes: new Uint8Array(),
|
|
2374
|
+
dataView: /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(0)),
|
|
2375
|
+
position: 0,
|
|
2376
|
+
positionReadCount: /* @__PURE__ */ new Map(),
|
|
2377
|
+
recursiveReadCount: 0,
|
|
2378
|
+
recursiveReadLimit: Number.POSITIVE_INFINITY,
|
|
2379
|
+
assertReadLimit() {
|
|
2380
|
+
if (this.recursiveReadCount >= this.recursiveReadLimit) throw new RecursiveReadLimitExceededError({
|
|
2381
|
+
count: this.recursiveReadCount + 1,
|
|
2382
|
+
limit: this.recursiveReadLimit
|
|
2383
|
+
});
|
|
2384
|
+
},
|
|
2385
|
+
assertPosition(position) {
|
|
2386
|
+
if (position < 0 || position > this.bytes.length - 1) throw new PositionOutOfBoundsError({
|
|
2387
|
+
length: this.bytes.length,
|
|
2388
|
+
position
|
|
2389
|
+
});
|
|
2390
|
+
},
|
|
2391
|
+
decrementPosition(offset) {
|
|
2392
|
+
if (offset < 0) throw new NegativeOffsetError({ offset });
|
|
2393
|
+
const position = this.position - offset;
|
|
2394
|
+
this.assertPosition(position);
|
|
2395
|
+
this.position = position;
|
|
2396
|
+
},
|
|
2397
|
+
getReadCount(position) {
|
|
2398
|
+
return this.positionReadCount.get(position || this.position) || 0;
|
|
2399
|
+
},
|
|
2400
|
+
incrementPosition(offset) {
|
|
2401
|
+
if (offset < 0) throw new NegativeOffsetError({ offset });
|
|
2402
|
+
const position = this.position + offset;
|
|
2403
|
+
this.assertPosition(position);
|
|
2404
|
+
this.position = position;
|
|
2405
|
+
},
|
|
2406
|
+
inspectByte(position_) {
|
|
2407
|
+
const position = position_ ?? this.position;
|
|
2408
|
+
this.assertPosition(position);
|
|
2409
|
+
return this.bytes[position];
|
|
2410
|
+
},
|
|
2411
|
+
inspectBytes(length, position_) {
|
|
2412
|
+
const position = position_ ?? this.position;
|
|
2413
|
+
this.assertPosition(position + length - 1);
|
|
2414
|
+
return this.bytes.subarray(position, position + length);
|
|
2415
|
+
},
|
|
2416
|
+
inspectUint8(position_) {
|
|
2417
|
+
const position = position_ ?? this.position;
|
|
2418
|
+
this.assertPosition(position);
|
|
2419
|
+
return this.bytes[position];
|
|
2420
|
+
},
|
|
2421
|
+
inspectUint16(position_) {
|
|
2422
|
+
const position = position_ ?? this.position;
|
|
2423
|
+
this.assertPosition(position + 1);
|
|
2424
|
+
return this.dataView.getUint16(position);
|
|
2425
|
+
},
|
|
2426
|
+
inspectUint24(position_) {
|
|
2427
|
+
const position = position_ ?? this.position;
|
|
2428
|
+
this.assertPosition(position + 2);
|
|
2429
|
+
return (this.dataView.getUint16(position) << 8) + this.dataView.getUint8(position + 2);
|
|
2430
|
+
},
|
|
2431
|
+
inspectUint32(position_) {
|
|
2432
|
+
const position = position_ ?? this.position;
|
|
2433
|
+
this.assertPosition(position + 3);
|
|
2434
|
+
return this.dataView.getUint32(position);
|
|
2435
|
+
},
|
|
2436
|
+
pushByte(byte) {
|
|
2437
|
+
this.assertPosition(this.position);
|
|
2438
|
+
this.bytes[this.position] = byte;
|
|
2439
|
+
this.position++;
|
|
2440
|
+
},
|
|
2441
|
+
pushBytes(bytes) {
|
|
2442
|
+
this.assertPosition(this.position + bytes.length - 1);
|
|
2443
|
+
this.bytes.set(bytes, this.position);
|
|
2444
|
+
this.position += bytes.length;
|
|
2445
|
+
},
|
|
2446
|
+
pushUint8(value) {
|
|
2447
|
+
this.assertPosition(this.position);
|
|
2448
|
+
this.bytes[this.position] = value;
|
|
2449
|
+
this.position++;
|
|
2450
|
+
},
|
|
2451
|
+
pushUint16(value) {
|
|
2452
|
+
this.assertPosition(this.position + 1);
|
|
2453
|
+
this.dataView.setUint16(this.position, value);
|
|
2454
|
+
this.position += 2;
|
|
2455
|
+
},
|
|
2456
|
+
pushUint24(value) {
|
|
2457
|
+
this.assertPosition(this.position + 2);
|
|
2458
|
+
this.dataView.setUint16(this.position, value >> 8);
|
|
2459
|
+
this.dataView.setUint8(this.position + 2, value & 255);
|
|
2460
|
+
this.position += 3;
|
|
2461
|
+
},
|
|
2462
|
+
pushUint32(value) {
|
|
2463
|
+
this.assertPosition(this.position + 3);
|
|
2464
|
+
this.dataView.setUint32(this.position, value);
|
|
2465
|
+
this.position += 4;
|
|
2466
|
+
},
|
|
2467
|
+
readByte() {
|
|
2468
|
+
this.assertReadLimit();
|
|
2469
|
+
this._touch();
|
|
2470
|
+
const value = this.inspectByte();
|
|
2471
|
+
this.position++;
|
|
2472
|
+
return value;
|
|
2473
|
+
},
|
|
2474
|
+
readBytes(length, size) {
|
|
2475
|
+
this.assertReadLimit();
|
|
2476
|
+
this._touch();
|
|
2477
|
+
const value = this.inspectBytes(length);
|
|
2478
|
+
this.position += size ?? length;
|
|
2479
|
+
return value;
|
|
2480
|
+
},
|
|
2481
|
+
readUint8() {
|
|
2482
|
+
this.assertReadLimit();
|
|
2483
|
+
this._touch();
|
|
2484
|
+
const value = this.inspectUint8();
|
|
2485
|
+
this.position += 1;
|
|
2486
|
+
return value;
|
|
2487
|
+
},
|
|
2488
|
+
readUint16() {
|
|
2489
|
+
this.assertReadLimit();
|
|
2490
|
+
this._touch();
|
|
2491
|
+
const value = this.inspectUint16();
|
|
2492
|
+
this.position += 2;
|
|
2493
|
+
return value;
|
|
2494
|
+
},
|
|
2495
|
+
readUint24() {
|
|
2496
|
+
this.assertReadLimit();
|
|
2497
|
+
this._touch();
|
|
2498
|
+
const value = this.inspectUint24();
|
|
2499
|
+
this.position += 3;
|
|
2500
|
+
return value;
|
|
2501
|
+
},
|
|
2502
|
+
readUint32() {
|
|
2503
|
+
this.assertReadLimit();
|
|
2504
|
+
this._touch();
|
|
2505
|
+
const value = this.inspectUint32();
|
|
2506
|
+
this.position += 4;
|
|
2507
|
+
return value;
|
|
2508
|
+
},
|
|
2509
|
+
get remaining() {
|
|
2510
|
+
return this.bytes.length - this.position;
|
|
2511
|
+
},
|
|
2512
|
+
setPosition(position) {
|
|
2513
|
+
const oldPosition = this.position;
|
|
2514
|
+
this.assertPosition(position);
|
|
2515
|
+
this.position = position;
|
|
2516
|
+
return () => this.position = oldPosition;
|
|
2517
|
+
},
|
|
2518
|
+
_touch() {
|
|
2519
|
+
if (this.recursiveReadLimit === Number.POSITIVE_INFINITY) return;
|
|
2520
|
+
const count = this.getReadCount();
|
|
2521
|
+
this.positionReadCount.set(this.position, count + 1);
|
|
2522
|
+
if (count > 0) this.recursiveReadCount++;
|
|
2523
|
+
}
|
|
2524
|
+
};
|
|
2525
|
+
function createCursor(bytes, { recursiveReadLimit = 8192 } = {}) {
|
|
2526
|
+
const cursor = Object.create(staticCursor);
|
|
2527
|
+
cursor.bytes = bytes;
|
|
2528
|
+
cursor.dataView = new DataView(bytes.buffer ?? bytes, bytes.byteOffset, bytes.byteLength);
|
|
2529
|
+
cursor.positionReadCount = /* @__PURE__ */ new Map();
|
|
2530
|
+
cursor.recursiveReadLimit = recursiveReadLimit;
|
|
2531
|
+
return cursor;
|
|
2532
|
+
}
|
|
2533
|
+
//#endregion
|
|
1047
2534
|
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/encoding/fromBytes.js
|
|
1048
2535
|
/**
|
|
1049
2536
|
* Decodes a byte array into a bigint.
|
|
@@ -1295,7 +2782,7 @@ function decodeErrorResult(parameters) {
|
|
|
1295
2782
|
...abi || [],
|
|
1296
2783
|
solidityError,
|
|
1297
2784
|
solidityPanic
|
|
1298
|
-
].find((x) => x.type === "error" && signature === toFunctionSelector(formatAbiItem
|
|
2785
|
+
].find((x) => x.type === "error" && signature === toFunctionSelector(formatAbiItem(x)));
|
|
1299
2786
|
if (!abiItem) throw new AbiErrorSignatureNotFoundError(signature, {
|
|
1300
2787
|
docsPath: "/docs/contract/decodeErrorResult",
|
|
1301
2788
|
cause
|
|
@@ -1307,6 +2794,12 @@ function decodeErrorResult(parameters) {
|
|
|
1307
2794
|
};
|
|
1308
2795
|
}
|
|
1309
2796
|
//#endregion
|
|
2797
|
+
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/stringify.js
|
|
2798
|
+
const stringify$1 = (value, replacer, space) => JSON.stringify(value, (key, value_) => {
|
|
2799
|
+
const value = typeof value_ === "bigint" ? value_.toString() : value_;
|
|
2800
|
+
return typeof replacer === "function" ? replacer(key, value) : value;
|
|
2801
|
+
}, space);
|
|
2802
|
+
//#endregion
|
|
1310
2803
|
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/abi/formatAbiItemWithArgs.js
|
|
1311
2804
|
function formatAbiItemWithArgs({ abiItem, args, includeFunctionName = true, includeName = false }) {
|
|
1312
2805
|
if (!("name" in abiItem)) return;
|
|
@@ -1315,13 +2808,77 @@ function formatAbiItemWithArgs({ abiItem, args, includeFunctionName = true, incl
|
|
|
1315
2808
|
return `${includeFunctionName ? abiItem.name : ""}(${abiItem.inputs.map((input, i) => `${includeName && input.name ? `${input.name}: ` : ""}${typeof args[i] === "object" ? stringify$1(args[i]) : args[i]}`).join(", ")})`;
|
|
1316
2809
|
}
|
|
1317
2810
|
//#endregion
|
|
2811
|
+
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/constants/unit.js
|
|
2812
|
+
const etherUnits = {
|
|
2813
|
+
gwei: 9,
|
|
2814
|
+
wei: 18
|
|
2815
|
+
};
|
|
2816
|
+
const gweiUnits = {
|
|
2817
|
+
ether: -9,
|
|
2818
|
+
wei: 9
|
|
2819
|
+
};
|
|
2820
|
+
//#endregion
|
|
2821
|
+
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/unit/formatUnits.js
|
|
2822
|
+
/**
|
|
2823
|
+
* Divides a number by a given exponent of base 10 (10exponent), and formats it into a string representation of the number..
|
|
2824
|
+
*
|
|
2825
|
+
* - Docs: https://viem.sh/docs/utilities/formatUnits
|
|
2826
|
+
*
|
|
2827
|
+
* @example
|
|
2828
|
+
* import { formatUnits } from 'viem'
|
|
2829
|
+
*
|
|
2830
|
+
* formatUnits(420000000000n, 9)
|
|
2831
|
+
* // '420'
|
|
2832
|
+
*/
|
|
2833
|
+
function formatUnits(value, decimals) {
|
|
2834
|
+
let display = value.toString();
|
|
2835
|
+
const negative = display.startsWith("-");
|
|
2836
|
+
if (negative) display = display.slice(1);
|
|
2837
|
+
display = display.padStart(decimals, "0");
|
|
2838
|
+
let [integer, fraction] = [display.slice(0, display.length - decimals), display.slice(display.length - decimals)];
|
|
2839
|
+
fraction = fraction.replace(/(0+)$/, "");
|
|
2840
|
+
return `${negative ? "-" : ""}${integer || "0"}${fraction ? `.${fraction}` : ""}`;
|
|
2841
|
+
}
|
|
2842
|
+
//#endregion
|
|
2843
|
+
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/unit/formatEther.js
|
|
2844
|
+
/**
|
|
2845
|
+
* Converts numerical wei to a string representation of ether.
|
|
2846
|
+
*
|
|
2847
|
+
* - Docs: https://viem.sh/docs/utilities/formatEther
|
|
2848
|
+
*
|
|
2849
|
+
* @example
|
|
2850
|
+
* import { formatEther } from 'viem'
|
|
2851
|
+
*
|
|
2852
|
+
* formatEther(1000000000000000000n)
|
|
2853
|
+
* // '1'
|
|
2854
|
+
*/
|
|
2855
|
+
function formatEther(wei, unit = "wei") {
|
|
2856
|
+
return formatUnits(wei, etherUnits[unit]);
|
|
2857
|
+
}
|
|
2858
|
+
//#endregion
|
|
2859
|
+
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/unit/formatGwei.js
|
|
2860
|
+
/**
|
|
2861
|
+
* Converts numerical wei to a string representation of gwei.
|
|
2862
|
+
*
|
|
2863
|
+
* - Docs: https://viem.sh/docs/utilities/formatGwei
|
|
2864
|
+
*
|
|
2865
|
+
* @example
|
|
2866
|
+
* import { formatGwei } from 'viem'
|
|
2867
|
+
*
|
|
2868
|
+
* formatGwei(1000000000n)
|
|
2869
|
+
* // '1'
|
|
2870
|
+
*/
|
|
2871
|
+
function formatGwei(wei, unit = "wei") {
|
|
2872
|
+
return formatUnits(wei, gweiUnits[unit]);
|
|
2873
|
+
}
|
|
2874
|
+
//#endregion
|
|
1318
2875
|
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/errors/stateOverride.js
|
|
1319
|
-
var AccountStateConflictError = class extends BaseError$
|
|
2876
|
+
var AccountStateConflictError = class extends BaseError$1 {
|
|
1320
2877
|
constructor({ address }) {
|
|
1321
2878
|
super(`State for account "${address}" is set multiple times.`, { name: "AccountStateConflictError" });
|
|
1322
2879
|
}
|
|
1323
2880
|
};
|
|
1324
|
-
var StateAssignmentConflictError = class extends BaseError$
|
|
2881
|
+
var StateAssignmentConflictError = class extends BaseError$1 {
|
|
1325
2882
|
constructor() {
|
|
1326
2883
|
super("state and stateDiff are set on the same account.", { name: "StateAssignmentConflictError" });
|
|
1327
2884
|
}
|
|
@@ -1350,12 +2907,121 @@ function prettyStateOverride(stateOverride) {
|
|
|
1350
2907
|
}, " State Override:\n").slice(0, -1);
|
|
1351
2908
|
}
|
|
1352
2909
|
//#endregion
|
|
2910
|
+
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/errors/transaction.js
|
|
2911
|
+
function prettyPrint(args) {
|
|
2912
|
+
const entries = Object.entries(args).map(([key, value]) => {
|
|
2913
|
+
if (value === void 0 || value === false) return null;
|
|
2914
|
+
return [key, value];
|
|
2915
|
+
}).filter(Boolean);
|
|
2916
|
+
const maxLength = entries.reduce((acc, [key]) => Math.max(acc, key.length), 0);
|
|
2917
|
+
return entries.map(([key, value]) => ` ${`${key}:`.padEnd(maxLength + 1)} ${value}`).join("\n");
|
|
2918
|
+
}
|
|
2919
|
+
var InvalidLegacyVError = class extends BaseError$1 {
|
|
2920
|
+
constructor({ v }) {
|
|
2921
|
+
super(`Invalid \`v\` value "${v}". Expected 27 or 28.`, { name: "InvalidLegacyVError" });
|
|
2922
|
+
}
|
|
2923
|
+
};
|
|
2924
|
+
var InvalidSerializableTransactionError = class extends BaseError$1 {
|
|
2925
|
+
constructor({ transaction }) {
|
|
2926
|
+
super("Cannot infer a transaction type from provided transaction.", {
|
|
2927
|
+
metaMessages: [
|
|
2928
|
+
"Provided Transaction:",
|
|
2929
|
+
"{",
|
|
2930
|
+
prettyPrint(transaction),
|
|
2931
|
+
"}",
|
|
2932
|
+
"",
|
|
2933
|
+
"To infer the type, either provide:",
|
|
2934
|
+
"- a `type` to the Transaction, or",
|
|
2935
|
+
"- an EIP-1559 Transaction with `maxFeePerGas`, or",
|
|
2936
|
+
"- an EIP-2930 Transaction with `gasPrice` & `accessList`, or",
|
|
2937
|
+
"- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or",
|
|
2938
|
+
"- an EIP-7702 Transaction with `authorizationList`, or",
|
|
2939
|
+
"- a Legacy Transaction with `gasPrice`"
|
|
2940
|
+
],
|
|
2941
|
+
name: "InvalidSerializableTransactionError"
|
|
2942
|
+
});
|
|
2943
|
+
}
|
|
2944
|
+
};
|
|
2945
|
+
var InvalidSerializedTransactionTypeError = class extends BaseError$1 {
|
|
2946
|
+
constructor({ serializedType }) {
|
|
2947
|
+
super(`Serialized transaction type "${serializedType}" is invalid.`, { name: "InvalidSerializedTransactionType" });
|
|
2948
|
+
Object.defineProperty(this, "serializedType", {
|
|
2949
|
+
enumerable: true,
|
|
2950
|
+
configurable: true,
|
|
2951
|
+
writable: true,
|
|
2952
|
+
value: void 0
|
|
2953
|
+
});
|
|
2954
|
+
this.serializedType = serializedType;
|
|
2955
|
+
}
|
|
2956
|
+
};
|
|
2957
|
+
var InvalidSerializedTransactionError = class extends BaseError$1 {
|
|
2958
|
+
constructor({ attributes, serializedTransaction, type }) {
|
|
2959
|
+
const missing = Object.entries(attributes).map(([key, value]) => typeof value === "undefined" ? key : void 0).filter(Boolean);
|
|
2960
|
+
super(`Invalid serialized transaction of type "${type}" was provided.`, {
|
|
2961
|
+
metaMessages: [`Serialized Transaction: "${serializedTransaction}"`, missing.length > 0 ? `Missing Attributes: ${missing.join(", ")}` : ""].filter(Boolean),
|
|
2962
|
+
name: "InvalidSerializedTransactionError"
|
|
2963
|
+
});
|
|
2964
|
+
Object.defineProperty(this, "serializedTransaction", {
|
|
2965
|
+
enumerable: true,
|
|
2966
|
+
configurable: true,
|
|
2967
|
+
writable: true,
|
|
2968
|
+
value: void 0
|
|
2969
|
+
});
|
|
2970
|
+
Object.defineProperty(this, "type", {
|
|
2971
|
+
enumerable: true,
|
|
2972
|
+
configurable: true,
|
|
2973
|
+
writable: true,
|
|
2974
|
+
value: void 0
|
|
2975
|
+
});
|
|
2976
|
+
this.serializedTransaction = serializedTransaction;
|
|
2977
|
+
this.type = type;
|
|
2978
|
+
}
|
|
2979
|
+
};
|
|
2980
|
+
var InvalidStorageKeySizeError = class extends BaseError$1 {
|
|
2981
|
+
constructor({ storageKey }) {
|
|
2982
|
+
super(`Size for storage key "${storageKey}" is invalid. Expected 32 bytes. Got ${Math.floor((storageKey.length - 2) / 2)} bytes.`, { name: "InvalidStorageKeySizeError" });
|
|
2983
|
+
}
|
|
2984
|
+
};
|
|
2985
|
+
var TransactionExecutionError = class extends BaseError$1 {
|
|
2986
|
+
constructor(cause, { account, docsPath, chain, data, gas, gasPrice, maxFeePerGas, maxPriorityFeePerGas, nonce, to, value }) {
|
|
2987
|
+
const prettyArgs = prettyPrint({
|
|
2988
|
+
chain: chain && `${chain?.name} (id: ${chain?.id})`,
|
|
2989
|
+
from: account?.address,
|
|
2990
|
+
to,
|
|
2991
|
+
value: typeof value !== "undefined" && `${formatEther(value)} ${chain?.nativeCurrency?.symbol || "ETH"}`,
|
|
2992
|
+
data,
|
|
2993
|
+
gas,
|
|
2994
|
+
gasPrice: typeof gasPrice !== "undefined" && `${formatGwei(gasPrice)} gwei`,
|
|
2995
|
+
maxFeePerGas: typeof maxFeePerGas !== "undefined" && `${formatGwei(maxFeePerGas)} gwei`,
|
|
2996
|
+
maxPriorityFeePerGas: typeof maxPriorityFeePerGas !== "undefined" && `${formatGwei(maxPriorityFeePerGas)} gwei`,
|
|
2997
|
+
nonce
|
|
2998
|
+
});
|
|
2999
|
+
super(cause.shortMessage, {
|
|
3000
|
+
cause,
|
|
3001
|
+
docsPath,
|
|
3002
|
+
metaMessages: [
|
|
3003
|
+
...cause.metaMessages ? [...cause.metaMessages, " "] : [],
|
|
3004
|
+
"Request Arguments:",
|
|
3005
|
+
prettyArgs
|
|
3006
|
+
].filter(Boolean),
|
|
3007
|
+
name: "TransactionExecutionError"
|
|
3008
|
+
});
|
|
3009
|
+
Object.defineProperty(this, "cause", {
|
|
3010
|
+
enumerable: true,
|
|
3011
|
+
configurable: true,
|
|
3012
|
+
writable: true,
|
|
3013
|
+
value: void 0
|
|
3014
|
+
});
|
|
3015
|
+
this.cause = cause;
|
|
3016
|
+
}
|
|
3017
|
+
};
|
|
3018
|
+
//#endregion
|
|
1353
3019
|
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/errors/utils.js
|
|
1354
3020
|
const getContractAddress = (address) => address;
|
|
1355
3021
|
const getUrl = (url) => url;
|
|
1356
3022
|
//#endregion
|
|
1357
3023
|
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/errors/contract.js
|
|
1358
|
-
var CallExecutionError = class extends BaseError$
|
|
3024
|
+
var CallExecutionError = class extends BaseError$1 {
|
|
1359
3025
|
constructor(cause, { account: account_, docsPath, chain, data, gas, gasPrice, maxFeePerGas, maxPriorityFeePerGas, nonce, to, value, stateOverride }) {
|
|
1360
3026
|
let prettyArgs = prettyPrint({
|
|
1361
3027
|
from: (account_ ? parseAccount(account_) : void 0)?.address,
|
|
@@ -1388,7 +3054,7 @@ var CallExecutionError = class extends BaseError$2 {
|
|
|
1388
3054
|
this.cause = cause;
|
|
1389
3055
|
}
|
|
1390
3056
|
};
|
|
1391
|
-
var ContractFunctionExecutionError = class extends BaseError$
|
|
3057
|
+
var ContractFunctionExecutionError = class extends BaseError$1 {
|
|
1392
3058
|
constructor(cause, { abi, args, contractAddress, docsPath, functionName, sender }) {
|
|
1393
3059
|
const abiItem = getAbiItem({
|
|
1394
3060
|
abi,
|
|
@@ -1401,7 +3067,7 @@ var ContractFunctionExecutionError = class extends BaseError$2 {
|
|
|
1401
3067
|
includeFunctionName: false,
|
|
1402
3068
|
includeName: false
|
|
1403
3069
|
}) : void 0;
|
|
1404
|
-
const functionWithParams = abiItem ? formatAbiItem
|
|
3070
|
+
const functionWithParams = abiItem ? formatAbiItem(abiItem, { includeName: true }) : void 0;
|
|
1405
3071
|
const prettyArgs = prettyPrint({
|
|
1406
3072
|
address: contractAddress && getContractAddress(contractAddress),
|
|
1407
3073
|
function: functionWithParams,
|
|
@@ -1468,7 +3134,7 @@ var ContractFunctionExecutionError = class extends BaseError$2 {
|
|
|
1468
3134
|
this.sender = sender;
|
|
1469
3135
|
}
|
|
1470
3136
|
};
|
|
1471
|
-
var ContractFunctionRevertedError = class extends BaseError$
|
|
3137
|
+
var ContractFunctionRevertedError = class extends BaseError$1 {
|
|
1472
3138
|
constructor({ abi, data, functionName, message, cause: error }) {
|
|
1473
3139
|
let cause;
|
|
1474
3140
|
let decodedData;
|
|
@@ -1486,7 +3152,7 @@ var ContractFunctionRevertedError = class extends BaseError$2 {
|
|
|
1486
3152
|
const [firstArg] = errorArgs;
|
|
1487
3153
|
reason = panicReasons[firstArg];
|
|
1488
3154
|
} else {
|
|
1489
|
-
const errorWithParams = abiItem ? formatAbiItem
|
|
3155
|
+
const errorWithParams = abiItem ? formatAbiItem(abiItem, { includeName: true }) : void 0;
|
|
1490
3156
|
const formattedArgs = abiItem && errorArgs ? formatAbiItemWithArgs({
|
|
1491
3157
|
abiItem,
|
|
1492
3158
|
args: errorArgs,
|
|
@@ -1543,7 +3209,7 @@ var ContractFunctionRevertedError = class extends BaseError$2 {
|
|
|
1543
3209
|
this.signature = signature;
|
|
1544
3210
|
}
|
|
1545
3211
|
};
|
|
1546
|
-
var ContractFunctionZeroDataError = class extends BaseError$
|
|
3212
|
+
var ContractFunctionZeroDataError = class extends BaseError$1 {
|
|
1547
3213
|
constructor({ functionName, cause }) {
|
|
1548
3214
|
super(`The contract function "${functionName}" returned no data ("0x").`, {
|
|
1549
3215
|
metaMessages: [
|
|
@@ -1557,7 +3223,7 @@ var ContractFunctionZeroDataError = class extends BaseError$2 {
|
|
|
1557
3223
|
});
|
|
1558
3224
|
}
|
|
1559
3225
|
};
|
|
1560
|
-
var CounterfactualDeploymentFailedError = class extends BaseError$
|
|
3226
|
+
var CounterfactualDeploymentFailedError = class extends BaseError$1 {
|
|
1561
3227
|
constructor({ factory }) {
|
|
1562
3228
|
super(`Deployment for counterfactual contract call failed${factory ? ` for factory "${factory}".` : ""}`, {
|
|
1563
3229
|
metaMessages: [
|
|
@@ -1569,7 +3235,7 @@ var CounterfactualDeploymentFailedError = class extends BaseError$2 {
|
|
|
1569
3235
|
});
|
|
1570
3236
|
}
|
|
1571
3237
|
};
|
|
1572
|
-
var RawContractError = class extends BaseError$
|
|
3238
|
+
var RawContractError = class extends BaseError$1 {
|
|
1573
3239
|
constructor({ data, message }) {
|
|
1574
3240
|
super(message || "", { name: "RawContractError" });
|
|
1575
3241
|
Object.defineProperty(this, "code", {
|
|
@@ -1589,7 +3255,7 @@ var RawContractError = class extends BaseError$2 {
|
|
|
1589
3255
|
};
|
|
1590
3256
|
//#endregion
|
|
1591
3257
|
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/errors/request.js
|
|
1592
|
-
var HttpRequestError = class extends BaseError$
|
|
3258
|
+
var HttpRequestError = class extends BaseError$1 {
|
|
1593
3259
|
constructor({ body, cause, details, headers, status, url }) {
|
|
1594
3260
|
super("HTTP request failed.", {
|
|
1595
3261
|
cause,
|
|
@@ -1631,7 +3297,7 @@ var HttpRequestError = class extends BaseError$2 {
|
|
|
1631
3297
|
this.url = url;
|
|
1632
3298
|
}
|
|
1633
3299
|
};
|
|
1634
|
-
var RpcRequestError = class extends BaseError$
|
|
3300
|
+
var RpcRequestError = class extends BaseError$1 {
|
|
1635
3301
|
constructor({ body, error, url }) {
|
|
1636
3302
|
super("RPC Request failed.", {
|
|
1637
3303
|
cause: error,
|
|
@@ -1662,7 +3328,7 @@ var RpcRequestError = class extends BaseError$2 {
|
|
|
1662
3328
|
this.url = url;
|
|
1663
3329
|
}
|
|
1664
3330
|
};
|
|
1665
|
-
var TimeoutError = class extends BaseError$
|
|
3331
|
+
var TimeoutError = class extends BaseError$1 {
|
|
1666
3332
|
constructor({ body, url }) {
|
|
1667
3333
|
super("The request took too long to respond.", {
|
|
1668
3334
|
details: "The request timed out.",
|
|
@@ -1681,7 +3347,7 @@ var TimeoutError = class extends BaseError$2 {
|
|
|
1681
3347
|
//#endregion
|
|
1682
3348
|
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/errors/rpc.js
|
|
1683
3349
|
const unknownErrorCode = -1;
|
|
1684
|
-
var RpcError = class extends BaseError$
|
|
3350
|
+
var RpcError = class extends BaseError$1 {
|
|
1685
3351
|
constructor(cause, { code, docsPath, metaMessages, name, shortMessage }) {
|
|
1686
3352
|
super(shortMessage, {
|
|
1687
3353
|
cause,
|
|
@@ -2116,11 +3782,192 @@ var UnknownRpcError = class extends RpcError {
|
|
|
2116
3782
|
}
|
|
2117
3783
|
};
|
|
2118
3784
|
//#endregion
|
|
3785
|
+
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/errors/node.js
|
|
3786
|
+
var ExecutionRevertedError = class extends BaseError$1 {
|
|
3787
|
+
constructor({ cause, message } = {}) {
|
|
3788
|
+
const reason = message?.replace("execution reverted: ", "")?.replace("execution reverted", "");
|
|
3789
|
+
super(`Execution reverted ${reason ? `with reason: ${reason}` : "for an unknown reason"}.`, {
|
|
3790
|
+
cause,
|
|
3791
|
+
name: "ExecutionRevertedError"
|
|
3792
|
+
});
|
|
3793
|
+
}
|
|
3794
|
+
};
|
|
3795
|
+
Object.defineProperty(ExecutionRevertedError, "code", {
|
|
3796
|
+
enumerable: true,
|
|
3797
|
+
configurable: true,
|
|
3798
|
+
writable: true,
|
|
3799
|
+
value: 3
|
|
3800
|
+
});
|
|
3801
|
+
Object.defineProperty(ExecutionRevertedError, "nodeMessage", {
|
|
3802
|
+
enumerable: true,
|
|
3803
|
+
configurable: true,
|
|
3804
|
+
writable: true,
|
|
3805
|
+
value: /execution reverted|gas required exceeds allowance/
|
|
3806
|
+
});
|
|
3807
|
+
var FeeCapTooHighError = class extends BaseError$1 {
|
|
3808
|
+
constructor({ cause, maxFeePerGas } = {}) {
|
|
3809
|
+
super(`The fee cap (\`maxFeePerGas\`${maxFeePerGas ? ` = ${formatGwei(maxFeePerGas)} gwei` : ""}) cannot be higher than the maximum allowed value (2^256-1).`, {
|
|
3810
|
+
cause,
|
|
3811
|
+
name: "FeeCapTooHighError"
|
|
3812
|
+
});
|
|
3813
|
+
}
|
|
3814
|
+
};
|
|
3815
|
+
Object.defineProperty(FeeCapTooHighError, "nodeMessage", {
|
|
3816
|
+
enumerable: true,
|
|
3817
|
+
configurable: true,
|
|
3818
|
+
writable: true,
|
|
3819
|
+
value: /max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/
|
|
3820
|
+
});
|
|
3821
|
+
var FeeCapTooLowError = class extends BaseError$1 {
|
|
3822
|
+
constructor({ cause, maxFeePerGas } = {}) {
|
|
3823
|
+
super(`The fee cap (\`maxFeePerGas\`${maxFeePerGas ? ` = ${formatGwei(maxFeePerGas)}` : ""} gwei) cannot be lower than the block base fee.`, {
|
|
3824
|
+
cause,
|
|
3825
|
+
name: "FeeCapTooLowError"
|
|
3826
|
+
});
|
|
3827
|
+
}
|
|
3828
|
+
};
|
|
3829
|
+
Object.defineProperty(FeeCapTooLowError, "nodeMessage", {
|
|
3830
|
+
enumerable: true,
|
|
3831
|
+
configurable: true,
|
|
3832
|
+
writable: true,
|
|
3833
|
+
value: /max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/
|
|
3834
|
+
});
|
|
3835
|
+
var NonceTooHighError = class extends BaseError$1 {
|
|
3836
|
+
constructor({ cause, nonce } = {}) {
|
|
3837
|
+
super(`Nonce provided for the transaction ${nonce ? `(${nonce}) ` : ""}is higher than the next one expected.`, {
|
|
3838
|
+
cause,
|
|
3839
|
+
name: "NonceTooHighError"
|
|
3840
|
+
});
|
|
3841
|
+
}
|
|
3842
|
+
};
|
|
3843
|
+
Object.defineProperty(NonceTooHighError, "nodeMessage", {
|
|
3844
|
+
enumerable: true,
|
|
3845
|
+
configurable: true,
|
|
3846
|
+
writable: true,
|
|
3847
|
+
value: /nonce too high/
|
|
3848
|
+
});
|
|
3849
|
+
var NonceTooLowError = class extends BaseError$1 {
|
|
3850
|
+
constructor({ cause, nonce } = {}) {
|
|
3851
|
+
super([`Nonce provided for the transaction ${nonce ? `(${nonce}) ` : ""}is lower than the current nonce of the account.`, "Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join("\n"), {
|
|
3852
|
+
cause,
|
|
3853
|
+
name: "NonceTooLowError"
|
|
3854
|
+
});
|
|
3855
|
+
}
|
|
3856
|
+
};
|
|
3857
|
+
Object.defineProperty(NonceTooLowError, "nodeMessage", {
|
|
3858
|
+
enumerable: true,
|
|
3859
|
+
configurable: true,
|
|
3860
|
+
writable: true,
|
|
3861
|
+
value: /nonce too low|transaction already imported|already known/
|
|
3862
|
+
});
|
|
3863
|
+
var NonceMaxValueError = class extends BaseError$1 {
|
|
3864
|
+
constructor({ cause, nonce } = {}) {
|
|
3865
|
+
super(`Nonce provided for the transaction ${nonce ? `(${nonce}) ` : ""}exceeds the maximum allowed nonce.`, {
|
|
3866
|
+
cause,
|
|
3867
|
+
name: "NonceMaxValueError"
|
|
3868
|
+
});
|
|
3869
|
+
}
|
|
3870
|
+
};
|
|
3871
|
+
Object.defineProperty(NonceMaxValueError, "nodeMessage", {
|
|
3872
|
+
enumerable: true,
|
|
3873
|
+
configurable: true,
|
|
3874
|
+
writable: true,
|
|
3875
|
+
value: /nonce has max value/
|
|
3876
|
+
});
|
|
3877
|
+
var InsufficientFundsError = class extends BaseError$1 {
|
|
3878
|
+
constructor({ cause } = {}) {
|
|
3879
|
+
super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join("\n"), {
|
|
3880
|
+
cause,
|
|
3881
|
+
metaMessages: [
|
|
3882
|
+
"This error could arise when the account does not have enough funds to:",
|
|
3883
|
+
" - pay for the total gas fee,",
|
|
3884
|
+
" - pay for the value to send.",
|
|
3885
|
+
" ",
|
|
3886
|
+
"The cost of the transaction is calculated as `gas * gas fee + value`, where:",
|
|
3887
|
+
" - `gas` is the amount of gas needed for transaction to execute,",
|
|
3888
|
+
" - `gas fee` is the gas fee,",
|
|
3889
|
+
" - `value` is the amount of ether to send to the recipient."
|
|
3890
|
+
],
|
|
3891
|
+
name: "InsufficientFundsError"
|
|
3892
|
+
});
|
|
3893
|
+
}
|
|
3894
|
+
};
|
|
3895
|
+
Object.defineProperty(InsufficientFundsError, "nodeMessage", {
|
|
3896
|
+
enumerable: true,
|
|
3897
|
+
configurable: true,
|
|
3898
|
+
writable: true,
|
|
3899
|
+
value: /insufficient funds|exceeds transaction sender account balance/
|
|
3900
|
+
});
|
|
3901
|
+
var IntrinsicGasTooHighError = class extends BaseError$1 {
|
|
3902
|
+
constructor({ cause, gas } = {}) {
|
|
3903
|
+
super(`The amount of gas ${gas ? `(${gas}) ` : ""}provided for the transaction exceeds the limit allowed for the block.`, {
|
|
3904
|
+
cause,
|
|
3905
|
+
name: "IntrinsicGasTooHighError"
|
|
3906
|
+
});
|
|
3907
|
+
}
|
|
3908
|
+
};
|
|
3909
|
+
Object.defineProperty(IntrinsicGasTooHighError, "nodeMessage", {
|
|
3910
|
+
enumerable: true,
|
|
3911
|
+
configurable: true,
|
|
3912
|
+
writable: true,
|
|
3913
|
+
value: /intrinsic gas too high|gas limit reached/
|
|
3914
|
+
});
|
|
3915
|
+
var IntrinsicGasTooLowError = class extends BaseError$1 {
|
|
3916
|
+
constructor({ cause, gas } = {}) {
|
|
3917
|
+
super(`The amount of gas ${gas ? `(${gas}) ` : ""}provided for the transaction is too low.`, {
|
|
3918
|
+
cause,
|
|
3919
|
+
name: "IntrinsicGasTooLowError"
|
|
3920
|
+
});
|
|
3921
|
+
}
|
|
3922
|
+
};
|
|
3923
|
+
Object.defineProperty(IntrinsicGasTooLowError, "nodeMessage", {
|
|
3924
|
+
enumerable: true,
|
|
3925
|
+
configurable: true,
|
|
3926
|
+
writable: true,
|
|
3927
|
+
value: /intrinsic gas too low/
|
|
3928
|
+
});
|
|
3929
|
+
var TransactionTypeNotSupportedError = class extends BaseError$1 {
|
|
3930
|
+
constructor({ cause }) {
|
|
3931
|
+
super("The transaction type is not supported for this chain.", {
|
|
3932
|
+
cause,
|
|
3933
|
+
name: "TransactionTypeNotSupportedError"
|
|
3934
|
+
});
|
|
3935
|
+
}
|
|
3936
|
+
};
|
|
3937
|
+
Object.defineProperty(TransactionTypeNotSupportedError, "nodeMessage", {
|
|
3938
|
+
enumerable: true,
|
|
3939
|
+
configurable: true,
|
|
3940
|
+
writable: true,
|
|
3941
|
+
value: /transaction type not valid/
|
|
3942
|
+
});
|
|
3943
|
+
var TipAboveFeeCapError = class extends BaseError$1 {
|
|
3944
|
+
constructor({ cause, maxPriorityFeePerGas, maxFeePerGas } = {}) {
|
|
3945
|
+
super([`The provided tip (\`maxPriorityFeePerGas\`${maxPriorityFeePerGas ? ` = ${formatGwei(maxPriorityFeePerGas)} gwei` : ""}) cannot be higher than the fee cap (\`maxFeePerGas\`${maxFeePerGas ? ` = ${formatGwei(maxFeePerGas)} gwei` : ""}).`].join("\n"), {
|
|
3946
|
+
cause,
|
|
3947
|
+
name: "TipAboveFeeCapError"
|
|
3948
|
+
});
|
|
3949
|
+
}
|
|
3950
|
+
};
|
|
3951
|
+
Object.defineProperty(TipAboveFeeCapError, "nodeMessage", {
|
|
3952
|
+
enumerable: true,
|
|
3953
|
+
configurable: true,
|
|
3954
|
+
writable: true,
|
|
3955
|
+
value: /max priority fee per gas higher than max fee per gas|tip higher than fee cap/
|
|
3956
|
+
});
|
|
3957
|
+
var UnknownNodeError = class extends BaseError$1 {
|
|
3958
|
+
constructor({ cause }) {
|
|
3959
|
+
super(`An error occurred while executing: ${cause?.shortMessage}`, {
|
|
3960
|
+
cause,
|
|
3961
|
+
name: "UnknownNodeError"
|
|
3962
|
+
});
|
|
3963
|
+
}
|
|
3964
|
+
};
|
|
3965
|
+
//#endregion
|
|
2119
3966
|
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/errors/getNodeError.js
|
|
2120
3967
|
function getNodeError(err, args) {
|
|
2121
3968
|
const message = (err.details || "").toLowerCase();
|
|
2122
|
-
const executionRevertedError = err instanceof BaseError$
|
|
2123
|
-
if (executionRevertedError instanceof BaseError$
|
|
3969
|
+
const executionRevertedError = err instanceof BaseError$1 ? err.walk((e) => e?.code === ExecutionRevertedError.code) : err;
|
|
3970
|
+
if (executionRevertedError instanceof BaseError$1) return new ExecutionRevertedError({
|
|
2124
3971
|
cause: err,
|
|
2125
3972
|
message: executionRevertedError.details
|
|
2126
3973
|
});
|
|
@@ -2288,6 +4135,71 @@ function serializeStateOverride(parameters) {
|
|
|
2288
4135
|
}
|
|
2289
4136
|
return rpcStateOverride;
|
|
2290
4137
|
}
|
|
4138
|
+
2n ** (8n - 1n) - 1n;
|
|
4139
|
+
2n ** (16n - 1n) - 1n;
|
|
4140
|
+
2n ** (24n - 1n) - 1n;
|
|
4141
|
+
2n ** (32n - 1n) - 1n;
|
|
4142
|
+
2n ** (40n - 1n) - 1n;
|
|
4143
|
+
2n ** (48n - 1n) - 1n;
|
|
4144
|
+
2n ** (56n - 1n) - 1n;
|
|
4145
|
+
2n ** (64n - 1n) - 1n;
|
|
4146
|
+
2n ** (72n - 1n) - 1n;
|
|
4147
|
+
2n ** (80n - 1n) - 1n;
|
|
4148
|
+
2n ** (88n - 1n) - 1n;
|
|
4149
|
+
2n ** (96n - 1n) - 1n;
|
|
4150
|
+
2n ** (104n - 1n) - 1n;
|
|
4151
|
+
2n ** (112n - 1n) - 1n;
|
|
4152
|
+
2n ** (120n - 1n) - 1n;
|
|
4153
|
+
2n ** (128n - 1n) - 1n;
|
|
4154
|
+
2n ** (136n - 1n) - 1n;
|
|
4155
|
+
2n ** (144n - 1n) - 1n;
|
|
4156
|
+
2n ** (152n - 1n) - 1n;
|
|
4157
|
+
2n ** (160n - 1n) - 1n;
|
|
4158
|
+
2n ** (168n - 1n) - 1n;
|
|
4159
|
+
2n ** (176n - 1n) - 1n;
|
|
4160
|
+
2n ** (184n - 1n) - 1n;
|
|
4161
|
+
2n ** (192n - 1n) - 1n;
|
|
4162
|
+
2n ** (200n - 1n) - 1n;
|
|
4163
|
+
2n ** (208n - 1n) - 1n;
|
|
4164
|
+
2n ** (216n - 1n) - 1n;
|
|
4165
|
+
2n ** (224n - 1n) - 1n;
|
|
4166
|
+
2n ** (232n - 1n) - 1n;
|
|
4167
|
+
2n ** (240n - 1n) - 1n;
|
|
4168
|
+
2n ** (248n - 1n) - 1n;
|
|
4169
|
+
2n ** (256n - 1n) - 1n;
|
|
4170
|
+
-(2n ** (8n - 1n));
|
|
4171
|
+
-(2n ** (16n - 1n));
|
|
4172
|
+
-(2n ** (24n - 1n));
|
|
4173
|
+
-(2n ** (32n - 1n));
|
|
4174
|
+
-(2n ** (40n - 1n));
|
|
4175
|
+
-(2n ** (48n - 1n));
|
|
4176
|
+
-(2n ** (56n - 1n));
|
|
4177
|
+
-(2n ** (64n - 1n));
|
|
4178
|
+
-(2n ** (72n - 1n));
|
|
4179
|
+
-(2n ** (80n - 1n));
|
|
4180
|
+
-(2n ** (88n - 1n));
|
|
4181
|
+
-(2n ** (96n - 1n));
|
|
4182
|
+
-(2n ** (104n - 1n));
|
|
4183
|
+
-(2n ** (112n - 1n));
|
|
4184
|
+
-(2n ** (120n - 1n));
|
|
4185
|
+
-(2n ** (128n - 1n));
|
|
4186
|
+
-(2n ** (136n - 1n));
|
|
4187
|
+
-(2n ** (144n - 1n));
|
|
4188
|
+
-(2n ** (152n - 1n));
|
|
4189
|
+
-(2n ** (160n - 1n));
|
|
4190
|
+
-(2n ** (168n - 1n));
|
|
4191
|
+
-(2n ** (176n - 1n));
|
|
4192
|
+
-(2n ** (184n - 1n));
|
|
4193
|
+
-(2n ** (192n - 1n));
|
|
4194
|
+
-(2n ** (200n - 1n));
|
|
4195
|
+
-(2n ** (208n - 1n));
|
|
4196
|
+
-(2n ** (216n - 1n));
|
|
4197
|
+
-(2n ** (224n - 1n));
|
|
4198
|
+
-(2n ** (232n - 1n));
|
|
4199
|
+
-(2n ** (240n - 1n));
|
|
4200
|
+
-(2n ** (248n - 1n));
|
|
4201
|
+
-(2n ** (256n - 1n));
|
|
4202
|
+
const maxUint256 = 2n ** 256n - 1n;
|
|
2291
4203
|
//#endregion
|
|
2292
4204
|
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/transaction/assertRequest.js
|
|
2293
4205
|
function assertRequest(args) {
|
|
@@ -2302,6 +4214,13 @@ function assertRequest(args) {
|
|
|
2302
4214
|
});
|
|
2303
4215
|
}
|
|
2304
4216
|
//#endregion
|
|
4217
|
+
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/address/isAddressEqual.js
|
|
4218
|
+
function isAddressEqual(a, b) {
|
|
4219
|
+
if (!isAddress(a, { strict: false })) throw new InvalidAddressError({ address: a });
|
|
4220
|
+
if (!isAddress(b, { strict: false })) throw new InvalidAddressError({ address: b });
|
|
4221
|
+
return a.toLowerCase() === b.toLowerCase();
|
|
4222
|
+
}
|
|
4223
|
+
//#endregion
|
|
2305
4224
|
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/abi/decodeFunctionResult.js
|
|
2306
4225
|
const docsPath$1 = "/docs/contract/decodeFunctionResult";
|
|
2307
4226
|
function decodeFunctionResult(parameters) {
|
|
@@ -4065,6 +5984,39 @@ const deploylessCallViaFactoryBytecode = "0x608060405234801561001057600080fd5b50
|
|
|
4065
5984
|
const erc6492SignatureValidatorByteCode = "0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572";
|
|
4066
5985
|
const multicall3Bytecode = "0x608060405234801561001057600080fd5b506115b9806100206000396000f3fe6080604052600436106100f35760003560e01c80634d2301cc1161008a578063a8b0574e11610059578063a8b0574e14610325578063bce38bd714610350578063c3077fa914610380578063ee82ac5e146103b2576100f3565b80634d2301cc1461026257806372425d9d1461029f57806382ad56cb146102ca57806386d516e8146102fa576100f3565b80633408e470116100c65780633408e470146101af578063399542e9146101da5780633e64a6961461020c57806342cbb15c14610237576100f3565b80630f28c97d146100f8578063174dea7114610123578063252dba421461015357806327e86d6e14610184575b600080fd5b34801561010457600080fd5b5061010d6103ef565b60405161011a9190610c0a565b60405180910390f35b61013d60048036038101906101389190610c94565b6103f7565b60405161014a9190610e94565b60405180910390f35b61016d60048036038101906101689190610f0c565b610615565b60405161017b92919061101b565b60405180910390f35b34801561019057600080fd5b506101996107ab565b6040516101a69190611064565b60405180910390f35b3480156101bb57600080fd5b506101c46107b7565b6040516101d19190610c0a565b60405180910390f35b6101f460048036038101906101ef91906110ab565b6107bf565b6040516102039392919061110b565b60405180910390f35b34801561021857600080fd5b506102216107e1565b60405161022e9190610c0a565b60405180910390f35b34801561024357600080fd5b5061024c6107e9565b6040516102599190610c0a565b60405180910390f35b34801561026e57600080fd5b50610289600480360381019061028491906111a7565b6107f1565b6040516102969190610c0a565b60405180910390f35b3480156102ab57600080fd5b506102b4610812565b6040516102c19190610c0a565b60405180910390f35b6102e460048036038101906102df919061122a565b61081a565b6040516102f19190610e94565b60405180910390f35b34801561030657600080fd5b5061030f6109e4565b60405161031c9190610c0a565b60405180910390f35b34801561033157600080fd5b5061033a6109ec565b6040516103479190611286565b60405180910390f35b61036a600480360381019061036591906110ab565b6109f4565b6040516103779190610e94565b60405180910390f35b61039a60048036038101906103959190610f0c565b610ba6565b6040516103a99392919061110b565b60405180910390f35b3480156103be57600080fd5b506103d960048036038101906103d491906112cd565b610bca565b6040516103e69190611064565b60405180910390f35b600042905090565b60606000808484905090508067ffffffffffffffff81111561041c5761041b6112fa565b5b60405190808252806020026020018201604052801561045557816020015b610442610bd5565b81526020019060019003908161043a5790505b5092503660005b828110156105c957600085828151811061047957610478611329565b5b6020026020010151905087878381811061049657610495611329565b5b90506020028101906104a89190611367565b925060008360400135905080860195508360000160208101906104cb91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16818580606001906104f2919061138f565b604051610500929190611431565b60006040518083038185875af1925050503d806000811461053d576040519150601f19603f3d011682016040523d82523d6000602084013e610542565b606091505b5083600001846020018290528215151515815250505081516020850135176105bc577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260846000fd5b826001019250505061045c565b5082341461060c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610603906114a7565b60405180910390fd5b50505092915050565b6000606043915060008484905090508067ffffffffffffffff81111561063e5761063d6112fa565b5b60405190808252806020026020018201604052801561067157816020015b606081526020019060019003908161065c5790505b5091503660005b828110156107a157600087878381811061069557610694611329565b5b90506020028101906106a791906114c7565b92508260000160208101906106bc91906111a7565b73ffffffffffffffffffffffffffffffffffffffff168380602001906106e2919061138f565b6040516106f0929190611431565b6000604051808303816000865af19150503d806000811461072d576040519150601f19603f3d011682016040523d82523d6000602084013e610732565b606091505b5086848151811061074657610745611329565b5b60200260200101819052819250505080610795576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078c9061153b565b60405180910390fd5b81600101915050610678565b5050509250929050565b60006001430340905090565b600046905090565b6000806060439250434091506107d68686866109f4565b905093509350939050565b600048905090565b600043905090565b60008173ffffffffffffffffffffffffffffffffffffffff16319050919050565b600044905090565b606060008383905090508067ffffffffffffffff81111561083e5761083d6112fa565b5b60405190808252806020026020018201604052801561087757816020015b610864610bd5565b81526020019060019003908161085c5790505b5091503660005b828110156109db57600084828151811061089b5761089a611329565b5b602002602001015190508686838181106108b8576108b7611329565b5b90506020028101906108ca919061155b565b92508260000160208101906108df91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060400190610905919061138f565b604051610913929190611431565b6000604051808303816000865af19150503d8060008114610950576040519150601f19603f3d011682016040523d82523d6000602084013e610955565b606091505b5082600001836020018290528215151515815250505080516020840135176109cf577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260646000fd5b8160010191505061087e565b50505092915050565b600045905090565b600041905090565b606060008383905090508067ffffffffffffffff811115610a1857610a176112fa565b5b604051908082528060200260200182016040528015610a5157816020015b610a3e610bd5565b815260200190600190039081610a365790505b5091503660005b82811015610b9c576000848281518110610a7557610a74611329565b5b60200260200101519050868683818110610a9257610a91611329565b5b9050602002810190610aa491906114c7565b9250826000016020810190610ab991906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060200190610adf919061138f565b604051610aed929190611431565b6000604051808303816000865af19150503d8060008114610b2a576040519150601f19603f3d011682016040523d82523d6000602084013e610b2f565b606091505b508260000183602001829052821515151581525050508715610b90578060000151610b8f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b869061153b565b60405180910390fd5b5b81600101915050610a58565b5050509392505050565b6000806060610bb7600186866107bf565b8093508194508295505050509250925092565b600081409050919050565b6040518060400160405280600015158152602001606081525090565b6000819050919050565b610c0481610bf1565b82525050565b6000602082019050610c1f6000830184610bfb565b92915050565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f840112610c5457610c53610c2f565b5b8235905067ffffffffffffffff811115610c7157610c70610c34565b5b602083019150836020820283011115610c8d57610c8c610c39565b5b9250929050565b60008060208385031215610cab57610caa610c25565b5b600083013567ffffffffffffffff811115610cc957610cc8610c2a565b5b610cd585828601610c3e565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b60008115159050919050565b610d2281610d0d565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610d62578082015181840152602081019050610d47565b83811115610d71576000848401525b50505050565b6000601f19601f8301169050919050565b6000610d9382610d28565b610d9d8185610d33565b9350610dad818560208601610d44565b610db681610d77565b840191505092915050565b6000604083016000830151610dd96000860182610d19565b5060208301518482036020860152610df18282610d88565b9150508091505092915050565b6000610e0a8383610dc1565b905092915050565b6000602082019050919050565b6000610e2a82610ce1565b610e348185610cec565b935083602082028501610e4685610cfd565b8060005b85811015610e825784840389528151610e638582610dfe565b9450610e6e83610e12565b925060208a01995050600181019050610e4a565b50829750879550505050505092915050565b60006020820190508181036000830152610eae8184610e1f565b905092915050565b60008083601f840112610ecc57610ecb610c2f565b5b8235905067ffffffffffffffff811115610ee957610ee8610c34565b5b602083019150836020820283011115610f0557610f04610c39565b5b9250929050565b60008060208385031215610f2357610f22610c25565b5b600083013567ffffffffffffffff811115610f4157610f40610c2a565b5b610f4d85828601610eb6565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000610f918383610d88565b905092915050565b6000602082019050919050565b6000610fb182610f59565b610fbb8185610f64565b935083602082028501610fcd85610f75565b8060005b858110156110095784840389528151610fea8582610f85565b9450610ff583610f99565b925060208a01995050600181019050610fd1565b50829750879550505050505092915050565b60006040820190506110306000830185610bfb565b81810360208301526110428184610fa6565b90509392505050565b6000819050919050565b61105e8161104b565b82525050565b60006020820190506110796000830184611055565b92915050565b61108881610d0d565b811461109357600080fd5b50565b6000813590506110a58161107f565b92915050565b6000806000604084860312156110c4576110c3610c25565b5b60006110d286828701611096565b935050602084013567ffffffffffffffff8111156110f3576110f2610c2a565b5b6110ff86828701610eb6565b92509250509250925092565b60006060820190506111206000830186610bfb565b61112d6020830185611055565b818103604083015261113f8184610e1f565b9050949350505050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061117482611149565b9050919050565b61118481611169565b811461118f57600080fd5b50565b6000813590506111a18161117b565b92915050565b6000602082840312156111bd576111bc610c25565b5b60006111cb84828501611192565b91505092915050565b60008083601f8401126111ea576111e9610c2f565b5b8235905067ffffffffffffffff81111561120757611206610c34565b5b60208301915083602082028301111561122357611222610c39565b5b9250929050565b6000806020838503121561124157611240610c25565b5b600083013567ffffffffffffffff81111561125f5761125e610c2a565b5b61126b858286016111d4565b92509250509250929050565b61128081611169565b82525050565b600060208201905061129b6000830184611277565b92915050565b6112aa81610bf1565b81146112b557600080fd5b50565b6000813590506112c7816112a1565b92915050565b6000602082840312156112e3576112e2610c25565b5b60006112f1848285016112b8565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b600080fd5b600080fd5b60008235600160800383360303811261138357611382611358565b5b80830191505092915050565b600080833560016020038436030381126113ac576113ab611358565b5b80840192508235915067ffffffffffffffff8211156113ce576113cd61135d565b5b6020830192506001820236038313156113ea576113e9611362565b5b509250929050565b600081905092915050565b82818337600083830152505050565b600061141883856113f2565b93506114258385846113fd565b82840190509392505050565b600061143e82848661140c565b91508190509392505050565b600082825260208201905092915050565b7f4d756c746963616c6c333a2076616c7565206d69736d61746368000000000000600082015250565b6000611491601a8361144a565b915061149c8261145b565b602082019050919050565b600060208201905081810360008301526114c081611484565b9050919050565b6000823560016040038336030381126114e3576114e2611358565b5b80830191505092915050565b7f4d756c746963616c6c333a2063616c6c206661696c6564000000000000000000600082015250565b600061152560178361144a565b9150611530826114ef565b602082019050919050565b6000602082019050818103600083015261155481611518565b9050919050565b60008235600160600383360303811261157757611576611358565b5b8083019150509291505056fea264697066735822122020c1bc9aacf8e4a6507193432a895a8e77094f45a1395583f07b24e860ef06cd64736f6c634300080c0033";
|
|
4067
5986
|
//#endregion
|
|
5987
|
+
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/errors/chain.js
|
|
5988
|
+
var ChainDoesNotSupportContract = class extends BaseError$1 {
|
|
5989
|
+
constructor({ blockNumber, chain, contract }) {
|
|
5990
|
+
super(`Chain "${chain.name}" does not support contract "${contract.name}".`, {
|
|
5991
|
+
metaMessages: ["This could be due to any of the following:", ...blockNumber && contract.blockCreated && contract.blockCreated > blockNumber ? [`- The contract "${contract.name}" was not deployed until block ${contract.blockCreated} (current block ${blockNumber}).`] : [`- The chain does not have the contract "${contract.name}" configured.`]],
|
|
5992
|
+
name: "ChainDoesNotSupportContract"
|
|
5993
|
+
});
|
|
5994
|
+
}
|
|
5995
|
+
};
|
|
5996
|
+
var ChainMismatchError = class extends BaseError$1 {
|
|
5997
|
+
constructor({ chain, currentChainId }) {
|
|
5998
|
+
super(`The current chain of the wallet (id: ${currentChainId}) does not match the target chain for the transaction (id: ${chain.id} – ${chain.name}).`, {
|
|
5999
|
+
metaMessages: [`Current Chain ID: ${currentChainId}`, `Expected Chain ID: ${chain.id} – ${chain.name}`],
|
|
6000
|
+
name: "ChainMismatchError"
|
|
6001
|
+
});
|
|
6002
|
+
}
|
|
6003
|
+
};
|
|
6004
|
+
var ChainNotFoundError = class extends BaseError$1 {
|
|
6005
|
+
constructor() {
|
|
6006
|
+
super(["No chain was provided to the request.", "Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."].join("\n"), { name: "ChainNotFoundError" });
|
|
6007
|
+
}
|
|
6008
|
+
};
|
|
6009
|
+
var ClientChainNotConfiguredError = class extends BaseError$1 {
|
|
6010
|
+
constructor() {
|
|
6011
|
+
super("No chain was provided to the Client.", { name: "ClientChainNotConfiguredError" });
|
|
6012
|
+
}
|
|
6013
|
+
};
|
|
6014
|
+
var InvalidChainIdError = class extends BaseError$1 {
|
|
6015
|
+
constructor({ chainId }) {
|
|
6016
|
+
super(typeof chainId === "number" ? `Chain ID "${chainId}" is invalid.` : "Chain ID is invalid.", { name: "InvalidChainIdError" });
|
|
6017
|
+
}
|
|
6018
|
+
};
|
|
6019
|
+
//#endregion
|
|
4068
6020
|
//#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/abi/encodeDeployData.js
|
|
4069
6021
|
const docsPath = "/docs/contract/encodeDeployData";
|
|
4070
6022
|
function encodeDeployData(parameters) {
|
|
@@ -4201,8 +6153,8 @@ function createBatchScheduler({ fn, id, shouldSplitBatch, wait = 0, sort }) {
|
|
|
4201
6153
|
async function call(client, args) {
|
|
4202
6154
|
const { account: account_ = client.account, authorizationList, batch = Boolean(client.batch?.multicall), blockNumber, blockTag = client.experimental_blockTag ?? "latest", accessList, blobs, blockOverrides, code, data: data_, factory, factoryData, gas, gasPrice, maxFeePerBlobGas, maxFeePerGas, maxPriorityFeePerGas, nonce, to, value, stateOverride, ...rest } = args;
|
|
4203
6155
|
const account = account_ ? parseAccount(account_) : void 0;
|
|
4204
|
-
if (code && (factory || factoryData)) throw new BaseError$
|
|
4205
|
-
if (code && to) throw new BaseError$
|
|
6156
|
+
if (code && (factory || factoryData)) throw new BaseError$1("Cannot provide both `code` & `factory`/`factoryData` as parameters.");
|
|
6157
|
+
if (code && to) throw new BaseError$1("Cannot provide both `code` & `to` as parameters.");
|
|
4206
6158
|
const deploylessCallViaBytecode = code && data_;
|
|
4207
6159
|
const deploylessCallViaFactory = factory && factoryData && to && data_;
|
|
4208
6160
|
const deploylessCall = deploylessCallViaBytecode || deploylessCallViaFactory;
|
|
@@ -4273,7 +6225,7 @@ async function call(client, args) {
|
|
|
4273
6225
|
return { data: response };
|
|
4274
6226
|
} catch (err) {
|
|
4275
6227
|
const data = getRevertErrorData(err);
|
|
4276
|
-
const { offchainLookup, offchainLookupSignature } = await import("./ccip-
|
|
6228
|
+
const { offchainLookup, offchainLookupSignature } = await import("./ccip-IumNC20V.js");
|
|
4277
6229
|
if (client.ccipRead !== false && data?.slice(0, 10) === offchainLookupSignature && to) return { data: await offchainLookup(client, {
|
|
4278
6230
|
data,
|
|
4279
6231
|
to
|
|
@@ -4374,21 +6326,9 @@ function toDeploylessCallViaFactoryData(parameters) {
|
|
|
4374
6326
|
}
|
|
4375
6327
|
/** @internal */
|
|
4376
6328
|
function getRevertErrorData(err) {
|
|
4377
|
-
if (!(err instanceof BaseError$
|
|
6329
|
+
if (!(err instanceof BaseError$1)) return void 0;
|
|
4378
6330
|
const error = err.walk();
|
|
4379
6331
|
return typeof error?.data === "object" ? error.data?.data : error.data;
|
|
4380
6332
|
}
|
|
4381
6333
|
//#endregion
|
|
4382
|
-
|
|
4383
|
-
function decodeFunctionData(parameters) {
|
|
4384
|
-
const { abi, data } = parameters;
|
|
4385
|
-
const signature = slice$2(data, 0, 4);
|
|
4386
|
-
const description = abi.find((x) => x.type === "function" && signature === toFunctionSelector(formatAbiItem$1(x)));
|
|
4387
|
-
if (!description) throw new AbiFunctionSignatureNotFoundError(signature, { docsPath: "/docs/contract/decodeFunctionData" });
|
|
4388
|
-
return {
|
|
4389
|
-
functionName: description.name,
|
|
4390
|
-
args: "inputs" in description && description.inputs && description.inputs.length > 0 ? decodeAbiParameters(description.inputs, slice$2(data, 4)) : void 0
|
|
4391
|
-
};
|
|
4392
|
-
}
|
|
4393
|
-
//#endregion
|
|
4394
|
-
export { extract as $, trimLeft as A, TimeoutError as At, toBoolean as B, encodeFunctionData as Bt, random as C, UnsupportedChainIdError as Ct, toBytes as D, WalletConnectSessionSettlementError as Dt, toBigInt as E, UserRejectedRequestError as Et, fromString$1 as F, RawContractError as Ft, stringify as G, parseAbiParameter as Gt, toString$1 as H, toFunctionSelector as Ht, isEqual as I, getUrl as It, assertRequest as J, isStructSignature as Jt, BaseError as K, splitParameters as Kt, size$1 as L, decodeErrorResult as Lt, concat$1 as M, ContractFunctionExecutionError as Mt, from$1 as N, ContractFunctionRevertedError as Nt, toNumber as O, HttpRequestError as Ot, fromHex as P, ContractFunctionZeroDataError as Pt, defineFormatter as Q, slice$1 as R, decodeAbiParameters as Rt, padRight as S, UnknownRpcError as St, slice as T, UnsupportedProviderMethodError as Tt, trimLeft$1 as U, toEventSelector as Ut, toNumber$1 as V, getAbiItem as Vt, validate$1 as W, parseStructs as Wt, defineTransactionRequest as X, formatAbiItem as Xt, serializeStateOverride as Y, modifiers as Yt, formatTransactionRequest as Z, formatAbiParameters as Zt, fromBoolean as _, ResourceUnavailableRpcError as _t, encodeDeployData as a, DuplicateIdError as at, fromString as b, UnauthorizedProviderError as bt, batchGatewayAbi as c, InvalidParamsRpcError as ct, multicall3Abi as d, LimitExceededRpcError as dt, getNodeError as et, IntegerOutOfRangeError as f, MethodNotFoundRpcError as ft, from as g, ResourceNotFoundRpcError as gt, concat as h, ProviderDisconnectedError as ht, withResolvers as i, ChainDisconnectedError as it, validate as j, CallExecutionError as jt, toString as k, RpcRequestError as kt, erc1271Abi as l, InvalidRequestRpcError as lt, assert as m, ParseRpcError as mt, call as n, AtomicityNotSupportedError as nt, erc6492SignatureValidatorByteCode as o, InternalRpcError as ot, InvalidLengthError as p, MethodNotSupportedRpcError as pt, decodeFunctionResult as q, InvalidAbiParametersError as qt, createBatchScheduler as r, BundleTooLargeError as rt, multicall3Bytecode as s, InvalidInputRpcError as st, decodeFunctionData as t, AtomicReadyWalletRejectedUpgradeError as tt, erc6492SignatureValidatorAbi as u, JsonRpcVersionUnsupportedError as ut, fromBytes as v, SwitchChainError as vt, size as w, UnsupportedNonOptionalCapabilityError as wt, padLeft as x, UnknownBundleIdError as xt, fromNumber as y, TransactionRejectedRpcError as yt, toBigInt$1 as z, solidityError as zt };
|
|
6334
|
+
export { serializeStateOverride as $, parseAbiParameter as $n, stringify$1 as $t, toNumber as A, hexToBool as An, UnsupportedChainIdError as At, slice$1 as B, AbiEventSignatureNotFoundError as Bn, ContractFunctionRevertedError as Bt, padLeft as C, hexToBytes as Cn, ResourceNotFoundRpcError as Ct, slice as D, stringToHex as Dn, UnauthorizedProviderError as Dt, size as E, numberToHex as En, TransactionRejectedRpcError as Et, from$1 as F, AbiDecodingDataSizeTooSmallError as Fn, HttpRequestError as Ft, trimLeft$1 as G, DecodeLogDataMismatch as Gn, InvalidSerializableTransactionError as Gt, toBoolean as H, AbiFunctionOutputsNotFoundError as Hn, RawContractError as Ht, fromHex as I, AbiDecodingZeroDataError as In, RpcRequestError as It, BaseError as J, BaseError$1 as Jn, InvalidStorageKeySizeError as Jt, validate$1 as K, DecodeLogTopicsMismatch as Kn, InvalidSerializedTransactionError as Kt, fromString$1 as L, AbiErrorInputsNotFoundError as Ln, TimeoutError as Lt, trimLeft as M, trim$2 as Mn, UnsupportedProviderMethodError as Mt, validate as N, InvalidHexValueError$1 as Nn, UserRejectedRequestError as Nt, toBigInt as O, toHex as On, UnknownBundleIdError as Ot, concat$1 as P, padHex as Pn, WalletConnectSessionSettlementError as Pt, maxUint256 as Q, parseStructs as Qn, formatEther as Qt, isEqual as R, AbiErrorNotFoundError as Rn, CallExecutionError as Rt, fromString as S, keccak256 as Sn, ProviderDisconnectedError as St, random as T, bytesToHex as Tn, SwitchChainError as Tt, toNumber$1 as U, AbiFunctionSignatureNotFoundError as Un, getUrl as Ut, toBigInt$1 as V, AbiFunctionNotFoundError as Vn, ContractFunctionZeroDataError as Vt, toString$1 as W, BytesSizeMismatchError as Wn, InvalidLegacyVError as Wt, isAddressEqual as X, isHex as Xn, prettyPrint as Xt, decodeFunctionResult as Y, size$2 as Yn, TransactionExecutionError as Yt, assertRequest as Z, formatAbiItem as Zn, formatGwei as Zt, concat as _, checksumAddress as _n, JsonRpcVersionUnsupportedError as _t, ChainMismatchError as a, encodeFunctionData as an, FeeCapTooHighError as at, fromBytes as b, InvalidAddressError as bn, MethodNotSupportedRpcError as bt, erc6492SignatureValidatorByteCode as c, toFunctionSelector as cn, AtomicReadyWalletRejectedUpgradeError as ct, erc1271Abi as d, integerRegex as dn, ChainDisconnectedError as dt, decodeErrorResult as en, splitParameters as er, defineTransactionRequest as et, erc6492SignatureValidatorAbi as f, slice$2 as fn, DuplicateIdError as ft, assert as g, isAddress as gn, InvalidRequestRpcError as gt, InvalidLengthError as h, concatHex as hn, InvalidParamsRpcError as ht, encodeDeployData as i, solidityError as in, formatAbiParameters as ir, getNodeError as it, toString as j, hexToNumber as jn, UnsupportedNonOptionalCapabilityError as jt, toBytes as k, hexToBigInt as kn, UnknownRpcError as kt, multicall3Bytecode as l, encodeAbiParameters as ln, AtomicityNotSupportedError as lt, IntegerOutOfRangeError as m, concat$2 as mn, InvalidInputRpcError as mt, createBatchScheduler as n, createCursor as nn, isStructSignature as nr, defineFormatter as nt, ChainNotFoundError as o, parseAccount as on, TipAboveFeeCapError as ot, multicall3Abi as p, sliceHex as pn, InternalRpcError as pt, stringify as q, InvalidArrayError as qn, InvalidSerializedTransactionTypeError as qt, withResolvers as r, PositionOutOfBoundsError as rn, modifiers as rr, extract as rt, InvalidChainIdError as s, getAbiItem as sn, UnknownNodeError as st, call as t, decodeAbiParameters as tn, InvalidAbiParametersError as tr, formatTransactionRequest as tt, batchGatewayAbi as u, bytesRegex as un, BundleTooLargeError as ut, from as v, getAddress as vn, LimitExceededRpcError as vt, padRight as w, toBytes$1 as wn, ResourceUnavailableRpcError as wt, fromNumber as x, toEventSelector as xn, ParseRpcError as xt, fromBoolean as y, LruMap as yn, MethodNotFoundRpcError as yt, size$1 as z, AbiEventSignatureEmptyTopicsError as zn, ContractFunctionExecutionError as zt };
|