x402-proxy 0.10.7 → 0.10.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/CHANGELOG.md +23 -1
  2. package/README.md +7 -1
  3. package/dist/Credential-COZQnr1-.js +2055 -0
  4. package/dist/Mcp-CrCEqLqO.js +10 -0
  5. package/dist/Sse-ChldYgU7.js +9742 -0
  6. package/dist/Sse-kCB38G56.js +16482 -0
  7. package/dist/accounts-DsuvWwph.js +232 -0
  8. package/dist/accounts-DzvAlQRn.js +5 -0
  9. package/dist/accounts-IG-Cmrwy.js +229 -0
  10. package/dist/api-CUzmQvTQ.js +2802 -0
  11. package/dist/auth-DTzQmnZ_.js +1196 -0
  12. package/dist/bin/cli.js +585 -242
  13. package/dist/ccip-Bx-zoUCJ.js +240 -0
  14. package/dist/ccip-C2k1DD1T.js +153 -0
  15. package/dist/ccip-C6CQOJYv.js +152 -0
  16. package/dist/ccip-RZzsZ5Mv.js +156 -0
  17. package/dist/chain-CafcHffR.js +1997 -0
  18. package/dist/chain-DwfP5RGZ.js +1968 -0
  19. package/dist/chunk-DBEY4PJZ.js +16 -0
  20. package/dist/chunk-DjEMn6fM.js +36 -0
  21. package/dist/client-Blw2V7LF.js +657 -0
  22. package/dist/client-C37gWJOZ.js +102 -0
  23. package/dist/client-CEc4NYAA.js +6388 -0
  24. package/dist/client-CVDTUY0l.js +5152 -0
  25. package/dist/config-BUQsit4s.js +3 -0
  26. package/dist/config-DR1Fs_wL.js +6600 -0
  27. package/dist/{config-D9wIR3xc.js → config-rvKA3SYT.js} +10 -5
  28. package/dist/decodeFunctionData-DuFcwhC_.js +4510 -0
  29. package/dist/decodeFunctionData-JPOUdvil.js +4394 -0
  30. package/dist/derive-DNUl8LU9.js +9109 -0
  31. package/dist/dist-C2YO6HSQ.js +6581 -0
  32. package/dist/dist-DM5_F3r5.js +4 -0
  33. package/dist/dist-DxJCYyL5.js +1388 -0
  34. package/dist/hashTypedData-BHmP9dBd.js +859 -0
  35. package/dist/hashTypedData-CtEdfx4y.js +846 -0
  36. package/dist/helpers-CuUSw-tH.js +7125 -0
  37. package/dist/hmac-59IlS_by.js +648 -0
  38. package/dist/http-BAtucMbS.js +2060 -0
  39. package/dist/index.d.ts +1903 -9
  40. package/dist/index.js +18006 -50
  41. package/dist/index.node-CxkL0OFh.js +3592 -0
  42. package/dist/index.node-DvmeuZBj.js +3 -0
  43. package/dist/isAddressEqual-BLrd1Hg1.js +9 -0
  44. package/dist/isAddressEqual-DsAqfQOD.js +10 -0
  45. package/dist/localBatchGatewayRequest-C-RPJyDO.js +6260 -0
  46. package/dist/localBatchGatewayRequest-DOdQ9bR7.js +93 -0
  47. package/dist/localBatchGatewayRequest-DQkbZaSy.js +6261 -0
  48. package/dist/parseUnits-CApwcKSD.js +49 -0
  49. package/dist/parseUnits-cMO2udMe.js +48 -0
  50. package/dist/schemas-BxMFYNbH.js +1270 -0
  51. package/dist/secp256k1-BZpiyffY.js +2525 -0
  52. package/dist/secp256k1-BjenrLl5.js +1877 -0
  53. package/dist/secp256k1-CLPUX17u.js +3 -0
  54. package/dist/sendRawTransactionSync-DvSkhZtW.js +3612 -0
  55. package/dist/server-CSq0IuUq.js +565 -0
  56. package/dist/setup-BY4J49Lv.js +1110 -0
  57. package/dist/setup-wMOAgrsN.js +3 -0
  58. package/dist/sha256-FAs0qeni.js +17 -0
  59. package/dist/sha3-CYkWM8Xa.js +195 -0
  60. package/dist/sha3-DbMJRJ3C.js +194 -0
  61. package/dist/sse-B4LLqBQm.js +408 -0
  62. package/dist/status-Bu23RjW6.js +3 -0
  63. package/dist/{status-DihAcUSC.js → status-X21VnGUO.js} +16 -15
  64. package/dist/stdio-BADqxZdZ.js +85 -0
  65. package/dist/streamableHttp-BHkJypcI.js +358 -0
  66. package/dist/tempo-3nttrxgQ.js +17 -0
  67. package/dist/tempo-DER0P-ul.js +18 -0
  68. package/dist/types-BEKUz-Mf.js +1240 -0
  69. package/dist/types-DatK5vR5.js +3 -0
  70. package/dist/utils-BYjkXZDF.js +444 -0
  71. package/dist/utils-SeGHMW9O.js +445 -0
  72. package/dist/wallet-DKVlrR1S.js +3 -0
  73. package/dist/wallet-DSyht15_.js +17759 -0
  74. package/package.json +18 -71
  75. package/dist/config-B_upkJeK.js +0 -66
  76. package/dist/config-Be35NM5s.js +0 -3
  77. package/dist/config-J1m-CWXT.js +0 -27
  78. package/dist/derive-CL6e8K0Z.js +0 -81
  79. package/dist/openclaw/plugin.d.ts +0 -15
  80. package/dist/openclaw/plugin.js +0 -2067
  81. package/dist/openclaw.plugin.json +0 -93
  82. package/dist/setup-CNyMLnM-.js +0 -197
  83. package/dist/setup-DTIxPe58.js +0 -3
  84. package/dist/status-DZlJ4pS7.js +0 -3
  85. package/dist/wallet-B0S-rma9.js +0 -544
  86. package/dist/wallet-DBrVZJqe.js +0 -3
  87. package/openclaw.plugin.json +0 -93
  88. package/skills/SKILL.md +0 -183
  89. package/skills/references/library.md +0 -85
  90. package/skills/references/openclaw-plugin.md +0 -145
@@ -0,0 +1,4510 @@
1
+ #!/usr/bin/env node
2
+ import { $ as toBytes$1, A as formatGwei, At as InvalidAbiDecodingTypeError, B as slice$2, Ct as AbiFunctionNotFoundError, Et as AbiItemAmbiguityError, F as parseAccount, Ft as formatAbiItem$1, G as isAddress, I as encodeAbiParameters, K as checksumAddress, L as getArrayComponents, M as stringify$1, Mt as BaseError$2, N as createCursor, Nt as size$2, Pt as isHex, Tt as AbiFunctionSignatureNotFoundError, V as sliceBytes, W as concatHex, X as keccak256, Y as InvalidAddressError, Z as hexToBytes, _ as TransactionTypeNotSupportedError, at as hexToBigInt, c as FeeCapTooHighError, ct as trim$2, d as IntrinsicGasTooHighError, et as bytesToHex, f as IntrinsicGasTooLowError, ft as InvalidBytesLengthError, g as TipAboveFeeCapError, gt as AbiDecodingZeroDataError, h as NonceTooLowError, ht as AbiDecodingDataSizeTooSmallError, i as ClientChainNotConfiguredError, it as assertSize$2, j as formatEther, k as prettyPrint, l as FeeCapTooLowError, lt as InvalidBytesBooleanError$1, m as NonceTooHighError, mt as AbiConstructorParamsNotFoundError, o as maxUint256, p as NonceMaxValueError, pt as AbiConstructorNotFoundError, s as ExecutionRevertedError, st as hexToNumber, t as ChainDoesNotSupportContract, tt as numberToHex, u as InsufficientFundsError, v as UnknownNodeError, wt as AbiFunctionOutputsNotFoundError, yt as AbiErrorSignatureNotFoundError } from "./chain-CafcHffR.js";
3
+ import { f as equalBytes } from "./utils-SeGHMW9O.js";
4
+ //#region node_modules/.pnpm/abitype@1.2.3_typescript@5.9.3_zod@4.3.6/node_modules/abitype/dist/esm/version.js
5
+ const version$1 = "1.2.3";
6
+ //#endregion
7
+ //#region node_modules/.pnpm/abitype@1.2.3_typescript@5.9.3_zod@4.3.6/node_modules/abitype/dist/esm/errors.js
8
+ var BaseError$1 = class BaseError$1 extends Error {
9
+ constructor(shortMessage, args = {}) {
10
+ const details = args.cause instanceof BaseError$1 ? args.cause.details : args.cause?.message ? args.cause.message : args.details;
11
+ const docsPath = args.cause instanceof BaseError$1 ? args.cause.docsPath || args.docsPath : args.docsPath;
12
+ const message = [
13
+ shortMessage || "An error occurred.",
14
+ "",
15
+ ...args.metaMessages ? [...args.metaMessages, ""] : [],
16
+ ...docsPath ? [`Docs: https://abitype.dev${docsPath}`] : [],
17
+ ...details ? [`Details: ${details}`] : [],
18
+ `Version: abitype@${version$1}`
19
+ ].join("\n");
20
+ super(message);
21
+ Object.defineProperty(this, "details", {
22
+ enumerable: true,
23
+ configurable: true,
24
+ writable: true,
25
+ value: void 0
26
+ });
27
+ Object.defineProperty(this, "docsPath", {
28
+ enumerable: true,
29
+ configurable: true,
30
+ writable: true,
31
+ value: void 0
32
+ });
33
+ Object.defineProperty(this, "metaMessages", {
34
+ enumerable: true,
35
+ configurable: true,
36
+ writable: true,
37
+ value: void 0
38
+ });
39
+ Object.defineProperty(this, "shortMessage", {
40
+ enumerable: true,
41
+ configurable: true,
42
+ writable: true,
43
+ value: void 0
44
+ });
45
+ Object.defineProperty(this, "name", {
46
+ enumerable: true,
47
+ configurable: true,
48
+ writable: true,
49
+ value: "AbiTypeError"
50
+ });
51
+ if (args.cause) this.cause = args.cause;
52
+ this.details = details;
53
+ this.docsPath = docsPath;
54
+ this.metaMessages = args.metaMessages;
55
+ this.shortMessage = shortMessage;
56
+ }
57
+ };
58
+ //#endregion
59
+ //#region node_modules/.pnpm/abitype@1.2.3_typescript@5.9.3_zod@4.3.6/node_modules/abitype/dist/esm/regex.js
60
+ function execTyped(regex, string) {
61
+ return regex.exec(string)?.groups;
62
+ }
63
+ const bytesRegex = /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/;
64
+ 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)?$/;
65
+ const isTupleRegex = /^\(.+?\).*?$/;
66
+ //#endregion
67
+ //#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
68
+ const tupleRegex = /^tuple(?<array>(\[(\d*)\])*)$/;
69
+ /**
70
+ * Formats {@link AbiParameter} to human-readable ABI parameter.
71
+ *
72
+ * @param abiParameter - ABI parameter
73
+ * @returns Human-readable ABI parameter
74
+ *
75
+ * @example
76
+ * const result = formatAbiParameter({ type: 'address', name: 'from' })
77
+ * // ^? const result: 'address from'
78
+ */
79
+ function formatAbiParameter(abiParameter) {
80
+ let type = abiParameter.type;
81
+ if (tupleRegex.test(abiParameter.type) && "components" in abiParameter) {
82
+ type = "(";
83
+ const length = abiParameter.components.length;
84
+ for (let i = 0; i < length; i++) {
85
+ const component = abiParameter.components[i];
86
+ type += formatAbiParameter(component);
87
+ if (i < length - 1) type += ", ";
88
+ }
89
+ const result = execTyped(tupleRegex, abiParameter.type);
90
+ type += `)${result?.array || ""}`;
91
+ return formatAbiParameter({
92
+ ...abiParameter,
93
+ type
94
+ });
95
+ }
96
+ if ("indexed" in abiParameter && abiParameter.indexed) type = `${type} indexed`;
97
+ if (abiParameter.name) return `${type} ${abiParameter.name}`;
98
+ return type;
99
+ }
100
+ //#endregion
101
+ //#region node_modules/.pnpm/abitype@1.2.3_typescript@5.9.3_zod@4.3.6/node_modules/abitype/dist/esm/human-readable/formatAbiParameters.js
102
+ /**
103
+ * Formats {@link AbiParameter}s to human-readable ABI parameters.
104
+ *
105
+ * @param abiParameters - ABI parameters
106
+ * @returns Human-readable ABI parameters
107
+ *
108
+ * @example
109
+ * const result = formatAbiParameters([
110
+ * // ^? const result: 'address from, uint256 tokenId'
111
+ * { type: 'address', name: 'from' },
112
+ * { type: 'uint256', name: 'tokenId' },
113
+ * ])
114
+ */
115
+ function formatAbiParameters(abiParameters) {
116
+ let params = "";
117
+ const length = abiParameters.length;
118
+ for (let i = 0; i < length; i++) {
119
+ const abiParameter = abiParameters[i];
120
+ params += formatAbiParameter(abiParameter);
121
+ if (i !== length - 1) params += ", ";
122
+ }
123
+ return params;
124
+ }
125
+ //#endregion
126
+ //#region node_modules/.pnpm/abitype@1.2.3_typescript@5.9.3_zod@4.3.6/node_modules/abitype/dist/esm/human-readable/formatAbiItem.js
127
+ /**
128
+ * Formats ABI item (e.g. error, event, function) into human-readable ABI item
129
+ *
130
+ * @param abiItem - ABI item
131
+ * @returns Human-readable ABI item
132
+ */
133
+ function formatAbiItem(abiItem) {
134
+ 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)})` : ""}`;
135
+ if (abiItem.type === "event") return `event ${abiItem.name}(${formatAbiParameters(abiItem.inputs)})`;
136
+ if (abiItem.type === "error") return `error ${abiItem.name}(${formatAbiParameters(abiItem.inputs)})`;
137
+ if (abiItem.type === "constructor") return `constructor(${formatAbiParameters(abiItem.inputs)})${abiItem.stateMutability === "payable" ? " payable" : ""}`;
138
+ if (abiItem.type === "fallback") return `fallback() external${abiItem.stateMutability === "payable" ? " payable" : ""}`;
139
+ return "receive() external payable";
140
+ }
141
+ //#endregion
142
+ //#region node_modules/.pnpm/abitype@1.2.3_typescript@5.9.3_zod@4.3.6/node_modules/abitype/dist/esm/human-readable/runtime/signatures.js
143
+ const errorSignatureRegex = /^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;
144
+ function isErrorSignature(signature) {
145
+ return errorSignatureRegex.test(signature);
146
+ }
147
+ function execErrorSignature(signature) {
148
+ return execTyped(errorSignatureRegex, signature);
149
+ }
150
+ const eventSignatureRegex = /^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;
151
+ function isEventSignature(signature) {
152
+ return eventSignatureRegex.test(signature);
153
+ }
154
+ function execEventSignature(signature) {
155
+ return execTyped(eventSignatureRegex, signature);
156
+ }
157
+ const functionSignatureRegex = /^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;
158
+ function isFunctionSignature(signature) {
159
+ return functionSignatureRegex.test(signature);
160
+ }
161
+ function execFunctionSignature(signature) {
162
+ return execTyped(functionSignatureRegex, signature);
163
+ }
164
+ const structSignatureRegex = /^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;
165
+ function isStructSignature(signature) {
166
+ return structSignatureRegex.test(signature);
167
+ }
168
+ function execStructSignature(signature) {
169
+ return execTyped(structSignatureRegex, signature);
170
+ }
171
+ const constructorSignatureRegex = /^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;
172
+ function isConstructorSignature(signature) {
173
+ return constructorSignatureRegex.test(signature);
174
+ }
175
+ function execConstructorSignature(signature) {
176
+ return execTyped(constructorSignatureRegex, signature);
177
+ }
178
+ const fallbackSignatureRegex = /^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;
179
+ function isFallbackSignature(signature) {
180
+ return fallbackSignatureRegex.test(signature);
181
+ }
182
+ function execFallbackSignature(signature) {
183
+ return execTyped(fallbackSignatureRegex, signature);
184
+ }
185
+ const receiveSignatureRegex = /^receive\(\) external payable$/;
186
+ function isReceiveSignature(signature) {
187
+ return receiveSignatureRegex.test(signature);
188
+ }
189
+ const modifiers = new Set([
190
+ "memory",
191
+ "indexed",
192
+ "storage",
193
+ "calldata"
194
+ ]);
195
+ const eventModifiers = new Set(["indexed"]);
196
+ const functionModifiers = new Set([
197
+ "calldata",
198
+ "memory",
199
+ "storage"
200
+ ]);
201
+ //#endregion
202
+ //#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
203
+ var InvalidAbiItemError = class extends BaseError$1 {
204
+ constructor({ signature }) {
205
+ super("Failed to parse ABI item.", {
206
+ details: `parseAbiItem(${JSON.stringify(signature, null, 2)})`,
207
+ docsPath: "/api/human#parseabiitem-1"
208
+ });
209
+ Object.defineProperty(this, "name", {
210
+ enumerable: true,
211
+ configurable: true,
212
+ writable: true,
213
+ value: "InvalidAbiItemError"
214
+ });
215
+ }
216
+ };
217
+ var UnknownTypeError = class extends BaseError$1 {
218
+ constructor({ type }) {
219
+ super("Unknown type.", { metaMessages: [`Type "${type}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`] });
220
+ Object.defineProperty(this, "name", {
221
+ enumerable: true,
222
+ configurable: true,
223
+ writable: true,
224
+ value: "UnknownTypeError"
225
+ });
226
+ }
227
+ };
228
+ var UnknownSolidityTypeError = class extends BaseError$1 {
229
+ constructor({ type }) {
230
+ super("Unknown type.", { metaMessages: [`Type "${type}" is not a valid ABI type.`] });
231
+ Object.defineProperty(this, "name", {
232
+ enumerable: true,
233
+ configurable: true,
234
+ writable: true,
235
+ value: "UnknownSolidityTypeError"
236
+ });
237
+ }
238
+ };
239
+ //#endregion
240
+ //#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
241
+ var InvalidAbiParametersError = class extends BaseError$1 {
242
+ constructor({ params }) {
243
+ super("Failed to parse ABI parameters.", {
244
+ details: `parseAbiParameters(${JSON.stringify(params, null, 2)})`,
245
+ docsPath: "/api/human#parseabiparameters-1"
246
+ });
247
+ Object.defineProperty(this, "name", {
248
+ enumerable: true,
249
+ configurable: true,
250
+ writable: true,
251
+ value: "InvalidAbiParametersError"
252
+ });
253
+ }
254
+ };
255
+ var InvalidParameterError = class extends BaseError$1 {
256
+ constructor({ param }) {
257
+ super("Invalid ABI parameter.", { details: param });
258
+ Object.defineProperty(this, "name", {
259
+ enumerable: true,
260
+ configurable: true,
261
+ writable: true,
262
+ value: "InvalidParameterError"
263
+ });
264
+ }
265
+ };
266
+ var SolidityProtectedKeywordError = class extends BaseError$1 {
267
+ constructor({ param, name }) {
268
+ super("Invalid ABI parameter.", {
269
+ details: param,
270
+ metaMessages: [`"${name}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]
271
+ });
272
+ Object.defineProperty(this, "name", {
273
+ enumerable: true,
274
+ configurable: true,
275
+ writable: true,
276
+ value: "SolidityProtectedKeywordError"
277
+ });
278
+ }
279
+ };
280
+ var InvalidModifierError = class extends BaseError$1 {
281
+ constructor({ param, type, modifier }) {
282
+ super("Invalid ABI parameter.", {
283
+ details: param,
284
+ metaMessages: [`Modifier "${modifier}" not allowed${type ? ` in "${type}" type` : ""}.`]
285
+ });
286
+ Object.defineProperty(this, "name", {
287
+ enumerable: true,
288
+ configurable: true,
289
+ writable: true,
290
+ value: "InvalidModifierError"
291
+ });
292
+ }
293
+ };
294
+ var InvalidFunctionModifierError = class extends BaseError$1 {
295
+ constructor({ param, type, modifier }) {
296
+ super("Invalid ABI parameter.", {
297
+ details: param,
298
+ metaMessages: [`Modifier "${modifier}" not allowed${type ? ` in "${type}" type` : ""}.`, `Data location can only be specified for array, struct, or mapping types, but "${modifier}" was given.`]
299
+ });
300
+ Object.defineProperty(this, "name", {
301
+ enumerable: true,
302
+ configurable: true,
303
+ writable: true,
304
+ value: "InvalidFunctionModifierError"
305
+ });
306
+ }
307
+ };
308
+ var InvalidAbiTypeParameterError = class extends BaseError$1 {
309
+ constructor({ abiParameter }) {
310
+ super("Invalid ABI parameter.", {
311
+ details: JSON.stringify(abiParameter, null, 2),
312
+ metaMessages: ["ABI parameter type is invalid."]
313
+ });
314
+ Object.defineProperty(this, "name", {
315
+ enumerable: true,
316
+ configurable: true,
317
+ writable: true,
318
+ value: "InvalidAbiTypeParameterError"
319
+ });
320
+ }
321
+ };
322
+ //#endregion
323
+ //#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
324
+ var InvalidSignatureError = class extends BaseError$1 {
325
+ constructor({ signature, type }) {
326
+ super(`Invalid ${type} signature.`, { details: signature });
327
+ Object.defineProperty(this, "name", {
328
+ enumerable: true,
329
+ configurable: true,
330
+ writable: true,
331
+ value: "InvalidSignatureError"
332
+ });
333
+ }
334
+ };
335
+ var UnknownSignatureError = class extends BaseError$1 {
336
+ constructor({ signature }) {
337
+ super("Unknown signature.", { details: signature });
338
+ Object.defineProperty(this, "name", {
339
+ enumerable: true,
340
+ configurable: true,
341
+ writable: true,
342
+ value: "UnknownSignatureError"
343
+ });
344
+ }
345
+ };
346
+ var InvalidStructSignatureError = class extends BaseError$1 {
347
+ constructor({ signature }) {
348
+ super("Invalid struct signature.", {
349
+ details: signature,
350
+ metaMessages: ["No properties exist."]
351
+ });
352
+ Object.defineProperty(this, "name", {
353
+ enumerable: true,
354
+ configurable: true,
355
+ writable: true,
356
+ value: "InvalidStructSignatureError"
357
+ });
358
+ }
359
+ };
360
+ //#endregion
361
+ //#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
362
+ var CircularReferenceError = class extends BaseError$1 {
363
+ constructor({ type }) {
364
+ super("Circular reference detected.", { metaMessages: [`Struct "${type}" is a circular reference.`] });
365
+ Object.defineProperty(this, "name", {
366
+ enumerable: true,
367
+ configurable: true,
368
+ writable: true,
369
+ value: "CircularReferenceError"
370
+ });
371
+ }
372
+ };
373
+ //#endregion
374
+ //#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
375
+ var InvalidParenthesisError = class extends BaseError$1 {
376
+ constructor({ current, depth }) {
377
+ super("Unbalanced parentheses.", {
378
+ metaMessages: [`"${current.trim()}" has too many ${depth > 0 ? "opening" : "closing"} parentheses.`],
379
+ details: `Depth "${depth}"`
380
+ });
381
+ Object.defineProperty(this, "name", {
382
+ enumerable: true,
383
+ configurable: true,
384
+ writable: true,
385
+ value: "InvalidParenthesisError"
386
+ });
387
+ }
388
+ };
389
+ //#endregion
390
+ //#region node_modules/.pnpm/abitype@1.2.3_typescript@5.9.3_zod@4.3.6/node_modules/abitype/dist/esm/human-readable/runtime/cache.js
391
+ /**
392
+ * Gets {@link parameterCache} cache key namespaced by {@link type} and {@link structs}. This prevents parameters from being accessible to types that don't allow them (e.g. `string indexed foo` not allowed outside of `type: 'event'`) and ensures different struct definitions with the same name are cached separately.
393
+ * @param param ABI parameter string
394
+ * @param type ABI parameter type
395
+ * @param structs Struct definitions to include in cache key
396
+ * @returns Cache key for {@link parameterCache}
397
+ */
398
+ function getParameterCacheKey(param, type, structs) {
399
+ let structKey = "";
400
+ if (structs) for (const struct of Object.entries(structs)) {
401
+ if (!struct) continue;
402
+ let propertyKey = "";
403
+ for (const property of struct[1]) propertyKey += `[${property.type}${property.name ? `:${property.name}` : ""}]`;
404
+ structKey += `(${struct[0]}{${propertyKey}})`;
405
+ }
406
+ if (type) return `${type}:${param}${structKey}`;
407
+ return `${param}${structKey}`;
408
+ }
409
+ /**
410
+ * Basic cache seeded with common ABI parameter strings.
411
+ *
412
+ * **Note: When seeding more parameters, make sure you benchmark performance. The current number is the ideal balance between performance and having an already existing cache.**
413
+ */
414
+ const parameterCache = new Map([
415
+ ["address", { type: "address" }],
416
+ ["bool", { type: "bool" }],
417
+ ["bytes", { type: "bytes" }],
418
+ ["bytes32", { type: "bytes32" }],
419
+ ["int", { type: "int256" }],
420
+ ["int256", { type: "int256" }],
421
+ ["string", { type: "string" }],
422
+ ["uint", { type: "uint256" }],
423
+ ["uint8", { type: "uint8" }],
424
+ ["uint16", { type: "uint16" }],
425
+ ["uint24", { type: "uint24" }],
426
+ ["uint32", { type: "uint32" }],
427
+ ["uint64", { type: "uint64" }],
428
+ ["uint96", { type: "uint96" }],
429
+ ["uint112", { type: "uint112" }],
430
+ ["uint160", { type: "uint160" }],
431
+ ["uint192", { type: "uint192" }],
432
+ ["uint256", { type: "uint256" }],
433
+ ["address owner", {
434
+ type: "address",
435
+ name: "owner"
436
+ }],
437
+ ["address to", {
438
+ type: "address",
439
+ name: "to"
440
+ }],
441
+ ["bool approved", {
442
+ type: "bool",
443
+ name: "approved"
444
+ }],
445
+ ["bytes _data", {
446
+ type: "bytes",
447
+ name: "_data"
448
+ }],
449
+ ["bytes data", {
450
+ type: "bytes",
451
+ name: "data"
452
+ }],
453
+ ["bytes signature", {
454
+ type: "bytes",
455
+ name: "signature"
456
+ }],
457
+ ["bytes32 hash", {
458
+ type: "bytes32",
459
+ name: "hash"
460
+ }],
461
+ ["bytes32 r", {
462
+ type: "bytes32",
463
+ name: "r"
464
+ }],
465
+ ["bytes32 root", {
466
+ type: "bytes32",
467
+ name: "root"
468
+ }],
469
+ ["bytes32 s", {
470
+ type: "bytes32",
471
+ name: "s"
472
+ }],
473
+ ["string name", {
474
+ type: "string",
475
+ name: "name"
476
+ }],
477
+ ["string symbol", {
478
+ type: "string",
479
+ name: "symbol"
480
+ }],
481
+ ["string tokenURI", {
482
+ type: "string",
483
+ name: "tokenURI"
484
+ }],
485
+ ["uint tokenId", {
486
+ type: "uint256",
487
+ name: "tokenId"
488
+ }],
489
+ ["uint8 v", {
490
+ type: "uint8",
491
+ name: "v"
492
+ }],
493
+ ["uint256 balance", {
494
+ type: "uint256",
495
+ name: "balance"
496
+ }],
497
+ ["uint256 tokenId", {
498
+ type: "uint256",
499
+ name: "tokenId"
500
+ }],
501
+ ["uint256 value", {
502
+ type: "uint256",
503
+ name: "value"
504
+ }],
505
+ ["event:address indexed from", {
506
+ type: "address",
507
+ name: "from",
508
+ indexed: true
509
+ }],
510
+ ["event:address indexed to", {
511
+ type: "address",
512
+ name: "to",
513
+ indexed: true
514
+ }],
515
+ ["event:uint indexed tokenId", {
516
+ type: "uint256",
517
+ name: "tokenId",
518
+ indexed: true
519
+ }],
520
+ ["event:uint256 indexed tokenId", {
521
+ type: "uint256",
522
+ name: "tokenId",
523
+ indexed: true
524
+ }]
525
+ ]);
526
+ //#endregion
527
+ //#region node_modules/.pnpm/abitype@1.2.3_typescript@5.9.3_zod@4.3.6/node_modules/abitype/dist/esm/human-readable/runtime/utils.js
528
+ function parseSignature(signature, structs = {}) {
529
+ if (isFunctionSignature(signature)) return parseFunctionSignature(signature, structs);
530
+ if (isEventSignature(signature)) return parseEventSignature(signature, structs);
531
+ if (isErrorSignature(signature)) return parseErrorSignature(signature, structs);
532
+ if (isConstructorSignature(signature)) return parseConstructorSignature(signature, structs);
533
+ if (isFallbackSignature(signature)) return parseFallbackSignature(signature);
534
+ if (isReceiveSignature(signature)) return {
535
+ type: "receive",
536
+ stateMutability: "payable"
537
+ };
538
+ throw new UnknownSignatureError({ signature });
539
+ }
540
+ function parseFunctionSignature(signature, structs = {}) {
541
+ const match = execFunctionSignature(signature);
542
+ if (!match) throw new InvalidSignatureError({
543
+ signature,
544
+ type: "function"
545
+ });
546
+ const inputParams = splitParameters(match.parameters);
547
+ const inputs = [];
548
+ const inputLength = inputParams.length;
549
+ for (let i = 0; i < inputLength; i++) inputs.push(parseAbiParameter(inputParams[i], {
550
+ modifiers: functionModifiers,
551
+ structs,
552
+ type: "function"
553
+ }));
554
+ const outputs = [];
555
+ if (match.returns) {
556
+ const outputParams = splitParameters(match.returns);
557
+ const outputLength = outputParams.length;
558
+ for (let i = 0; i < outputLength; i++) outputs.push(parseAbiParameter(outputParams[i], {
559
+ modifiers: functionModifiers,
560
+ structs,
561
+ type: "function"
562
+ }));
563
+ }
564
+ return {
565
+ name: match.name,
566
+ type: "function",
567
+ stateMutability: match.stateMutability ?? "nonpayable",
568
+ inputs,
569
+ outputs
570
+ };
571
+ }
572
+ function parseEventSignature(signature, structs = {}) {
573
+ const match = execEventSignature(signature);
574
+ if (!match) throw new InvalidSignatureError({
575
+ signature,
576
+ type: "event"
577
+ });
578
+ const params = splitParameters(match.parameters);
579
+ const abiParameters = [];
580
+ const length = params.length;
581
+ for (let i = 0; i < length; i++) abiParameters.push(parseAbiParameter(params[i], {
582
+ modifiers: eventModifiers,
583
+ structs,
584
+ type: "event"
585
+ }));
586
+ return {
587
+ name: match.name,
588
+ type: "event",
589
+ inputs: abiParameters
590
+ };
591
+ }
592
+ function parseErrorSignature(signature, structs = {}) {
593
+ const match = execErrorSignature(signature);
594
+ if (!match) throw new InvalidSignatureError({
595
+ signature,
596
+ type: "error"
597
+ });
598
+ const params = splitParameters(match.parameters);
599
+ const abiParameters = [];
600
+ const length = params.length;
601
+ for (let i = 0; i < length; i++) abiParameters.push(parseAbiParameter(params[i], {
602
+ structs,
603
+ type: "error"
604
+ }));
605
+ return {
606
+ name: match.name,
607
+ type: "error",
608
+ inputs: abiParameters
609
+ };
610
+ }
611
+ function parseConstructorSignature(signature, structs = {}) {
612
+ const match = execConstructorSignature(signature);
613
+ if (!match) throw new InvalidSignatureError({
614
+ signature,
615
+ type: "constructor"
616
+ });
617
+ const params = splitParameters(match.parameters);
618
+ const abiParameters = [];
619
+ const length = params.length;
620
+ for (let i = 0; i < length; i++) abiParameters.push(parseAbiParameter(params[i], {
621
+ structs,
622
+ type: "constructor"
623
+ }));
624
+ return {
625
+ type: "constructor",
626
+ stateMutability: match.stateMutability ?? "nonpayable",
627
+ inputs: abiParameters
628
+ };
629
+ }
630
+ function parseFallbackSignature(signature) {
631
+ const match = execFallbackSignature(signature);
632
+ if (!match) throw new InvalidSignatureError({
633
+ signature,
634
+ type: "fallback"
635
+ });
636
+ return {
637
+ type: "fallback",
638
+ stateMutability: match.stateMutability ?? "nonpayable"
639
+ };
640
+ }
641
+ const abiParameterWithoutTupleRegex = /^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*(?:\spayable)?)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/;
642
+ const abiParameterWithTupleRegex = /^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/;
643
+ const dynamicIntegerRegex = /^u?int$/;
644
+ function parseAbiParameter(param, options) {
645
+ const parameterCacheKey = getParameterCacheKey(param, options?.type, options?.structs);
646
+ if (parameterCache.has(parameterCacheKey)) return parameterCache.get(parameterCacheKey);
647
+ const isTuple = isTupleRegex.test(param);
648
+ const match = execTyped(isTuple ? abiParameterWithTupleRegex : abiParameterWithoutTupleRegex, param);
649
+ if (!match) throw new InvalidParameterError({ param });
650
+ if (match.name && isSolidityKeyword(match.name)) throw new SolidityProtectedKeywordError({
651
+ param,
652
+ name: match.name
653
+ });
654
+ const name = match.name ? { name: match.name } : {};
655
+ const indexed = match.modifier === "indexed" ? { indexed: true } : {};
656
+ const structs = options?.structs ?? {};
657
+ let type;
658
+ let components = {};
659
+ if (isTuple) {
660
+ type = "tuple";
661
+ const params = splitParameters(match.type);
662
+ const components_ = [];
663
+ const length = params.length;
664
+ for (let i = 0; i < length; i++) components_.push(parseAbiParameter(params[i], { structs }));
665
+ components = { components: components_ };
666
+ } else if (match.type in structs) {
667
+ type = "tuple";
668
+ components = { components: structs[match.type] };
669
+ } else if (dynamicIntegerRegex.test(match.type)) type = `${match.type}256`;
670
+ else if (match.type === "address payable") type = "address";
671
+ else {
672
+ type = match.type;
673
+ if (!(options?.type === "struct") && !isSolidityType(type)) throw new UnknownSolidityTypeError({ type });
674
+ }
675
+ if (match.modifier) {
676
+ if (!options?.modifiers?.has?.(match.modifier)) throw new InvalidModifierError({
677
+ param,
678
+ type: options?.type,
679
+ modifier: match.modifier
680
+ });
681
+ if (functionModifiers.has(match.modifier) && !isValidDataLocation(type, !!match.array)) throw new InvalidFunctionModifierError({
682
+ param,
683
+ type: options?.type,
684
+ modifier: match.modifier
685
+ });
686
+ }
687
+ const abiParameter = {
688
+ type: `${type}${match.array ?? ""}`,
689
+ ...name,
690
+ ...indexed,
691
+ ...components
692
+ };
693
+ parameterCache.set(parameterCacheKey, abiParameter);
694
+ return abiParameter;
695
+ }
696
+ function splitParameters(params, result = [], current = "", depth = 0) {
697
+ const length = params.trim().length;
698
+ for (let i = 0; i < length; i++) {
699
+ const char = params[i];
700
+ const tail = params.slice(i + 1);
701
+ switch (char) {
702
+ case ",": return depth === 0 ? splitParameters(tail, [...result, current.trim()]) : splitParameters(tail, result, `${current}${char}`, depth);
703
+ case "(": return splitParameters(tail, result, `${current}${char}`, depth + 1);
704
+ case ")": return splitParameters(tail, result, `${current}${char}`, depth - 1);
705
+ default: return splitParameters(tail, result, `${current}${char}`, depth);
706
+ }
707
+ }
708
+ if (current === "") return result;
709
+ if (depth !== 0) throw new InvalidParenthesisError({
710
+ current,
711
+ depth
712
+ });
713
+ result.push(current.trim());
714
+ return result;
715
+ }
716
+ function isSolidityType(type) {
717
+ return type === "address" || type === "bool" || type === "function" || type === "string" || bytesRegex.test(type) || integerRegex.test(type);
718
+ }
719
+ 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)$/;
720
+ /** @internal */
721
+ function isSolidityKeyword(name) {
722
+ return name === "address" || name === "bool" || name === "function" || name === "string" || name === "tuple" || bytesRegex.test(name) || integerRegex.test(name) || protectedKeywordsRegex.test(name);
723
+ }
724
+ /** @internal */
725
+ function isValidDataLocation(type, isArray) {
726
+ return isArray || type === "bytes" || type === "string" || type === "tuple";
727
+ }
728
+ //#endregion
729
+ //#region node_modules/.pnpm/abitype@1.2.3_typescript@5.9.3_zod@4.3.6/node_modules/abitype/dist/esm/human-readable/runtime/structs.js
730
+ function parseStructs(signatures) {
731
+ const shallowStructs = {};
732
+ const signaturesLength = signatures.length;
733
+ for (let i = 0; i < signaturesLength; i++) {
734
+ const signature = signatures[i];
735
+ if (!isStructSignature(signature)) continue;
736
+ const match = execStructSignature(signature);
737
+ if (!match) throw new InvalidSignatureError({
738
+ signature,
739
+ type: "struct"
740
+ });
741
+ const properties = match.properties.split(";");
742
+ const components = [];
743
+ const propertiesLength = properties.length;
744
+ for (let k = 0; k < propertiesLength; k++) {
745
+ const trimmed = properties[k].trim();
746
+ if (!trimmed) continue;
747
+ const abiParameter = parseAbiParameter(trimmed, { type: "struct" });
748
+ components.push(abiParameter);
749
+ }
750
+ if (!components.length) throw new InvalidStructSignatureError({ signature });
751
+ shallowStructs[match.name] = components;
752
+ }
753
+ const resolvedStructs = {};
754
+ const entries = Object.entries(shallowStructs);
755
+ const entriesLength = entries.length;
756
+ for (let i = 0; i < entriesLength; i++) {
757
+ const [name, parameters] = entries[i];
758
+ resolvedStructs[name] = resolveStructs(parameters, shallowStructs);
759
+ }
760
+ return resolvedStructs;
761
+ }
762
+ const typeWithoutTupleRegex = /^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;
763
+ function resolveStructs(abiParameters = [], structs = {}, ancestors = /* @__PURE__ */ new Set()) {
764
+ const components = [];
765
+ const length = abiParameters.length;
766
+ for (let i = 0; i < length; i++) {
767
+ const abiParameter = abiParameters[i];
768
+ if (isTupleRegex.test(abiParameter.type)) components.push(abiParameter);
769
+ else {
770
+ const match = execTyped(typeWithoutTupleRegex, abiParameter.type);
771
+ if (!match?.type) throw new InvalidAbiTypeParameterError({ abiParameter });
772
+ const { array, type } = match;
773
+ if (type in structs) {
774
+ if (ancestors.has(type)) throw new CircularReferenceError({ type });
775
+ components.push({
776
+ ...abiParameter,
777
+ type: `tuple${array ?? ""}`,
778
+ components: resolveStructs(structs[type], structs, new Set([...ancestors, type]))
779
+ });
780
+ } else if (isSolidityType(type)) components.push(abiParameter);
781
+ else throw new UnknownTypeError({ type });
782
+ }
783
+ }
784
+ return components;
785
+ }
786
+ //#endregion
787
+ //#region node_modules/.pnpm/abitype@1.2.3_typescript@5.9.3_zod@4.3.6/node_modules/abitype/dist/esm/human-readable/parseAbi.js
788
+ /**
789
+ * Parses human-readable ABI into JSON {@link Abi}
790
+ *
791
+ * @param signatures - Human-Readable ABI
792
+ * @returns Parsed {@link Abi}
793
+ *
794
+ * @example
795
+ * const abi = parseAbi([
796
+ * // ^? const abi: readonly [{ name: "balanceOf"; type: "function"; stateMutability:...
797
+ * 'function balanceOf(address owner) view returns (uint256)',
798
+ * 'event Transfer(address indexed from, address indexed to, uint256 amount)',
799
+ * ])
800
+ */
801
+ function parseAbi(signatures) {
802
+ const structs = parseStructs(signatures);
803
+ const abi = [];
804
+ const length = signatures.length;
805
+ for (let i = 0; i < length; i++) {
806
+ const signature = signatures[i];
807
+ if (isStructSignature(signature)) continue;
808
+ abi.push(parseSignature(signature, structs));
809
+ }
810
+ return abi;
811
+ }
812
+ //#endregion
813
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/hash/hashSignature.js
814
+ const hash = (value) => keccak256(toBytes$1(value));
815
+ function hashSignature(sig) {
816
+ return hash(sig);
817
+ }
818
+ //#endregion
819
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/hash/normalizeSignature.js
820
+ function normalizeSignature(signature) {
821
+ let active = true;
822
+ let current = "";
823
+ let level = 0;
824
+ let result = "";
825
+ let valid = false;
826
+ for (let i = 0; i < signature.length; i++) {
827
+ const char = signature[i];
828
+ if ([
829
+ "(",
830
+ ")",
831
+ ","
832
+ ].includes(char)) active = true;
833
+ if (char === "(") level++;
834
+ if (char === ")") level--;
835
+ if (!active) continue;
836
+ if (level === 0) {
837
+ if (char === " " && [
838
+ "event",
839
+ "function",
840
+ ""
841
+ ].includes(result)) result = "";
842
+ else {
843
+ result += char;
844
+ if (char === ")") {
845
+ valid = true;
846
+ break;
847
+ }
848
+ }
849
+ continue;
850
+ }
851
+ if (char === " ") {
852
+ if (signature[i - 1] !== "," && current !== "," && current !== ",(") {
853
+ current = "";
854
+ active = false;
855
+ }
856
+ continue;
857
+ }
858
+ result += char;
859
+ current += char;
860
+ }
861
+ if (!valid) throw new BaseError$2("Unable to normalize signature.");
862
+ return result;
863
+ }
864
+ //#endregion
865
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/hash/toSignature.js
866
+ /**
867
+ * Returns the signature for a given function or event definition.
868
+ *
869
+ * @example
870
+ * const signature = toSignature('function ownerOf(uint256 tokenId)')
871
+ * // 'ownerOf(uint256)'
872
+ *
873
+ * @example
874
+ * const signature_3 = toSignature({
875
+ * name: 'ownerOf',
876
+ * type: 'function',
877
+ * inputs: [{ name: 'tokenId', type: 'uint256' }],
878
+ * outputs: [],
879
+ * stateMutability: 'view',
880
+ * })
881
+ * // 'ownerOf(uint256)'
882
+ */
883
+ const toSignature = (def) => {
884
+ return normalizeSignature((() => {
885
+ if (typeof def === "string") return def;
886
+ return formatAbiItem(def);
887
+ })());
888
+ };
889
+ //#endregion
890
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/hash/toSignatureHash.js
891
+ /**
892
+ * Returns the hash (of the function/event signature) for a given event or function definition.
893
+ */
894
+ function toSignatureHash(fn) {
895
+ return hashSignature(toSignature(fn));
896
+ }
897
+ //#endregion
898
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/hash/toEventSelector.js
899
+ /**
900
+ * Returns the event selector for a given event definition.
901
+ *
902
+ * @example
903
+ * const selector = toEventSelector('Transfer(address indexed from, address indexed to, uint256 amount)')
904
+ * // 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef
905
+ */
906
+ const toEventSelector = toSignatureHash;
907
+ //#endregion
908
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/hash/toFunctionSelector.js
909
+ /**
910
+ * Returns the function selector for a given function definition.
911
+ *
912
+ * @example
913
+ * const selector = toFunctionSelector('function ownerOf(uint256 tokenId)')
914
+ * // 0x6352211e
915
+ */
916
+ const toFunctionSelector = (fn) => slice$2(toSignatureHash(fn), 0, 4);
917
+ //#endregion
918
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/abi/getAbiItem.js
919
+ function getAbiItem(parameters) {
920
+ const { abi, args = [], name } = parameters;
921
+ const isSelector = isHex(name, { strict: false });
922
+ const abiItems = abi.filter((abiItem) => {
923
+ if (isSelector) {
924
+ if (abiItem.type === "function") return toFunctionSelector(abiItem) === name;
925
+ if (abiItem.type === "event") return toEventSelector(abiItem) === name;
926
+ return false;
927
+ }
928
+ return "name" in abiItem && abiItem.name === name;
929
+ });
930
+ if (abiItems.length === 0) return void 0;
931
+ if (abiItems.length === 1) return abiItems[0];
932
+ let matchedAbiItem;
933
+ for (const abiItem of abiItems) {
934
+ if (!("inputs" in abiItem)) continue;
935
+ if (!args || args.length === 0) {
936
+ if (!abiItem.inputs || abiItem.inputs.length === 0) return abiItem;
937
+ continue;
938
+ }
939
+ if (!abiItem.inputs) continue;
940
+ if (abiItem.inputs.length === 0) continue;
941
+ if (abiItem.inputs.length !== args.length) continue;
942
+ if (args.every((arg, index) => {
943
+ const abiParameter = "inputs" in abiItem && abiItem.inputs[index];
944
+ if (!abiParameter) return false;
945
+ return isArgOfType(arg, abiParameter);
946
+ })) {
947
+ if (matchedAbiItem && "inputs" in matchedAbiItem && matchedAbiItem.inputs) {
948
+ const ambiguousTypes = getAmbiguousTypes(abiItem.inputs, matchedAbiItem.inputs, args);
949
+ if (ambiguousTypes) throw new AbiItemAmbiguityError({
950
+ abiItem,
951
+ type: ambiguousTypes[0]
952
+ }, {
953
+ abiItem: matchedAbiItem,
954
+ type: ambiguousTypes[1]
955
+ });
956
+ }
957
+ matchedAbiItem = abiItem;
958
+ }
959
+ }
960
+ if (matchedAbiItem) return matchedAbiItem;
961
+ return abiItems[0];
962
+ }
963
+ /** @internal */
964
+ function isArgOfType(arg, abiParameter) {
965
+ const argType = typeof arg;
966
+ const abiParameterType = abiParameter.type;
967
+ switch (abiParameterType) {
968
+ case "address": return isAddress(arg, { strict: false });
969
+ case "bool": return argType === "boolean";
970
+ case "function": return argType === "string";
971
+ case "string": return argType === "string";
972
+ default:
973
+ if (abiParameterType === "tuple" && "components" in abiParameter) return Object.values(abiParameter.components).every((component, index) => {
974
+ return argType === "object" && isArgOfType(Object.values(arg)[index], component);
975
+ });
976
+ if (/^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)?$/.test(abiParameterType)) return argType === "number" || argType === "bigint";
977
+ if (/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(abiParameterType)) return argType === "string" || arg instanceof Uint8Array;
978
+ if (/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(abiParameterType)) return Array.isArray(arg) && arg.every((x) => isArgOfType(x, {
979
+ ...abiParameter,
980
+ type: abiParameterType.replace(/(\[[0-9]{0,}\])$/, "")
981
+ }));
982
+ return false;
983
+ }
984
+ }
985
+ /** @internal */
986
+ function getAmbiguousTypes(sourceParameters, targetParameters, args) {
987
+ for (const parameterIndex in sourceParameters) {
988
+ const sourceParameter = sourceParameters[parameterIndex];
989
+ const targetParameter = targetParameters[parameterIndex];
990
+ if (sourceParameter.type === "tuple" && targetParameter.type === "tuple" && "components" in sourceParameter && "components" in targetParameter) return getAmbiguousTypes(sourceParameter.components, targetParameter.components, args[parameterIndex]);
991
+ const types = [sourceParameter.type, targetParameter.type];
992
+ if ((() => {
993
+ if (types.includes("address") && types.includes("bytes20")) return true;
994
+ if (types.includes("address") && types.includes("string")) return isAddress(args[parameterIndex], { strict: false });
995
+ if (types.includes("address") && types.includes("bytes")) return isAddress(args[parameterIndex], { strict: false });
996
+ return false;
997
+ })()) return types;
998
+ }
999
+ }
1000
+ //#endregion
1001
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/abi/prepareEncodeFunctionData.js
1002
+ const docsPath$2 = "/docs/contract/encodeFunctionData";
1003
+ function prepareEncodeFunctionData(parameters) {
1004
+ const { abi, args, functionName } = parameters;
1005
+ let abiItem = abi[0];
1006
+ if (functionName) {
1007
+ const item = getAbiItem({
1008
+ abi,
1009
+ args,
1010
+ name: functionName
1011
+ });
1012
+ if (!item) throw new AbiFunctionNotFoundError(functionName, { docsPath: docsPath$2 });
1013
+ abiItem = item;
1014
+ }
1015
+ if (abiItem.type !== "function") throw new AbiFunctionNotFoundError(void 0, { docsPath: docsPath$2 });
1016
+ return {
1017
+ abi: [abiItem],
1018
+ functionName: toFunctionSelector(formatAbiItem$1(abiItem))
1019
+ };
1020
+ }
1021
+ //#endregion
1022
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/abi/encodeFunctionData.js
1023
+ function encodeFunctionData(parameters) {
1024
+ const { args } = parameters;
1025
+ const { abi, functionName } = (() => {
1026
+ if (parameters.abi.length === 1 && parameters.functionName?.startsWith("0x")) return parameters;
1027
+ return prepareEncodeFunctionData(parameters);
1028
+ })();
1029
+ const abiItem = abi[0];
1030
+ return concatHex([functionName, ("inputs" in abiItem && abiItem.inputs ? encodeAbiParameters(abiItem.inputs, args ?? []) : void 0) ?? "0x"]);
1031
+ }
1032
+ //#endregion
1033
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/constants/solidity.js
1034
+ const panicReasons = {
1035
+ 1: "An `assert` condition failed.",
1036
+ 17: "Arithmetic operation resulted in underflow or overflow.",
1037
+ 18: "Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",
1038
+ 33: "Attempted to convert to an invalid type.",
1039
+ 34: "Attempted to access a storage byte array that is incorrectly encoded.",
1040
+ 49: "Performed `.pop()` on an empty array",
1041
+ 50: "Array index is out of bounds.",
1042
+ 65: "Allocated too much memory or created an array which is too large.",
1043
+ 81: "Attempted to call a zero-initialized variable of internal function type."
1044
+ };
1045
+ const solidityError = {
1046
+ inputs: [{
1047
+ name: "message",
1048
+ type: "string"
1049
+ }],
1050
+ name: "Error",
1051
+ type: "error"
1052
+ };
1053
+ const solidityPanic = {
1054
+ inputs: [{
1055
+ name: "reason",
1056
+ type: "uint256"
1057
+ }],
1058
+ name: "Panic",
1059
+ type: "error"
1060
+ };
1061
+ //#endregion
1062
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/encoding/fromBytes.js
1063
+ /**
1064
+ * Decodes a byte array into a bigint.
1065
+ *
1066
+ * - Docs: https://viem.sh/docs/utilities/fromBytes#bytestobigint
1067
+ *
1068
+ * @param bytes Byte array to decode.
1069
+ * @param opts Options.
1070
+ * @returns BigInt value.
1071
+ *
1072
+ * @example
1073
+ * import { bytesToBigInt } from 'viem'
1074
+ * const data = bytesToBigInt(new Uint8Array([1, 164]))
1075
+ * // 420n
1076
+ */
1077
+ function bytesToBigInt(bytes, opts = {}) {
1078
+ if (typeof opts.size !== "undefined") assertSize$2(bytes, { size: opts.size });
1079
+ return hexToBigInt(bytesToHex(bytes, opts), opts);
1080
+ }
1081
+ /**
1082
+ * Decodes a byte array into a boolean.
1083
+ *
1084
+ * - Docs: https://viem.sh/docs/utilities/fromBytes#bytestobool
1085
+ *
1086
+ * @param bytes Byte array to decode.
1087
+ * @param opts Options.
1088
+ * @returns Boolean value.
1089
+ *
1090
+ * @example
1091
+ * import { bytesToBool } from 'viem'
1092
+ * const data = bytesToBool(new Uint8Array([1]))
1093
+ * // true
1094
+ */
1095
+ function bytesToBool(bytes_, opts = {}) {
1096
+ let bytes = bytes_;
1097
+ if (typeof opts.size !== "undefined") {
1098
+ assertSize$2(bytes, { size: opts.size });
1099
+ bytes = trim$2(bytes);
1100
+ }
1101
+ if (bytes.length > 1 || bytes[0] > 1) throw new InvalidBytesBooleanError$1(bytes);
1102
+ return Boolean(bytes[0]);
1103
+ }
1104
+ /**
1105
+ * Decodes a byte array into a number.
1106
+ *
1107
+ * - Docs: https://viem.sh/docs/utilities/fromBytes#bytestonumber
1108
+ *
1109
+ * @param bytes Byte array to decode.
1110
+ * @param opts Options.
1111
+ * @returns Number value.
1112
+ *
1113
+ * @example
1114
+ * import { bytesToNumber } from 'viem'
1115
+ * const data = bytesToNumber(new Uint8Array([1, 164]))
1116
+ * // 420
1117
+ */
1118
+ function bytesToNumber(bytes, opts = {}) {
1119
+ if (typeof opts.size !== "undefined") assertSize$2(bytes, { size: opts.size });
1120
+ return hexToNumber(bytesToHex(bytes, opts), opts);
1121
+ }
1122
+ /**
1123
+ * Decodes a byte array into a UTF-8 string.
1124
+ *
1125
+ * - Docs: https://viem.sh/docs/utilities/fromBytes#bytestostring
1126
+ *
1127
+ * @param bytes Byte array to decode.
1128
+ * @param opts Options.
1129
+ * @returns String value.
1130
+ *
1131
+ * @example
1132
+ * import { bytesToString } from 'viem'
1133
+ * const data = bytesToString(new Uint8Array([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33]))
1134
+ * // 'Hello world'
1135
+ */
1136
+ function bytesToString(bytes_, opts = {}) {
1137
+ let bytes = bytes_;
1138
+ if (typeof opts.size !== "undefined") {
1139
+ assertSize$2(bytes, { size: opts.size });
1140
+ bytes = trim$2(bytes, { dir: "right" });
1141
+ }
1142
+ return new TextDecoder().decode(bytes);
1143
+ }
1144
+ //#endregion
1145
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/abi/decodeAbiParameters.js
1146
+ function decodeAbiParameters(params, data) {
1147
+ const bytes = typeof data === "string" ? hexToBytes(data) : data;
1148
+ const cursor = createCursor(bytes);
1149
+ if (size$2(bytes) === 0 && params.length > 0) throw new AbiDecodingZeroDataError();
1150
+ if (size$2(data) && size$2(data) < 32) throw new AbiDecodingDataSizeTooSmallError({
1151
+ data: typeof data === "string" ? data : bytesToHex(data),
1152
+ params,
1153
+ size: size$2(data)
1154
+ });
1155
+ let consumed = 0;
1156
+ const values = [];
1157
+ for (let i = 0; i < params.length; ++i) {
1158
+ const param = params[i];
1159
+ cursor.setPosition(consumed);
1160
+ const [data, consumed_] = decodeParameter(cursor, param, { staticPosition: 0 });
1161
+ consumed += consumed_;
1162
+ values.push(data);
1163
+ }
1164
+ return values;
1165
+ }
1166
+ function decodeParameter(cursor, param, { staticPosition }) {
1167
+ const arrayComponents = getArrayComponents(param.type);
1168
+ if (arrayComponents) {
1169
+ const [length, type] = arrayComponents;
1170
+ return decodeArray(cursor, {
1171
+ ...param,
1172
+ type
1173
+ }, {
1174
+ length,
1175
+ staticPosition
1176
+ });
1177
+ }
1178
+ if (param.type === "tuple") return decodeTuple(cursor, param, { staticPosition });
1179
+ if (param.type === "address") return decodeAddress(cursor);
1180
+ if (param.type === "bool") return decodeBool(cursor);
1181
+ if (param.type.startsWith("bytes")) return decodeBytes(cursor, param, { staticPosition });
1182
+ if (param.type.startsWith("uint") || param.type.startsWith("int")) return decodeNumber(cursor, param);
1183
+ if (param.type === "string") return decodeString(cursor, { staticPosition });
1184
+ throw new InvalidAbiDecodingTypeError(param.type, { docsPath: "/docs/contract/decodeAbiParameters" });
1185
+ }
1186
+ const sizeOfLength = 32;
1187
+ const sizeOfOffset = 32;
1188
+ function decodeAddress(cursor) {
1189
+ return [checksumAddress(bytesToHex(sliceBytes(cursor.readBytes(32), -20))), 32];
1190
+ }
1191
+ function decodeArray(cursor, param, { length, staticPosition }) {
1192
+ if (!length) {
1193
+ const start = staticPosition + bytesToNumber(cursor.readBytes(sizeOfOffset));
1194
+ const startOfData = start + sizeOfLength;
1195
+ cursor.setPosition(start);
1196
+ const length = bytesToNumber(cursor.readBytes(sizeOfLength));
1197
+ const dynamicChild = hasDynamicChild(param);
1198
+ let consumed = 0;
1199
+ const value = [];
1200
+ for (let i = 0; i < length; ++i) {
1201
+ cursor.setPosition(startOfData + (dynamicChild ? i * 32 : consumed));
1202
+ const [data, consumed_] = decodeParameter(cursor, param, { staticPosition: startOfData });
1203
+ consumed += consumed_;
1204
+ value.push(data);
1205
+ }
1206
+ cursor.setPosition(staticPosition + 32);
1207
+ return [value, 32];
1208
+ }
1209
+ if (hasDynamicChild(param)) {
1210
+ const start = staticPosition + bytesToNumber(cursor.readBytes(sizeOfOffset));
1211
+ const value = [];
1212
+ for (let i = 0; i < length; ++i) {
1213
+ cursor.setPosition(start + i * 32);
1214
+ const [data] = decodeParameter(cursor, param, { staticPosition: start });
1215
+ value.push(data);
1216
+ }
1217
+ cursor.setPosition(staticPosition + 32);
1218
+ return [value, 32];
1219
+ }
1220
+ let consumed = 0;
1221
+ const value = [];
1222
+ for (let i = 0; i < length; ++i) {
1223
+ const [data, consumed_] = decodeParameter(cursor, param, { staticPosition: staticPosition + consumed });
1224
+ consumed += consumed_;
1225
+ value.push(data);
1226
+ }
1227
+ return [value, consumed];
1228
+ }
1229
+ function decodeBool(cursor) {
1230
+ return [bytesToBool(cursor.readBytes(32), { size: 32 }), 32];
1231
+ }
1232
+ function decodeBytes(cursor, param, { staticPosition }) {
1233
+ const [_, size] = param.type.split("bytes");
1234
+ if (!size) {
1235
+ const offset = bytesToNumber(cursor.readBytes(32));
1236
+ cursor.setPosition(staticPosition + offset);
1237
+ const length = bytesToNumber(cursor.readBytes(32));
1238
+ if (length === 0) {
1239
+ cursor.setPosition(staticPosition + 32);
1240
+ return ["0x", 32];
1241
+ }
1242
+ const data = cursor.readBytes(length);
1243
+ cursor.setPosition(staticPosition + 32);
1244
+ return [bytesToHex(data), 32];
1245
+ }
1246
+ return [bytesToHex(cursor.readBytes(Number.parseInt(size, 10), 32)), 32];
1247
+ }
1248
+ function decodeNumber(cursor, param) {
1249
+ const signed = param.type.startsWith("int");
1250
+ const size = Number.parseInt(param.type.split("int")[1] || "256", 10);
1251
+ const value = cursor.readBytes(32);
1252
+ return [size > 48 ? bytesToBigInt(value, { signed }) : bytesToNumber(value, { signed }), 32];
1253
+ }
1254
+ function decodeTuple(cursor, param, { staticPosition }) {
1255
+ const hasUnnamedChild = param.components.length === 0 || param.components.some(({ name }) => !name);
1256
+ const value = hasUnnamedChild ? [] : {};
1257
+ let consumed = 0;
1258
+ if (hasDynamicChild(param)) {
1259
+ const start = staticPosition + bytesToNumber(cursor.readBytes(sizeOfOffset));
1260
+ for (let i = 0; i < param.components.length; ++i) {
1261
+ const component = param.components[i];
1262
+ cursor.setPosition(start + consumed);
1263
+ const [data, consumed_] = decodeParameter(cursor, component, { staticPosition: start });
1264
+ consumed += consumed_;
1265
+ value[hasUnnamedChild ? i : component?.name] = data;
1266
+ }
1267
+ cursor.setPosition(staticPosition + 32);
1268
+ return [value, 32];
1269
+ }
1270
+ for (let i = 0; i < param.components.length; ++i) {
1271
+ const component = param.components[i];
1272
+ const [data, consumed_] = decodeParameter(cursor, component, { staticPosition });
1273
+ value[hasUnnamedChild ? i : component?.name] = data;
1274
+ consumed += consumed_;
1275
+ }
1276
+ return [value, consumed];
1277
+ }
1278
+ function decodeString(cursor, { staticPosition }) {
1279
+ const start = staticPosition + bytesToNumber(cursor.readBytes(32));
1280
+ cursor.setPosition(start);
1281
+ const length = bytesToNumber(cursor.readBytes(32));
1282
+ if (length === 0) {
1283
+ cursor.setPosition(staticPosition + 32);
1284
+ return ["", 32];
1285
+ }
1286
+ const value = bytesToString(trim$2(cursor.readBytes(length, 32)));
1287
+ cursor.setPosition(staticPosition + 32);
1288
+ return [value, 32];
1289
+ }
1290
+ function hasDynamicChild(param) {
1291
+ const { type } = param;
1292
+ if (type === "string") return true;
1293
+ if (type === "bytes") return true;
1294
+ if (type.endsWith("[]")) return true;
1295
+ if (type === "tuple") return param.components?.some(hasDynamicChild);
1296
+ const arrayComponents = getArrayComponents(param.type);
1297
+ if (arrayComponents && hasDynamicChild({
1298
+ ...param,
1299
+ type: arrayComponents[1]
1300
+ })) return true;
1301
+ return false;
1302
+ }
1303
+ //#endregion
1304
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/abi/decodeErrorResult.js
1305
+ function decodeErrorResult(parameters) {
1306
+ const { abi, data, cause } = parameters;
1307
+ const signature = slice$2(data, 0, 4);
1308
+ if (signature === "0x") throw new AbiDecodingZeroDataError({ cause });
1309
+ const abiItem = [
1310
+ ...abi || [],
1311
+ solidityError,
1312
+ solidityPanic
1313
+ ].find((x) => x.type === "error" && signature === toFunctionSelector(formatAbiItem$1(x)));
1314
+ if (!abiItem) throw new AbiErrorSignatureNotFoundError(signature, {
1315
+ docsPath: "/docs/contract/decodeErrorResult",
1316
+ cause
1317
+ });
1318
+ return {
1319
+ abiItem,
1320
+ args: "inputs" in abiItem && abiItem.inputs && abiItem.inputs.length > 0 ? decodeAbiParameters(abiItem.inputs, slice$2(data, 4)) : void 0,
1321
+ errorName: abiItem.name
1322
+ };
1323
+ }
1324
+ //#endregion
1325
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/abi/formatAbiItemWithArgs.js
1326
+ function formatAbiItemWithArgs({ abiItem, args, includeFunctionName = true, includeName = false }) {
1327
+ if (!("name" in abiItem)) return;
1328
+ if (!("inputs" in abiItem)) return;
1329
+ if (!abiItem.inputs) return;
1330
+ 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(", ")})`;
1331
+ }
1332
+ //#endregion
1333
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/errors/stateOverride.js
1334
+ var AccountStateConflictError = class extends BaseError$2 {
1335
+ constructor({ address }) {
1336
+ super(`State for account "${address}" is set multiple times.`, { name: "AccountStateConflictError" });
1337
+ }
1338
+ };
1339
+ var StateAssignmentConflictError = class extends BaseError$2 {
1340
+ constructor() {
1341
+ super("state and stateDiff are set on the same account.", { name: "StateAssignmentConflictError" });
1342
+ }
1343
+ };
1344
+ /** @internal */
1345
+ function prettyStateMapping(stateMapping) {
1346
+ return stateMapping.reduce((pretty, { slot, value }) => {
1347
+ return `${pretty} ${slot}: ${value}\n`;
1348
+ }, "");
1349
+ }
1350
+ function prettyStateOverride(stateOverride) {
1351
+ return stateOverride.reduce((pretty, { address, ...state }) => {
1352
+ let val = `${pretty} ${address}:\n`;
1353
+ if (state.nonce) val += ` nonce: ${state.nonce}\n`;
1354
+ if (state.balance) val += ` balance: ${state.balance}\n`;
1355
+ if (state.code) val += ` code: ${state.code}\n`;
1356
+ if (state.state) {
1357
+ val += " state:\n";
1358
+ val += prettyStateMapping(state.state);
1359
+ }
1360
+ if (state.stateDiff) {
1361
+ val += " stateDiff:\n";
1362
+ val += prettyStateMapping(state.stateDiff);
1363
+ }
1364
+ return val;
1365
+ }, " State Override:\n").slice(0, -1);
1366
+ }
1367
+ //#endregion
1368
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/errors/utils.js
1369
+ const getContractAddress = (address) => address;
1370
+ const getUrl = (url) => url;
1371
+ //#endregion
1372
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/errors/contract.js
1373
+ var CallExecutionError = class extends BaseError$2 {
1374
+ constructor(cause, { account: account_, docsPath, chain, data, gas, gasPrice, maxFeePerGas, maxPriorityFeePerGas, nonce, to, value, stateOverride }) {
1375
+ let prettyArgs = prettyPrint({
1376
+ from: (account_ ? parseAccount(account_) : void 0)?.address,
1377
+ to,
1378
+ value: typeof value !== "undefined" && `${formatEther(value)} ${chain?.nativeCurrency?.symbol || "ETH"}`,
1379
+ data,
1380
+ gas,
1381
+ gasPrice: typeof gasPrice !== "undefined" && `${formatGwei(gasPrice)} gwei`,
1382
+ maxFeePerGas: typeof maxFeePerGas !== "undefined" && `${formatGwei(maxFeePerGas)} gwei`,
1383
+ maxPriorityFeePerGas: typeof maxPriorityFeePerGas !== "undefined" && `${formatGwei(maxPriorityFeePerGas)} gwei`,
1384
+ nonce
1385
+ });
1386
+ if (stateOverride) prettyArgs += `\n${prettyStateOverride(stateOverride)}`;
1387
+ super(cause.shortMessage, {
1388
+ cause,
1389
+ docsPath,
1390
+ metaMessages: [
1391
+ ...cause.metaMessages ? [...cause.metaMessages, " "] : [],
1392
+ "Raw Call Arguments:",
1393
+ prettyArgs
1394
+ ].filter(Boolean),
1395
+ name: "CallExecutionError"
1396
+ });
1397
+ Object.defineProperty(this, "cause", {
1398
+ enumerable: true,
1399
+ configurable: true,
1400
+ writable: true,
1401
+ value: void 0
1402
+ });
1403
+ this.cause = cause;
1404
+ }
1405
+ };
1406
+ var ContractFunctionExecutionError = class extends BaseError$2 {
1407
+ constructor(cause, { abi, args, contractAddress, docsPath, functionName, sender }) {
1408
+ const abiItem = getAbiItem({
1409
+ abi,
1410
+ args,
1411
+ name: functionName
1412
+ });
1413
+ const formattedArgs = abiItem ? formatAbiItemWithArgs({
1414
+ abiItem,
1415
+ args,
1416
+ includeFunctionName: false,
1417
+ includeName: false
1418
+ }) : void 0;
1419
+ const functionWithParams = abiItem ? formatAbiItem$1(abiItem, { includeName: true }) : void 0;
1420
+ const prettyArgs = prettyPrint({
1421
+ address: contractAddress && getContractAddress(contractAddress),
1422
+ function: functionWithParams,
1423
+ args: formattedArgs && formattedArgs !== "()" && `${[...Array(functionName?.length ?? 0).keys()].map(() => " ").join("")}${formattedArgs}`,
1424
+ sender
1425
+ });
1426
+ super(cause.shortMessage || `An unknown error occurred while executing the contract function "${functionName}".`, {
1427
+ cause,
1428
+ docsPath,
1429
+ metaMessages: [
1430
+ ...cause.metaMessages ? [...cause.metaMessages, " "] : [],
1431
+ prettyArgs && "Contract Call:",
1432
+ prettyArgs
1433
+ ].filter(Boolean),
1434
+ name: "ContractFunctionExecutionError"
1435
+ });
1436
+ Object.defineProperty(this, "abi", {
1437
+ enumerable: true,
1438
+ configurable: true,
1439
+ writable: true,
1440
+ value: void 0
1441
+ });
1442
+ Object.defineProperty(this, "args", {
1443
+ enumerable: true,
1444
+ configurable: true,
1445
+ writable: true,
1446
+ value: void 0
1447
+ });
1448
+ Object.defineProperty(this, "cause", {
1449
+ enumerable: true,
1450
+ configurable: true,
1451
+ writable: true,
1452
+ value: void 0
1453
+ });
1454
+ Object.defineProperty(this, "contractAddress", {
1455
+ enumerable: true,
1456
+ configurable: true,
1457
+ writable: true,
1458
+ value: void 0
1459
+ });
1460
+ Object.defineProperty(this, "formattedArgs", {
1461
+ enumerable: true,
1462
+ configurable: true,
1463
+ writable: true,
1464
+ value: void 0
1465
+ });
1466
+ Object.defineProperty(this, "functionName", {
1467
+ enumerable: true,
1468
+ configurable: true,
1469
+ writable: true,
1470
+ value: void 0
1471
+ });
1472
+ Object.defineProperty(this, "sender", {
1473
+ enumerable: true,
1474
+ configurable: true,
1475
+ writable: true,
1476
+ value: void 0
1477
+ });
1478
+ this.abi = abi;
1479
+ this.args = args;
1480
+ this.cause = cause;
1481
+ this.contractAddress = contractAddress;
1482
+ this.functionName = functionName;
1483
+ this.sender = sender;
1484
+ }
1485
+ };
1486
+ var ContractFunctionRevertedError = class extends BaseError$2 {
1487
+ constructor({ abi, data, functionName, message, cause: error }) {
1488
+ let cause;
1489
+ let decodedData;
1490
+ let metaMessages;
1491
+ let reason;
1492
+ if (data && data !== "0x") try {
1493
+ decodedData = decodeErrorResult({
1494
+ abi,
1495
+ data,
1496
+ cause: error
1497
+ });
1498
+ const { abiItem, errorName, args: errorArgs } = decodedData;
1499
+ if (errorName === "Error") reason = errorArgs[0];
1500
+ else if (errorName === "Panic") {
1501
+ const [firstArg] = errorArgs;
1502
+ reason = panicReasons[firstArg];
1503
+ } else {
1504
+ const errorWithParams = abiItem ? formatAbiItem$1(abiItem, { includeName: true }) : void 0;
1505
+ const formattedArgs = abiItem && errorArgs ? formatAbiItemWithArgs({
1506
+ abiItem,
1507
+ args: errorArgs,
1508
+ includeFunctionName: false,
1509
+ includeName: false
1510
+ }) : void 0;
1511
+ metaMessages = [errorWithParams ? `Error: ${errorWithParams}` : "", formattedArgs && formattedArgs !== "()" ? ` ${[...Array(errorName?.length ?? 0).keys()].map(() => " ").join("")}${formattedArgs}` : ""];
1512
+ }
1513
+ } catch (err) {
1514
+ cause = err;
1515
+ }
1516
+ else if (message) reason = message;
1517
+ let signature;
1518
+ if (cause instanceof AbiErrorSignatureNotFoundError) {
1519
+ signature = cause.signature;
1520
+ metaMessages = [
1521
+ `Unable to decode signature "${signature}" as it was not found on the provided ABI.`,
1522
+ "Make sure you are using the correct ABI and that the error exists on it.",
1523
+ `You can look up the decoded signature here: https://4byte.sourcify.dev/?q=${signature}.`
1524
+ ];
1525
+ }
1526
+ super(reason && reason !== "execution reverted" || signature ? [`The contract function "${functionName}" reverted with the following ${signature ? "signature" : "reason"}:`, reason || signature].join("\n") : `The contract function "${functionName}" reverted.`, {
1527
+ cause: cause ?? error,
1528
+ metaMessages,
1529
+ name: "ContractFunctionRevertedError"
1530
+ });
1531
+ Object.defineProperty(this, "data", {
1532
+ enumerable: true,
1533
+ configurable: true,
1534
+ writable: true,
1535
+ value: void 0
1536
+ });
1537
+ Object.defineProperty(this, "raw", {
1538
+ enumerable: true,
1539
+ configurable: true,
1540
+ writable: true,
1541
+ value: void 0
1542
+ });
1543
+ Object.defineProperty(this, "reason", {
1544
+ enumerable: true,
1545
+ configurable: true,
1546
+ writable: true,
1547
+ value: void 0
1548
+ });
1549
+ Object.defineProperty(this, "signature", {
1550
+ enumerable: true,
1551
+ configurable: true,
1552
+ writable: true,
1553
+ value: void 0
1554
+ });
1555
+ this.data = decodedData;
1556
+ this.raw = data;
1557
+ this.reason = reason;
1558
+ this.signature = signature;
1559
+ }
1560
+ };
1561
+ var ContractFunctionZeroDataError = class extends BaseError$2 {
1562
+ constructor({ functionName, cause }) {
1563
+ super(`The contract function "${functionName}" returned no data ("0x").`, {
1564
+ metaMessages: [
1565
+ "This could be due to any of the following:",
1566
+ ` - The contract does not have the function "${functionName}",`,
1567
+ " - The parameters passed to the contract function may be invalid, or",
1568
+ " - The address is not a contract."
1569
+ ],
1570
+ name: "ContractFunctionZeroDataError",
1571
+ cause
1572
+ });
1573
+ }
1574
+ };
1575
+ var CounterfactualDeploymentFailedError = class extends BaseError$2 {
1576
+ constructor({ factory }) {
1577
+ super(`Deployment for counterfactual contract call failed${factory ? ` for factory "${factory}".` : ""}`, {
1578
+ metaMessages: [
1579
+ "Please ensure:",
1580
+ "- The `factory` is a valid contract deployment factory (ie. Create2 Factory, ERC-4337 Factory, etc).",
1581
+ "- The `factoryData` is a valid encoded function call for contract deployment function on the factory."
1582
+ ],
1583
+ name: "CounterfactualDeploymentFailedError"
1584
+ });
1585
+ }
1586
+ };
1587
+ var RawContractError = class extends BaseError$2 {
1588
+ constructor({ data, message }) {
1589
+ super(message || "", { name: "RawContractError" });
1590
+ Object.defineProperty(this, "code", {
1591
+ enumerable: true,
1592
+ configurable: true,
1593
+ writable: true,
1594
+ value: 3
1595
+ });
1596
+ Object.defineProperty(this, "data", {
1597
+ enumerable: true,
1598
+ configurable: true,
1599
+ writable: true,
1600
+ value: void 0
1601
+ });
1602
+ this.data = data;
1603
+ }
1604
+ };
1605
+ //#endregion
1606
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/errors/request.js
1607
+ var HttpRequestError = class extends BaseError$2 {
1608
+ constructor({ body, cause, details, headers, status, url }) {
1609
+ super("HTTP request failed.", {
1610
+ cause,
1611
+ details,
1612
+ metaMessages: [
1613
+ status && `Status: ${status}`,
1614
+ `URL: ${getUrl(url)}`,
1615
+ body && `Request body: ${stringify$1(body)}`
1616
+ ].filter(Boolean),
1617
+ name: "HttpRequestError"
1618
+ });
1619
+ Object.defineProperty(this, "body", {
1620
+ enumerable: true,
1621
+ configurable: true,
1622
+ writable: true,
1623
+ value: void 0
1624
+ });
1625
+ Object.defineProperty(this, "headers", {
1626
+ enumerable: true,
1627
+ configurable: true,
1628
+ writable: true,
1629
+ value: void 0
1630
+ });
1631
+ Object.defineProperty(this, "status", {
1632
+ enumerable: true,
1633
+ configurable: true,
1634
+ writable: true,
1635
+ value: void 0
1636
+ });
1637
+ Object.defineProperty(this, "url", {
1638
+ enumerable: true,
1639
+ configurable: true,
1640
+ writable: true,
1641
+ value: void 0
1642
+ });
1643
+ this.body = body;
1644
+ this.headers = headers;
1645
+ this.status = status;
1646
+ this.url = url;
1647
+ }
1648
+ };
1649
+ var RpcRequestError = class extends BaseError$2 {
1650
+ constructor({ body, error, url }) {
1651
+ super("RPC Request failed.", {
1652
+ cause: error,
1653
+ details: error.message,
1654
+ metaMessages: [`URL: ${getUrl(url)}`, `Request body: ${stringify$1(body)}`],
1655
+ name: "RpcRequestError"
1656
+ });
1657
+ Object.defineProperty(this, "code", {
1658
+ enumerable: true,
1659
+ configurable: true,
1660
+ writable: true,
1661
+ value: void 0
1662
+ });
1663
+ Object.defineProperty(this, "data", {
1664
+ enumerable: true,
1665
+ configurable: true,
1666
+ writable: true,
1667
+ value: void 0
1668
+ });
1669
+ Object.defineProperty(this, "url", {
1670
+ enumerable: true,
1671
+ configurable: true,
1672
+ writable: true,
1673
+ value: void 0
1674
+ });
1675
+ this.code = error.code;
1676
+ this.data = error.data;
1677
+ this.url = url;
1678
+ }
1679
+ };
1680
+ var TimeoutError = class extends BaseError$2 {
1681
+ constructor({ body, url }) {
1682
+ super("The request took too long to respond.", {
1683
+ details: "The request timed out.",
1684
+ metaMessages: [`URL: ${getUrl(url)}`, `Request body: ${stringify$1(body)}`],
1685
+ name: "TimeoutError"
1686
+ });
1687
+ Object.defineProperty(this, "url", {
1688
+ enumerable: true,
1689
+ configurable: true,
1690
+ writable: true,
1691
+ value: void 0
1692
+ });
1693
+ this.url = url;
1694
+ }
1695
+ };
1696
+ //#endregion
1697
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/errors/rpc.js
1698
+ const unknownErrorCode = -1;
1699
+ var RpcError = class extends BaseError$2 {
1700
+ constructor(cause, { code, docsPath, metaMessages, name, shortMessage }) {
1701
+ super(shortMessage, {
1702
+ cause,
1703
+ docsPath,
1704
+ metaMessages: metaMessages || cause?.metaMessages,
1705
+ name: name || "RpcError"
1706
+ });
1707
+ Object.defineProperty(this, "code", {
1708
+ enumerable: true,
1709
+ configurable: true,
1710
+ writable: true,
1711
+ value: void 0
1712
+ });
1713
+ this.name = name || cause.name;
1714
+ this.code = cause instanceof RpcRequestError ? cause.code : code ?? unknownErrorCode;
1715
+ }
1716
+ };
1717
+ var ProviderRpcError = class extends RpcError {
1718
+ constructor(cause, options) {
1719
+ super(cause, options);
1720
+ Object.defineProperty(this, "data", {
1721
+ enumerable: true,
1722
+ configurable: true,
1723
+ writable: true,
1724
+ value: void 0
1725
+ });
1726
+ this.data = options.data;
1727
+ }
1728
+ };
1729
+ var ParseRpcError = class ParseRpcError extends RpcError {
1730
+ constructor(cause) {
1731
+ super(cause, {
1732
+ code: ParseRpcError.code,
1733
+ name: "ParseRpcError",
1734
+ shortMessage: "Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."
1735
+ });
1736
+ }
1737
+ };
1738
+ Object.defineProperty(ParseRpcError, "code", {
1739
+ enumerable: true,
1740
+ configurable: true,
1741
+ writable: true,
1742
+ value: -32700
1743
+ });
1744
+ var InvalidRequestRpcError = class InvalidRequestRpcError extends RpcError {
1745
+ constructor(cause) {
1746
+ super(cause, {
1747
+ code: InvalidRequestRpcError.code,
1748
+ name: "InvalidRequestRpcError",
1749
+ shortMessage: "JSON is not a valid request object."
1750
+ });
1751
+ }
1752
+ };
1753
+ Object.defineProperty(InvalidRequestRpcError, "code", {
1754
+ enumerable: true,
1755
+ configurable: true,
1756
+ writable: true,
1757
+ value: -32600
1758
+ });
1759
+ var MethodNotFoundRpcError = class MethodNotFoundRpcError extends RpcError {
1760
+ constructor(cause, { method } = {}) {
1761
+ super(cause, {
1762
+ code: MethodNotFoundRpcError.code,
1763
+ name: "MethodNotFoundRpcError",
1764
+ shortMessage: `The method${method ? ` "${method}"` : ""} does not exist / is not available.`
1765
+ });
1766
+ }
1767
+ };
1768
+ Object.defineProperty(MethodNotFoundRpcError, "code", {
1769
+ enumerable: true,
1770
+ configurable: true,
1771
+ writable: true,
1772
+ value: -32601
1773
+ });
1774
+ var InvalidParamsRpcError = class InvalidParamsRpcError extends RpcError {
1775
+ constructor(cause) {
1776
+ super(cause, {
1777
+ code: InvalidParamsRpcError.code,
1778
+ name: "InvalidParamsRpcError",
1779
+ shortMessage: ["Invalid parameters were provided to the RPC method.", "Double check you have provided the correct parameters."].join("\n")
1780
+ });
1781
+ }
1782
+ };
1783
+ Object.defineProperty(InvalidParamsRpcError, "code", {
1784
+ enumerable: true,
1785
+ configurable: true,
1786
+ writable: true,
1787
+ value: -32602
1788
+ });
1789
+ var InternalRpcError = class InternalRpcError extends RpcError {
1790
+ constructor(cause) {
1791
+ super(cause, {
1792
+ code: InternalRpcError.code,
1793
+ name: "InternalRpcError",
1794
+ shortMessage: "An internal error was received."
1795
+ });
1796
+ }
1797
+ };
1798
+ Object.defineProperty(InternalRpcError, "code", {
1799
+ enumerable: true,
1800
+ configurable: true,
1801
+ writable: true,
1802
+ value: -32603
1803
+ });
1804
+ var InvalidInputRpcError = class InvalidInputRpcError extends RpcError {
1805
+ constructor(cause) {
1806
+ super(cause, {
1807
+ code: InvalidInputRpcError.code,
1808
+ name: "InvalidInputRpcError",
1809
+ shortMessage: ["Missing or invalid parameters.", "Double check you have provided the correct parameters."].join("\n")
1810
+ });
1811
+ }
1812
+ };
1813
+ Object.defineProperty(InvalidInputRpcError, "code", {
1814
+ enumerable: true,
1815
+ configurable: true,
1816
+ writable: true,
1817
+ value: -32e3
1818
+ });
1819
+ var ResourceNotFoundRpcError = class ResourceNotFoundRpcError extends RpcError {
1820
+ constructor(cause) {
1821
+ super(cause, {
1822
+ code: ResourceNotFoundRpcError.code,
1823
+ name: "ResourceNotFoundRpcError",
1824
+ shortMessage: "Requested resource not found."
1825
+ });
1826
+ Object.defineProperty(this, "name", {
1827
+ enumerable: true,
1828
+ configurable: true,
1829
+ writable: true,
1830
+ value: "ResourceNotFoundRpcError"
1831
+ });
1832
+ }
1833
+ };
1834
+ Object.defineProperty(ResourceNotFoundRpcError, "code", {
1835
+ enumerable: true,
1836
+ configurable: true,
1837
+ writable: true,
1838
+ value: -32001
1839
+ });
1840
+ var ResourceUnavailableRpcError = class ResourceUnavailableRpcError extends RpcError {
1841
+ constructor(cause) {
1842
+ super(cause, {
1843
+ code: ResourceUnavailableRpcError.code,
1844
+ name: "ResourceUnavailableRpcError",
1845
+ shortMessage: "Requested resource not available."
1846
+ });
1847
+ }
1848
+ };
1849
+ Object.defineProperty(ResourceUnavailableRpcError, "code", {
1850
+ enumerable: true,
1851
+ configurable: true,
1852
+ writable: true,
1853
+ value: -32002
1854
+ });
1855
+ var TransactionRejectedRpcError = class TransactionRejectedRpcError extends RpcError {
1856
+ constructor(cause) {
1857
+ super(cause, {
1858
+ code: TransactionRejectedRpcError.code,
1859
+ name: "TransactionRejectedRpcError",
1860
+ shortMessage: "Transaction creation failed."
1861
+ });
1862
+ }
1863
+ };
1864
+ Object.defineProperty(TransactionRejectedRpcError, "code", {
1865
+ enumerable: true,
1866
+ configurable: true,
1867
+ writable: true,
1868
+ value: -32003
1869
+ });
1870
+ var MethodNotSupportedRpcError = class MethodNotSupportedRpcError extends RpcError {
1871
+ constructor(cause, { method } = {}) {
1872
+ super(cause, {
1873
+ code: MethodNotSupportedRpcError.code,
1874
+ name: "MethodNotSupportedRpcError",
1875
+ shortMessage: `Method${method ? ` "${method}"` : ""} is not supported.`
1876
+ });
1877
+ }
1878
+ };
1879
+ Object.defineProperty(MethodNotSupportedRpcError, "code", {
1880
+ enumerable: true,
1881
+ configurable: true,
1882
+ writable: true,
1883
+ value: -32004
1884
+ });
1885
+ var LimitExceededRpcError = class LimitExceededRpcError extends RpcError {
1886
+ constructor(cause) {
1887
+ super(cause, {
1888
+ code: LimitExceededRpcError.code,
1889
+ name: "LimitExceededRpcError",
1890
+ shortMessage: "Request exceeds defined limit."
1891
+ });
1892
+ }
1893
+ };
1894
+ Object.defineProperty(LimitExceededRpcError, "code", {
1895
+ enumerable: true,
1896
+ configurable: true,
1897
+ writable: true,
1898
+ value: -32005
1899
+ });
1900
+ var JsonRpcVersionUnsupportedError = class JsonRpcVersionUnsupportedError extends RpcError {
1901
+ constructor(cause) {
1902
+ super(cause, {
1903
+ code: JsonRpcVersionUnsupportedError.code,
1904
+ name: "JsonRpcVersionUnsupportedError",
1905
+ shortMessage: "Version of JSON-RPC protocol is not supported."
1906
+ });
1907
+ }
1908
+ };
1909
+ Object.defineProperty(JsonRpcVersionUnsupportedError, "code", {
1910
+ enumerable: true,
1911
+ configurable: true,
1912
+ writable: true,
1913
+ value: -32006
1914
+ });
1915
+ var UserRejectedRequestError = class UserRejectedRequestError extends ProviderRpcError {
1916
+ constructor(cause) {
1917
+ super(cause, {
1918
+ code: UserRejectedRequestError.code,
1919
+ name: "UserRejectedRequestError",
1920
+ shortMessage: "User rejected the request."
1921
+ });
1922
+ }
1923
+ };
1924
+ Object.defineProperty(UserRejectedRequestError, "code", {
1925
+ enumerable: true,
1926
+ configurable: true,
1927
+ writable: true,
1928
+ value: 4001
1929
+ });
1930
+ var UnauthorizedProviderError = class UnauthorizedProviderError extends ProviderRpcError {
1931
+ constructor(cause) {
1932
+ super(cause, {
1933
+ code: UnauthorizedProviderError.code,
1934
+ name: "UnauthorizedProviderError",
1935
+ shortMessage: "The requested method and/or account has not been authorized by the user."
1936
+ });
1937
+ }
1938
+ };
1939
+ Object.defineProperty(UnauthorizedProviderError, "code", {
1940
+ enumerable: true,
1941
+ configurable: true,
1942
+ writable: true,
1943
+ value: 4100
1944
+ });
1945
+ var UnsupportedProviderMethodError = class UnsupportedProviderMethodError extends ProviderRpcError {
1946
+ constructor(cause, { method } = {}) {
1947
+ super(cause, {
1948
+ code: UnsupportedProviderMethodError.code,
1949
+ name: "UnsupportedProviderMethodError",
1950
+ shortMessage: `The Provider does not support the requested method${method ? ` " ${method}"` : ""}.`
1951
+ });
1952
+ }
1953
+ };
1954
+ Object.defineProperty(UnsupportedProviderMethodError, "code", {
1955
+ enumerable: true,
1956
+ configurable: true,
1957
+ writable: true,
1958
+ value: 4200
1959
+ });
1960
+ var ProviderDisconnectedError = class ProviderDisconnectedError extends ProviderRpcError {
1961
+ constructor(cause) {
1962
+ super(cause, {
1963
+ code: ProviderDisconnectedError.code,
1964
+ name: "ProviderDisconnectedError",
1965
+ shortMessage: "The Provider is disconnected from all chains."
1966
+ });
1967
+ }
1968
+ };
1969
+ Object.defineProperty(ProviderDisconnectedError, "code", {
1970
+ enumerable: true,
1971
+ configurable: true,
1972
+ writable: true,
1973
+ value: 4900
1974
+ });
1975
+ var ChainDisconnectedError = class ChainDisconnectedError extends ProviderRpcError {
1976
+ constructor(cause) {
1977
+ super(cause, {
1978
+ code: ChainDisconnectedError.code,
1979
+ name: "ChainDisconnectedError",
1980
+ shortMessage: "The Provider is not connected to the requested chain."
1981
+ });
1982
+ }
1983
+ };
1984
+ Object.defineProperty(ChainDisconnectedError, "code", {
1985
+ enumerable: true,
1986
+ configurable: true,
1987
+ writable: true,
1988
+ value: 4901
1989
+ });
1990
+ var SwitchChainError = class SwitchChainError extends ProviderRpcError {
1991
+ constructor(cause) {
1992
+ super(cause, {
1993
+ code: SwitchChainError.code,
1994
+ name: "SwitchChainError",
1995
+ shortMessage: "An error occurred when attempting to switch chain."
1996
+ });
1997
+ }
1998
+ };
1999
+ Object.defineProperty(SwitchChainError, "code", {
2000
+ enumerable: true,
2001
+ configurable: true,
2002
+ writable: true,
2003
+ value: 4902
2004
+ });
2005
+ var UnsupportedNonOptionalCapabilityError = class UnsupportedNonOptionalCapabilityError extends ProviderRpcError {
2006
+ constructor(cause) {
2007
+ super(cause, {
2008
+ code: UnsupportedNonOptionalCapabilityError.code,
2009
+ name: "UnsupportedNonOptionalCapabilityError",
2010
+ shortMessage: "This Wallet does not support a capability that was not marked as optional."
2011
+ });
2012
+ }
2013
+ };
2014
+ Object.defineProperty(UnsupportedNonOptionalCapabilityError, "code", {
2015
+ enumerable: true,
2016
+ configurable: true,
2017
+ writable: true,
2018
+ value: 5700
2019
+ });
2020
+ var UnsupportedChainIdError = class UnsupportedChainIdError extends ProviderRpcError {
2021
+ constructor(cause) {
2022
+ super(cause, {
2023
+ code: UnsupportedChainIdError.code,
2024
+ name: "UnsupportedChainIdError",
2025
+ shortMessage: "This Wallet does not support the requested chain ID."
2026
+ });
2027
+ }
2028
+ };
2029
+ Object.defineProperty(UnsupportedChainIdError, "code", {
2030
+ enumerable: true,
2031
+ configurable: true,
2032
+ writable: true,
2033
+ value: 5710
2034
+ });
2035
+ var DuplicateIdError = class DuplicateIdError extends ProviderRpcError {
2036
+ constructor(cause) {
2037
+ super(cause, {
2038
+ code: DuplicateIdError.code,
2039
+ name: "DuplicateIdError",
2040
+ shortMessage: "There is already a bundle submitted with this ID."
2041
+ });
2042
+ }
2043
+ };
2044
+ Object.defineProperty(DuplicateIdError, "code", {
2045
+ enumerable: true,
2046
+ configurable: true,
2047
+ writable: true,
2048
+ value: 5720
2049
+ });
2050
+ var UnknownBundleIdError = class UnknownBundleIdError extends ProviderRpcError {
2051
+ constructor(cause) {
2052
+ super(cause, {
2053
+ code: UnknownBundleIdError.code,
2054
+ name: "UnknownBundleIdError",
2055
+ shortMessage: "This bundle id is unknown / has not been submitted"
2056
+ });
2057
+ }
2058
+ };
2059
+ Object.defineProperty(UnknownBundleIdError, "code", {
2060
+ enumerable: true,
2061
+ configurable: true,
2062
+ writable: true,
2063
+ value: 5730
2064
+ });
2065
+ var BundleTooLargeError = class BundleTooLargeError extends ProviderRpcError {
2066
+ constructor(cause) {
2067
+ super(cause, {
2068
+ code: BundleTooLargeError.code,
2069
+ name: "BundleTooLargeError",
2070
+ shortMessage: "The call bundle is too large for the Wallet to process."
2071
+ });
2072
+ }
2073
+ };
2074
+ Object.defineProperty(BundleTooLargeError, "code", {
2075
+ enumerable: true,
2076
+ configurable: true,
2077
+ writable: true,
2078
+ value: 5740
2079
+ });
2080
+ var AtomicReadyWalletRejectedUpgradeError = class AtomicReadyWalletRejectedUpgradeError extends ProviderRpcError {
2081
+ constructor(cause) {
2082
+ super(cause, {
2083
+ code: AtomicReadyWalletRejectedUpgradeError.code,
2084
+ name: "AtomicReadyWalletRejectedUpgradeError",
2085
+ shortMessage: "The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."
2086
+ });
2087
+ }
2088
+ };
2089
+ Object.defineProperty(AtomicReadyWalletRejectedUpgradeError, "code", {
2090
+ enumerable: true,
2091
+ configurable: true,
2092
+ writable: true,
2093
+ value: 5750
2094
+ });
2095
+ var AtomicityNotSupportedError = class AtomicityNotSupportedError extends ProviderRpcError {
2096
+ constructor(cause) {
2097
+ super(cause, {
2098
+ code: AtomicityNotSupportedError.code,
2099
+ name: "AtomicityNotSupportedError",
2100
+ shortMessage: "The wallet does not support atomic execution but the request requires it."
2101
+ });
2102
+ }
2103
+ };
2104
+ Object.defineProperty(AtomicityNotSupportedError, "code", {
2105
+ enumerable: true,
2106
+ configurable: true,
2107
+ writable: true,
2108
+ value: 5760
2109
+ });
2110
+ var WalletConnectSessionSettlementError = class WalletConnectSessionSettlementError extends ProviderRpcError {
2111
+ constructor(cause) {
2112
+ super(cause, {
2113
+ code: WalletConnectSessionSettlementError.code,
2114
+ name: "WalletConnectSessionSettlementError",
2115
+ shortMessage: "WalletConnect session settlement failed."
2116
+ });
2117
+ }
2118
+ };
2119
+ Object.defineProperty(WalletConnectSessionSettlementError, "code", {
2120
+ enumerable: true,
2121
+ configurable: true,
2122
+ writable: true,
2123
+ value: 7e3
2124
+ });
2125
+ var UnknownRpcError = class extends RpcError {
2126
+ constructor(cause) {
2127
+ super(cause, {
2128
+ name: "UnknownRpcError",
2129
+ shortMessage: "An unknown RPC error occurred."
2130
+ });
2131
+ }
2132
+ };
2133
+ //#endregion
2134
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/errors/getNodeError.js
2135
+ function getNodeError(err, args) {
2136
+ const message = (err.details || "").toLowerCase();
2137
+ const executionRevertedError = err instanceof BaseError$2 ? err.walk((e) => e?.code === ExecutionRevertedError.code) : err;
2138
+ if (executionRevertedError instanceof BaseError$2) return new ExecutionRevertedError({
2139
+ cause: err,
2140
+ message: executionRevertedError.details
2141
+ });
2142
+ if (ExecutionRevertedError.nodeMessage.test(message)) return new ExecutionRevertedError({
2143
+ cause: err,
2144
+ message: err.details
2145
+ });
2146
+ if (FeeCapTooHighError.nodeMessage.test(message)) return new FeeCapTooHighError({
2147
+ cause: err,
2148
+ maxFeePerGas: args?.maxFeePerGas
2149
+ });
2150
+ if (FeeCapTooLowError.nodeMessage.test(message)) return new FeeCapTooLowError({
2151
+ cause: err,
2152
+ maxFeePerGas: args?.maxFeePerGas
2153
+ });
2154
+ if (NonceTooHighError.nodeMessage.test(message)) return new NonceTooHighError({
2155
+ cause: err,
2156
+ nonce: args?.nonce
2157
+ });
2158
+ if (NonceTooLowError.nodeMessage.test(message)) return new NonceTooLowError({
2159
+ cause: err,
2160
+ nonce: args?.nonce
2161
+ });
2162
+ if (NonceMaxValueError.nodeMessage.test(message)) return new NonceMaxValueError({
2163
+ cause: err,
2164
+ nonce: args?.nonce
2165
+ });
2166
+ if (InsufficientFundsError.nodeMessage.test(message)) return new InsufficientFundsError({ cause: err });
2167
+ if (IntrinsicGasTooHighError.nodeMessage.test(message)) return new IntrinsicGasTooHighError({
2168
+ cause: err,
2169
+ gas: args?.gas
2170
+ });
2171
+ if (IntrinsicGasTooLowError.nodeMessage.test(message)) return new IntrinsicGasTooLowError({
2172
+ cause: err,
2173
+ gas: args?.gas
2174
+ });
2175
+ if (TransactionTypeNotSupportedError.nodeMessage.test(message)) return new TransactionTypeNotSupportedError({ cause: err });
2176
+ if (TipAboveFeeCapError.nodeMessage.test(message)) return new TipAboveFeeCapError({
2177
+ cause: err,
2178
+ maxFeePerGas: args?.maxFeePerGas,
2179
+ maxPriorityFeePerGas: args?.maxPriorityFeePerGas
2180
+ });
2181
+ return new UnknownNodeError({ cause: err });
2182
+ }
2183
+ //#endregion
2184
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/formatters/extract.js
2185
+ /**
2186
+ * @description Picks out the keys from `value` that exist in the formatter..
2187
+ */
2188
+ function extract(value_, { format }) {
2189
+ if (!format) return {};
2190
+ const value = {};
2191
+ function extract_(formatted) {
2192
+ const keys = Object.keys(formatted);
2193
+ for (const key of keys) {
2194
+ if (key in value_) value[key] = value_[key];
2195
+ if (formatted[key] && typeof formatted[key] === "object" && !Array.isArray(formatted[key])) extract_(formatted[key]);
2196
+ }
2197
+ }
2198
+ extract_(format(value_ || {}));
2199
+ return value;
2200
+ }
2201
+ //#endregion
2202
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/formatters/formatter.js
2203
+ function defineFormatter(type, format) {
2204
+ return ({ exclude, format: overrides }) => {
2205
+ return {
2206
+ exclude,
2207
+ format: (args, action) => {
2208
+ const formatted = format(args, action);
2209
+ if (exclude) for (const key of exclude) delete formatted[key];
2210
+ return {
2211
+ ...formatted,
2212
+ ...overrides(args, action)
2213
+ };
2214
+ },
2215
+ type
2216
+ };
2217
+ };
2218
+ }
2219
+ //#endregion
2220
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/formatters/transactionRequest.js
2221
+ const rpcTransactionType = {
2222
+ legacy: "0x0",
2223
+ eip2930: "0x1",
2224
+ eip1559: "0x2",
2225
+ eip4844: "0x3",
2226
+ eip7702: "0x4"
2227
+ };
2228
+ function formatTransactionRequest(request, _) {
2229
+ const rpcRequest = {};
2230
+ if (typeof request.authorizationList !== "undefined") rpcRequest.authorizationList = formatAuthorizationList(request.authorizationList);
2231
+ if (typeof request.accessList !== "undefined") rpcRequest.accessList = request.accessList;
2232
+ if (typeof request.blobVersionedHashes !== "undefined") rpcRequest.blobVersionedHashes = request.blobVersionedHashes;
2233
+ if (typeof request.blobs !== "undefined") if (typeof request.blobs[0] !== "string") rpcRequest.blobs = request.blobs.map((x) => bytesToHex(x));
2234
+ else rpcRequest.blobs = request.blobs;
2235
+ if (typeof request.data !== "undefined") rpcRequest.data = request.data;
2236
+ if (request.account) rpcRequest.from = request.account.address;
2237
+ if (typeof request.from !== "undefined") rpcRequest.from = request.from;
2238
+ if (typeof request.gas !== "undefined") rpcRequest.gas = numberToHex(request.gas);
2239
+ if (typeof request.gasPrice !== "undefined") rpcRequest.gasPrice = numberToHex(request.gasPrice);
2240
+ if (typeof request.maxFeePerBlobGas !== "undefined") rpcRequest.maxFeePerBlobGas = numberToHex(request.maxFeePerBlobGas);
2241
+ if (typeof request.maxFeePerGas !== "undefined") rpcRequest.maxFeePerGas = numberToHex(request.maxFeePerGas);
2242
+ if (typeof request.maxPriorityFeePerGas !== "undefined") rpcRequest.maxPriorityFeePerGas = numberToHex(request.maxPriorityFeePerGas);
2243
+ if (typeof request.nonce !== "undefined") rpcRequest.nonce = numberToHex(request.nonce);
2244
+ if (typeof request.to !== "undefined") rpcRequest.to = request.to;
2245
+ if (typeof request.type !== "undefined") rpcRequest.type = rpcTransactionType[request.type];
2246
+ if (typeof request.value !== "undefined") rpcRequest.value = numberToHex(request.value);
2247
+ return rpcRequest;
2248
+ }
2249
+ const defineTransactionRequest = /* @__PURE__ */ defineFormatter("transactionRequest", formatTransactionRequest);
2250
+ function formatAuthorizationList(authorizationList) {
2251
+ return authorizationList.map((authorization) => ({
2252
+ address: authorization.address,
2253
+ r: authorization.r ? numberToHex(BigInt(authorization.r)) : authorization.r,
2254
+ s: authorization.s ? numberToHex(BigInt(authorization.s)) : authorization.s,
2255
+ chainId: numberToHex(authorization.chainId),
2256
+ nonce: numberToHex(authorization.nonce),
2257
+ ...typeof authorization.yParity !== "undefined" ? { yParity: numberToHex(authorization.yParity) } : {},
2258
+ ...typeof authorization.v !== "undefined" && typeof authorization.yParity === "undefined" ? { v: numberToHex(authorization.v) } : {}
2259
+ }));
2260
+ }
2261
+ //#endregion
2262
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/stateOverride.js
2263
+ /** @internal */
2264
+ function serializeStateMapping(stateMapping) {
2265
+ if (!stateMapping || stateMapping.length === 0) return void 0;
2266
+ return stateMapping.reduce((acc, { slot, value }) => {
2267
+ if (slot.length !== 66) throw new InvalidBytesLengthError({
2268
+ size: slot.length,
2269
+ targetSize: 66,
2270
+ type: "hex"
2271
+ });
2272
+ if (value.length !== 66) throw new InvalidBytesLengthError({
2273
+ size: value.length,
2274
+ targetSize: 66,
2275
+ type: "hex"
2276
+ });
2277
+ acc[slot] = value;
2278
+ return acc;
2279
+ }, {});
2280
+ }
2281
+ /** @internal */
2282
+ function serializeAccountStateOverride(parameters) {
2283
+ const { balance, nonce, state, stateDiff, code } = parameters;
2284
+ const rpcAccountStateOverride = {};
2285
+ if (code !== void 0) rpcAccountStateOverride.code = code;
2286
+ if (balance !== void 0) rpcAccountStateOverride.balance = numberToHex(balance);
2287
+ if (nonce !== void 0) rpcAccountStateOverride.nonce = numberToHex(nonce);
2288
+ if (state !== void 0) rpcAccountStateOverride.state = serializeStateMapping(state);
2289
+ if (stateDiff !== void 0) {
2290
+ if (rpcAccountStateOverride.state) throw new StateAssignmentConflictError();
2291
+ rpcAccountStateOverride.stateDiff = serializeStateMapping(stateDiff);
2292
+ }
2293
+ return rpcAccountStateOverride;
2294
+ }
2295
+ /** @internal */
2296
+ function serializeStateOverride(parameters) {
2297
+ if (!parameters) return void 0;
2298
+ const rpcStateOverride = {};
2299
+ for (const { address, ...accountState } of parameters) {
2300
+ if (!isAddress(address, { strict: false })) throw new InvalidAddressError({ address });
2301
+ if (rpcStateOverride[address]) throw new AccountStateConflictError({ address });
2302
+ rpcStateOverride[address] = serializeAccountStateOverride(accountState);
2303
+ }
2304
+ return rpcStateOverride;
2305
+ }
2306
+ //#endregion
2307
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/transaction/assertRequest.js
2308
+ function assertRequest(args) {
2309
+ const { account: account_, maxFeePerGas, maxPriorityFeePerGas, to } = args;
2310
+ const account = account_ ? parseAccount(account_) : void 0;
2311
+ if (account && !isAddress(account.address)) throw new InvalidAddressError({ address: account.address });
2312
+ if (to && !isAddress(to)) throw new InvalidAddressError({ address: to });
2313
+ if (maxFeePerGas && maxFeePerGas > maxUint256) throw new FeeCapTooHighError({ maxFeePerGas });
2314
+ if (maxPriorityFeePerGas && maxFeePerGas && maxPriorityFeePerGas > maxFeePerGas) throw new TipAboveFeeCapError({
2315
+ maxFeePerGas,
2316
+ maxPriorityFeePerGas
2317
+ });
2318
+ }
2319
+ //#endregion
2320
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/abi/decodeFunctionResult.js
2321
+ const docsPath$1 = "/docs/contract/decodeFunctionResult";
2322
+ function decodeFunctionResult(parameters) {
2323
+ const { abi, args, functionName, data } = parameters;
2324
+ let abiItem = abi[0];
2325
+ if (functionName) {
2326
+ const item = getAbiItem({
2327
+ abi,
2328
+ args,
2329
+ name: functionName
2330
+ });
2331
+ if (!item) throw new AbiFunctionNotFoundError(functionName, { docsPath: docsPath$1 });
2332
+ abiItem = item;
2333
+ }
2334
+ if (abiItem.type !== "function") throw new AbiFunctionNotFoundError(void 0, { docsPath: docsPath$1 });
2335
+ if (!abiItem.outputs) throw new AbiFunctionOutputsNotFoundError(abiItem.name, { docsPath: docsPath$1 });
2336
+ const values = decodeAbiParameters(abiItem.outputs, data);
2337
+ if (values && values.length > 1) return values;
2338
+ if (values && values.length === 1) return values[0];
2339
+ }
2340
+ //#endregion
2341
+ //#region node_modules/.pnpm/ox@0.14.7_typescript@5.9.3_zod@4.3.6/node_modules/ox/_esm/core/version.js
2342
+ /** @internal */
2343
+ const version = "0.1.1";
2344
+ //#endregion
2345
+ //#region node_modules/.pnpm/ox@0.14.7_typescript@5.9.3_zod@4.3.6/node_modules/ox/_esm/core/internal/errors.js
2346
+ /** @internal */
2347
+ function getVersion() {
2348
+ return version;
2349
+ }
2350
+ //#endregion
2351
+ //#region node_modules/.pnpm/ox@0.14.7_typescript@5.9.3_zod@4.3.6/node_modules/ox/_esm/core/Errors.js
2352
+ /**
2353
+ * Base error class inherited by all errors thrown by ox.
2354
+ *
2355
+ * @example
2356
+ * ```ts
2357
+ * import { Errors } from 'ox'
2358
+ * throw new Errors.BaseError('An error occurred')
2359
+ * ```
2360
+ */
2361
+ var BaseError = class BaseError extends Error {
2362
+ static setStaticOptions(options) {
2363
+ BaseError.prototype.docsOrigin = options.docsOrigin;
2364
+ BaseError.prototype.showVersion = options.showVersion;
2365
+ BaseError.prototype.version = options.version;
2366
+ }
2367
+ constructor(shortMessage, options = {}) {
2368
+ const details = (() => {
2369
+ if (options.cause instanceof BaseError) {
2370
+ if (options.cause.details) return options.cause.details;
2371
+ if (options.cause.shortMessage) return options.cause.shortMessage;
2372
+ }
2373
+ if (options.cause && "details" in options.cause && typeof options.cause.details === "string") return options.cause.details;
2374
+ if (options.cause?.message) return options.cause.message;
2375
+ return options.details;
2376
+ })();
2377
+ const docsPath = (() => {
2378
+ if (options.cause instanceof BaseError) return options.cause.docsPath || options.docsPath;
2379
+ return options.docsPath;
2380
+ })();
2381
+ const docsBaseUrl = options.docsOrigin ?? BaseError.prototype.docsOrigin;
2382
+ const docs = `${docsBaseUrl}${docsPath ?? ""}`;
2383
+ const showVersion = Boolean(options.version ?? BaseError.prototype.showVersion);
2384
+ const version = options.version ?? BaseError.prototype.version;
2385
+ const message = [
2386
+ shortMessage || "An error occurred.",
2387
+ ...options.metaMessages ? ["", ...options.metaMessages] : [],
2388
+ ...details || docsPath || showVersion ? [
2389
+ "",
2390
+ details ? `Details: ${details}` : void 0,
2391
+ docsPath ? `See: ${docs}` : void 0,
2392
+ showVersion ? `Version: ${version}` : void 0
2393
+ ] : []
2394
+ ].filter((x) => typeof x === "string").join("\n");
2395
+ super(message, options.cause ? { cause: options.cause } : void 0);
2396
+ Object.defineProperty(this, "details", {
2397
+ enumerable: true,
2398
+ configurable: true,
2399
+ writable: true,
2400
+ value: void 0
2401
+ });
2402
+ Object.defineProperty(this, "docs", {
2403
+ enumerable: true,
2404
+ configurable: true,
2405
+ writable: true,
2406
+ value: void 0
2407
+ });
2408
+ Object.defineProperty(this, "docsOrigin", {
2409
+ enumerable: true,
2410
+ configurable: true,
2411
+ writable: true,
2412
+ value: void 0
2413
+ });
2414
+ Object.defineProperty(this, "docsPath", {
2415
+ enumerable: true,
2416
+ configurable: true,
2417
+ writable: true,
2418
+ value: void 0
2419
+ });
2420
+ Object.defineProperty(this, "shortMessage", {
2421
+ enumerable: true,
2422
+ configurable: true,
2423
+ writable: true,
2424
+ value: void 0
2425
+ });
2426
+ Object.defineProperty(this, "showVersion", {
2427
+ enumerable: true,
2428
+ configurable: true,
2429
+ writable: true,
2430
+ value: void 0
2431
+ });
2432
+ Object.defineProperty(this, "version", {
2433
+ enumerable: true,
2434
+ configurable: true,
2435
+ writable: true,
2436
+ value: void 0
2437
+ });
2438
+ Object.defineProperty(this, "cause", {
2439
+ enumerable: true,
2440
+ configurable: true,
2441
+ writable: true,
2442
+ value: void 0
2443
+ });
2444
+ Object.defineProperty(this, "name", {
2445
+ enumerable: true,
2446
+ configurable: true,
2447
+ writable: true,
2448
+ value: "BaseError"
2449
+ });
2450
+ this.cause = options.cause;
2451
+ this.details = details;
2452
+ this.docs = docs;
2453
+ this.docsOrigin = docsBaseUrl;
2454
+ this.docsPath = docsPath;
2455
+ this.shortMessage = shortMessage;
2456
+ this.showVersion = showVersion;
2457
+ this.version = version;
2458
+ }
2459
+ walk(fn) {
2460
+ return walk(this, fn);
2461
+ }
2462
+ };
2463
+ Object.defineProperty(BaseError, "defaultStaticOptions", {
2464
+ enumerable: true,
2465
+ configurable: true,
2466
+ writable: true,
2467
+ value: {
2468
+ docsOrigin: "https://oxlib.sh",
2469
+ showVersion: false,
2470
+ version: `ox@${getVersion()}`
2471
+ }
2472
+ });
2473
+ BaseError.setStaticOptions(BaseError.defaultStaticOptions);
2474
+ /** @internal */
2475
+ function walk(err, fn) {
2476
+ if (fn?.(err)) return err;
2477
+ if (err && typeof err === "object" && "cause" in err && err.cause) return walk(err.cause, fn);
2478
+ return fn ? null : err;
2479
+ }
2480
+ //#endregion
2481
+ //#region node_modules/.pnpm/ox@0.14.7_typescript@5.9.3_zod@4.3.6/node_modules/ox/_esm/core/internal/bytes.js
2482
+ /** @internal */
2483
+ function assertSize$1(bytes, size_) {
2484
+ if (size$1(bytes) > size_) throw new SizeOverflowError$1({
2485
+ givenSize: size$1(bytes),
2486
+ maxSize: size_
2487
+ });
2488
+ }
2489
+ /** @internal */
2490
+ function assertStartOffset$1(value, start) {
2491
+ if (typeof start === "number" && start > 0 && start > size$1(value) - 1) throw new SliceOffsetOutOfBoundsError$1({
2492
+ offset: start,
2493
+ position: "start",
2494
+ size: size$1(value)
2495
+ });
2496
+ }
2497
+ /** @internal */
2498
+ function assertEndOffset$1(value, start, end) {
2499
+ if (typeof start === "number" && typeof end === "number" && size$1(value) !== end - start) throw new SliceOffsetOutOfBoundsError$1({
2500
+ offset: end,
2501
+ position: "end",
2502
+ size: size$1(value)
2503
+ });
2504
+ }
2505
+ /** @internal */
2506
+ const charCodeMap = {
2507
+ zero: 48,
2508
+ nine: 57,
2509
+ A: 65,
2510
+ F: 70,
2511
+ a: 97,
2512
+ f: 102
2513
+ };
2514
+ /** @internal */
2515
+ function charCodeToBase16(char) {
2516
+ if (char >= charCodeMap.zero && char <= charCodeMap.nine) return char - charCodeMap.zero;
2517
+ if (char >= charCodeMap.A && char <= charCodeMap.F) return char - (charCodeMap.A - 10);
2518
+ if (char >= charCodeMap.a && char <= charCodeMap.f) return char - (charCodeMap.a - 10);
2519
+ }
2520
+ /** @internal */
2521
+ function pad$1(bytes, options = {}) {
2522
+ const { dir, size = 32 } = options;
2523
+ if (size === 0) return bytes;
2524
+ if (bytes.length > size) throw new SizeExceedsPaddingSizeError$1({
2525
+ size: bytes.length,
2526
+ targetSize: size,
2527
+ type: "Bytes"
2528
+ });
2529
+ const paddedBytes = new Uint8Array(size);
2530
+ for (let i = 0; i < size; i++) {
2531
+ const padEnd = dir === "right";
2532
+ paddedBytes[padEnd ? i : size - i - 1] = bytes[padEnd ? i : bytes.length - i - 1];
2533
+ }
2534
+ return paddedBytes;
2535
+ }
2536
+ /** @internal */
2537
+ function trim$1(value, options = {}) {
2538
+ const { dir = "left" } = options;
2539
+ let data = value;
2540
+ let sliceLength = 0;
2541
+ for (let i = 0; i < data.length - 1; i++) if (data[dir === "left" ? i : data.length - i - 1].toString() === "0") sliceLength++;
2542
+ else break;
2543
+ data = dir === "left" ? data.slice(sliceLength) : data.slice(0, data.length - sliceLength);
2544
+ return data;
2545
+ }
2546
+ //#endregion
2547
+ //#region node_modules/.pnpm/ox@0.14.7_typescript@5.9.3_zod@4.3.6/node_modules/ox/_esm/core/internal/hex.js
2548
+ /** @internal */
2549
+ function assertSize(hex, size_) {
2550
+ if (size(hex) > size_) throw new SizeOverflowError({
2551
+ givenSize: size(hex),
2552
+ maxSize: size_
2553
+ });
2554
+ }
2555
+ /** @internal */
2556
+ function assertStartOffset(value, start) {
2557
+ if (typeof start === "number" && start > 0 && start > size(value) - 1) throw new SliceOffsetOutOfBoundsError({
2558
+ offset: start,
2559
+ position: "start",
2560
+ size: size(value)
2561
+ });
2562
+ }
2563
+ /** @internal */
2564
+ function assertEndOffset(value, start, end) {
2565
+ if (typeof start === "number" && typeof end === "number" && size(value) !== end - start) throw new SliceOffsetOutOfBoundsError({
2566
+ offset: end,
2567
+ position: "end",
2568
+ size: size(value)
2569
+ });
2570
+ }
2571
+ /** @internal */
2572
+ function pad(hex_, options = {}) {
2573
+ const { dir, size = 32 } = options;
2574
+ if (size === 0) return hex_;
2575
+ const hex = hex_.replace("0x", "");
2576
+ if (hex.length > size * 2) throw new SizeExceedsPaddingSizeError({
2577
+ size: Math.ceil(hex.length / 2),
2578
+ targetSize: size,
2579
+ type: "Hex"
2580
+ });
2581
+ return `0x${hex[dir === "right" ? "padEnd" : "padStart"](size * 2, "0")}`;
2582
+ }
2583
+ /** @internal */
2584
+ function trim(value, options = {}) {
2585
+ const { dir = "left" } = options;
2586
+ let data = value.replace("0x", "");
2587
+ let sliceLength = 0;
2588
+ for (let i = 0; i < data.length - 1; i++) if (data[dir === "left" ? i : data.length - i - 1].toString() === "0") sliceLength++;
2589
+ else break;
2590
+ data = dir === "left" ? data.slice(sliceLength) : data.slice(0, data.length - sliceLength);
2591
+ if (data === "0") return "0x";
2592
+ if (dir === "right" && data.length % 2 === 1) return `0x${data}0`;
2593
+ return `0x${data}`;
2594
+ }
2595
+ //#endregion
2596
+ //#region node_modules/.pnpm/ox@0.14.7_typescript@5.9.3_zod@4.3.6/node_modules/ox/_esm/core/Json.js
2597
+ const bigIntSuffix = "#__bigint";
2598
+ /**
2599
+ * Stringifies a value to its JSON representation, with support for `bigint`.
2600
+ *
2601
+ * @example
2602
+ * ```ts twoslash
2603
+ * import { Json } from 'ox'
2604
+ *
2605
+ * const json = Json.stringify({
2606
+ * foo: 'bar',
2607
+ * baz: 69420694206942069420694206942069420694206942069420n,
2608
+ * })
2609
+ * // @log: '{"foo":"bar","baz":"69420694206942069420694206942069420694206942069420#__bigint"}'
2610
+ * ```
2611
+ *
2612
+ * @param value - The value to stringify.
2613
+ * @param replacer - A function that transforms the results. It is passed the key and value of the property, and must return the value to be used in the JSON string. If this function returns `undefined`, the property is not included in the resulting JSON string.
2614
+ * @param space - A string or number that determines the indentation of the JSON string. If it is a number, it indicates the number of spaces to use as indentation; if it is a string (e.g. `'\t'`), it uses the string as the indentation character.
2615
+ * @returns The JSON string.
2616
+ */
2617
+ function stringify(value, replacer, space) {
2618
+ return JSON.stringify(value, (key, value) => {
2619
+ if (typeof replacer === "function") return replacer(key, value);
2620
+ if (typeof value === "bigint") return value.toString() + bigIntSuffix;
2621
+ return value;
2622
+ }, space);
2623
+ }
2624
+ //#endregion
2625
+ //#region node_modules/.pnpm/ox@0.14.7_typescript@5.9.3_zod@4.3.6/node_modules/ox/_esm/core/Bytes.js
2626
+ const decoder = /* @__PURE__ */ new TextDecoder();
2627
+ const encoder$1 = /* @__PURE__ */ new TextEncoder();
2628
+ /**
2629
+ * Asserts if the given value is {@link ox#Bytes.Bytes}.
2630
+ *
2631
+ * @example
2632
+ * ```ts twoslash
2633
+ * import { Bytes } from 'ox'
2634
+ *
2635
+ * Bytes.assert('abc')
2636
+ * // @error: Bytes.InvalidBytesTypeError:
2637
+ * // @error: Value `"abc"` of type `string` is an invalid Bytes value.
2638
+ * // @error: Bytes values must be of type `Uint8Array`.
2639
+ * ```
2640
+ *
2641
+ * @param value - Value to assert.
2642
+ */
2643
+ function assert$1(value) {
2644
+ if (value instanceof Uint8Array) return;
2645
+ if (!value) throw new InvalidBytesTypeError(value);
2646
+ if (typeof value !== "object") throw new InvalidBytesTypeError(value);
2647
+ if (!("BYTES_PER_ELEMENT" in value)) throw new InvalidBytesTypeError(value);
2648
+ if (value.BYTES_PER_ELEMENT !== 1 || value.constructor.name !== "Uint8Array") throw new InvalidBytesTypeError(value);
2649
+ }
2650
+ /**
2651
+ * Concatenates two or more {@link ox#Bytes.Bytes}.
2652
+ *
2653
+ * @example
2654
+ * ```ts twoslash
2655
+ * import { Bytes } from 'ox'
2656
+ *
2657
+ * const bytes = Bytes.concat(
2658
+ * Bytes.from([1]),
2659
+ * Bytes.from([69]),
2660
+ * Bytes.from([420, 69]),
2661
+ * )
2662
+ * // @log: Uint8Array [ 1, 69, 420, 69 ]
2663
+ * ```
2664
+ *
2665
+ * @param values - Values to concatenate.
2666
+ * @returns Concatenated {@link ox#Bytes.Bytes}.
2667
+ */
2668
+ function concat$1(...values) {
2669
+ let length = 0;
2670
+ for (const arr of values) length += arr.length;
2671
+ const result = new Uint8Array(length);
2672
+ for (let i = 0, index = 0; i < values.length; i++) {
2673
+ const arr = values[i];
2674
+ result.set(arr, index);
2675
+ index += arr.length;
2676
+ }
2677
+ return result;
2678
+ }
2679
+ /**
2680
+ * Instantiates a {@link ox#Bytes.Bytes} value from a `Uint8Array`, a hex string, or an array of unsigned 8-bit integers.
2681
+ *
2682
+ * :::tip
2683
+ *
2684
+ * To instantiate from a **Boolean**, **String**, or **Number**, use one of the following:
2685
+ *
2686
+ * - `Bytes.fromBoolean`
2687
+ *
2688
+ * - `Bytes.fromString`
2689
+ *
2690
+ * - `Bytes.fromNumber`
2691
+ *
2692
+ * :::
2693
+ *
2694
+ * @example
2695
+ * ```ts twoslash
2696
+ * // @noErrors
2697
+ * import { Bytes } from 'ox'
2698
+ *
2699
+ * const data = Bytes.from([255, 124, 5, 4])
2700
+ * // @log: Uint8Array([255, 124, 5, 4])
2701
+ *
2702
+ * const data = Bytes.from('0xdeadbeef')
2703
+ * // @log: Uint8Array([222, 173, 190, 239])
2704
+ * ```
2705
+ *
2706
+ * @param value - Value to convert.
2707
+ * @returns A {@link ox#Bytes.Bytes} instance.
2708
+ */
2709
+ function from$1(value) {
2710
+ if (value instanceof Uint8Array) return value;
2711
+ if (typeof value === "string") return fromHex(value);
2712
+ return fromArray(value);
2713
+ }
2714
+ /**
2715
+ * Converts an array of unsigned 8-bit integers into {@link ox#Bytes.Bytes}.
2716
+ *
2717
+ * @example
2718
+ * ```ts twoslash
2719
+ * import { Bytes } from 'ox'
2720
+ *
2721
+ * const data = Bytes.fromArray([255, 124, 5, 4])
2722
+ * // @log: Uint8Array([255, 124, 5, 4])
2723
+ * ```
2724
+ *
2725
+ * @param value - Value to convert.
2726
+ * @returns A {@link ox#Bytes.Bytes} instance.
2727
+ */
2728
+ function fromArray(value) {
2729
+ return value instanceof Uint8Array ? value : new Uint8Array(value);
2730
+ }
2731
+ /**
2732
+ * Encodes a {@link ox#Hex.Hex} value into {@link ox#Bytes.Bytes}.
2733
+ *
2734
+ * @example
2735
+ * ```ts twoslash
2736
+ * import { Bytes } from 'ox'
2737
+ *
2738
+ * const data = Bytes.fromHex('0x48656c6c6f20776f726c6421')
2739
+ * // @log: Uint8Array([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33])
2740
+ * ```
2741
+ *
2742
+ * @example
2743
+ * ```ts twoslash
2744
+ * import { Bytes } from 'ox'
2745
+ *
2746
+ * const data = Bytes.fromHex('0x48656c6c6f20776f726c6421', { size: 32 })
2747
+ * // @log: 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])
2748
+ * ```
2749
+ *
2750
+ * @param value - {@link ox#Hex.Hex} value to encode.
2751
+ * @param options - Encoding options.
2752
+ * @returns Encoded {@link ox#Bytes.Bytes}.
2753
+ */
2754
+ function fromHex(value, options = {}) {
2755
+ const { size } = options;
2756
+ let hex = value;
2757
+ if (size) {
2758
+ assertSize(value, size);
2759
+ hex = padRight(value, size);
2760
+ }
2761
+ let hexString = hex.slice(2);
2762
+ if (hexString.length % 2) hexString = `0${hexString}`;
2763
+ const length = hexString.length / 2;
2764
+ const bytes = new Uint8Array(length);
2765
+ for (let index = 0, j = 0; index < length; index++) {
2766
+ const nibbleLeft = charCodeToBase16(hexString.charCodeAt(j++));
2767
+ const nibbleRight = charCodeToBase16(hexString.charCodeAt(j++));
2768
+ if (nibbleLeft === void 0 || nibbleRight === void 0) throw new BaseError(`Invalid byte sequence ("${hexString[j - 2]}${hexString[j - 1]}" in "${hexString}").`);
2769
+ bytes[index] = nibbleLeft << 4 | nibbleRight;
2770
+ }
2771
+ return bytes;
2772
+ }
2773
+ /**
2774
+ * Encodes a string into {@link ox#Bytes.Bytes}.
2775
+ *
2776
+ * @example
2777
+ * ```ts twoslash
2778
+ * import { Bytes } from 'ox'
2779
+ *
2780
+ * const data = Bytes.fromString('Hello world!')
2781
+ * // @log: Uint8Array([72, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 33])
2782
+ * ```
2783
+ *
2784
+ * @example
2785
+ * ```ts twoslash
2786
+ * import { Bytes } from 'ox'
2787
+ *
2788
+ * const data = Bytes.fromString('Hello world!', { size: 32 })
2789
+ * // @log: 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])
2790
+ * ```
2791
+ *
2792
+ * @param value - String to encode.
2793
+ * @param options - Encoding options.
2794
+ * @returns Encoded {@link ox#Bytes.Bytes}.
2795
+ */
2796
+ function fromString$1(value, options = {}) {
2797
+ const { size } = options;
2798
+ const bytes = encoder$1.encode(value);
2799
+ if (typeof size === "number") {
2800
+ assertSize$1(bytes, size);
2801
+ return padRight$1(bytes, size);
2802
+ }
2803
+ return bytes;
2804
+ }
2805
+ /**
2806
+ * Checks if two {@link ox#Bytes.Bytes} values are equal.
2807
+ *
2808
+ * @example
2809
+ * ```ts twoslash
2810
+ * import { Bytes } from 'ox'
2811
+ *
2812
+ * Bytes.isEqual(Bytes.from([1]), Bytes.from([1]))
2813
+ * // @log: true
2814
+ *
2815
+ * Bytes.isEqual(Bytes.from([1]), Bytes.from([2]))
2816
+ * // @log: false
2817
+ * ```
2818
+ *
2819
+ * @param bytesA - First {@link ox#Bytes.Bytes} value.
2820
+ * @param bytesB - Second {@link ox#Bytes.Bytes} value.
2821
+ * @returns `true` if the two values are equal, otherwise `false`.
2822
+ */
2823
+ function isEqual(bytesA, bytesB) {
2824
+ return equalBytes(bytesA, bytesB);
2825
+ }
2826
+ /**
2827
+ * Pads a {@link ox#Bytes.Bytes} value to the right with zero bytes until it reaches the given `size` (default: 32 bytes).
2828
+ *
2829
+ * @example
2830
+ * ```ts twoslash
2831
+ * import { Bytes } from 'ox'
2832
+ *
2833
+ * Bytes.padRight(Bytes.from([1]), 4)
2834
+ * // @log: Uint8Array([1, 0, 0, 0])
2835
+ * ```
2836
+ *
2837
+ * @param value - {@link ox#Bytes.Bytes} value to pad.
2838
+ * @param size - Size to pad the {@link ox#Bytes.Bytes} value to.
2839
+ * @returns Padded {@link ox#Bytes.Bytes} value.
2840
+ */
2841
+ function padRight$1(value, size) {
2842
+ return pad$1(value, {
2843
+ dir: "right",
2844
+ size
2845
+ });
2846
+ }
2847
+ /**
2848
+ * Generates random {@link ox#Bytes.Bytes} of the specified length.
2849
+ *
2850
+ * @example
2851
+ * ```ts twoslash
2852
+ * import { Bytes } from 'ox'
2853
+ *
2854
+ * const bytes = Bytes.random(32)
2855
+ * // @log: Uint8Array([... x32])
2856
+ * ```
2857
+ *
2858
+ * @param length - Length of the random {@link ox#Bytes.Bytes} to generate.
2859
+ * @returns Random {@link ox#Bytes.Bytes} of the specified length.
2860
+ */
2861
+ function random$1(length) {
2862
+ return crypto.getRandomValues(new Uint8Array(length));
2863
+ }
2864
+ /**
2865
+ * Retrieves the size of a {@link ox#Bytes.Bytes} value.
2866
+ *
2867
+ * @example
2868
+ * ```ts twoslash
2869
+ * import { Bytes } from 'ox'
2870
+ *
2871
+ * Bytes.size(Bytes.from([1, 2, 3, 4]))
2872
+ * // @log: 4
2873
+ * ```
2874
+ *
2875
+ * @param value - {@link ox#Bytes.Bytes} value.
2876
+ * @returns Size of the {@link ox#Bytes.Bytes} value.
2877
+ */
2878
+ function size$1(value) {
2879
+ return value.length;
2880
+ }
2881
+ /**
2882
+ * Returns a section of a {@link ox#Bytes.Bytes} value given a start/end bytes offset.
2883
+ *
2884
+ * @example
2885
+ * ```ts twoslash
2886
+ * import { Bytes } from 'ox'
2887
+ *
2888
+ * Bytes.slice(
2889
+ * Bytes.from([1, 2, 3, 4, 5, 6, 7, 8, 9]),
2890
+ * 1,
2891
+ * 4,
2892
+ * )
2893
+ * // @log: Uint8Array([2, 3, 4])
2894
+ * ```
2895
+ *
2896
+ * @param value - The {@link ox#Bytes.Bytes} value.
2897
+ * @param start - Start offset.
2898
+ * @param end - End offset.
2899
+ * @param options - Slice options.
2900
+ * @returns Sliced {@link ox#Bytes.Bytes} value.
2901
+ */
2902
+ function slice$1(value, start, end, options = {}) {
2903
+ const { strict } = options;
2904
+ assertStartOffset$1(value, start);
2905
+ const value_ = value.slice(start, end);
2906
+ if (strict) assertEndOffset$1(value_, start, end);
2907
+ return value_;
2908
+ }
2909
+ /**
2910
+ * Decodes a {@link ox#Bytes.Bytes} into a bigint.
2911
+ *
2912
+ * @example
2913
+ * ```ts
2914
+ * import { Bytes } from 'ox'
2915
+ *
2916
+ * Bytes.toBigInt(Bytes.from([1, 164]))
2917
+ * // @log: 420n
2918
+ * ```
2919
+ *
2920
+ * @param bytes - The {@link ox#Bytes.Bytes} to decode.
2921
+ * @param options - Decoding options.
2922
+ * @returns Decoded bigint.
2923
+ */
2924
+ function toBigInt$1(bytes, options = {}) {
2925
+ const { size } = options;
2926
+ if (typeof size !== "undefined") assertSize$1(bytes, size);
2927
+ return toBigInt(fromBytes(bytes, options), options);
2928
+ }
2929
+ /**
2930
+ * Decodes a {@link ox#Bytes.Bytes} into a boolean.
2931
+ *
2932
+ * @example
2933
+ * ```ts
2934
+ * import { Bytes } from 'ox'
2935
+ *
2936
+ * Bytes.toBoolean(Bytes.from([1]))
2937
+ * // @log: true
2938
+ * ```
2939
+ *
2940
+ * @param bytes - The {@link ox#Bytes.Bytes} to decode.
2941
+ * @param options - Decoding options.
2942
+ * @returns Decoded boolean.
2943
+ */
2944
+ function toBoolean(bytes, options = {}) {
2945
+ const { size } = options;
2946
+ let bytes_ = bytes;
2947
+ if (typeof size !== "undefined") {
2948
+ assertSize$1(bytes_, size);
2949
+ bytes_ = trimLeft$1(bytes_);
2950
+ }
2951
+ if (bytes_.length > 1 || bytes_[0] > 1) throw new InvalidBytesBooleanError(bytes_);
2952
+ return Boolean(bytes_[0]);
2953
+ }
2954
+ /**
2955
+ * Decodes a {@link ox#Bytes.Bytes} into a number.
2956
+ *
2957
+ * @example
2958
+ * ```ts twoslash
2959
+ * import { Bytes } from 'ox'
2960
+ *
2961
+ * Bytes.toNumber(Bytes.from([1, 164]))
2962
+ * // @log: 420
2963
+ * ```
2964
+ */
2965
+ function toNumber$1(bytes, options = {}) {
2966
+ const { size } = options;
2967
+ if (typeof size !== "undefined") assertSize$1(bytes, size);
2968
+ return toNumber(fromBytes(bytes, options), options);
2969
+ }
2970
+ /**
2971
+ * Decodes a {@link ox#Bytes.Bytes} into a string.
2972
+ *
2973
+ * @example
2974
+ * ```ts twoslash
2975
+ * import { Bytes } from 'ox'
2976
+ *
2977
+ * const data = Bytes.toString(Bytes.from([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33]))
2978
+ * // @log: 'Hello world'
2979
+ * ```
2980
+ *
2981
+ * @param bytes - The {@link ox#Bytes.Bytes} to decode.
2982
+ * @param options - Options.
2983
+ * @returns Decoded string.
2984
+ */
2985
+ function toString$1(bytes, options = {}) {
2986
+ const { size } = options;
2987
+ let bytes_ = bytes;
2988
+ if (typeof size !== "undefined") {
2989
+ assertSize$1(bytes_, size);
2990
+ bytes_ = trimRight(bytes_);
2991
+ }
2992
+ return decoder.decode(bytes_);
2993
+ }
2994
+ /**
2995
+ * Trims leading zeros from a {@link ox#Bytes.Bytes} value.
2996
+ *
2997
+ * @example
2998
+ * ```ts twoslash
2999
+ * import { Bytes } from 'ox'
3000
+ *
3001
+ * Bytes.trimLeft(Bytes.from([0, 0, 0, 0, 1, 2, 3]))
3002
+ * // @log: Uint8Array([1, 2, 3])
3003
+ * ```
3004
+ *
3005
+ * @param value - {@link ox#Bytes.Bytes} value.
3006
+ * @returns Trimmed {@link ox#Bytes.Bytes} value.
3007
+ */
3008
+ function trimLeft$1(value) {
3009
+ return trim$1(value, { dir: "left" });
3010
+ }
3011
+ /**
3012
+ * Trims trailing zeros from a {@link ox#Bytes.Bytes} value.
3013
+ *
3014
+ * @example
3015
+ * ```ts twoslash
3016
+ * import { Bytes } from 'ox'
3017
+ *
3018
+ * Bytes.trimRight(Bytes.from([1, 2, 3, 0, 0, 0, 0]))
3019
+ * // @log: Uint8Array([1, 2, 3])
3020
+ * ```
3021
+ *
3022
+ * @param value - {@link ox#Bytes.Bytes} value.
3023
+ * @returns Trimmed {@link ox#Bytes.Bytes} value.
3024
+ */
3025
+ function trimRight(value) {
3026
+ return trim$1(value, { dir: "right" });
3027
+ }
3028
+ /**
3029
+ * Checks if the given value is {@link ox#Bytes.Bytes}.
3030
+ *
3031
+ * @example
3032
+ * ```ts twoslash
3033
+ * import { Bytes } from 'ox'
3034
+ *
3035
+ * Bytes.validate('0x')
3036
+ * // @log: false
3037
+ *
3038
+ * Bytes.validate(Bytes.from([1, 2, 3]))
3039
+ * // @log: true
3040
+ * ```
3041
+ *
3042
+ * @param value - Value to check.
3043
+ * @returns `true` if the value is {@link ox#Bytes.Bytes}, otherwise `false`.
3044
+ */
3045
+ function validate$1(value) {
3046
+ try {
3047
+ assert$1(value);
3048
+ return true;
3049
+ } catch {
3050
+ return false;
3051
+ }
3052
+ }
3053
+ /**
3054
+ * Thrown when the bytes value cannot be represented as a boolean.
3055
+ *
3056
+ * @example
3057
+ * ```ts twoslash
3058
+ * import { Bytes } from 'ox'
3059
+ *
3060
+ * Bytes.toBoolean(Bytes.from([5]))
3061
+ * // @error: Bytes.InvalidBytesBooleanError: Bytes value `[5]` is not a valid boolean.
3062
+ * // @error: The bytes array must contain a single byte of either a `0` or `1` value.
3063
+ * ```
3064
+ */
3065
+ var InvalidBytesBooleanError = class extends BaseError {
3066
+ constructor(bytes) {
3067
+ super(`Bytes value \`${bytes}\` is not a valid boolean.`, { metaMessages: ["The bytes array must contain a single byte of either a `0` or `1` value."] });
3068
+ Object.defineProperty(this, "name", {
3069
+ enumerable: true,
3070
+ configurable: true,
3071
+ writable: true,
3072
+ value: "Bytes.InvalidBytesBooleanError"
3073
+ });
3074
+ }
3075
+ };
3076
+ /**
3077
+ * Thrown when a value cannot be converted to bytes.
3078
+ *
3079
+ * @example
3080
+ * ```ts twoslash
3081
+ * // @noErrors
3082
+ * import { Bytes } from 'ox'
3083
+ *
3084
+ * Bytes.from('foo')
3085
+ * // @error: Bytes.InvalidBytesTypeError: Value `foo` of type `string` is an invalid Bytes value.
3086
+ * ```
3087
+ */
3088
+ var InvalidBytesTypeError = class extends BaseError {
3089
+ constructor(value) {
3090
+ super(`Value \`${typeof value === "object" ? stringify(value) : value}\` of type \`${typeof value}\` is an invalid Bytes value.`, { metaMessages: ["Bytes values must be of type `Bytes`."] });
3091
+ Object.defineProperty(this, "name", {
3092
+ enumerable: true,
3093
+ configurable: true,
3094
+ writable: true,
3095
+ value: "Bytes.InvalidBytesTypeError"
3096
+ });
3097
+ }
3098
+ };
3099
+ /**
3100
+ * Thrown when a size exceeds the maximum allowed size.
3101
+ *
3102
+ * @example
3103
+ * ```ts twoslash
3104
+ * import { Bytes } from 'ox'
3105
+ *
3106
+ * Bytes.fromString('Hello World!', { size: 8 })
3107
+ * // @error: Bytes.SizeOverflowError: Size cannot exceed `8` bytes. Given size: `12` bytes.
3108
+ * ```
3109
+ */
3110
+ var SizeOverflowError$1 = class extends BaseError {
3111
+ constructor({ givenSize, maxSize }) {
3112
+ super(`Size cannot exceed \`${maxSize}\` bytes. Given size: \`${givenSize}\` bytes.`);
3113
+ Object.defineProperty(this, "name", {
3114
+ enumerable: true,
3115
+ configurable: true,
3116
+ writable: true,
3117
+ value: "Bytes.SizeOverflowError"
3118
+ });
3119
+ }
3120
+ };
3121
+ /**
3122
+ * Thrown when a slice offset is out-of-bounds.
3123
+ *
3124
+ * @example
3125
+ * ```ts twoslash
3126
+ * import { Bytes } from 'ox'
3127
+ *
3128
+ * Bytes.slice(Bytes.from([1, 2, 3]), 4)
3129
+ * // @error: Bytes.SliceOffsetOutOfBoundsError: Slice starting at offset `4` is out-of-bounds (size: `3`).
3130
+ * ```
3131
+ */
3132
+ var SliceOffsetOutOfBoundsError$1 = class extends BaseError {
3133
+ constructor({ offset, position, size }) {
3134
+ super(`Slice ${position === "start" ? "starting" : "ending"} at offset \`${offset}\` is out-of-bounds (size: \`${size}\`).`);
3135
+ Object.defineProperty(this, "name", {
3136
+ enumerable: true,
3137
+ configurable: true,
3138
+ writable: true,
3139
+ value: "Bytes.SliceOffsetOutOfBoundsError"
3140
+ });
3141
+ }
3142
+ };
3143
+ /**
3144
+ * Thrown when a the padding size exceeds the maximum allowed size.
3145
+ *
3146
+ * @example
3147
+ * ```ts twoslash
3148
+ * import { Bytes } from 'ox'
3149
+ *
3150
+ * Bytes.padLeft(Bytes.fromString('Hello World!'), 8)
3151
+ * // @error: [Bytes.SizeExceedsPaddingSizeError: Bytes size (`12`) exceeds padding size (`8`).
3152
+ * ```
3153
+ */
3154
+ var SizeExceedsPaddingSizeError$1 = class extends BaseError {
3155
+ constructor({ size, targetSize, type }) {
3156
+ super(`${type.charAt(0).toUpperCase()}${type.slice(1).toLowerCase()} size (\`${size}\`) exceeds padding size (\`${targetSize}\`).`);
3157
+ Object.defineProperty(this, "name", {
3158
+ enumerable: true,
3159
+ configurable: true,
3160
+ writable: true,
3161
+ value: "Bytes.SizeExceedsPaddingSizeError"
3162
+ });
3163
+ }
3164
+ };
3165
+ //#endregion
3166
+ //#region node_modules/.pnpm/ox@0.14.7_typescript@5.9.3_zod@4.3.6/node_modules/ox/_esm/core/Hex.js
3167
+ const encoder = /* @__PURE__ */ new TextEncoder();
3168
+ const hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_v, i) => i.toString(16).padStart(2, "0"));
3169
+ /**
3170
+ * Asserts if the given value is {@link ox#Hex.Hex}.
3171
+ *
3172
+ * @example
3173
+ * ```ts twoslash
3174
+ * import { Hex } from 'ox'
3175
+ *
3176
+ * Hex.assert('abc')
3177
+ * // @error: InvalidHexValueTypeError:
3178
+ * // @error: Value `"abc"` of type `string` is an invalid hex type.
3179
+ * // @error: Hex types must be represented as `"0x\${string}"`.
3180
+ * ```
3181
+ *
3182
+ * @param value - The value to assert.
3183
+ * @param options - Options.
3184
+ */
3185
+ function assert(value, options = {}) {
3186
+ const { strict = false } = options;
3187
+ if (!value) throw new InvalidHexTypeError(value);
3188
+ if (typeof value !== "string") throw new InvalidHexTypeError(value);
3189
+ if (strict) {
3190
+ if (!/^0x[0-9a-fA-F]*$/.test(value)) throw new InvalidHexValueError(value);
3191
+ }
3192
+ if (!value.startsWith("0x")) throw new InvalidHexValueError(value);
3193
+ }
3194
+ /**
3195
+ * Concatenates two or more {@link ox#Hex.Hex}.
3196
+ *
3197
+ * @example
3198
+ * ```ts twoslash
3199
+ * import { Hex } from 'ox'
3200
+ *
3201
+ * Hex.concat('0x123', '0x456')
3202
+ * // @log: '0x123456'
3203
+ * ```
3204
+ *
3205
+ * @param values - The {@link ox#Hex.Hex} values to concatenate.
3206
+ * @returns The concatenated {@link ox#Hex.Hex} value.
3207
+ */
3208
+ function concat(...values) {
3209
+ return `0x${values.reduce((acc, x) => acc + x.replace("0x", ""), "")}`;
3210
+ }
3211
+ /**
3212
+ * Instantiates a {@link ox#Hex.Hex} value from a hex string or {@link ox#Bytes.Bytes} value.
3213
+ *
3214
+ * :::tip
3215
+ *
3216
+ * To instantiate from a **Boolean**, **String**, or **Number**, use one of the following:
3217
+ *
3218
+ * - `Hex.fromBoolean`
3219
+ *
3220
+ * - `Hex.fromString`
3221
+ *
3222
+ * - `Hex.fromNumber`
3223
+ *
3224
+ * :::
3225
+ *
3226
+ * @example
3227
+ * ```ts twoslash
3228
+ * import { Bytes, Hex } from 'ox'
3229
+ *
3230
+ * Hex.from('0x48656c6c6f20576f726c6421')
3231
+ * // @log: '0x48656c6c6f20576f726c6421'
3232
+ *
3233
+ * Hex.from(Bytes.from([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33]))
3234
+ * // @log: '0x48656c6c6f20576f726c6421'
3235
+ * ```
3236
+ *
3237
+ * @param value - The {@link ox#Bytes.Bytes} value to encode.
3238
+ * @returns The encoded {@link ox#Hex.Hex} value.
3239
+ */
3240
+ function from(value) {
3241
+ if (value instanceof Uint8Array) return fromBytes(value);
3242
+ if (Array.isArray(value)) return fromBytes(new Uint8Array(value));
3243
+ return value;
3244
+ }
3245
+ /**
3246
+ * Encodes a boolean into a {@link ox#Hex.Hex} value.
3247
+ *
3248
+ * @example
3249
+ * ```ts twoslash
3250
+ * import { Hex } from 'ox'
3251
+ *
3252
+ * Hex.fromBoolean(true)
3253
+ * // @log: '0x1'
3254
+ *
3255
+ * Hex.fromBoolean(false)
3256
+ * // @log: '0x0'
3257
+ *
3258
+ * Hex.fromBoolean(true, { size: 32 })
3259
+ * // @log: '0x0000000000000000000000000000000000000000000000000000000000000001'
3260
+ * ```
3261
+ *
3262
+ * @param value - The boolean value to encode.
3263
+ * @param options - Options.
3264
+ * @returns The encoded {@link ox#Hex.Hex} value.
3265
+ */
3266
+ function fromBoolean(value, options = {}) {
3267
+ const hex = `0x${Number(value)}`;
3268
+ if (typeof options.size === "number") {
3269
+ assertSize(hex, options.size);
3270
+ return padLeft(hex, options.size);
3271
+ }
3272
+ return hex;
3273
+ }
3274
+ /**
3275
+ * Encodes a {@link ox#Bytes.Bytes} value into a {@link ox#Hex.Hex} value.
3276
+ *
3277
+ * @example
3278
+ * ```ts twoslash
3279
+ * import { Bytes, Hex } from 'ox'
3280
+ *
3281
+ * Hex.fromBytes(Bytes.from([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33]))
3282
+ * // @log: '0x48656c6c6f20576f726c6421'
3283
+ * ```
3284
+ *
3285
+ * @param value - The {@link ox#Bytes.Bytes} value to encode.
3286
+ * @param options - Options.
3287
+ * @returns The encoded {@link ox#Hex.Hex} value.
3288
+ */
3289
+ function fromBytes(value, options = {}) {
3290
+ let string = "";
3291
+ for (let i = 0; i < value.length; i++) string += hexes[value[i]];
3292
+ const hex = `0x${string}`;
3293
+ if (typeof options.size === "number") {
3294
+ assertSize(hex, options.size);
3295
+ return padRight(hex, options.size);
3296
+ }
3297
+ return hex;
3298
+ }
3299
+ /**
3300
+ * Encodes a number or bigint into a {@link ox#Hex.Hex} value.
3301
+ *
3302
+ * @example
3303
+ * ```ts twoslash
3304
+ * import { Hex } from 'ox'
3305
+ *
3306
+ * Hex.fromNumber(420)
3307
+ * // @log: '0x1a4'
3308
+ *
3309
+ * Hex.fromNumber(420, { size: 32 })
3310
+ * // @log: '0x00000000000000000000000000000000000000000000000000000000000001a4'
3311
+ * ```
3312
+ *
3313
+ * @param value - The number or bigint value to encode.
3314
+ * @param options - Options.
3315
+ * @returns The encoded {@link ox#Hex.Hex} value.
3316
+ */
3317
+ function fromNumber(value, options = {}) {
3318
+ const { signed, size } = options;
3319
+ const value_ = BigInt(value);
3320
+ let maxValue;
3321
+ if (size) if (signed) maxValue = (1n << BigInt(size) * 8n - 1n) - 1n;
3322
+ else maxValue = 2n ** (BigInt(size) * 8n) - 1n;
3323
+ else if (typeof value === "number") maxValue = BigInt(Number.MAX_SAFE_INTEGER);
3324
+ const minValue = typeof maxValue === "bigint" && signed ? -maxValue - 1n : 0;
3325
+ if (maxValue && value_ > maxValue || value_ < minValue) {
3326
+ const suffix = typeof value === "bigint" ? "n" : "";
3327
+ throw new IntegerOutOfRangeError({
3328
+ max: maxValue ? `${maxValue}${suffix}` : void 0,
3329
+ min: `${minValue}${suffix}`,
3330
+ signed,
3331
+ size,
3332
+ value: `${value}${suffix}`
3333
+ });
3334
+ }
3335
+ const hex = `0x${(signed && value_ < 0 ? BigInt.asUintN(size * 8, BigInt(value_)) : value_).toString(16)}`;
3336
+ if (size) return padLeft(hex, size);
3337
+ return hex;
3338
+ }
3339
+ /**
3340
+ * Encodes a string into a {@link ox#Hex.Hex} value.
3341
+ *
3342
+ * @example
3343
+ * ```ts twoslash
3344
+ * import { Hex } from 'ox'
3345
+ * Hex.fromString('Hello World!')
3346
+ * // '0x48656c6c6f20576f726c6421'
3347
+ *
3348
+ * Hex.fromString('Hello World!', { size: 32 })
3349
+ * // '0x48656c6c6f20576f726c64210000000000000000000000000000000000000000'
3350
+ * ```
3351
+ *
3352
+ * @param value - The string value to encode.
3353
+ * @param options - Options.
3354
+ * @returns The encoded {@link ox#Hex.Hex} value.
3355
+ */
3356
+ function fromString(value, options = {}) {
3357
+ return fromBytes(encoder.encode(value), options);
3358
+ }
3359
+ /**
3360
+ * Pads a {@link ox#Hex.Hex} value to the left with zero bytes until it reaches the given `size` (default: 32 bytes).
3361
+ *
3362
+ * @example
3363
+ * ```ts twoslash
3364
+ * import { Hex } from 'ox'
3365
+ *
3366
+ * Hex.padLeft('0x1234', 4)
3367
+ * // @log: '0x00001234'
3368
+ * ```
3369
+ *
3370
+ * @param value - The {@link ox#Hex.Hex} value to pad.
3371
+ * @param size - The size (in bytes) of the output hex value.
3372
+ * @returns The padded {@link ox#Hex.Hex} value.
3373
+ */
3374
+ function padLeft(value, size) {
3375
+ return pad(value, {
3376
+ dir: "left",
3377
+ size
3378
+ });
3379
+ }
3380
+ /**
3381
+ * Pads a {@link ox#Hex.Hex} value to the right with zero bytes until it reaches the given `size` (default: 32 bytes).
3382
+ *
3383
+ * @example
3384
+ * ```ts
3385
+ * import { Hex } from 'ox'
3386
+ *
3387
+ * Hex.padRight('0x1234', 4)
3388
+ * // @log: '0x12340000'
3389
+ * ```
3390
+ *
3391
+ * @param value - The {@link ox#Hex.Hex} value to pad.
3392
+ * @param size - The size (in bytes) of the output hex value.
3393
+ * @returns The padded {@link ox#Hex.Hex} value.
3394
+ */
3395
+ function padRight(value, size) {
3396
+ return pad(value, {
3397
+ dir: "right",
3398
+ size
3399
+ });
3400
+ }
3401
+ /**
3402
+ * Generates a random {@link ox#Hex.Hex} value of the specified length.
3403
+ *
3404
+ * @example
3405
+ * ```ts twoslash
3406
+ * import { Hex } from 'ox'
3407
+ *
3408
+ * const hex = Hex.random(32)
3409
+ * // @log: '0x...'
3410
+ * ```
3411
+ *
3412
+ * @returns Random {@link ox#Hex.Hex} value.
3413
+ */
3414
+ function random(length) {
3415
+ return fromBytes(random$1(length));
3416
+ }
3417
+ /**
3418
+ * Returns a section of a {@link ox#Bytes.Bytes} value given a start/end bytes offset.
3419
+ *
3420
+ * @example
3421
+ * ```ts twoslash
3422
+ * import { Hex } from 'ox'
3423
+ *
3424
+ * Hex.slice('0x0123456789', 1, 4)
3425
+ * // @log: '0x234567'
3426
+ * ```
3427
+ *
3428
+ * @param value - The {@link ox#Hex.Hex} value to slice.
3429
+ * @param start - The start offset (in bytes).
3430
+ * @param end - The end offset (in bytes).
3431
+ * @param options - Options.
3432
+ * @returns The sliced {@link ox#Hex.Hex} value.
3433
+ */
3434
+ function slice(value, start, end, options = {}) {
3435
+ const { strict } = options;
3436
+ assertStartOffset(value, start);
3437
+ const value_ = `0x${value.replace("0x", "").slice((start ?? 0) * 2, (end ?? value.length) * 2)}`;
3438
+ if (strict) assertEndOffset(value_, start, end);
3439
+ return value_;
3440
+ }
3441
+ /**
3442
+ * Retrieves the size of a {@link ox#Hex.Hex} value (in bytes).
3443
+ *
3444
+ * @example
3445
+ * ```ts twoslash
3446
+ * import { Hex } from 'ox'
3447
+ *
3448
+ * Hex.size('0xdeadbeef')
3449
+ * // @log: 4
3450
+ * ```
3451
+ *
3452
+ * @param value - The {@link ox#Hex.Hex} value to get the size of.
3453
+ * @returns The size of the {@link ox#Hex.Hex} value (in bytes).
3454
+ */
3455
+ function size(value) {
3456
+ return Math.ceil((value.length - 2) / 2);
3457
+ }
3458
+ /**
3459
+ * Trims leading zeros from a {@link ox#Hex.Hex} value.
3460
+ *
3461
+ * @example
3462
+ * ```ts twoslash
3463
+ * import { Hex } from 'ox'
3464
+ *
3465
+ * Hex.trimLeft('0x00000000deadbeef')
3466
+ * // @log: '0xdeadbeef'
3467
+ * ```
3468
+ *
3469
+ * @param value - The {@link ox#Hex.Hex} value to trim.
3470
+ * @returns The trimmed {@link ox#Hex.Hex} value.
3471
+ */
3472
+ function trimLeft(value) {
3473
+ return trim(value, { dir: "left" });
3474
+ }
3475
+ /**
3476
+ * Decodes a {@link ox#Hex.Hex} value into a BigInt.
3477
+ *
3478
+ * @example
3479
+ * ```ts twoslash
3480
+ * import { Hex } from 'ox'
3481
+ *
3482
+ * Hex.toBigInt('0x1a4')
3483
+ * // @log: 420n
3484
+ *
3485
+ * Hex.toBigInt('0x00000000000000000000000000000000000000000000000000000000000001a4', { size: 32 })
3486
+ * // @log: 420n
3487
+ * ```
3488
+ *
3489
+ * @param hex - The {@link ox#Hex.Hex} value to decode.
3490
+ * @param options - Options.
3491
+ * @returns The decoded BigInt.
3492
+ */
3493
+ function toBigInt(hex, options = {}) {
3494
+ const { signed } = options;
3495
+ if (options.size) assertSize(hex, options.size);
3496
+ const value = BigInt(hex);
3497
+ if (!signed) return value;
3498
+ const size = (hex.length - 2) / 2;
3499
+ const max_unsigned = (1n << BigInt(size) * 8n) - 1n;
3500
+ if (value <= max_unsigned >> 1n) return value;
3501
+ return value - max_unsigned - 1n;
3502
+ }
3503
+ /**
3504
+ * Decodes a {@link ox#Hex.Hex} value into a {@link ox#Bytes.Bytes}.
3505
+ *
3506
+ * @example
3507
+ * ```ts twoslash
3508
+ * import { Hex } from 'ox'
3509
+ *
3510
+ * const data = Hex.toBytes('0x48656c6c6f20776f726c6421')
3511
+ * // @log: Uint8Array([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33])
3512
+ * ```
3513
+ *
3514
+ * @param hex - The {@link ox#Hex.Hex} value to decode.
3515
+ * @param options - Options.
3516
+ * @returns The decoded {@link ox#Bytes.Bytes}.
3517
+ */
3518
+ function toBytes(hex, options = {}) {
3519
+ return fromHex(hex, options);
3520
+ }
3521
+ /**
3522
+ * Decodes a {@link ox#Hex.Hex} value into a number.
3523
+ *
3524
+ * @example
3525
+ * ```ts twoslash
3526
+ * import { Hex } from 'ox'
3527
+ *
3528
+ * Hex.toNumber('0x1a4')
3529
+ * // @log: 420
3530
+ *
3531
+ * Hex.toNumber('0x00000000000000000000000000000000000000000000000000000000000001a4', { size: 32 })
3532
+ * // @log: 420
3533
+ * ```
3534
+ *
3535
+ * @param hex - The {@link ox#Hex.Hex} value to decode.
3536
+ * @param options - Options.
3537
+ * @returns The decoded number.
3538
+ */
3539
+ function toNumber(hex, options = {}) {
3540
+ const { signed, size } = options;
3541
+ if (!signed && !size) return Number(hex);
3542
+ return Number(toBigInt(hex, options));
3543
+ }
3544
+ /**
3545
+ * Decodes a {@link ox#Hex.Hex} value into a string.
3546
+ *
3547
+ * @example
3548
+ * ```ts twoslash
3549
+ * import { Hex } from 'ox'
3550
+ *
3551
+ * Hex.toString('0x48656c6c6f20576f726c6421')
3552
+ * // @log: 'Hello world!'
3553
+ *
3554
+ * Hex.toString('0x48656c6c6f20576f726c64210000000000000000000000000000000000000000', {
3555
+ * size: 32,
3556
+ * })
3557
+ * // @log: 'Hello world'
3558
+ * ```
3559
+ *
3560
+ * @param hex - The {@link ox#Hex.Hex} value to decode.
3561
+ * @param options - Options.
3562
+ * @returns The decoded string.
3563
+ */
3564
+ function toString(hex, options = {}) {
3565
+ const { size } = options;
3566
+ let bytes = fromHex(hex);
3567
+ if (size) {
3568
+ assertSize$1(bytes, size);
3569
+ bytes = trimRight(bytes);
3570
+ }
3571
+ return new TextDecoder().decode(bytes);
3572
+ }
3573
+ /**
3574
+ * Checks if the given value is {@link ox#Hex.Hex}.
3575
+ *
3576
+ * @example
3577
+ * ```ts twoslash
3578
+ * import { Bytes, Hex } from 'ox'
3579
+ *
3580
+ * Hex.validate('0xdeadbeef')
3581
+ * // @log: true
3582
+ *
3583
+ * Hex.validate(Bytes.from([1, 2, 3]))
3584
+ * // @log: false
3585
+ * ```
3586
+ *
3587
+ * @param value - The value to check.
3588
+ * @param options - Options.
3589
+ * @returns `true` if the value is a {@link ox#Hex.Hex}, `false` otherwise.
3590
+ */
3591
+ function validate(value, options = {}) {
3592
+ const { strict = false } = options;
3593
+ try {
3594
+ assert(value, { strict });
3595
+ return true;
3596
+ } catch {
3597
+ return false;
3598
+ }
3599
+ }
3600
+ /**
3601
+ * Thrown when the provided integer is out of range, and cannot be represented as a hex value.
3602
+ *
3603
+ * @example
3604
+ * ```ts twoslash
3605
+ * import { Hex } from 'ox'
3606
+ *
3607
+ * Hex.fromNumber(420182738912731283712937129)
3608
+ * // @error: Hex.IntegerOutOfRangeError: Number \`4.2018273891273126e+26\` is not in safe unsigned integer range (`0` to `9007199254740991`)
3609
+ * ```
3610
+ */
3611
+ var IntegerOutOfRangeError = class extends BaseError {
3612
+ constructor({ max, min, signed, size, value }) {
3613
+ super(`Number \`${value}\` is not in safe${size ? ` ${size * 8}-bit` : ""}${signed ? " signed" : " unsigned"} integer range ${max ? `(\`${min}\` to \`${max}\`)` : `(above \`${min}\`)`}`);
3614
+ Object.defineProperty(this, "name", {
3615
+ enumerable: true,
3616
+ configurable: true,
3617
+ writable: true,
3618
+ value: "Hex.IntegerOutOfRangeError"
3619
+ });
3620
+ }
3621
+ };
3622
+ /**
3623
+ * Thrown when the provided value is not a valid hex type.
3624
+ *
3625
+ * @example
3626
+ * ```ts twoslash
3627
+ * import { Hex } from 'ox'
3628
+ *
3629
+ * Hex.assert(1)
3630
+ * // @error: Hex.InvalidHexTypeError: Value `1` of type `number` is an invalid hex type.
3631
+ * ```
3632
+ */
3633
+ var InvalidHexTypeError = class extends BaseError {
3634
+ constructor(value) {
3635
+ super(`Value \`${typeof value === "object" ? stringify(value) : value}\` of type \`${typeof value}\` is an invalid hex type.`, { metaMessages: ["Hex types must be represented as `\"0x${string}\"`."] });
3636
+ Object.defineProperty(this, "name", {
3637
+ enumerable: true,
3638
+ configurable: true,
3639
+ writable: true,
3640
+ value: "Hex.InvalidHexTypeError"
3641
+ });
3642
+ }
3643
+ };
3644
+ /**
3645
+ * Thrown when the provided hex value is invalid.
3646
+ *
3647
+ * @example
3648
+ * ```ts twoslash
3649
+ * import { Hex } from 'ox'
3650
+ *
3651
+ * Hex.assert('0x0123456789abcdefg')
3652
+ * // @error: Hex.InvalidHexValueError: Value `0x0123456789abcdefg` is an invalid hex value.
3653
+ * // @error: Hex values must start with `"0x"` and contain only hexadecimal characters (0-9, a-f, A-F).
3654
+ * ```
3655
+ */
3656
+ var InvalidHexValueError = class extends BaseError {
3657
+ constructor(value) {
3658
+ super(`Value \`${value}\` is an invalid hex value.`, { metaMessages: ["Hex values must start with `\"0x\"` and contain only hexadecimal characters (0-9, a-f, A-F)."] });
3659
+ Object.defineProperty(this, "name", {
3660
+ enumerable: true,
3661
+ configurable: true,
3662
+ writable: true,
3663
+ value: "Hex.InvalidHexValueError"
3664
+ });
3665
+ }
3666
+ };
3667
+ /**
3668
+ * Thrown when the provided hex value is an odd length.
3669
+ *
3670
+ * @example
3671
+ * ```ts twoslash
3672
+ * import { Bytes } from 'ox'
3673
+ *
3674
+ * Bytes.fromHex('0xabcde')
3675
+ * // @error: Hex.InvalidLengthError: Hex value `"0xabcde"` is an odd length (5 nibbles).
3676
+ * ```
3677
+ */
3678
+ var InvalidLengthError = class extends BaseError {
3679
+ constructor(value) {
3680
+ super(`Hex value \`"${value}"\` is an odd length (${value.length - 2} nibbles).`, { metaMessages: ["It must be an even length."] });
3681
+ Object.defineProperty(this, "name", {
3682
+ enumerable: true,
3683
+ configurable: true,
3684
+ writable: true,
3685
+ value: "Hex.InvalidLengthError"
3686
+ });
3687
+ }
3688
+ };
3689
+ /**
3690
+ * Thrown when the size of the value exceeds the expected max size.
3691
+ *
3692
+ * @example
3693
+ * ```ts twoslash
3694
+ * import { Hex } from 'ox'
3695
+ *
3696
+ * Hex.fromString('Hello World!', { size: 8 })
3697
+ * // @error: Hex.SizeOverflowError: Size cannot exceed `8` bytes. Given size: `12` bytes.
3698
+ * ```
3699
+ */
3700
+ var SizeOverflowError = class extends BaseError {
3701
+ constructor({ givenSize, maxSize }) {
3702
+ super(`Size cannot exceed \`${maxSize}\` bytes. Given size: \`${givenSize}\` bytes.`);
3703
+ Object.defineProperty(this, "name", {
3704
+ enumerable: true,
3705
+ configurable: true,
3706
+ writable: true,
3707
+ value: "Hex.SizeOverflowError"
3708
+ });
3709
+ }
3710
+ };
3711
+ /**
3712
+ * Thrown when the slice offset exceeds the bounds of the value.
3713
+ *
3714
+ * @example
3715
+ * ```ts twoslash
3716
+ * import { Hex } from 'ox'
3717
+ *
3718
+ * Hex.slice('0x0123456789', 6)
3719
+ * // @error: Hex.SliceOffsetOutOfBoundsError: Slice starting at offset `6` is out-of-bounds (size: `5`).
3720
+ * ```
3721
+ */
3722
+ var SliceOffsetOutOfBoundsError = class extends BaseError {
3723
+ constructor({ offset, position, size }) {
3724
+ super(`Slice ${position === "start" ? "starting" : "ending"} at offset \`${offset}\` is out-of-bounds (size: \`${size}\`).`);
3725
+ Object.defineProperty(this, "name", {
3726
+ enumerable: true,
3727
+ configurable: true,
3728
+ writable: true,
3729
+ value: "Hex.SliceOffsetOutOfBoundsError"
3730
+ });
3731
+ }
3732
+ };
3733
+ /**
3734
+ * Thrown when the size of the value exceeds the pad size.
3735
+ *
3736
+ * @example
3737
+ * ```ts twoslash
3738
+ * import { Hex } from 'ox'
3739
+ *
3740
+ * Hex.padLeft('0x1a4e12a45a21323123aaa87a897a897a898a6567a578a867a98778a667a85a875a87a6a787a65a675a6a9', 32)
3741
+ * // @error: Hex.SizeExceedsPaddingSizeError: Hex size (`43`) exceeds padding size (`32`).
3742
+ * ```
3743
+ */
3744
+ var SizeExceedsPaddingSizeError = class extends BaseError {
3745
+ constructor({ size, targetSize, type }) {
3746
+ super(`${type.charAt(0).toUpperCase()}${type.slice(1).toLowerCase()} size (\`${size}\`) exceeds padding size (\`${targetSize}\`).`);
3747
+ Object.defineProperty(this, "name", {
3748
+ enumerable: true,
3749
+ configurable: true,
3750
+ writable: true,
3751
+ value: "Hex.SizeExceedsPaddingSizeError"
3752
+ });
3753
+ }
3754
+ };
3755
+ //#endregion
3756
+ //#region node_modules/.pnpm/ox@0.14.7_typescript@5.9.3_zod@4.3.6/node_modules/ox/_esm/core/Withdrawal.js
3757
+ /**
3758
+ * Converts a {@link ox#Withdrawal.Withdrawal} to an {@link ox#Withdrawal.Rpc}.
3759
+ *
3760
+ * @example
3761
+ * ```ts twoslash
3762
+ * import { Withdrawal } from 'ox'
3763
+ *
3764
+ * const withdrawal = Withdrawal.toRpc({
3765
+ * address: '0x00000000219ab540356cBB839Cbe05303d7705Fa',
3766
+ * amount: 6423331n,
3767
+ * index: 0,
3768
+ * validatorIndex: 1,
3769
+ * })
3770
+ * // @log: {
3771
+ * // @log: address: '0x00000000219ab540356cBB839Cbe05303d7705Fa',
3772
+ * // @log: amount: '0x620323',
3773
+ * // @log: index: '0x0',
3774
+ * // @log: validatorIndex: '0x1',
3775
+ * // @log: }
3776
+ * ```
3777
+ *
3778
+ * @param withdrawal - The Withdrawal to convert.
3779
+ * @returns An RPC Withdrawal.
3780
+ */
3781
+ function toRpc$1(withdrawal) {
3782
+ return {
3783
+ address: withdrawal.address,
3784
+ amount: fromNumber(withdrawal.amount),
3785
+ index: fromNumber(withdrawal.index),
3786
+ validatorIndex: fromNumber(withdrawal.validatorIndex)
3787
+ };
3788
+ }
3789
+ //#endregion
3790
+ //#region node_modules/.pnpm/ox@0.14.7_typescript@5.9.3_zod@4.3.6/node_modules/ox/_esm/core/BlockOverrides.js
3791
+ /**
3792
+ * Converts an {@link ox#BlockOverrides.BlockOverrides} to an {@link ox#BlockOverrides.Rpc}.
3793
+ *
3794
+ * @example
3795
+ * ```ts twoslash
3796
+ * import { BlockOverrides } from 'ox'
3797
+ *
3798
+ * const blockOverrides = BlockOverrides.toRpc({
3799
+ * baseFeePerGas: 1n,
3800
+ * blobBaseFee: 2n,
3801
+ * feeRecipient: '0x0000000000000000000000000000000000000000',
3802
+ * gasLimit: 4n,
3803
+ * number: 5n,
3804
+ * prevRandao: 6n,
3805
+ * time: 78187493520n,
3806
+ * withdrawals: [
3807
+ * {
3808
+ * address: '0x0000000000000000000000000000000000000000',
3809
+ * amount: 1n,
3810
+ * index: 0,
3811
+ * validatorIndex: 1,
3812
+ * },
3813
+ * ],
3814
+ * })
3815
+ * ```
3816
+ *
3817
+ * @param blockOverrides - The block overrides to convert.
3818
+ * @returns An instantiated {@link ox#BlockOverrides.Rpc}.
3819
+ */
3820
+ function toRpc(blockOverrides) {
3821
+ return {
3822
+ ...typeof blockOverrides.baseFeePerGas === "bigint" && { baseFeePerGas: fromNumber(blockOverrides.baseFeePerGas) },
3823
+ ...typeof blockOverrides.blobBaseFee === "bigint" && { blobBaseFee: fromNumber(blockOverrides.blobBaseFee) },
3824
+ ...typeof blockOverrides.feeRecipient === "string" && { feeRecipient: blockOverrides.feeRecipient },
3825
+ ...typeof blockOverrides.gasLimit === "bigint" && { gasLimit: fromNumber(blockOverrides.gasLimit) },
3826
+ ...typeof blockOverrides.number === "bigint" && { number: fromNumber(blockOverrides.number) },
3827
+ ...typeof blockOverrides.prevRandao === "bigint" && { prevRandao: fromNumber(blockOverrides.prevRandao) },
3828
+ ...typeof blockOverrides.time === "bigint" && { time: fromNumber(blockOverrides.time) },
3829
+ ...blockOverrides.withdrawals && { withdrawals: blockOverrides.withdrawals.map(toRpc$1) }
3830
+ };
3831
+ }
3832
+ //#endregion
3833
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/constants/abis.js
3834
+ const multicall3Abi = [
3835
+ {
3836
+ inputs: [{
3837
+ components: [
3838
+ {
3839
+ name: "target",
3840
+ type: "address"
3841
+ },
3842
+ {
3843
+ name: "allowFailure",
3844
+ type: "bool"
3845
+ },
3846
+ {
3847
+ name: "callData",
3848
+ type: "bytes"
3849
+ }
3850
+ ],
3851
+ name: "calls",
3852
+ type: "tuple[]"
3853
+ }],
3854
+ name: "aggregate3",
3855
+ outputs: [{
3856
+ components: [{
3857
+ name: "success",
3858
+ type: "bool"
3859
+ }, {
3860
+ name: "returnData",
3861
+ type: "bytes"
3862
+ }],
3863
+ name: "returnData",
3864
+ type: "tuple[]"
3865
+ }],
3866
+ stateMutability: "view",
3867
+ type: "function"
3868
+ },
3869
+ {
3870
+ inputs: [{
3871
+ name: "addr",
3872
+ type: "address"
3873
+ }],
3874
+ name: "getEthBalance",
3875
+ outputs: [{
3876
+ name: "balance",
3877
+ type: "uint256"
3878
+ }],
3879
+ stateMutability: "view",
3880
+ type: "function"
3881
+ },
3882
+ {
3883
+ inputs: [],
3884
+ name: "getCurrentBlockTimestamp",
3885
+ outputs: [{
3886
+ internalType: "uint256",
3887
+ name: "timestamp",
3888
+ type: "uint256"
3889
+ }],
3890
+ stateMutability: "view",
3891
+ type: "function"
3892
+ }
3893
+ ];
3894
+ const batchGatewayAbi = [{
3895
+ name: "query",
3896
+ type: "function",
3897
+ stateMutability: "view",
3898
+ inputs: [{
3899
+ type: "tuple[]",
3900
+ name: "queries",
3901
+ components: [
3902
+ {
3903
+ type: "address",
3904
+ name: "sender"
3905
+ },
3906
+ {
3907
+ type: "string[]",
3908
+ name: "urls"
3909
+ },
3910
+ {
3911
+ type: "bytes",
3912
+ name: "data"
3913
+ }
3914
+ ]
3915
+ }],
3916
+ outputs: [{
3917
+ type: "bool[]",
3918
+ name: "failures"
3919
+ }, {
3920
+ type: "bytes[]",
3921
+ name: "responses"
3922
+ }]
3923
+ }, {
3924
+ name: "HttpError",
3925
+ type: "error",
3926
+ inputs: [{
3927
+ type: "uint16",
3928
+ name: "status"
3929
+ }, {
3930
+ type: "string",
3931
+ name: "message"
3932
+ }]
3933
+ }];
3934
+ const universalResolverErrors = [
3935
+ {
3936
+ inputs: [{
3937
+ name: "dns",
3938
+ type: "bytes"
3939
+ }],
3940
+ name: "DNSDecodingFailed",
3941
+ type: "error"
3942
+ },
3943
+ {
3944
+ inputs: [{
3945
+ name: "ens",
3946
+ type: "string"
3947
+ }],
3948
+ name: "DNSEncodingFailed",
3949
+ type: "error"
3950
+ },
3951
+ {
3952
+ inputs: [],
3953
+ name: "EmptyAddress",
3954
+ type: "error"
3955
+ },
3956
+ {
3957
+ inputs: [{
3958
+ name: "status",
3959
+ type: "uint16"
3960
+ }, {
3961
+ name: "message",
3962
+ type: "string"
3963
+ }],
3964
+ name: "HttpError",
3965
+ type: "error"
3966
+ },
3967
+ {
3968
+ inputs: [],
3969
+ name: "InvalidBatchGatewayResponse",
3970
+ type: "error"
3971
+ },
3972
+ {
3973
+ inputs: [{
3974
+ name: "errorData",
3975
+ type: "bytes"
3976
+ }],
3977
+ name: "ResolverError",
3978
+ type: "error"
3979
+ },
3980
+ {
3981
+ inputs: [{
3982
+ name: "name",
3983
+ type: "bytes"
3984
+ }, {
3985
+ name: "resolver",
3986
+ type: "address"
3987
+ }],
3988
+ name: "ResolverNotContract",
3989
+ type: "error"
3990
+ },
3991
+ {
3992
+ inputs: [{
3993
+ name: "name",
3994
+ type: "bytes"
3995
+ }],
3996
+ name: "ResolverNotFound",
3997
+ type: "error"
3998
+ },
3999
+ {
4000
+ inputs: [{
4001
+ name: "primary",
4002
+ type: "string"
4003
+ }, {
4004
+ name: "primaryAddress",
4005
+ type: "bytes"
4006
+ }],
4007
+ name: "ReverseAddressMismatch",
4008
+ type: "error"
4009
+ },
4010
+ {
4011
+ inputs: [{
4012
+ internalType: "bytes4",
4013
+ name: "selector",
4014
+ type: "bytes4"
4015
+ }],
4016
+ name: "UnsupportedResolverProfile",
4017
+ type: "error"
4018
+ }
4019
+ ];
4020
+ const universalResolverResolveAbi = [...universalResolverErrors, {
4021
+ name: "resolveWithGateways",
4022
+ type: "function",
4023
+ stateMutability: "view",
4024
+ inputs: [
4025
+ {
4026
+ name: "name",
4027
+ type: "bytes"
4028
+ },
4029
+ {
4030
+ name: "data",
4031
+ type: "bytes"
4032
+ },
4033
+ {
4034
+ name: "gateways",
4035
+ type: "string[]"
4036
+ }
4037
+ ],
4038
+ outputs: [{
4039
+ name: "",
4040
+ type: "bytes"
4041
+ }, {
4042
+ name: "address",
4043
+ type: "address"
4044
+ }]
4045
+ }];
4046
+ const universalResolverReverseAbi = [...universalResolverErrors, {
4047
+ name: "reverseWithGateways",
4048
+ type: "function",
4049
+ stateMutability: "view",
4050
+ inputs: [
4051
+ {
4052
+ type: "bytes",
4053
+ name: "reverseName"
4054
+ },
4055
+ {
4056
+ type: "uint256",
4057
+ name: "coinType"
4058
+ },
4059
+ {
4060
+ type: "string[]",
4061
+ name: "gateways"
4062
+ }
4063
+ ],
4064
+ outputs: [
4065
+ {
4066
+ type: "string",
4067
+ name: "resolvedName"
4068
+ },
4069
+ {
4070
+ type: "address",
4071
+ name: "resolver"
4072
+ },
4073
+ {
4074
+ type: "address",
4075
+ name: "reverseResolver"
4076
+ }
4077
+ ]
4078
+ }];
4079
+ const textResolverAbi = [{
4080
+ name: "text",
4081
+ type: "function",
4082
+ stateMutability: "view",
4083
+ inputs: [{
4084
+ name: "name",
4085
+ type: "bytes32"
4086
+ }, {
4087
+ name: "key",
4088
+ type: "string"
4089
+ }],
4090
+ outputs: [{
4091
+ name: "",
4092
+ type: "string"
4093
+ }]
4094
+ }];
4095
+ const addressResolverAbi = [{
4096
+ name: "addr",
4097
+ type: "function",
4098
+ stateMutability: "view",
4099
+ inputs: [{
4100
+ name: "name",
4101
+ type: "bytes32"
4102
+ }],
4103
+ outputs: [{
4104
+ name: "",
4105
+ type: "address"
4106
+ }]
4107
+ }, {
4108
+ name: "addr",
4109
+ type: "function",
4110
+ stateMutability: "view",
4111
+ inputs: [{
4112
+ name: "name",
4113
+ type: "bytes32"
4114
+ }, {
4115
+ name: "coinType",
4116
+ type: "uint256"
4117
+ }],
4118
+ outputs: [{
4119
+ name: "",
4120
+ type: "bytes"
4121
+ }]
4122
+ }];
4123
+ /** @internal */
4124
+ const erc1271Abi = [{
4125
+ name: "isValidSignature",
4126
+ type: "function",
4127
+ stateMutability: "view",
4128
+ inputs: [{
4129
+ name: "hash",
4130
+ type: "bytes32"
4131
+ }, {
4132
+ name: "signature",
4133
+ type: "bytes"
4134
+ }],
4135
+ outputs: [{
4136
+ name: "",
4137
+ type: "bytes4"
4138
+ }]
4139
+ }];
4140
+ const erc6492SignatureValidatorAbi = [{
4141
+ inputs: [
4142
+ {
4143
+ name: "_signer",
4144
+ type: "address"
4145
+ },
4146
+ {
4147
+ name: "_hash",
4148
+ type: "bytes32"
4149
+ },
4150
+ {
4151
+ name: "_signature",
4152
+ type: "bytes"
4153
+ }
4154
+ ],
4155
+ stateMutability: "nonpayable",
4156
+ type: "constructor"
4157
+ }, {
4158
+ inputs: [
4159
+ {
4160
+ name: "_signer",
4161
+ type: "address"
4162
+ },
4163
+ {
4164
+ name: "_hash",
4165
+ type: "bytes32"
4166
+ },
4167
+ {
4168
+ name: "_signature",
4169
+ type: "bytes"
4170
+ }
4171
+ ],
4172
+ outputs: [{ type: "bool" }],
4173
+ stateMutability: "nonpayable",
4174
+ type: "function",
4175
+ name: "isValidSig"
4176
+ }];
4177
+ //#endregion
4178
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/constants/contracts.js
4179
+ const deploylessCallViaBytecodeBytecode = "0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe";
4180
+ const deploylessCallViaFactoryBytecode = "0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe";
4181
+ const erc6492SignatureValidatorByteCode = "0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572";
4182
+ const multicall3Bytecode = "0x608060405234801561001057600080fd5b506115b9806100206000396000f3fe6080604052600436106100f35760003560e01c80634d2301cc1161008a578063a8b0574e11610059578063a8b0574e14610325578063bce38bd714610350578063c3077fa914610380578063ee82ac5e146103b2576100f3565b80634d2301cc1461026257806372425d9d1461029f57806382ad56cb146102ca57806386d516e8146102fa576100f3565b80633408e470116100c65780633408e470146101af578063399542e9146101da5780633e64a6961461020c57806342cbb15c14610237576100f3565b80630f28c97d146100f8578063174dea7114610123578063252dba421461015357806327e86d6e14610184575b600080fd5b34801561010457600080fd5b5061010d6103ef565b60405161011a9190610c0a565b60405180910390f35b61013d60048036038101906101389190610c94565b6103f7565b60405161014a9190610e94565b60405180910390f35b61016d60048036038101906101689190610f0c565b610615565b60405161017b92919061101b565b60405180910390f35b34801561019057600080fd5b506101996107ab565b6040516101a69190611064565b60405180910390f35b3480156101bb57600080fd5b506101c46107b7565b6040516101d19190610c0a565b60405180910390f35b6101f460048036038101906101ef91906110ab565b6107bf565b6040516102039392919061110b565b60405180910390f35b34801561021857600080fd5b506102216107e1565b60405161022e9190610c0a565b60405180910390f35b34801561024357600080fd5b5061024c6107e9565b6040516102599190610c0a565b60405180910390f35b34801561026e57600080fd5b50610289600480360381019061028491906111a7565b6107f1565b6040516102969190610c0a565b60405180910390f35b3480156102ab57600080fd5b506102b4610812565b6040516102c19190610c0a565b60405180910390f35b6102e460048036038101906102df919061122a565b61081a565b6040516102f19190610e94565b60405180910390f35b34801561030657600080fd5b5061030f6109e4565b60405161031c9190610c0a565b60405180910390f35b34801561033157600080fd5b5061033a6109ec565b6040516103479190611286565b60405180910390f35b61036a600480360381019061036591906110ab565b6109f4565b6040516103779190610e94565b60405180910390f35b61039a60048036038101906103959190610f0c565b610ba6565b6040516103a99392919061110b565b60405180910390f35b3480156103be57600080fd5b506103d960048036038101906103d491906112cd565b610bca565b6040516103e69190611064565b60405180910390f35b600042905090565b60606000808484905090508067ffffffffffffffff81111561041c5761041b6112fa565b5b60405190808252806020026020018201604052801561045557816020015b610442610bd5565b81526020019060019003908161043a5790505b5092503660005b828110156105c957600085828151811061047957610478611329565b5b6020026020010151905087878381811061049657610495611329565b5b90506020028101906104a89190611367565b925060008360400135905080860195508360000160208101906104cb91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16818580606001906104f2919061138f565b604051610500929190611431565b60006040518083038185875af1925050503d806000811461053d576040519150601f19603f3d011682016040523d82523d6000602084013e610542565b606091505b5083600001846020018290528215151515815250505081516020850135176105bc577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260846000fd5b826001019250505061045c565b5082341461060c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610603906114a7565b60405180910390fd5b50505092915050565b6000606043915060008484905090508067ffffffffffffffff81111561063e5761063d6112fa565b5b60405190808252806020026020018201604052801561067157816020015b606081526020019060019003908161065c5790505b5091503660005b828110156107a157600087878381811061069557610694611329565b5b90506020028101906106a791906114c7565b92508260000160208101906106bc91906111a7565b73ffffffffffffffffffffffffffffffffffffffff168380602001906106e2919061138f565b6040516106f0929190611431565b6000604051808303816000865af19150503d806000811461072d576040519150601f19603f3d011682016040523d82523d6000602084013e610732565b606091505b5086848151811061074657610745611329565b5b60200260200101819052819250505080610795576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078c9061153b565b60405180910390fd5b81600101915050610678565b5050509250929050565b60006001430340905090565b600046905090565b6000806060439250434091506107d68686866109f4565b905093509350939050565b600048905090565b600043905090565b60008173ffffffffffffffffffffffffffffffffffffffff16319050919050565b600044905090565b606060008383905090508067ffffffffffffffff81111561083e5761083d6112fa565b5b60405190808252806020026020018201604052801561087757816020015b610864610bd5565b81526020019060019003908161085c5790505b5091503660005b828110156109db57600084828151811061089b5761089a611329565b5b602002602001015190508686838181106108b8576108b7611329565b5b90506020028101906108ca919061155b565b92508260000160208101906108df91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060400190610905919061138f565b604051610913929190611431565b6000604051808303816000865af19150503d8060008114610950576040519150601f19603f3d011682016040523d82523d6000602084013e610955565b606091505b5082600001836020018290528215151515815250505080516020840135176109cf577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260646000fd5b8160010191505061087e565b50505092915050565b600045905090565b600041905090565b606060008383905090508067ffffffffffffffff811115610a1857610a176112fa565b5b604051908082528060200260200182016040528015610a5157816020015b610a3e610bd5565b815260200190600190039081610a365790505b5091503660005b82811015610b9c576000848281518110610a7557610a74611329565b5b60200260200101519050868683818110610a9257610a91611329565b5b9050602002810190610aa491906114c7565b9250826000016020810190610ab991906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060200190610adf919061138f565b604051610aed929190611431565b6000604051808303816000865af19150503d8060008114610b2a576040519150601f19603f3d011682016040523d82523d6000602084013e610b2f565b606091505b508260000183602001829052821515151581525050508715610b90578060000151610b8f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b869061153b565b60405180910390fd5b5b81600101915050610a58565b5050509392505050565b6000806060610bb7600186866107bf565b8093508194508295505050509250925092565b600081409050919050565b6040518060400160405280600015158152602001606081525090565b6000819050919050565b610c0481610bf1565b82525050565b6000602082019050610c1f6000830184610bfb565b92915050565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f840112610c5457610c53610c2f565b5b8235905067ffffffffffffffff811115610c7157610c70610c34565b5b602083019150836020820283011115610c8d57610c8c610c39565b5b9250929050565b60008060208385031215610cab57610caa610c25565b5b600083013567ffffffffffffffff811115610cc957610cc8610c2a565b5b610cd585828601610c3e565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b60008115159050919050565b610d2281610d0d565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610d62578082015181840152602081019050610d47565b83811115610d71576000848401525b50505050565b6000601f19601f8301169050919050565b6000610d9382610d28565b610d9d8185610d33565b9350610dad818560208601610d44565b610db681610d77565b840191505092915050565b6000604083016000830151610dd96000860182610d19565b5060208301518482036020860152610df18282610d88565b9150508091505092915050565b6000610e0a8383610dc1565b905092915050565b6000602082019050919050565b6000610e2a82610ce1565b610e348185610cec565b935083602082028501610e4685610cfd565b8060005b85811015610e825784840389528151610e638582610dfe565b9450610e6e83610e12565b925060208a01995050600181019050610e4a565b50829750879550505050505092915050565b60006020820190508181036000830152610eae8184610e1f565b905092915050565b60008083601f840112610ecc57610ecb610c2f565b5b8235905067ffffffffffffffff811115610ee957610ee8610c34565b5b602083019150836020820283011115610f0557610f04610c39565b5b9250929050565b60008060208385031215610f2357610f22610c25565b5b600083013567ffffffffffffffff811115610f4157610f40610c2a565b5b610f4d85828601610eb6565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000610f918383610d88565b905092915050565b6000602082019050919050565b6000610fb182610f59565b610fbb8185610f64565b935083602082028501610fcd85610f75565b8060005b858110156110095784840389528151610fea8582610f85565b9450610ff583610f99565b925060208a01995050600181019050610fd1565b50829750879550505050505092915050565b60006040820190506110306000830185610bfb565b81810360208301526110428184610fa6565b90509392505050565b6000819050919050565b61105e8161104b565b82525050565b60006020820190506110796000830184611055565b92915050565b61108881610d0d565b811461109357600080fd5b50565b6000813590506110a58161107f565b92915050565b6000806000604084860312156110c4576110c3610c25565b5b60006110d286828701611096565b935050602084013567ffffffffffffffff8111156110f3576110f2610c2a565b5b6110ff86828701610eb6565b92509250509250925092565b60006060820190506111206000830186610bfb565b61112d6020830185611055565b818103604083015261113f8184610e1f565b9050949350505050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061117482611149565b9050919050565b61118481611169565b811461118f57600080fd5b50565b6000813590506111a18161117b565b92915050565b6000602082840312156111bd576111bc610c25565b5b60006111cb84828501611192565b91505092915050565b60008083601f8401126111ea576111e9610c2f565b5b8235905067ffffffffffffffff81111561120757611206610c34565b5b60208301915083602082028301111561122357611222610c39565b5b9250929050565b6000806020838503121561124157611240610c25565b5b600083013567ffffffffffffffff81111561125f5761125e610c2a565b5b61126b858286016111d4565b92509250509250929050565b61128081611169565b82525050565b600060208201905061129b6000830184611277565b92915050565b6112aa81610bf1565b81146112b557600080fd5b50565b6000813590506112c7816112a1565b92915050565b6000602082840312156112e3576112e2610c25565b5b60006112f1848285016112b8565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b600080fd5b600080fd5b60008235600160800383360303811261138357611382611358565b5b80830191505092915050565b600080833560016020038436030381126113ac576113ab611358565b5b80840192508235915067ffffffffffffffff8211156113ce576113cd61135d565b5b6020830192506001820236038313156113ea576113e9611362565b5b509250929050565b600081905092915050565b82818337600083830152505050565b600061141883856113f2565b93506114258385846113fd565b82840190509392505050565b600061143e82848661140c565b91508190509392505050565b600082825260208201905092915050565b7f4d756c746963616c6c333a2076616c7565206d69736d61746368000000000000600082015250565b6000611491601a8361144a565b915061149c8261145b565b602082019050919050565b600060208201905081810360008301526114c081611484565b9050919050565b6000823560016040038336030381126114e3576114e2611358565b5b80830191505092915050565b7f4d756c746963616c6c333a2063616c6c206661696c6564000000000000000000600082015250565b600061152560178361144a565b9150611530826114ef565b602082019050919050565b6000602082019050818103600083015261155481611518565b9050919050565b60008235600160600383360303811261157757611576611358565b5b8083019150509291505056fea264697066735822122020c1bc9aacf8e4a6507193432a895a8e77094f45a1395583f07b24e860ef06cd64736f6c634300080c0033";
4183
+ //#endregion
4184
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/abi/encodeDeployData.js
4185
+ const docsPath = "/docs/contract/encodeDeployData";
4186
+ function encodeDeployData(parameters) {
4187
+ const { abi, args, bytecode } = parameters;
4188
+ if (!args || args.length === 0) return bytecode;
4189
+ const description = abi.find((x) => "type" in x && x.type === "constructor");
4190
+ if (!description) throw new AbiConstructorNotFoundError({ docsPath });
4191
+ if (!("inputs" in description)) throw new AbiConstructorParamsNotFoundError({ docsPath });
4192
+ if (!description.inputs || description.inputs.length === 0) throw new AbiConstructorParamsNotFoundError({ docsPath });
4193
+ return concatHex([bytecode, encodeAbiParameters(description.inputs, args)]);
4194
+ }
4195
+ //#endregion
4196
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/chain/getChainContractAddress.js
4197
+ function getChainContractAddress({ blockNumber, chain, contract: name }) {
4198
+ const contract = chain?.contracts?.[name];
4199
+ if (!contract) throw new ChainDoesNotSupportContract({
4200
+ chain,
4201
+ contract: { name }
4202
+ });
4203
+ if (blockNumber && contract.blockCreated && contract.blockCreated > blockNumber) throw new ChainDoesNotSupportContract({
4204
+ blockNumber,
4205
+ chain,
4206
+ contract: {
4207
+ name,
4208
+ blockCreated: contract.blockCreated
4209
+ }
4210
+ });
4211
+ return contract.address;
4212
+ }
4213
+ //#endregion
4214
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/errors/getCallError.js
4215
+ function getCallError(err, { docsPath, ...args }) {
4216
+ return new CallExecutionError((() => {
4217
+ const cause = getNodeError(err, args);
4218
+ if (cause instanceof UnknownNodeError) return err;
4219
+ return cause;
4220
+ })(), {
4221
+ docsPath,
4222
+ ...args
4223
+ });
4224
+ }
4225
+ //#endregion
4226
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/promise/withResolvers.js
4227
+ /** @internal */
4228
+ function withResolvers() {
4229
+ let resolve = () => void 0;
4230
+ let reject = () => void 0;
4231
+ return {
4232
+ promise: new Promise((resolve_, reject_) => {
4233
+ resolve = resolve_;
4234
+ reject = reject_;
4235
+ }),
4236
+ resolve,
4237
+ reject
4238
+ };
4239
+ }
4240
+ //#endregion
4241
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/promise/createBatchScheduler.js
4242
+ const schedulerCache = /* @__PURE__ */ new Map();
4243
+ /** @internal */
4244
+ function createBatchScheduler({ fn, id, shouldSplitBatch, wait = 0, sort }) {
4245
+ const exec = async () => {
4246
+ const scheduler = getScheduler();
4247
+ flush();
4248
+ const args = scheduler.map(({ args }) => args);
4249
+ if (args.length === 0) return;
4250
+ fn(args).then((data) => {
4251
+ if (sort && Array.isArray(data)) data.sort(sort);
4252
+ for (let i = 0; i < scheduler.length; i++) {
4253
+ const { resolve } = scheduler[i];
4254
+ resolve?.([data[i], data]);
4255
+ }
4256
+ }).catch((err) => {
4257
+ for (let i = 0; i < scheduler.length; i++) {
4258
+ const { reject } = scheduler[i];
4259
+ reject?.(err);
4260
+ }
4261
+ });
4262
+ };
4263
+ const flush = () => schedulerCache.delete(id);
4264
+ const getBatchedArgs = () => getScheduler().map(({ args }) => args);
4265
+ const getScheduler = () => schedulerCache.get(id) || [];
4266
+ const setScheduler = (item) => schedulerCache.set(id, [...getScheduler(), item]);
4267
+ return {
4268
+ flush,
4269
+ async schedule(args) {
4270
+ const { promise, resolve, reject } = withResolvers();
4271
+ if (shouldSplitBatch?.([...getBatchedArgs(), args])) exec();
4272
+ if (getScheduler().length > 0) {
4273
+ setScheduler({
4274
+ args,
4275
+ resolve,
4276
+ reject
4277
+ });
4278
+ return promise;
4279
+ }
4280
+ setScheduler({
4281
+ args,
4282
+ resolve,
4283
+ reject
4284
+ });
4285
+ setTimeout(exec, wait);
4286
+ return promise;
4287
+ }
4288
+ };
4289
+ }
4290
+ //#endregion
4291
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/actions/public/call.js
4292
+ /**
4293
+ * Executes a new message call immediately without submitting a transaction to the network.
4294
+ *
4295
+ * - Docs: https://viem.sh/docs/actions/public/call
4296
+ * - JSON-RPC Methods: [`eth_call`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_call)
4297
+ *
4298
+ * @param client - Client to use
4299
+ * @param parameters - {@link CallParameters}
4300
+ * @returns The call data. {@link CallReturnType}
4301
+ *
4302
+ * @example
4303
+ * import { createPublicClient, http } from 'viem'
4304
+ * import { mainnet } from 'viem/chains'
4305
+ * import { call } from 'viem/public'
4306
+ *
4307
+ * const client = createPublicClient({
4308
+ * chain: mainnet,
4309
+ * transport: http(),
4310
+ * })
4311
+ * const data = await call(client, {
4312
+ * account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266',
4313
+ * data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
4314
+ * to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
4315
+ * })
4316
+ */
4317
+ async function call(client, args) {
4318
+ 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;
4319
+ const account = account_ ? parseAccount(account_) : void 0;
4320
+ if (code && (factory || factoryData)) throw new BaseError$2("Cannot provide both `code` & `factory`/`factoryData` as parameters.");
4321
+ if (code && to) throw new BaseError$2("Cannot provide both `code` & `to` as parameters.");
4322
+ const deploylessCallViaBytecode = code && data_;
4323
+ const deploylessCallViaFactory = factory && factoryData && to && data_;
4324
+ const deploylessCall = deploylessCallViaBytecode || deploylessCallViaFactory;
4325
+ const data = (() => {
4326
+ if (deploylessCallViaBytecode) return toDeploylessCallViaBytecodeData({
4327
+ code,
4328
+ data: data_
4329
+ });
4330
+ if (deploylessCallViaFactory) return toDeploylessCallViaFactoryData({
4331
+ data: data_,
4332
+ factory,
4333
+ factoryData,
4334
+ to
4335
+ });
4336
+ return data_;
4337
+ })();
4338
+ try {
4339
+ assertRequest(args);
4340
+ const block = (typeof blockNumber === "bigint" ? numberToHex(blockNumber) : void 0) || blockTag;
4341
+ const rpcBlockOverrides = blockOverrides ? toRpc(blockOverrides) : void 0;
4342
+ const rpcStateOverride = serializeStateOverride(stateOverride);
4343
+ const chainFormat = client.chain?.formatters?.transactionRequest?.format;
4344
+ const request = (chainFormat || formatTransactionRequest)({
4345
+ ...extract(rest, { format: chainFormat }),
4346
+ accessList,
4347
+ account,
4348
+ authorizationList,
4349
+ blobs,
4350
+ data,
4351
+ gas,
4352
+ gasPrice,
4353
+ maxFeePerBlobGas,
4354
+ maxFeePerGas,
4355
+ maxPriorityFeePerGas,
4356
+ nonce,
4357
+ to: deploylessCall ? void 0 : to,
4358
+ value
4359
+ }, "call");
4360
+ if (batch && shouldPerformMulticall({ request }) && !rpcStateOverride && !rpcBlockOverrides) try {
4361
+ return await scheduleMulticall(client, {
4362
+ ...request,
4363
+ blockNumber,
4364
+ blockTag
4365
+ });
4366
+ } catch (err) {
4367
+ if (!(err instanceof ClientChainNotConfiguredError) && !(err instanceof ChainDoesNotSupportContract)) throw err;
4368
+ }
4369
+ const params = (() => {
4370
+ const base = [request, block];
4371
+ if (rpcStateOverride && rpcBlockOverrides) return [
4372
+ ...base,
4373
+ rpcStateOverride,
4374
+ rpcBlockOverrides
4375
+ ];
4376
+ if (rpcStateOverride) return [...base, rpcStateOverride];
4377
+ if (rpcBlockOverrides) return [
4378
+ ...base,
4379
+ {},
4380
+ rpcBlockOverrides
4381
+ ];
4382
+ return base;
4383
+ })();
4384
+ const response = await client.request({
4385
+ method: "eth_call",
4386
+ params
4387
+ });
4388
+ if (response === "0x") return { data: void 0 };
4389
+ return { data: response };
4390
+ } catch (err) {
4391
+ const data = getRevertErrorData(err);
4392
+ const { offchainLookup, offchainLookupSignature } = await import("./ccip-RZzsZ5Mv.js");
4393
+ if (client.ccipRead !== false && data?.slice(0, 10) === offchainLookupSignature && to) return { data: await offchainLookup(client, {
4394
+ data,
4395
+ to
4396
+ }) };
4397
+ if (deploylessCall && data?.slice(0, 10) === "0x101bb98d") throw new CounterfactualDeploymentFailedError({ factory });
4398
+ throw getCallError(err, {
4399
+ ...args,
4400
+ account,
4401
+ chain: client.chain
4402
+ });
4403
+ }
4404
+ }
4405
+ function shouldPerformMulticall({ request }) {
4406
+ const { data, to, ...request_ } = request;
4407
+ if (!data) return false;
4408
+ if (data.startsWith("0x82ad56cb")) return false;
4409
+ if (!to) return false;
4410
+ if (Object.values(request_).filter((x) => typeof x !== "undefined").length > 0) return false;
4411
+ return true;
4412
+ }
4413
+ async function scheduleMulticall(client, args) {
4414
+ const { batchSize = 1024, deployless = false, wait = 0 } = typeof client.batch?.multicall === "object" ? client.batch.multicall : {};
4415
+ const { blockNumber, blockTag = client.experimental_blockTag ?? "latest", data, to } = args;
4416
+ const multicallAddress = (() => {
4417
+ if (deployless) return null;
4418
+ if (args.multicallAddress) return args.multicallAddress;
4419
+ if (client.chain) return getChainContractAddress({
4420
+ blockNumber,
4421
+ chain: client.chain,
4422
+ contract: "multicall3"
4423
+ });
4424
+ throw new ClientChainNotConfiguredError();
4425
+ })();
4426
+ const block = (typeof blockNumber === "bigint" ? numberToHex(blockNumber) : void 0) || blockTag;
4427
+ const { schedule } = createBatchScheduler({
4428
+ id: `${client.uid}.${block}`,
4429
+ wait,
4430
+ shouldSplitBatch(args) {
4431
+ return args.reduce((size, { data }) => size + (data.length - 2), 0) > batchSize * 2;
4432
+ },
4433
+ fn: async (requests) => {
4434
+ const calls = requests.map((request) => ({
4435
+ allowFailure: true,
4436
+ callData: request.data,
4437
+ target: request.to
4438
+ }));
4439
+ const calldata = encodeFunctionData({
4440
+ abi: multicall3Abi,
4441
+ args: [calls],
4442
+ functionName: "aggregate3"
4443
+ });
4444
+ const data = await client.request({
4445
+ method: "eth_call",
4446
+ params: [{ ...multicallAddress === null ? { data: toDeploylessCallViaBytecodeData({
4447
+ code: multicall3Bytecode,
4448
+ data: calldata
4449
+ }) } : {
4450
+ to: multicallAddress,
4451
+ data: calldata
4452
+ } }, block]
4453
+ });
4454
+ return decodeFunctionResult({
4455
+ abi: multicall3Abi,
4456
+ args: [calls],
4457
+ functionName: "aggregate3",
4458
+ data: data || "0x"
4459
+ });
4460
+ }
4461
+ });
4462
+ const [{ returnData, success }] = await schedule({
4463
+ data,
4464
+ to
4465
+ });
4466
+ if (!success) throw new RawContractError({ data: returnData });
4467
+ if (returnData === "0x") return { data: void 0 };
4468
+ return { data: returnData };
4469
+ }
4470
+ function toDeploylessCallViaBytecodeData(parameters) {
4471
+ const { code, data } = parameters;
4472
+ return encodeDeployData({
4473
+ abi: parseAbi(["constructor(bytes, bytes)"]),
4474
+ bytecode: deploylessCallViaBytecodeBytecode,
4475
+ args: [code, data]
4476
+ });
4477
+ }
4478
+ function toDeploylessCallViaFactoryData(parameters) {
4479
+ const { data, factory, factoryData, to } = parameters;
4480
+ return encodeDeployData({
4481
+ abi: parseAbi(["constructor(address, bytes, address, bytes)"]),
4482
+ bytecode: deploylessCallViaFactoryBytecode,
4483
+ args: [
4484
+ to,
4485
+ data,
4486
+ factory,
4487
+ factoryData
4488
+ ]
4489
+ });
4490
+ }
4491
+ /** @internal */
4492
+ function getRevertErrorData(err) {
4493
+ if (!(err instanceof BaseError$2)) return void 0;
4494
+ const error = err.walk();
4495
+ return typeof error?.data === "object" ? error.data?.data : error.data;
4496
+ }
4497
+ //#endregion
4498
+ //#region node_modules/.pnpm/viem@2.47.6_typescript@5.9.3_zod@4.3.6/node_modules/viem/_esm/utils/abi/decodeFunctionData.js
4499
+ function decodeFunctionData(parameters) {
4500
+ const { abi, data } = parameters;
4501
+ const signature = slice$2(data, 0, 4);
4502
+ const description = abi.find((x) => x.type === "function" && signature === toFunctionSelector(formatAbiItem$1(x)));
4503
+ if (!description) throw new AbiFunctionSignatureNotFoundError(signature, { docsPath: "/docs/contract/decodeFunctionData" });
4504
+ return {
4505
+ functionName: description.name,
4506
+ args: "inputs" in description && description.inputs && description.inputs.length > 0 ? decodeAbiParameters(description.inputs, slice$2(data, 4)) : void 0
4507
+ };
4508
+ }
4509
+ //#endregion
4510
+ export { stringify as $, parseAbiParameter as $t, padRight as A, UnknownRpcError as At, concat$1 as B, ContractFunctionExecutionError as Bt, concat as C, ProviderDisconnectedError as Ct, fromNumber as D, TransactionRejectedRpcError as Dt, fromBytes as E, SwitchChainError as Et, toBytes as F, WalletConnectSessionSettlementError as Ft, size$1 as G, decodeErrorResult as Gt, fromHex as H, ContractFunctionZeroDataError as Ht, toNumber as I, HttpRequestError as It, toBoolean as J, encodeFunctionData as Jt, slice$1 as K, decodeAbiParameters as Kt, toString as L, RpcRequestError as Lt, size as M, UnsupportedNonOptionalCapabilityError as Mt, slice as N, UnsupportedProviderMethodError as Nt, fromString as O, UnauthorizedProviderError as Ot, toBigInt as P, UserRejectedRequestError as Pt, validate$1 as Q, parseStructs as Qt, trimLeft as R, TimeoutError as Rt, assert as S, ParseRpcError as St, fromBoolean as T, ResourceUnavailableRpcError as Tt, fromString$1 as U, RawContractError as Ut, from$1 as V, ContractFunctionRevertedError as Vt, isEqual as W, getUrl as Wt, toString$1 as X, toFunctionSelector as Xt, toNumber$1 as Y, getAbiItem as Yt, trimLeft$1 as Z, toEventSelector as Zt, universalResolverResolveAbi as _, InvalidRequestRpcError as _t, getCallError as a, modifiers as an, formatTransactionRequest as at, IntegerOutOfRangeError as b, MethodNotFoundRpcError as bt, deploylessCallViaBytecodeBytecode as c, getNodeError as ct, addressResolverAbi as d, BundleTooLargeError as dt, parseSignature as en, BaseError as et, batchGatewayAbi as f, ChainDisconnectedError as ft, textResolverAbi as g, InvalidParamsRpcError as gt, multicall3Abi as h, InvalidInputRpcError as ht, withResolvers as i, isStructSignature as in, defineTransactionRequest as it, random as j, UnsupportedChainIdError as jt, padLeft as k, UnknownBundleIdError as kt, erc6492SignatureValidatorByteCode as l, AtomicReadyWalletRejectedUpgradeError as lt, erc6492SignatureValidatorAbi as m, InternalRpcError as mt, call as n, InvalidAbiParametersError as nn, assertRequest as nt, getChainContractAddress as o, formatAbiItem as on, defineFormatter as ot, erc1271Abi as p, DuplicateIdError as pt, toBigInt$1 as q, solidityError as qt, createBatchScheduler as r, InvalidAbiItemError as rn, serializeStateOverride as rt, encodeDeployData as s, formatAbiParameters as sn, extract as st, decodeFunctionData as t, splitParameters as tn, decodeFunctionResult as tt, multicall3Bytecode as u, AtomicityNotSupportedError as ut, universalResolverReverseAbi as v, JsonRpcVersionUnsupportedError as vt, from as w, ResourceNotFoundRpcError as wt, InvalidLengthError as x, MethodNotSupportedRpcError as xt, toRpc as y, LimitExceededRpcError as yt, validate as z, CallExecutionError as zt };