@latticexyz/world-module-erc20 2.2.18-f0433092876e2ac9b5b12cd0ecae9c120a2d0368 → 2.2.18

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 (120) hide show
  1. package/dist/_esm-H47RQ4ED.js +3915 -0
  2. package/dist/{_esm-BQNWKNND.js.map → _esm-H47RQ4ED.js.map} +1 -1
  3. package/dist/ccip-VJWDNI4X.js +15 -0
  4. package/dist/chunk-2VXHCW2O.js +132 -0
  5. package/dist/{chunk-TJJDXMQ6.js.map → chunk-2VXHCW2O.js.map} +1 -1
  6. package/dist/chunk-LIWKL347.js +3833 -0
  7. package/dist/{chunk-GSBUANUZ.js.map → chunk-LIWKL347.js.map} +1 -1
  8. package/dist/chunk-PR4QN5HX.js +43 -0
  9. package/dist/internal.js +27 -1
  10. package/dist/internal.js.map +1 -1
  11. package/dist/mud.config.js +83 -1
  12. package/dist/mud.config.js.map +1 -1
  13. package/dist/secp256k1-XVT662DN.js +2395 -0
  14. package/dist/{secp256k1-UMYSD4MC.js.map → secp256k1-XVT662DN.js.map} +1 -1
  15. package/out/AccessManagementSystem.sol/AccessManagementSystem.json +1 -1
  16. package/out/BalanceTransferSystem.sol/BalanceTransferSystem.json +1 -1
  17. package/out/BatchCallSystem.sol/BatchCallSystem.json +1 -1
  18. package/out/Constants.sol/ERC20TableNames.json +1 -1
  19. package/out/Constants.sol/ModuleConstants.json +1 -1
  20. package/out/Constants.sol/OwnableTableNames.json +1 -1
  21. package/out/Constants.sol/PausableTableNames.json +1 -1
  22. package/out/Context.sol/Context.abi.json +15 -1
  23. package/out/Context.sol/Context.abi.json.d.ts +17 -0
  24. package/out/Context.sol/Context.json +1 -1
  25. package/out/Delegation.sol/Delegation.json +1 -1
  26. package/out/ERC20BaseTest.t.sol/ERC20BehaviorTest.json +1 -1
  27. package/out/ERC20BaseTest.t.sol/ERC20WithInternalStoreBehaviorTest.json +1 -1
  28. package/out/ERC20BaseTest.t.sol/ERC20WithInternalStoreTest.json +1 -1
  29. package/out/ERC20BaseTest.t.sol/ERC20WithWorldBehaviorTest.json +1 -1
  30. package/out/ERC20BaseTest.t.sol/ERC20WithWorldTest.json +1 -1
  31. package/out/ERC20BaseTest.t.sol/MockERC20Base.abi.json +13 -0
  32. package/out/ERC20BaseTest.t.sol/MockERC20Base.abi.json.d.ts +13 -0
  33. package/out/ERC20BaseTest.t.sol/MockERC20Base.json +1 -1
  34. package/out/ERC20BaseTest.t.sol/MockERC20WithInternalStore.abi.json +13 -0
  35. package/out/ERC20BaseTest.t.sol/MockERC20WithInternalStore.abi.json.d.ts +13 -0
  36. package/out/ERC20BaseTest.t.sol/MockERC20WithInternalStore.json +1 -1
  37. package/out/ERC20BaseTest.t.sol/MockERC20WithWorld.abi.json +95 -3
  38. package/out/ERC20BaseTest.t.sol/MockERC20WithWorld.abi.json.d.ts +95 -3
  39. package/out/ERC20BaseTest.t.sol/MockERC20WithWorld.json +1 -1
  40. package/out/ERC20BaseTest.t.sol/TestConstants.json +1 -1
  41. package/out/ERC20Burnable.sol/ERC20Burnable.abi.json +13 -0
  42. package/out/ERC20Burnable.sol/ERC20Burnable.abi.json.d.ts +13 -0
  43. package/out/ERC20Burnable.sol/ERC20Burnable.json +1 -1
  44. package/out/ERC20Burnable.t.sol/ERC20BurnableTest.json +1 -1
  45. package/out/ERC20Burnable.t.sol/ERC20BurnableWithInternalStoreTest.json +1 -1
  46. package/out/ERC20Burnable.t.sol/ERC20BurnableWithWorldTest.json +1 -1
  47. package/out/ERC20Burnable.t.sol/MockERC20WithInternalStoreBurnable.abi.json +13 -0
  48. package/out/ERC20Burnable.t.sol/MockERC20WithInternalStoreBurnable.abi.json.d.ts +13 -0
  49. package/out/ERC20Burnable.t.sol/MockERC20WithInternalStoreBurnable.json +1 -1
  50. package/out/ERC20Burnable.t.sol/MockERC20WithWorldBurnable.abi.json +95 -3
  51. package/out/ERC20Burnable.t.sol/MockERC20WithWorldBurnable.abi.json.d.ts +95 -3
  52. package/out/ERC20Burnable.t.sol/MockERC20WithWorldBurnable.json +1 -1
  53. package/out/ERC20Module.sol/ERC20Module.json +1 -1
  54. package/out/ERC20Module.sol/ERC20RegistryLib.json +1 -1
  55. package/out/ERC20Module.t.sol/ERC20ModuleTest.json +1 -1
  56. package/out/ERC20Module.t.sol/TestConstants.json +1 -1
  57. package/out/ERC20Pausable.sol/ERC20Pausable.abi.json +13 -0
  58. package/out/ERC20Pausable.sol/ERC20Pausable.abi.json.d.ts +13 -0
  59. package/out/ERC20Pausable.sol/ERC20Pausable.json +1 -1
  60. package/out/ERC20Pausable.t.sol/ERC20PausableBehaviorTest.json +1 -1
  61. package/out/ERC20Pausable.t.sol/ERC20PausableWithInternalStoreTest.json +1 -1
  62. package/out/ERC20Pausable.t.sol/ERC20PausableWithWorldTest.json +1 -1
  63. package/out/ERC20Pausable.t.sol/MockERC20Pausable.abi.json +13 -0
  64. package/out/ERC20Pausable.t.sol/MockERC20Pausable.abi.json.d.ts +13 -0
  65. package/out/ERC20Pausable.t.sol/MockERC20Pausable.json +1 -1
  66. package/out/ERC20Pausable.t.sol/MockERC20WithInternalStorePausable.abi.json +13 -0
  67. package/out/ERC20Pausable.t.sol/MockERC20WithInternalStorePausable.abi.json.d.ts +13 -0
  68. package/out/ERC20Pausable.t.sol/MockERC20WithInternalStorePausable.json +1 -1
  69. package/out/ERC20Pausable.t.sol/MockERC20WithWorldPausable.abi.json +95 -3
  70. package/out/ERC20Pausable.t.sol/MockERC20WithWorldPausable.abi.json.d.ts +95 -3
  71. package/out/ERC20Pausable.t.sol/MockERC20WithWorldPausable.json +1 -1
  72. package/out/ERC20WithInternalStore.sol/ERC20WithInternalStore.abi.json +13 -0
  73. package/out/ERC20WithInternalStore.sol/ERC20WithInternalStore.abi.json.d.ts +13 -0
  74. package/out/ERC20WithInternalStore.sol/ERC20WithInternalStore.json +1 -1
  75. package/out/ERC20WithWorld.sol/ERC20WithWorld.abi.json +95 -3
  76. package/out/ERC20WithWorld.sol/ERC20WithWorld.abi.json.d.ts +95 -3
  77. package/out/ERC20WithWorld.sol/ERC20WithWorld.json +1 -1
  78. package/out/IBaseWorld.sol/IBaseWorld.json +1 -1
  79. package/out/IWorldRegistrationSystem.sol/IWorldRegistrationSystem.json +1 -1
  80. package/out/InitModule.sol/InitModule.json +1 -1
  81. package/out/MUDERC20.sol/MUDERC20.abi.json +13 -0
  82. package/out/MUDERC20.sol/MUDERC20.abi.json.d.ts +13 -0
  83. package/out/MUDERC20.sol/MUDERC20.json +1 -1
  84. package/out/Module.sol/Module.json +1 -1
  85. package/out/ModuleInstallationSystem.sol/ModuleInstallationSystem.json +1 -1
  86. package/out/Ownable.sol/Ownable.abi.json +13 -0
  87. package/out/Ownable.sol/Ownable.abi.json.d.ts +13 -0
  88. package/out/Ownable.sol/Ownable.json +1 -1
  89. package/out/Pausable.sol/Pausable.abi.json +13 -0
  90. package/out/Pausable.sol/Pausable.abi.json.d.ts +13 -0
  91. package/out/Pausable.sol/Pausable.json +1 -1
  92. package/out/RegistrationSystem.sol/RegistrationSystem.json +1 -1
  93. package/out/StoreConsumer.sol/StoreConsumer.json +1 -1
  94. package/out/StoreRegistrationSystem.sol/StoreRegistrationSystem.json +1 -1
  95. package/out/System.sol/System.json +1 -1
  96. package/out/SystemCall.sol/SystemCall.json +1 -1
  97. package/out/WithStore.sol/WithStore.abi.json +13 -0
  98. package/out/WithStore.sol/WithStore.abi.json.d.ts +13 -0
  99. package/out/WithStore.sol/WithStore.json +1 -1
  100. package/out/WithWorld.sol/WithWorld.abi.json +95 -3
  101. package/out/WithWorld.sol/WithWorld.abi.json.d.ts +95 -3
  102. package/out/WithWorld.sol/WithWorld.json +1 -1
  103. package/out/World.sol/World.json +1 -1
  104. package/out/WorldContext.sol/WorldContextConsumer.json +1 -1
  105. package/out/WorldContext.sol/WorldContextConsumerLib.json +1 -1
  106. package/out/WorldContext.sol/WorldContextProviderLib.json +1 -1
  107. package/out/WorldRegistrationSystem.sol/WorldRegistrationSystem.json +1 -1
  108. package/out/build-info/{04cd01b00610d99132b6410373c2f462.json → 60c60a9593fdb00b3264c36836a28f39.json} +1 -1
  109. package/package.json +8 -8
  110. package/src/examples/ERC20WithWorld.sol +5 -0
  111. package/src/experimental/Constants.sol +7 -7
  112. package/src/experimental/ERC20Module.sol +9 -1
  113. package/dist/_esm-BQNWKNND.js +0 -10
  114. package/dist/ccip-YAWUVTAX.js +0 -2
  115. package/dist/chunk-GSBUANUZ.js +0 -30
  116. package/dist/chunk-LURIOADG.js +0 -2
  117. package/dist/chunk-TJJDXMQ6.js +0 -7
  118. package/dist/secp256k1-UMYSD4MC.js +0 -22
  119. /package/dist/{ccip-YAWUVTAX.js.map → ccip-VJWDNI4X.js.map} +0 -0
  120. /package/dist/{chunk-LURIOADG.js.map → chunk-PR4QN5HX.js.map} +0 -0
@@ -0,0 +1,3833 @@
1
+ import {
2
+ Hash,
3
+ byteSwap32,
4
+ bytes,
5
+ exists,
6
+ isLE,
7
+ number,
8
+ output,
9
+ toBytes,
10
+ u32,
11
+ wrapConstructor,
12
+ wrapXOFConstructorWithOpts
13
+ } from "./chunk-2VXHCW2O.js";
14
+
15
+ // ../../node_modules/.pnpm/abitype@1.0.6_typescript@5.4.2_zod@3.23.8/node_modules/abitype/dist/esm/version.js
16
+ var version = "1.0.6";
17
+
18
+ // ../../node_modules/.pnpm/abitype@1.0.6_typescript@5.4.2_zod@3.23.8/node_modules/abitype/dist/esm/errors.js
19
+ var BaseError = class _BaseError extends Error {
20
+ constructor(shortMessage, args = {}) {
21
+ const details = args.cause instanceof _BaseError ? args.cause.details : args.cause?.message ? args.cause.message : args.details;
22
+ const docsPath4 = args.cause instanceof _BaseError ? args.cause.docsPath || args.docsPath : args.docsPath;
23
+ const message = [
24
+ shortMessage || "An error occurred.",
25
+ "",
26
+ ...args.metaMessages ? [...args.metaMessages, ""] : [],
27
+ ...docsPath4 ? [`Docs: https://abitype.dev${docsPath4}`] : [],
28
+ ...details ? [`Details: ${details}`] : [],
29
+ `Version: abitype@${version}`
30
+ ].join("\n");
31
+ super(message);
32
+ Object.defineProperty(this, "details", {
33
+ enumerable: true,
34
+ configurable: true,
35
+ writable: true,
36
+ value: void 0
37
+ });
38
+ Object.defineProperty(this, "docsPath", {
39
+ enumerable: true,
40
+ configurable: true,
41
+ writable: true,
42
+ value: void 0
43
+ });
44
+ Object.defineProperty(this, "metaMessages", {
45
+ enumerable: true,
46
+ configurable: true,
47
+ writable: true,
48
+ value: void 0
49
+ });
50
+ Object.defineProperty(this, "shortMessage", {
51
+ enumerable: true,
52
+ configurable: true,
53
+ writable: true,
54
+ value: void 0
55
+ });
56
+ Object.defineProperty(this, "name", {
57
+ enumerable: true,
58
+ configurable: true,
59
+ writable: true,
60
+ value: "AbiTypeError"
61
+ });
62
+ if (args.cause)
63
+ this.cause = args.cause;
64
+ this.details = details;
65
+ this.docsPath = docsPath4;
66
+ this.metaMessages = args.metaMessages;
67
+ this.shortMessage = shortMessage;
68
+ }
69
+ };
70
+
71
+ // ../../node_modules/.pnpm/abitype@1.0.6_typescript@5.4.2_zod@3.23.8/node_modules/abitype/dist/esm/regex.js
72
+ function execTyped(regex, string) {
73
+ const match = regex.exec(string);
74
+ return match?.groups;
75
+ }
76
+ var bytesRegex = /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/;
77
+ var 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)?$/;
78
+ var isTupleRegex = /^\(.+?\).*?$/;
79
+
80
+ // ../../node_modules/.pnpm/abitype@1.0.6_typescript@5.4.2_zod@3.23.8/node_modules/abitype/dist/esm/human-readable/formatAbiParameter.js
81
+ var tupleRegex = /^tuple(?<array>(\[(\d*)\])*)$/;
82
+ function formatAbiParameter(abiParameter) {
83
+ let type = abiParameter.type;
84
+ if (tupleRegex.test(abiParameter.type) && "components" in abiParameter) {
85
+ type = "(";
86
+ const length = abiParameter.components.length;
87
+ for (let i = 0; i < length; i++) {
88
+ const component = abiParameter.components[i];
89
+ type += formatAbiParameter(component);
90
+ if (i < length - 1)
91
+ type += ", ";
92
+ }
93
+ const result = execTyped(tupleRegex, abiParameter.type);
94
+ type += `)${result?.array ?? ""}`;
95
+ return formatAbiParameter({
96
+ ...abiParameter,
97
+ type
98
+ });
99
+ }
100
+ if ("indexed" in abiParameter && abiParameter.indexed)
101
+ type = `${type} indexed`;
102
+ if (abiParameter.name)
103
+ return `${type} ${abiParameter.name}`;
104
+ return type;
105
+ }
106
+
107
+ // ../../node_modules/.pnpm/abitype@1.0.6_typescript@5.4.2_zod@3.23.8/node_modules/abitype/dist/esm/human-readable/formatAbiParameters.js
108
+ function formatAbiParameters(abiParameters) {
109
+ let params = "";
110
+ const length = abiParameters.length;
111
+ for (let i = 0; i < length; i++) {
112
+ const abiParameter = abiParameters[i];
113
+ params += formatAbiParameter(abiParameter);
114
+ if (i !== length - 1)
115
+ params += ", ";
116
+ }
117
+ return params;
118
+ }
119
+
120
+ // ../../node_modules/.pnpm/abitype@1.0.6_typescript@5.4.2_zod@3.23.8/node_modules/abitype/dist/esm/human-readable/formatAbiItem.js
121
+ function formatAbiItem(abiItem) {
122
+ if (abiItem.type === "function")
123
+ return `function ${abiItem.name}(${formatAbiParameters(abiItem.inputs)})${abiItem.stateMutability && abiItem.stateMutability !== "nonpayable" ? ` ${abiItem.stateMutability}` : ""}${abiItem.outputs.length ? ` returns (${formatAbiParameters(abiItem.outputs)})` : ""}`;
124
+ if (abiItem.type === "event")
125
+ return `event ${abiItem.name}(${formatAbiParameters(abiItem.inputs)})`;
126
+ if (abiItem.type === "error")
127
+ return `error ${abiItem.name}(${formatAbiParameters(abiItem.inputs)})`;
128
+ if (abiItem.type === "constructor")
129
+ return `constructor(${formatAbiParameters(abiItem.inputs)})${abiItem.stateMutability === "payable" ? " payable" : ""}`;
130
+ if (abiItem.type === "fallback")
131
+ return "fallback()";
132
+ return "receive() external payable";
133
+ }
134
+
135
+ // ../../node_modules/.pnpm/abitype@1.0.6_typescript@5.4.2_zod@3.23.8/node_modules/abitype/dist/esm/human-readable/runtime/signatures.js
136
+ var errorSignatureRegex = /^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;
137
+ function isErrorSignature(signature) {
138
+ return errorSignatureRegex.test(signature);
139
+ }
140
+ function execErrorSignature(signature) {
141
+ return execTyped(errorSignatureRegex, signature);
142
+ }
143
+ var eventSignatureRegex = /^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;
144
+ function isEventSignature(signature) {
145
+ return eventSignatureRegex.test(signature);
146
+ }
147
+ function execEventSignature(signature) {
148
+ return execTyped(eventSignatureRegex, signature);
149
+ }
150
+ var functionSignatureRegex = /^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;
151
+ function isFunctionSignature(signature) {
152
+ return functionSignatureRegex.test(signature);
153
+ }
154
+ function execFunctionSignature(signature) {
155
+ return execTyped(functionSignatureRegex, signature);
156
+ }
157
+ var structSignatureRegex = /^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;
158
+ function isStructSignature(signature) {
159
+ return structSignatureRegex.test(signature);
160
+ }
161
+ function execStructSignature(signature) {
162
+ return execTyped(structSignatureRegex, signature);
163
+ }
164
+ var constructorSignatureRegex = /^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;
165
+ function isConstructorSignature(signature) {
166
+ return constructorSignatureRegex.test(signature);
167
+ }
168
+ function execConstructorSignature(signature) {
169
+ return execTyped(constructorSignatureRegex, signature);
170
+ }
171
+ var fallbackSignatureRegex = /^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;
172
+ function isFallbackSignature(signature) {
173
+ return fallbackSignatureRegex.test(signature);
174
+ }
175
+ var receiveSignatureRegex = /^receive\(\) external payable$/;
176
+ function isReceiveSignature(signature) {
177
+ return receiveSignatureRegex.test(signature);
178
+ }
179
+ var eventModifiers = /* @__PURE__ */ new Set(["indexed"]);
180
+ var functionModifiers = /* @__PURE__ */ new Set([
181
+ "calldata",
182
+ "memory",
183
+ "storage"
184
+ ]);
185
+
186
+ // ../../node_modules/.pnpm/abitype@1.0.6_typescript@5.4.2_zod@3.23.8/node_modules/abitype/dist/esm/human-readable/errors/abiItem.js
187
+ var UnknownTypeError = class extends BaseError {
188
+ constructor({ type }) {
189
+ super("Unknown type.", {
190
+ metaMessages: [
191
+ `Type "${type}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`
192
+ ]
193
+ });
194
+ Object.defineProperty(this, "name", {
195
+ enumerable: true,
196
+ configurable: true,
197
+ writable: true,
198
+ value: "UnknownTypeError"
199
+ });
200
+ }
201
+ };
202
+ var UnknownSolidityTypeError = class extends BaseError {
203
+ constructor({ type }) {
204
+ super("Unknown type.", {
205
+ metaMessages: [`Type "${type}" is not a valid ABI type.`]
206
+ });
207
+ Object.defineProperty(this, "name", {
208
+ enumerable: true,
209
+ configurable: true,
210
+ writable: true,
211
+ value: "UnknownSolidityTypeError"
212
+ });
213
+ }
214
+ };
215
+
216
+ // ../../node_modules/.pnpm/abitype@1.0.6_typescript@5.4.2_zod@3.23.8/node_modules/abitype/dist/esm/human-readable/errors/abiParameter.js
217
+ var InvalidParameterError = class extends BaseError {
218
+ constructor({ param }) {
219
+ super("Invalid ABI parameter.", {
220
+ details: param
221
+ });
222
+ Object.defineProperty(this, "name", {
223
+ enumerable: true,
224
+ configurable: true,
225
+ writable: true,
226
+ value: "InvalidParameterError"
227
+ });
228
+ }
229
+ };
230
+ var SolidityProtectedKeywordError = class extends BaseError {
231
+ constructor({ param, name }) {
232
+ super("Invalid ABI parameter.", {
233
+ details: param,
234
+ metaMessages: [
235
+ `"${name}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`
236
+ ]
237
+ });
238
+ Object.defineProperty(this, "name", {
239
+ enumerable: true,
240
+ configurable: true,
241
+ writable: true,
242
+ value: "SolidityProtectedKeywordError"
243
+ });
244
+ }
245
+ };
246
+ var InvalidModifierError = class extends BaseError {
247
+ constructor({ param, type, modifier }) {
248
+ super("Invalid ABI parameter.", {
249
+ details: param,
250
+ metaMessages: [
251
+ `Modifier "${modifier}" not allowed${type ? ` in "${type}" type` : ""}.`
252
+ ]
253
+ });
254
+ Object.defineProperty(this, "name", {
255
+ enumerable: true,
256
+ configurable: true,
257
+ writable: true,
258
+ value: "InvalidModifierError"
259
+ });
260
+ }
261
+ };
262
+ var InvalidFunctionModifierError = class extends BaseError {
263
+ constructor({ param, type, modifier }) {
264
+ super("Invalid ABI parameter.", {
265
+ details: param,
266
+ metaMessages: [
267
+ `Modifier "${modifier}" not allowed${type ? ` in "${type}" type` : ""}.`,
268
+ `Data location can only be specified for array, struct, or mapping types, but "${modifier}" was given.`
269
+ ]
270
+ });
271
+ Object.defineProperty(this, "name", {
272
+ enumerable: true,
273
+ configurable: true,
274
+ writable: true,
275
+ value: "InvalidFunctionModifierError"
276
+ });
277
+ }
278
+ };
279
+ var InvalidAbiTypeParameterError = class extends BaseError {
280
+ constructor({ abiParameter }) {
281
+ super("Invalid ABI parameter.", {
282
+ details: JSON.stringify(abiParameter, null, 2),
283
+ metaMessages: ["ABI parameter type is invalid."]
284
+ });
285
+ Object.defineProperty(this, "name", {
286
+ enumerable: true,
287
+ configurable: true,
288
+ writable: true,
289
+ value: "InvalidAbiTypeParameterError"
290
+ });
291
+ }
292
+ };
293
+
294
+ // ../../node_modules/.pnpm/abitype@1.0.6_typescript@5.4.2_zod@3.23.8/node_modules/abitype/dist/esm/human-readable/errors/signature.js
295
+ var InvalidSignatureError = class extends BaseError {
296
+ constructor({ signature, type }) {
297
+ super(`Invalid ${type} signature.`, {
298
+ details: signature
299
+ });
300
+ Object.defineProperty(this, "name", {
301
+ enumerable: true,
302
+ configurable: true,
303
+ writable: true,
304
+ value: "InvalidSignatureError"
305
+ });
306
+ }
307
+ };
308
+ var UnknownSignatureError = class extends BaseError {
309
+ constructor({ signature }) {
310
+ super("Unknown signature.", {
311
+ details: signature
312
+ });
313
+ Object.defineProperty(this, "name", {
314
+ enumerable: true,
315
+ configurable: true,
316
+ writable: true,
317
+ value: "UnknownSignatureError"
318
+ });
319
+ }
320
+ };
321
+ var InvalidStructSignatureError = class extends BaseError {
322
+ constructor({ signature }) {
323
+ super("Invalid struct signature.", {
324
+ details: signature,
325
+ metaMessages: ["No properties exist."]
326
+ });
327
+ Object.defineProperty(this, "name", {
328
+ enumerable: true,
329
+ configurable: true,
330
+ writable: true,
331
+ value: "InvalidStructSignatureError"
332
+ });
333
+ }
334
+ };
335
+
336
+ // ../../node_modules/.pnpm/abitype@1.0.6_typescript@5.4.2_zod@3.23.8/node_modules/abitype/dist/esm/human-readable/errors/struct.js
337
+ var CircularReferenceError = class extends BaseError {
338
+ constructor({ type }) {
339
+ super("Circular reference detected.", {
340
+ metaMessages: [`Struct "${type}" is a circular reference.`]
341
+ });
342
+ Object.defineProperty(this, "name", {
343
+ enumerable: true,
344
+ configurable: true,
345
+ writable: true,
346
+ value: "CircularReferenceError"
347
+ });
348
+ }
349
+ };
350
+
351
+ // ../../node_modules/.pnpm/abitype@1.0.6_typescript@5.4.2_zod@3.23.8/node_modules/abitype/dist/esm/human-readable/errors/splitParameters.js
352
+ var InvalidParenthesisError = class extends BaseError {
353
+ constructor({ current, depth }) {
354
+ super("Unbalanced parentheses.", {
355
+ metaMessages: [
356
+ `"${current.trim()}" has too many ${depth > 0 ? "opening" : "closing"} parentheses.`
357
+ ],
358
+ details: `Depth "${depth}"`
359
+ });
360
+ Object.defineProperty(this, "name", {
361
+ enumerable: true,
362
+ configurable: true,
363
+ writable: true,
364
+ value: "InvalidParenthesisError"
365
+ });
366
+ }
367
+ };
368
+
369
+ // ../../node_modules/.pnpm/abitype@1.0.6_typescript@5.4.2_zod@3.23.8/node_modules/abitype/dist/esm/human-readable/runtime/cache.js
370
+ function getParameterCacheKey(param, type) {
371
+ if (type)
372
+ return `${type}:${param}`;
373
+ return param;
374
+ }
375
+ var parameterCache = /* @__PURE__ */ new Map([
376
+ // Unnamed
377
+ ["address", { type: "address" }],
378
+ ["bool", { type: "bool" }],
379
+ ["bytes", { type: "bytes" }],
380
+ ["bytes32", { type: "bytes32" }],
381
+ ["int", { type: "int256" }],
382
+ ["int256", { type: "int256" }],
383
+ ["string", { type: "string" }],
384
+ ["uint", { type: "uint256" }],
385
+ ["uint8", { type: "uint8" }],
386
+ ["uint16", { type: "uint16" }],
387
+ ["uint24", { type: "uint24" }],
388
+ ["uint32", { type: "uint32" }],
389
+ ["uint64", { type: "uint64" }],
390
+ ["uint96", { type: "uint96" }],
391
+ ["uint112", { type: "uint112" }],
392
+ ["uint160", { type: "uint160" }],
393
+ ["uint192", { type: "uint192" }],
394
+ ["uint256", { type: "uint256" }],
395
+ // Named
396
+ ["address owner", { type: "address", name: "owner" }],
397
+ ["address to", { type: "address", name: "to" }],
398
+ ["bool approved", { type: "bool", name: "approved" }],
399
+ ["bytes _data", { type: "bytes", name: "_data" }],
400
+ ["bytes data", { type: "bytes", name: "data" }],
401
+ ["bytes signature", { type: "bytes", name: "signature" }],
402
+ ["bytes32 hash", { type: "bytes32", name: "hash" }],
403
+ ["bytes32 r", { type: "bytes32", name: "r" }],
404
+ ["bytes32 root", { type: "bytes32", name: "root" }],
405
+ ["bytes32 s", { type: "bytes32", name: "s" }],
406
+ ["string name", { type: "string", name: "name" }],
407
+ ["string symbol", { type: "string", name: "symbol" }],
408
+ ["string tokenURI", { type: "string", name: "tokenURI" }],
409
+ ["uint tokenId", { type: "uint256", name: "tokenId" }],
410
+ ["uint8 v", { type: "uint8", name: "v" }],
411
+ ["uint256 balance", { type: "uint256", name: "balance" }],
412
+ ["uint256 tokenId", { type: "uint256", name: "tokenId" }],
413
+ ["uint256 value", { type: "uint256", name: "value" }],
414
+ // Indexed
415
+ [
416
+ "event:address indexed from",
417
+ { type: "address", name: "from", indexed: true }
418
+ ],
419
+ ["event:address indexed to", { type: "address", name: "to", indexed: true }],
420
+ [
421
+ "event:uint indexed tokenId",
422
+ { type: "uint256", name: "tokenId", indexed: true }
423
+ ],
424
+ [
425
+ "event:uint256 indexed tokenId",
426
+ { type: "uint256", name: "tokenId", indexed: true }
427
+ ]
428
+ ]);
429
+
430
+ // ../../node_modules/.pnpm/abitype@1.0.6_typescript@5.4.2_zod@3.23.8/node_modules/abitype/dist/esm/human-readable/runtime/utils.js
431
+ function parseSignature(signature, structs = {}) {
432
+ if (isFunctionSignature(signature)) {
433
+ const match = execFunctionSignature(signature);
434
+ if (!match)
435
+ throw new InvalidSignatureError({ signature, type: "function" });
436
+ const inputParams = splitParameters(match.parameters);
437
+ const inputs = [];
438
+ const inputLength = inputParams.length;
439
+ for (let i = 0; i < inputLength; i++) {
440
+ inputs.push(parseAbiParameter(inputParams[i], {
441
+ modifiers: functionModifiers,
442
+ structs,
443
+ type: "function"
444
+ }));
445
+ }
446
+ const outputs = [];
447
+ if (match.returns) {
448
+ const outputParams = splitParameters(match.returns);
449
+ const outputLength = outputParams.length;
450
+ for (let i = 0; i < outputLength; i++) {
451
+ outputs.push(parseAbiParameter(outputParams[i], {
452
+ modifiers: functionModifiers,
453
+ structs,
454
+ type: "function"
455
+ }));
456
+ }
457
+ }
458
+ return {
459
+ name: match.name,
460
+ type: "function",
461
+ stateMutability: match.stateMutability ?? "nonpayable",
462
+ inputs,
463
+ outputs
464
+ };
465
+ }
466
+ if (isEventSignature(signature)) {
467
+ const match = execEventSignature(signature);
468
+ if (!match)
469
+ throw new InvalidSignatureError({ signature, type: "event" });
470
+ const params = splitParameters(match.parameters);
471
+ const abiParameters = [];
472
+ const length = params.length;
473
+ for (let i = 0; i < length; i++) {
474
+ abiParameters.push(parseAbiParameter(params[i], {
475
+ modifiers: eventModifiers,
476
+ structs,
477
+ type: "event"
478
+ }));
479
+ }
480
+ return { name: match.name, type: "event", inputs: abiParameters };
481
+ }
482
+ if (isErrorSignature(signature)) {
483
+ const match = execErrorSignature(signature);
484
+ if (!match)
485
+ throw new InvalidSignatureError({ signature, type: "error" });
486
+ const params = splitParameters(match.parameters);
487
+ const abiParameters = [];
488
+ const length = params.length;
489
+ for (let i = 0; i < length; i++) {
490
+ abiParameters.push(parseAbiParameter(params[i], { structs, type: "error" }));
491
+ }
492
+ return { name: match.name, type: "error", inputs: abiParameters };
493
+ }
494
+ if (isConstructorSignature(signature)) {
495
+ const match = execConstructorSignature(signature);
496
+ if (!match)
497
+ throw new InvalidSignatureError({ signature, type: "constructor" });
498
+ const params = splitParameters(match.parameters);
499
+ const abiParameters = [];
500
+ const length = params.length;
501
+ for (let i = 0; i < length; i++) {
502
+ abiParameters.push(parseAbiParameter(params[i], { structs, type: "constructor" }));
503
+ }
504
+ return {
505
+ type: "constructor",
506
+ stateMutability: match.stateMutability ?? "nonpayable",
507
+ inputs: abiParameters
508
+ };
509
+ }
510
+ if (isFallbackSignature(signature))
511
+ return { type: "fallback" };
512
+ if (isReceiveSignature(signature))
513
+ return {
514
+ type: "receive",
515
+ stateMutability: "payable"
516
+ };
517
+ throw new UnknownSignatureError({ signature });
518
+ }
519
+ var abiParameterWithoutTupleRegex = /^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/;
520
+ var abiParameterWithTupleRegex = /^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/;
521
+ var dynamicIntegerRegex = /^u?int$/;
522
+ function parseAbiParameter(param, options) {
523
+ const parameterCacheKey = getParameterCacheKey(param, options?.type);
524
+ if (parameterCache.has(parameterCacheKey))
525
+ return parameterCache.get(parameterCacheKey);
526
+ const isTuple = isTupleRegex.test(param);
527
+ const match = execTyped(isTuple ? abiParameterWithTupleRegex : abiParameterWithoutTupleRegex, param);
528
+ if (!match)
529
+ throw new InvalidParameterError({ param });
530
+ if (match.name && isSolidityKeyword(match.name))
531
+ throw new SolidityProtectedKeywordError({ param, name: match.name });
532
+ const name = match.name ? { name: match.name } : {};
533
+ const indexed = match.modifier === "indexed" ? { indexed: true } : {};
534
+ const structs = options?.structs ?? {};
535
+ let type;
536
+ let components = {};
537
+ if (isTuple) {
538
+ type = "tuple";
539
+ const params = splitParameters(match.type);
540
+ const components_ = [];
541
+ const length = params.length;
542
+ for (let i = 0; i < length; i++) {
543
+ components_.push(parseAbiParameter(params[i], { structs }));
544
+ }
545
+ components = { components: components_ };
546
+ } else if (match.type in structs) {
547
+ type = "tuple";
548
+ components = { components: structs[match.type] };
549
+ } else if (dynamicIntegerRegex.test(match.type)) {
550
+ type = `${match.type}256`;
551
+ } else {
552
+ type = match.type;
553
+ if (!(options?.type === "struct") && !isSolidityType(type))
554
+ throw new UnknownSolidityTypeError({ type });
555
+ }
556
+ if (match.modifier) {
557
+ if (!options?.modifiers?.has?.(match.modifier))
558
+ throw new InvalidModifierError({
559
+ param,
560
+ type: options?.type,
561
+ modifier: match.modifier
562
+ });
563
+ if (functionModifiers.has(match.modifier) && !isValidDataLocation(type, !!match.array))
564
+ throw new InvalidFunctionModifierError({
565
+ param,
566
+ type: options?.type,
567
+ modifier: match.modifier
568
+ });
569
+ }
570
+ const abiParameter = {
571
+ type: `${type}${match.array ?? ""}`,
572
+ ...name,
573
+ ...indexed,
574
+ ...components
575
+ };
576
+ parameterCache.set(parameterCacheKey, abiParameter);
577
+ return abiParameter;
578
+ }
579
+ function splitParameters(params, result = [], current = "", depth = 0) {
580
+ const length = params.trim().length;
581
+ for (let i = 0; i < length; i++) {
582
+ const char = params[i];
583
+ const tail = params.slice(i + 1);
584
+ switch (char) {
585
+ case ",":
586
+ return depth === 0 ? splitParameters(tail, [...result, current.trim()]) : splitParameters(tail, result, `${current}${char}`, depth);
587
+ case "(":
588
+ return splitParameters(tail, result, `${current}${char}`, depth + 1);
589
+ case ")":
590
+ return splitParameters(tail, result, `${current}${char}`, depth - 1);
591
+ default:
592
+ return splitParameters(tail, result, `${current}${char}`, depth);
593
+ }
594
+ }
595
+ if (current === "")
596
+ return result;
597
+ if (depth !== 0)
598
+ throw new InvalidParenthesisError({ current, depth });
599
+ result.push(current.trim());
600
+ return result;
601
+ }
602
+ function isSolidityType(type) {
603
+ return type === "address" || type === "bool" || type === "function" || type === "string" || bytesRegex.test(type) || integerRegex.test(type);
604
+ }
605
+ var 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)$/;
606
+ function isSolidityKeyword(name) {
607
+ return name === "address" || name === "bool" || name === "function" || name === "string" || name === "tuple" || bytesRegex.test(name) || integerRegex.test(name) || protectedKeywordsRegex.test(name);
608
+ }
609
+ function isValidDataLocation(type, isArray) {
610
+ return isArray || type === "bytes" || type === "string" || type === "tuple";
611
+ }
612
+
613
+ // ../../node_modules/.pnpm/abitype@1.0.6_typescript@5.4.2_zod@3.23.8/node_modules/abitype/dist/esm/human-readable/runtime/structs.js
614
+ function parseStructs(signatures) {
615
+ const shallowStructs = {};
616
+ const signaturesLength = signatures.length;
617
+ for (let i = 0; i < signaturesLength; i++) {
618
+ const signature = signatures[i];
619
+ if (!isStructSignature(signature))
620
+ continue;
621
+ const match = execStructSignature(signature);
622
+ if (!match)
623
+ throw new InvalidSignatureError({ signature, type: "struct" });
624
+ const properties = match.properties.split(";");
625
+ const components = [];
626
+ const propertiesLength = properties.length;
627
+ for (let k = 0; k < propertiesLength; k++) {
628
+ const property = properties[k];
629
+ const trimmed = property.trim();
630
+ if (!trimmed)
631
+ continue;
632
+ const abiParameter = parseAbiParameter(trimmed, {
633
+ type: "struct"
634
+ });
635
+ components.push(abiParameter);
636
+ }
637
+ if (!components.length)
638
+ throw new InvalidStructSignatureError({ signature });
639
+ shallowStructs[match.name] = components;
640
+ }
641
+ const resolvedStructs = {};
642
+ const entries = Object.entries(shallowStructs);
643
+ const entriesLength = entries.length;
644
+ for (let i = 0; i < entriesLength; i++) {
645
+ const [name, parameters] = entries[i];
646
+ resolvedStructs[name] = resolveStructs(parameters, shallowStructs);
647
+ }
648
+ return resolvedStructs;
649
+ }
650
+ var typeWithoutTupleRegex = /^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;
651
+ function resolveStructs(abiParameters, structs, ancestors = /* @__PURE__ */ new Set()) {
652
+ const components = [];
653
+ const length = abiParameters.length;
654
+ for (let i = 0; i < length; i++) {
655
+ const abiParameter = abiParameters[i];
656
+ const isTuple = isTupleRegex.test(abiParameter.type);
657
+ if (isTuple)
658
+ components.push(abiParameter);
659
+ else {
660
+ const match = execTyped(typeWithoutTupleRegex, abiParameter.type);
661
+ if (!match?.type)
662
+ throw new InvalidAbiTypeParameterError({ abiParameter });
663
+ const { array, type } = match;
664
+ if (type in structs) {
665
+ if (ancestors.has(type))
666
+ throw new CircularReferenceError({ type });
667
+ components.push({
668
+ ...abiParameter,
669
+ type: `tuple${array ?? ""}`,
670
+ components: resolveStructs(structs[type] ?? [], structs, /* @__PURE__ */ new Set([...ancestors, type]))
671
+ });
672
+ } else {
673
+ if (isSolidityType(type))
674
+ components.push(abiParameter);
675
+ else
676
+ throw new UnknownTypeError({ type });
677
+ }
678
+ }
679
+ }
680
+ return components;
681
+ }
682
+
683
+ // ../../node_modules/.pnpm/abitype@1.0.6_typescript@5.4.2_zod@3.23.8/node_modules/abitype/dist/esm/human-readable/parseAbi.js
684
+ function parseAbi(signatures) {
685
+ const structs = parseStructs(signatures);
686
+ const abi = [];
687
+ const length = signatures.length;
688
+ for (let i = 0; i < length; i++) {
689
+ const signature = signatures[i];
690
+ if (isStructSignature(signature))
691
+ continue;
692
+ abi.push(parseSignature(signature, structs));
693
+ }
694
+ return abi;
695
+ }
696
+
697
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/accounts/utils/parseAccount.js
698
+ function parseAccount(account) {
699
+ if (typeof account === "string")
700
+ return { address: account, type: "json-rpc" };
701
+ return account;
702
+ }
703
+
704
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/constants/abis.js
705
+ var multicall3Abi = [
706
+ {
707
+ inputs: [
708
+ {
709
+ components: [
710
+ {
711
+ name: "target",
712
+ type: "address"
713
+ },
714
+ {
715
+ name: "allowFailure",
716
+ type: "bool"
717
+ },
718
+ {
719
+ name: "callData",
720
+ type: "bytes"
721
+ }
722
+ ],
723
+ name: "calls",
724
+ type: "tuple[]"
725
+ }
726
+ ],
727
+ name: "aggregate3",
728
+ outputs: [
729
+ {
730
+ components: [
731
+ {
732
+ name: "success",
733
+ type: "bool"
734
+ },
735
+ {
736
+ name: "returnData",
737
+ type: "bytes"
738
+ }
739
+ ],
740
+ name: "returnData",
741
+ type: "tuple[]"
742
+ }
743
+ ],
744
+ stateMutability: "view",
745
+ type: "function"
746
+ }
747
+ ];
748
+ var universalResolverErrors = [
749
+ {
750
+ inputs: [],
751
+ name: "ResolverNotFound",
752
+ type: "error"
753
+ },
754
+ {
755
+ inputs: [],
756
+ name: "ResolverWildcardNotSupported",
757
+ type: "error"
758
+ },
759
+ {
760
+ inputs: [],
761
+ name: "ResolverNotContract",
762
+ type: "error"
763
+ },
764
+ {
765
+ inputs: [
766
+ {
767
+ name: "returnData",
768
+ type: "bytes"
769
+ }
770
+ ],
771
+ name: "ResolverError",
772
+ type: "error"
773
+ },
774
+ {
775
+ inputs: [
776
+ {
777
+ components: [
778
+ {
779
+ name: "status",
780
+ type: "uint16"
781
+ },
782
+ {
783
+ name: "message",
784
+ type: "string"
785
+ }
786
+ ],
787
+ name: "errors",
788
+ type: "tuple[]"
789
+ }
790
+ ],
791
+ name: "HttpError",
792
+ type: "error"
793
+ }
794
+ ];
795
+ var universalResolverResolveAbi = [
796
+ ...universalResolverErrors,
797
+ {
798
+ name: "resolve",
799
+ type: "function",
800
+ stateMutability: "view",
801
+ inputs: [
802
+ { name: "name", type: "bytes" },
803
+ { name: "data", type: "bytes" }
804
+ ],
805
+ outputs: [
806
+ { name: "", type: "bytes" },
807
+ { name: "address", type: "address" }
808
+ ]
809
+ },
810
+ {
811
+ name: "resolve",
812
+ type: "function",
813
+ stateMutability: "view",
814
+ inputs: [
815
+ { name: "name", type: "bytes" },
816
+ { name: "data", type: "bytes" },
817
+ { name: "gateways", type: "string[]" }
818
+ ],
819
+ outputs: [
820
+ { name: "", type: "bytes" },
821
+ { name: "address", type: "address" }
822
+ ]
823
+ }
824
+ ];
825
+ var universalResolverReverseAbi = [
826
+ ...universalResolverErrors,
827
+ {
828
+ name: "reverse",
829
+ type: "function",
830
+ stateMutability: "view",
831
+ inputs: [{ type: "bytes", name: "reverseName" }],
832
+ outputs: [
833
+ { type: "string", name: "resolvedName" },
834
+ { type: "address", name: "resolvedAddress" },
835
+ { type: "address", name: "reverseResolver" },
836
+ { type: "address", name: "resolver" }
837
+ ]
838
+ },
839
+ {
840
+ name: "reverse",
841
+ type: "function",
842
+ stateMutability: "view",
843
+ inputs: [
844
+ { type: "bytes", name: "reverseName" },
845
+ { type: "string[]", name: "gateways" }
846
+ ],
847
+ outputs: [
848
+ { type: "string", name: "resolvedName" },
849
+ { type: "address", name: "resolvedAddress" },
850
+ { type: "address", name: "reverseResolver" },
851
+ { type: "address", name: "resolver" }
852
+ ]
853
+ }
854
+ ];
855
+
856
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/constants/contract.js
857
+ var aggregate3Signature = "0x82ad56cb";
858
+
859
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/constants/contracts.js
860
+ var deploylessCallViaBytecodeBytecode = "0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe";
861
+ var deploylessCallViaFactoryBytecode = "0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe";
862
+
863
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/errors/version.js
864
+ var version2 = "2.21.19";
865
+
866
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/errors/base.js
867
+ var errorConfig = {
868
+ getDocsUrl: ({ docsBaseUrl, docsPath: docsPath4 = "", docsSlug }) => docsPath4 ? `${docsBaseUrl ?? "https://viem.sh"}${docsPath4}${docsSlug ? `#${docsSlug}` : ""}` : void 0,
869
+ version: version2
870
+ };
871
+ var BaseError2 = class _BaseError extends Error {
872
+ constructor(shortMessage, args = {}) {
873
+ const details = (() => {
874
+ if (args.cause instanceof _BaseError)
875
+ return args.cause.details;
876
+ if (args.cause?.message)
877
+ return args.cause.message;
878
+ return args.details;
879
+ })();
880
+ const docsPath4 = (() => {
881
+ if (args.cause instanceof _BaseError)
882
+ return args.cause.docsPath || args.docsPath;
883
+ return args.docsPath;
884
+ })();
885
+ const docsUrl = errorConfig.getDocsUrl?.({ ...args, docsPath: docsPath4 });
886
+ const message = [
887
+ shortMessage || "An error occurred.",
888
+ "",
889
+ ...args.metaMessages ? [...args.metaMessages, ""] : [],
890
+ ...docsUrl ? [`Docs: ${docsUrl}`] : [],
891
+ ...details ? [`Details: ${details}`] : [],
892
+ ...errorConfig.version ? [`Version: ${errorConfig.version}`] : []
893
+ ].join("\n");
894
+ super(message, args.cause ? { cause: args.cause } : void 0);
895
+ Object.defineProperty(this, "details", {
896
+ enumerable: true,
897
+ configurable: true,
898
+ writable: true,
899
+ value: void 0
900
+ });
901
+ Object.defineProperty(this, "docsPath", {
902
+ enumerable: true,
903
+ configurable: true,
904
+ writable: true,
905
+ value: void 0
906
+ });
907
+ Object.defineProperty(this, "metaMessages", {
908
+ enumerable: true,
909
+ configurable: true,
910
+ writable: true,
911
+ value: void 0
912
+ });
913
+ Object.defineProperty(this, "shortMessage", {
914
+ enumerable: true,
915
+ configurable: true,
916
+ writable: true,
917
+ value: void 0
918
+ });
919
+ Object.defineProperty(this, "version", {
920
+ enumerable: true,
921
+ configurable: true,
922
+ writable: true,
923
+ value: void 0
924
+ });
925
+ Object.defineProperty(this, "name", {
926
+ enumerable: true,
927
+ configurable: true,
928
+ writable: true,
929
+ value: "BaseError"
930
+ });
931
+ this.details = details;
932
+ this.docsPath = docsPath4;
933
+ this.metaMessages = args.metaMessages;
934
+ this.name = args.name ?? this.name;
935
+ this.shortMessage = shortMessage;
936
+ this.version = version2;
937
+ }
938
+ walk(fn) {
939
+ return walk(this, fn);
940
+ }
941
+ };
942
+ function walk(err, fn) {
943
+ if (fn?.(err))
944
+ return err;
945
+ if (err && typeof err === "object" && "cause" in err)
946
+ return walk(err.cause, fn);
947
+ return fn ? null : err;
948
+ }
949
+
950
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/errors/chain.js
951
+ var ChainDoesNotSupportContract = class extends BaseError2 {
952
+ constructor({ blockNumber, chain, contract }) {
953
+ super(`Chain "${chain.name}" does not support contract "${contract.name}".`, {
954
+ metaMessages: [
955
+ "This could be due to any of the following:",
956
+ ...blockNumber && contract.blockCreated && contract.blockCreated > blockNumber ? [
957
+ `- The contract "${contract.name}" was not deployed until block ${contract.blockCreated} (current block ${blockNumber}).`
958
+ ] : [
959
+ `- The chain does not have the contract "${contract.name}" configured.`
960
+ ]
961
+ ],
962
+ name: "ChainDoesNotSupportContract"
963
+ });
964
+ }
965
+ };
966
+ var ClientChainNotConfiguredError = class extends BaseError2 {
967
+ constructor() {
968
+ super("No chain was provided to the Client.", {
969
+ name: "ClientChainNotConfiguredError"
970
+ });
971
+ }
972
+ };
973
+
974
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/constants/solidity.js
975
+ var solidityError = {
976
+ inputs: [
977
+ {
978
+ name: "message",
979
+ type: "string"
980
+ }
981
+ ],
982
+ name: "Error",
983
+ type: "error"
984
+ };
985
+ var solidityPanic = {
986
+ inputs: [
987
+ {
988
+ name: "reason",
989
+ type: "uint256"
990
+ }
991
+ ],
992
+ name: "Panic",
993
+ type: "error"
994
+ };
995
+
996
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/abi/formatAbiItem.js
997
+ function formatAbiItem2(abiItem, { includeName = false } = {}) {
998
+ if (abiItem.type !== "function" && abiItem.type !== "event" && abiItem.type !== "error")
999
+ throw new InvalidDefinitionTypeError(abiItem.type);
1000
+ return `${abiItem.name}(${formatAbiParams(abiItem.inputs, { includeName })})`;
1001
+ }
1002
+ function formatAbiParams(params, { includeName = false } = {}) {
1003
+ if (!params)
1004
+ return "";
1005
+ return params.map((param) => formatAbiParam(param, { includeName })).join(includeName ? ", " : ",");
1006
+ }
1007
+ function formatAbiParam(param, { includeName }) {
1008
+ if (param.type.startsWith("tuple")) {
1009
+ return `(${formatAbiParams(param.components, { includeName })})${param.type.slice("tuple".length)}`;
1010
+ }
1011
+ return param.type + (includeName && param.name ? ` ${param.name}` : "");
1012
+ }
1013
+
1014
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/data/isHex.js
1015
+ function isHex(value, { strict = true } = {}) {
1016
+ if (!value)
1017
+ return false;
1018
+ if (typeof value !== "string")
1019
+ return false;
1020
+ return strict ? /^0x[0-9a-fA-F]*$/.test(value) : value.startsWith("0x");
1021
+ }
1022
+
1023
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/data/size.js
1024
+ function size(value) {
1025
+ if (isHex(value, { strict: false }))
1026
+ return Math.ceil((value.length - 2) / 2);
1027
+ return value.length;
1028
+ }
1029
+
1030
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/errors/abi.js
1031
+ var AbiConstructorNotFoundError = class extends BaseError2 {
1032
+ constructor({ docsPath: docsPath4 }) {
1033
+ super([
1034
+ "A constructor was not found on the ABI.",
1035
+ "Make sure you are using the correct ABI and that the constructor exists on it."
1036
+ ].join("\n"), {
1037
+ docsPath: docsPath4,
1038
+ name: "AbiConstructorNotFoundError"
1039
+ });
1040
+ }
1041
+ };
1042
+ var AbiConstructorParamsNotFoundError = class extends BaseError2 {
1043
+ constructor({ docsPath: docsPath4 }) {
1044
+ super([
1045
+ "Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.",
1046
+ "Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."
1047
+ ].join("\n"), {
1048
+ docsPath: docsPath4,
1049
+ name: "AbiConstructorParamsNotFoundError"
1050
+ });
1051
+ }
1052
+ };
1053
+ var AbiDecodingDataSizeTooSmallError = class extends BaseError2 {
1054
+ constructor({ data, params, size: size2 }) {
1055
+ super([`Data size of ${size2} bytes is too small for given parameters.`].join("\n"), {
1056
+ metaMessages: [
1057
+ `Params: (${formatAbiParams(params, { includeName: true })})`,
1058
+ `Data: ${data} (${size2} bytes)`
1059
+ ],
1060
+ name: "AbiDecodingDataSizeTooSmallError"
1061
+ });
1062
+ Object.defineProperty(this, "data", {
1063
+ enumerable: true,
1064
+ configurable: true,
1065
+ writable: true,
1066
+ value: void 0
1067
+ });
1068
+ Object.defineProperty(this, "params", {
1069
+ enumerable: true,
1070
+ configurable: true,
1071
+ writable: true,
1072
+ value: void 0
1073
+ });
1074
+ Object.defineProperty(this, "size", {
1075
+ enumerable: true,
1076
+ configurable: true,
1077
+ writable: true,
1078
+ value: void 0
1079
+ });
1080
+ this.data = data;
1081
+ this.params = params;
1082
+ this.size = size2;
1083
+ }
1084
+ };
1085
+ var AbiDecodingZeroDataError = class extends BaseError2 {
1086
+ constructor() {
1087
+ super('Cannot decode zero data ("0x") with ABI parameters.', {
1088
+ name: "AbiDecodingZeroDataError"
1089
+ });
1090
+ }
1091
+ };
1092
+ var AbiEncodingArrayLengthMismatchError = class extends BaseError2 {
1093
+ constructor({ expectedLength, givenLength, type }) {
1094
+ super([
1095
+ `ABI encoding array length mismatch for type ${type}.`,
1096
+ `Expected length: ${expectedLength}`,
1097
+ `Given length: ${givenLength}`
1098
+ ].join("\n"), { name: "AbiEncodingArrayLengthMismatchError" });
1099
+ }
1100
+ };
1101
+ var AbiEncodingBytesSizeMismatchError = class extends BaseError2 {
1102
+ constructor({ expectedSize, value }) {
1103
+ super(`Size of bytes "${value}" (bytes${size(value)}) does not match expected size (bytes${expectedSize}).`, { name: "AbiEncodingBytesSizeMismatchError" });
1104
+ }
1105
+ };
1106
+ var AbiEncodingLengthMismatchError = class extends BaseError2 {
1107
+ constructor({ expectedLength, givenLength }) {
1108
+ super([
1109
+ "ABI encoding params/values length mismatch.",
1110
+ `Expected length (params): ${expectedLength}`,
1111
+ `Given length (values): ${givenLength}`
1112
+ ].join("\n"), { name: "AbiEncodingLengthMismatchError" });
1113
+ }
1114
+ };
1115
+ var AbiErrorSignatureNotFoundError = class extends BaseError2 {
1116
+ constructor(signature, { docsPath: docsPath4 }) {
1117
+ super([
1118
+ `Encoded error signature "${signature}" not found on ABI.`,
1119
+ "Make sure you are using the correct ABI and that the error exists on it.",
1120
+ `You can look up the decoded signature here: https://openchain.xyz/signatures?query=${signature}.`
1121
+ ].join("\n"), {
1122
+ docsPath: docsPath4,
1123
+ name: "AbiErrorSignatureNotFoundError"
1124
+ });
1125
+ Object.defineProperty(this, "signature", {
1126
+ enumerable: true,
1127
+ configurable: true,
1128
+ writable: true,
1129
+ value: void 0
1130
+ });
1131
+ this.signature = signature;
1132
+ }
1133
+ };
1134
+ var AbiFunctionNotFoundError = class extends BaseError2 {
1135
+ constructor(functionName, { docsPath: docsPath4 } = {}) {
1136
+ super([
1137
+ `Function ${functionName ? `"${functionName}" ` : ""}not found on ABI.`,
1138
+ "Make sure you are using the correct ABI and that the function exists on it."
1139
+ ].join("\n"), {
1140
+ docsPath: docsPath4,
1141
+ name: "AbiFunctionNotFoundError"
1142
+ });
1143
+ }
1144
+ };
1145
+ var AbiFunctionOutputsNotFoundError = class extends BaseError2 {
1146
+ constructor(functionName, { docsPath: docsPath4 }) {
1147
+ super([
1148
+ `Function "${functionName}" does not contain any \`outputs\` on ABI.`,
1149
+ "Cannot decode function result without knowing what the parameter types are.",
1150
+ "Make sure you are using the correct ABI and that the function exists on it."
1151
+ ].join("\n"), {
1152
+ docsPath: docsPath4,
1153
+ name: "AbiFunctionOutputsNotFoundError"
1154
+ });
1155
+ }
1156
+ };
1157
+ var AbiItemAmbiguityError = class extends BaseError2 {
1158
+ constructor(x, y) {
1159
+ super("Found ambiguous types in overloaded ABI items.", {
1160
+ metaMessages: [
1161
+ `\`${x.type}\` in \`${formatAbiItem2(x.abiItem)}\`, and`,
1162
+ `\`${y.type}\` in \`${formatAbiItem2(y.abiItem)}\``,
1163
+ "",
1164
+ "These types encode differently and cannot be distinguished at runtime.",
1165
+ "Remove one of the ambiguous items in the ABI."
1166
+ ],
1167
+ name: "AbiItemAmbiguityError"
1168
+ });
1169
+ }
1170
+ };
1171
+ var InvalidAbiEncodingTypeError = class extends BaseError2 {
1172
+ constructor(type, { docsPath: docsPath4 }) {
1173
+ super([
1174
+ `Type "${type}" is not a valid encoding type.`,
1175
+ "Please provide a valid ABI type."
1176
+ ].join("\n"), { docsPath: docsPath4, name: "InvalidAbiEncodingType" });
1177
+ }
1178
+ };
1179
+ var InvalidAbiDecodingTypeError = class extends BaseError2 {
1180
+ constructor(type, { docsPath: docsPath4 }) {
1181
+ super([
1182
+ `Type "${type}" is not a valid decoding type.`,
1183
+ "Please provide a valid ABI type."
1184
+ ].join("\n"), { docsPath: docsPath4, name: "InvalidAbiDecodingType" });
1185
+ }
1186
+ };
1187
+ var InvalidArrayError = class extends BaseError2 {
1188
+ constructor(value) {
1189
+ super([`Value "${value}" is not a valid array.`].join("\n"), {
1190
+ name: "InvalidArrayError"
1191
+ });
1192
+ }
1193
+ };
1194
+ var InvalidDefinitionTypeError = class extends BaseError2 {
1195
+ constructor(type) {
1196
+ super([
1197
+ `"${type}" is not a valid definition type.`,
1198
+ 'Valid types: "function", "event", "error"'
1199
+ ].join("\n"), { name: "InvalidDefinitionTypeError" });
1200
+ }
1201
+ };
1202
+
1203
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/errors/data.js
1204
+ var SliceOffsetOutOfBoundsError = class extends BaseError2 {
1205
+ constructor({ offset, position, size: size2 }) {
1206
+ super(`Slice ${position === "start" ? "starting" : "ending"} at offset "${offset}" is out-of-bounds (size: ${size2}).`, { name: "SliceOffsetOutOfBoundsError" });
1207
+ }
1208
+ };
1209
+ var SizeExceedsPaddingSizeError = class extends BaseError2 {
1210
+ constructor({ size: size2, targetSize, type }) {
1211
+ super(`${type.charAt(0).toUpperCase()}${type.slice(1).toLowerCase()} size (${size2}) exceeds padding size (${targetSize}).`, { name: "SizeExceedsPaddingSizeError" });
1212
+ }
1213
+ };
1214
+ var InvalidBytesLengthError = class extends BaseError2 {
1215
+ constructor({ size: size2, targetSize, type }) {
1216
+ super(`${type.charAt(0).toUpperCase()}${type.slice(1).toLowerCase()} is expected to be ${targetSize} ${type} long, but is ${size2} ${type} long.`, { name: "InvalidBytesLengthError" });
1217
+ }
1218
+ };
1219
+
1220
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/data/slice.js
1221
+ function slice(value, start, end, { strict } = {}) {
1222
+ if (isHex(value, { strict: false }))
1223
+ return sliceHex(value, start, end, {
1224
+ strict
1225
+ });
1226
+ return sliceBytes(value, start, end, {
1227
+ strict
1228
+ });
1229
+ }
1230
+ function assertStartOffset(value, start) {
1231
+ if (typeof start === "number" && start > 0 && start > size(value) - 1)
1232
+ throw new SliceOffsetOutOfBoundsError({
1233
+ offset: start,
1234
+ position: "start",
1235
+ size: size(value)
1236
+ });
1237
+ }
1238
+ function assertEndOffset(value, start, end) {
1239
+ if (typeof start === "number" && typeof end === "number" && size(value) !== end - start) {
1240
+ throw new SliceOffsetOutOfBoundsError({
1241
+ offset: end,
1242
+ position: "end",
1243
+ size: size(value)
1244
+ });
1245
+ }
1246
+ }
1247
+ function sliceBytes(value_, start, end, { strict } = {}) {
1248
+ assertStartOffset(value_, start);
1249
+ const value = value_.slice(start, end);
1250
+ if (strict)
1251
+ assertEndOffset(value, start, end);
1252
+ return value;
1253
+ }
1254
+ function sliceHex(value_, start, end, { strict } = {}) {
1255
+ assertStartOffset(value_, start);
1256
+ const value = `0x${value_.replace("0x", "").slice((start ?? 0) * 2, (end ?? value_.length) * 2)}`;
1257
+ if (strict)
1258
+ assertEndOffset(value, start, end);
1259
+ return value;
1260
+ }
1261
+
1262
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/data/pad.js
1263
+ function pad(hexOrBytes, { dir, size: size2 = 32 } = {}) {
1264
+ if (typeof hexOrBytes === "string")
1265
+ return padHex(hexOrBytes, { dir, size: size2 });
1266
+ return padBytes(hexOrBytes, { dir, size: size2 });
1267
+ }
1268
+ function padHex(hex_, { dir, size: size2 = 32 } = {}) {
1269
+ if (size2 === null)
1270
+ return hex_;
1271
+ const hex = hex_.replace("0x", "");
1272
+ if (hex.length > size2 * 2)
1273
+ throw new SizeExceedsPaddingSizeError({
1274
+ size: Math.ceil(hex.length / 2),
1275
+ targetSize: size2,
1276
+ type: "hex"
1277
+ });
1278
+ return `0x${hex[dir === "right" ? "padEnd" : "padStart"](size2 * 2, "0")}`;
1279
+ }
1280
+ function padBytes(bytes2, { dir, size: size2 = 32 } = {}) {
1281
+ if (size2 === null)
1282
+ return bytes2;
1283
+ if (bytes2.length > size2)
1284
+ throw new SizeExceedsPaddingSizeError({
1285
+ size: bytes2.length,
1286
+ targetSize: size2,
1287
+ type: "bytes"
1288
+ });
1289
+ const paddedBytes = new Uint8Array(size2);
1290
+ for (let i = 0; i < size2; i++) {
1291
+ const padEnd = dir === "right";
1292
+ paddedBytes[padEnd ? i : size2 - i - 1] = bytes2[padEnd ? i : bytes2.length - i - 1];
1293
+ }
1294
+ return paddedBytes;
1295
+ }
1296
+
1297
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/errors/encoding.js
1298
+ var IntegerOutOfRangeError = class extends BaseError2 {
1299
+ constructor({ max, min, signed, size: size2, value }) {
1300
+ super(`Number "${value}" is not in safe ${size2 ? `${size2 * 8}-bit ${signed ? "signed" : "unsigned"} ` : ""}integer range ${max ? `(${min} to ${max})` : `(above ${min})`}`, { name: "IntegerOutOfRangeError" });
1301
+ }
1302
+ };
1303
+ var InvalidBytesBooleanError = class extends BaseError2 {
1304
+ constructor(bytes2) {
1305
+ super(`Bytes value "${bytes2}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`, {
1306
+ name: "InvalidBytesBooleanError"
1307
+ });
1308
+ }
1309
+ };
1310
+ var SizeOverflowError = class extends BaseError2 {
1311
+ constructor({ givenSize, maxSize }) {
1312
+ super(`Size cannot exceed ${maxSize} bytes. Given size: ${givenSize} bytes.`, { name: "SizeOverflowError" });
1313
+ }
1314
+ };
1315
+
1316
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/data/trim.js
1317
+ function trim(hexOrBytes, { dir = "left" } = {}) {
1318
+ let data = typeof hexOrBytes === "string" ? hexOrBytes.replace("0x", "") : hexOrBytes;
1319
+ let sliceLength = 0;
1320
+ for (let i = 0; i < data.length - 1; i++) {
1321
+ if (data[dir === "left" ? i : data.length - i - 1].toString() === "0")
1322
+ sliceLength++;
1323
+ else
1324
+ break;
1325
+ }
1326
+ data = dir === "left" ? data.slice(sliceLength) : data.slice(0, data.length - sliceLength);
1327
+ if (typeof hexOrBytes === "string") {
1328
+ if (data.length === 1 && dir === "right")
1329
+ data = `${data}0`;
1330
+ return `0x${data.length % 2 === 1 ? `0${data}` : data}`;
1331
+ }
1332
+ return data;
1333
+ }
1334
+
1335
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/encoding/fromHex.js
1336
+ function assertSize(hexOrBytes, { size: size2 }) {
1337
+ if (size(hexOrBytes) > size2)
1338
+ throw new SizeOverflowError({
1339
+ givenSize: size(hexOrBytes),
1340
+ maxSize: size2
1341
+ });
1342
+ }
1343
+ function hexToBigInt(hex, opts = {}) {
1344
+ const { signed } = opts;
1345
+ if (opts.size)
1346
+ assertSize(hex, { size: opts.size });
1347
+ const value = BigInt(hex);
1348
+ if (!signed)
1349
+ return value;
1350
+ const size2 = (hex.length - 2) / 2;
1351
+ const max = (1n << BigInt(size2) * 8n - 1n) - 1n;
1352
+ if (value <= max)
1353
+ return value;
1354
+ return value - BigInt(`0x${"f".padStart(size2 * 2, "f")}`) - 1n;
1355
+ }
1356
+ function hexToNumber(hex, opts = {}) {
1357
+ return Number(hexToBigInt(hex, opts));
1358
+ }
1359
+
1360
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/encoding/toHex.js
1361
+ var hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_v, i) => i.toString(16).padStart(2, "0"));
1362
+ function toHex(value, opts = {}) {
1363
+ if (typeof value === "number" || typeof value === "bigint")
1364
+ return numberToHex(value, opts);
1365
+ if (typeof value === "string") {
1366
+ return stringToHex(value, opts);
1367
+ }
1368
+ if (typeof value === "boolean")
1369
+ return boolToHex(value, opts);
1370
+ return bytesToHex(value, opts);
1371
+ }
1372
+ function boolToHex(value, opts = {}) {
1373
+ const hex = `0x${Number(value)}`;
1374
+ if (typeof opts.size === "number") {
1375
+ assertSize(hex, { size: opts.size });
1376
+ return pad(hex, { size: opts.size });
1377
+ }
1378
+ return hex;
1379
+ }
1380
+ function bytesToHex(value, opts = {}) {
1381
+ let string = "";
1382
+ for (let i = 0; i < value.length; i++) {
1383
+ string += hexes[value[i]];
1384
+ }
1385
+ const hex = `0x${string}`;
1386
+ if (typeof opts.size === "number") {
1387
+ assertSize(hex, { size: opts.size });
1388
+ return pad(hex, { dir: "right", size: opts.size });
1389
+ }
1390
+ return hex;
1391
+ }
1392
+ function numberToHex(value_, opts = {}) {
1393
+ const { signed, size: size2 } = opts;
1394
+ const value = BigInt(value_);
1395
+ let maxValue;
1396
+ if (size2) {
1397
+ if (signed)
1398
+ maxValue = (1n << BigInt(size2) * 8n - 1n) - 1n;
1399
+ else
1400
+ maxValue = 2n ** (BigInt(size2) * 8n) - 1n;
1401
+ } else if (typeof value_ === "number") {
1402
+ maxValue = BigInt(Number.MAX_SAFE_INTEGER);
1403
+ }
1404
+ const minValue = typeof maxValue === "bigint" && signed ? -maxValue - 1n : 0;
1405
+ if (maxValue && value > maxValue || value < minValue) {
1406
+ const suffix = typeof value_ === "bigint" ? "n" : "";
1407
+ throw new IntegerOutOfRangeError({
1408
+ max: maxValue ? `${maxValue}${suffix}` : void 0,
1409
+ min: `${minValue}${suffix}`,
1410
+ signed,
1411
+ size: size2,
1412
+ value: `${value_}${suffix}`
1413
+ });
1414
+ }
1415
+ const hex = `0x${(signed && value < 0 ? (1n << BigInt(size2 * 8)) + BigInt(value) : value).toString(16)}`;
1416
+ if (size2)
1417
+ return pad(hex, { size: size2 });
1418
+ return hex;
1419
+ }
1420
+ var encoder = /* @__PURE__ */ new TextEncoder();
1421
+ function stringToHex(value_, opts = {}) {
1422
+ const value = encoder.encode(value_);
1423
+ return bytesToHex(value, opts);
1424
+ }
1425
+
1426
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/encoding/toBytes.js
1427
+ var encoder2 = /* @__PURE__ */ new TextEncoder();
1428
+ function toBytes2(value, opts = {}) {
1429
+ if (typeof value === "number" || typeof value === "bigint")
1430
+ return numberToBytes(value, opts);
1431
+ if (typeof value === "boolean")
1432
+ return boolToBytes(value, opts);
1433
+ if (isHex(value))
1434
+ return hexToBytes(value, opts);
1435
+ return stringToBytes(value, opts);
1436
+ }
1437
+ function boolToBytes(value, opts = {}) {
1438
+ const bytes2 = new Uint8Array(1);
1439
+ bytes2[0] = Number(value);
1440
+ if (typeof opts.size === "number") {
1441
+ assertSize(bytes2, { size: opts.size });
1442
+ return pad(bytes2, { size: opts.size });
1443
+ }
1444
+ return bytes2;
1445
+ }
1446
+ var charCodeMap = {
1447
+ zero: 48,
1448
+ nine: 57,
1449
+ A: 65,
1450
+ F: 70,
1451
+ a: 97,
1452
+ f: 102
1453
+ };
1454
+ function charCodeToBase16(char) {
1455
+ if (char >= charCodeMap.zero && char <= charCodeMap.nine)
1456
+ return char - charCodeMap.zero;
1457
+ if (char >= charCodeMap.A && char <= charCodeMap.F)
1458
+ return char - (charCodeMap.A - 10);
1459
+ if (char >= charCodeMap.a && char <= charCodeMap.f)
1460
+ return char - (charCodeMap.a - 10);
1461
+ return void 0;
1462
+ }
1463
+ function hexToBytes(hex_, opts = {}) {
1464
+ let hex = hex_;
1465
+ if (opts.size) {
1466
+ assertSize(hex, { size: opts.size });
1467
+ hex = pad(hex, { dir: "right", size: opts.size });
1468
+ }
1469
+ let hexString = hex.slice(2);
1470
+ if (hexString.length % 2)
1471
+ hexString = `0${hexString}`;
1472
+ const length = hexString.length / 2;
1473
+ const bytes2 = new Uint8Array(length);
1474
+ for (let index = 0, j = 0; index < length; index++) {
1475
+ const nibbleLeft = charCodeToBase16(hexString.charCodeAt(j++));
1476
+ const nibbleRight = charCodeToBase16(hexString.charCodeAt(j++));
1477
+ if (nibbleLeft === void 0 || nibbleRight === void 0) {
1478
+ throw new BaseError2(`Invalid byte sequence ("${hexString[j - 2]}${hexString[j - 1]}" in "${hexString}").`);
1479
+ }
1480
+ bytes2[index] = nibbleLeft * 16 + nibbleRight;
1481
+ }
1482
+ return bytes2;
1483
+ }
1484
+ function numberToBytes(value, opts) {
1485
+ const hex = numberToHex(value, opts);
1486
+ return hexToBytes(hex);
1487
+ }
1488
+ function stringToBytes(value, opts = {}) {
1489
+ const bytes2 = encoder2.encode(value);
1490
+ if (typeof opts.size === "number") {
1491
+ assertSize(bytes2, { size: opts.size });
1492
+ return pad(bytes2, { dir: "right", size: opts.size });
1493
+ }
1494
+ return bytes2;
1495
+ }
1496
+
1497
+ // ../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/_u64.js
1498
+ var U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
1499
+ var _32n = /* @__PURE__ */ BigInt(32);
1500
+ function fromBig(n, le = false) {
1501
+ if (le)
1502
+ return { h: Number(n & U32_MASK64), l: Number(n >> _32n & U32_MASK64) };
1503
+ return { h: Number(n >> _32n & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
1504
+ }
1505
+ function split(lst, le = false) {
1506
+ let Ah = new Uint32Array(lst.length);
1507
+ let Al = new Uint32Array(lst.length);
1508
+ for (let i = 0; i < lst.length; i++) {
1509
+ const { h, l } = fromBig(lst[i], le);
1510
+ [Ah[i], Al[i]] = [h, l];
1511
+ }
1512
+ return [Ah, Al];
1513
+ }
1514
+ var rotlSH = (h, l, s) => h << s | l >>> 32 - s;
1515
+ var rotlSL = (h, l, s) => l << s | h >>> 32 - s;
1516
+ var rotlBH = (h, l, s) => l << s - 32 | h >>> 64 - s;
1517
+ var rotlBL = (h, l, s) => h << s - 32 | l >>> 64 - s;
1518
+
1519
+ // ../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/sha3.js
1520
+ var SHA3_PI = [];
1521
+ var SHA3_ROTL = [];
1522
+ var _SHA3_IOTA = [];
1523
+ var _0n = /* @__PURE__ */ BigInt(0);
1524
+ var _1n = /* @__PURE__ */ BigInt(1);
1525
+ var _2n = /* @__PURE__ */ BigInt(2);
1526
+ var _7n = /* @__PURE__ */ BigInt(7);
1527
+ var _256n = /* @__PURE__ */ BigInt(256);
1528
+ var _0x71n = /* @__PURE__ */ BigInt(113);
1529
+ for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {
1530
+ [x, y] = [y, (2 * x + 3 * y) % 5];
1531
+ SHA3_PI.push(2 * (5 * y + x));
1532
+ SHA3_ROTL.push((round + 1) * (round + 2) / 2 % 64);
1533
+ let t = _0n;
1534
+ for (let j = 0; j < 7; j++) {
1535
+ R = (R << _1n ^ (R >> _7n) * _0x71n) % _256n;
1536
+ if (R & _2n)
1537
+ t ^= _1n << (_1n << /* @__PURE__ */ BigInt(j)) - _1n;
1538
+ }
1539
+ _SHA3_IOTA.push(t);
1540
+ }
1541
+ var [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ split(_SHA3_IOTA, true);
1542
+ var rotlH = (h, l, s) => s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s);
1543
+ var rotlL = (h, l, s) => s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s);
1544
+ function keccakP(s, rounds = 24) {
1545
+ const B = new Uint32Array(5 * 2);
1546
+ for (let round = 24 - rounds; round < 24; round++) {
1547
+ for (let x = 0; x < 10; x++)
1548
+ B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];
1549
+ for (let x = 0; x < 10; x += 2) {
1550
+ const idx1 = (x + 8) % 10;
1551
+ const idx0 = (x + 2) % 10;
1552
+ const B0 = B[idx0];
1553
+ const B1 = B[idx0 + 1];
1554
+ const Th = rotlH(B0, B1, 1) ^ B[idx1];
1555
+ const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];
1556
+ for (let y = 0; y < 50; y += 10) {
1557
+ s[x + y] ^= Th;
1558
+ s[x + y + 1] ^= Tl;
1559
+ }
1560
+ }
1561
+ let curH = s[2];
1562
+ let curL = s[3];
1563
+ for (let t = 0; t < 24; t++) {
1564
+ const shift = SHA3_ROTL[t];
1565
+ const Th = rotlH(curH, curL, shift);
1566
+ const Tl = rotlL(curH, curL, shift);
1567
+ const PI = SHA3_PI[t];
1568
+ curH = s[PI];
1569
+ curL = s[PI + 1];
1570
+ s[PI] = Th;
1571
+ s[PI + 1] = Tl;
1572
+ }
1573
+ for (let y = 0; y < 50; y += 10) {
1574
+ for (let x = 0; x < 10; x++)
1575
+ B[x] = s[y + x];
1576
+ for (let x = 0; x < 10; x++)
1577
+ s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];
1578
+ }
1579
+ s[0] ^= SHA3_IOTA_H[round];
1580
+ s[1] ^= SHA3_IOTA_L[round];
1581
+ }
1582
+ B.fill(0);
1583
+ }
1584
+ var Keccak = class _Keccak extends Hash {
1585
+ // NOTE: we accept arguments in bytes instead of bits here.
1586
+ constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {
1587
+ super();
1588
+ this.blockLen = blockLen;
1589
+ this.suffix = suffix;
1590
+ this.outputLen = outputLen;
1591
+ this.enableXOF = enableXOF;
1592
+ this.rounds = rounds;
1593
+ this.pos = 0;
1594
+ this.posOut = 0;
1595
+ this.finished = false;
1596
+ this.destroyed = false;
1597
+ number(outputLen);
1598
+ if (0 >= this.blockLen || this.blockLen >= 200)
1599
+ throw new Error("Sha3 supports only keccak-f1600 function");
1600
+ this.state = new Uint8Array(200);
1601
+ this.state32 = u32(this.state);
1602
+ }
1603
+ keccak() {
1604
+ if (!isLE)
1605
+ byteSwap32(this.state32);
1606
+ keccakP(this.state32, this.rounds);
1607
+ if (!isLE)
1608
+ byteSwap32(this.state32);
1609
+ this.posOut = 0;
1610
+ this.pos = 0;
1611
+ }
1612
+ update(data) {
1613
+ exists(this);
1614
+ const { blockLen, state } = this;
1615
+ data = toBytes(data);
1616
+ const len = data.length;
1617
+ for (let pos = 0; pos < len; ) {
1618
+ const take = Math.min(blockLen - this.pos, len - pos);
1619
+ for (let i = 0; i < take; i++)
1620
+ state[this.pos++] ^= data[pos++];
1621
+ if (this.pos === blockLen)
1622
+ this.keccak();
1623
+ }
1624
+ return this;
1625
+ }
1626
+ finish() {
1627
+ if (this.finished)
1628
+ return;
1629
+ this.finished = true;
1630
+ const { state, suffix, pos, blockLen } = this;
1631
+ state[pos] ^= suffix;
1632
+ if ((suffix & 128) !== 0 && pos === blockLen - 1)
1633
+ this.keccak();
1634
+ state[blockLen - 1] ^= 128;
1635
+ this.keccak();
1636
+ }
1637
+ writeInto(out) {
1638
+ exists(this, false);
1639
+ bytes(out);
1640
+ this.finish();
1641
+ const bufferOut = this.state;
1642
+ const { blockLen } = this;
1643
+ for (let pos = 0, len = out.length; pos < len; ) {
1644
+ if (this.posOut >= blockLen)
1645
+ this.keccak();
1646
+ const take = Math.min(blockLen - this.posOut, len - pos);
1647
+ out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);
1648
+ this.posOut += take;
1649
+ pos += take;
1650
+ }
1651
+ return out;
1652
+ }
1653
+ xofInto(out) {
1654
+ if (!this.enableXOF)
1655
+ throw new Error("XOF is not possible for this instance");
1656
+ return this.writeInto(out);
1657
+ }
1658
+ xof(bytes2) {
1659
+ number(bytes2);
1660
+ return this.xofInto(new Uint8Array(bytes2));
1661
+ }
1662
+ digestInto(out) {
1663
+ output(out, this);
1664
+ if (this.finished)
1665
+ throw new Error("digest() was already called");
1666
+ this.writeInto(out);
1667
+ this.destroy();
1668
+ return out;
1669
+ }
1670
+ digest() {
1671
+ return this.digestInto(new Uint8Array(this.outputLen));
1672
+ }
1673
+ destroy() {
1674
+ this.destroyed = true;
1675
+ this.state.fill(0);
1676
+ }
1677
+ _cloneInto(to) {
1678
+ const { blockLen, suffix, outputLen, rounds, enableXOF } = this;
1679
+ to || (to = new _Keccak(blockLen, suffix, outputLen, enableXOF, rounds));
1680
+ to.state32.set(this.state32);
1681
+ to.pos = this.pos;
1682
+ to.posOut = this.posOut;
1683
+ to.finished = this.finished;
1684
+ to.rounds = rounds;
1685
+ to.suffix = suffix;
1686
+ to.outputLen = outputLen;
1687
+ to.enableXOF = enableXOF;
1688
+ to.destroyed = this.destroyed;
1689
+ return to;
1690
+ }
1691
+ };
1692
+ var gen = (suffix, blockLen, outputLen) => wrapConstructor(() => new Keccak(blockLen, suffix, outputLen));
1693
+ var sha3_224 = /* @__PURE__ */ gen(6, 144, 224 / 8);
1694
+ var sha3_256 = /* @__PURE__ */ gen(6, 136, 256 / 8);
1695
+ var sha3_384 = /* @__PURE__ */ gen(6, 104, 384 / 8);
1696
+ var sha3_512 = /* @__PURE__ */ gen(6, 72, 512 / 8);
1697
+ var keccak_224 = /* @__PURE__ */ gen(1, 144, 224 / 8);
1698
+ var keccak_256 = /* @__PURE__ */ gen(1, 136, 256 / 8);
1699
+ var keccak_384 = /* @__PURE__ */ gen(1, 104, 384 / 8);
1700
+ var keccak_512 = /* @__PURE__ */ gen(1, 72, 512 / 8);
1701
+ var genShake = (suffix, blockLen, outputLen) => wrapXOFConstructorWithOpts((opts = {}) => new Keccak(blockLen, suffix, opts.dkLen === void 0 ? outputLen : opts.dkLen, true));
1702
+ var shake128 = /* @__PURE__ */ genShake(31, 168, 128 / 8);
1703
+ var shake256 = /* @__PURE__ */ genShake(31, 136, 256 / 8);
1704
+
1705
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/hash/keccak256.js
1706
+ function keccak256(value, to_) {
1707
+ const to = to_ || "hex";
1708
+ const bytes2 = keccak_256(isHex(value, { strict: false }) ? toBytes2(value) : value);
1709
+ if (to === "bytes")
1710
+ return bytes2;
1711
+ return toHex(bytes2);
1712
+ }
1713
+
1714
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/hash/hashSignature.js
1715
+ var hash = (value) => keccak256(toBytes2(value));
1716
+ function hashSignature(sig) {
1717
+ return hash(sig);
1718
+ }
1719
+
1720
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/hash/normalizeSignature.js
1721
+ function normalizeSignature(signature) {
1722
+ let active = true;
1723
+ let current = "";
1724
+ let level = 0;
1725
+ let result = "";
1726
+ let valid = false;
1727
+ for (let i = 0; i < signature.length; i++) {
1728
+ const char = signature[i];
1729
+ if (["(", ")", ","].includes(char))
1730
+ active = true;
1731
+ if (char === "(")
1732
+ level++;
1733
+ if (char === ")")
1734
+ level--;
1735
+ if (!active)
1736
+ continue;
1737
+ if (level === 0) {
1738
+ if (char === " " && ["event", "function", ""].includes(result))
1739
+ result = "";
1740
+ else {
1741
+ result += char;
1742
+ if (char === ")") {
1743
+ valid = true;
1744
+ break;
1745
+ }
1746
+ }
1747
+ continue;
1748
+ }
1749
+ if (char === " ") {
1750
+ if (signature[i - 1] !== "," && current !== "," && current !== ",(") {
1751
+ current = "";
1752
+ active = false;
1753
+ }
1754
+ continue;
1755
+ }
1756
+ result += char;
1757
+ current += char;
1758
+ }
1759
+ if (!valid)
1760
+ throw new BaseError2("Unable to normalize signature.");
1761
+ return result;
1762
+ }
1763
+
1764
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/hash/toSignature.js
1765
+ var toSignature = (def) => {
1766
+ const def_ = (() => {
1767
+ if (typeof def === "string")
1768
+ return def;
1769
+ return formatAbiItem(def);
1770
+ })();
1771
+ return normalizeSignature(def_);
1772
+ };
1773
+
1774
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/hash/toSignatureHash.js
1775
+ function toSignatureHash(fn) {
1776
+ return hashSignature(toSignature(fn));
1777
+ }
1778
+
1779
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/hash/toFunctionSelector.js
1780
+ var toFunctionSelector = (fn) => slice(toSignatureHash(fn), 0, 4);
1781
+
1782
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/errors/address.js
1783
+ var InvalidAddressError = class extends BaseError2 {
1784
+ constructor({ address }) {
1785
+ super(`Address "${address}" is invalid.`, {
1786
+ metaMessages: [
1787
+ "- Address must be a hex value of 20 bytes (40 hex characters).",
1788
+ "- Address must match its checksum counterpart."
1789
+ ],
1790
+ name: "InvalidAddressError"
1791
+ });
1792
+ }
1793
+ };
1794
+
1795
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/lru.js
1796
+ var LruMap = class extends Map {
1797
+ constructor(size2) {
1798
+ super();
1799
+ Object.defineProperty(this, "maxSize", {
1800
+ enumerable: true,
1801
+ configurable: true,
1802
+ writable: true,
1803
+ value: void 0
1804
+ });
1805
+ this.maxSize = size2;
1806
+ }
1807
+ get(key) {
1808
+ const value = super.get(key);
1809
+ if (super.has(key) && value !== void 0) {
1810
+ this.delete(key);
1811
+ super.set(key, value);
1812
+ }
1813
+ return value;
1814
+ }
1815
+ set(key, value) {
1816
+ super.set(key, value);
1817
+ if (this.maxSize && this.size > this.maxSize) {
1818
+ const firstKey = this.keys().next().value;
1819
+ if (firstKey)
1820
+ this.delete(firstKey);
1821
+ }
1822
+ return this;
1823
+ }
1824
+ };
1825
+
1826
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/address/isAddress.js
1827
+ var addressRegex = /^0x[a-fA-F0-9]{40}$/;
1828
+ var isAddressCache = /* @__PURE__ */ new LruMap(8192);
1829
+ function isAddress(address, options) {
1830
+ const { strict = true } = options ?? {};
1831
+ const cacheKey = `${address}.${strict}`;
1832
+ if (isAddressCache.has(cacheKey))
1833
+ return isAddressCache.get(cacheKey);
1834
+ const result = (() => {
1835
+ if (!addressRegex.test(address))
1836
+ return false;
1837
+ if (address.toLowerCase() === address)
1838
+ return true;
1839
+ if (strict)
1840
+ return checksumAddress(address) === address;
1841
+ return true;
1842
+ })();
1843
+ isAddressCache.set(cacheKey, result);
1844
+ return result;
1845
+ }
1846
+
1847
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/address/getAddress.js
1848
+ var checksumAddressCache = /* @__PURE__ */ new LruMap(8192);
1849
+ function checksumAddress(address_, chainId) {
1850
+ if (checksumAddressCache.has(`${address_}.${chainId}`))
1851
+ return checksumAddressCache.get(`${address_}.${chainId}`);
1852
+ const hexAddress = chainId ? `${chainId}${address_.toLowerCase()}` : address_.substring(2).toLowerCase();
1853
+ const hash2 = keccak256(stringToBytes(hexAddress), "bytes");
1854
+ const address = (chainId ? hexAddress.substring(`${chainId}0x`.length) : hexAddress).split("");
1855
+ for (let i = 0; i < 40; i += 2) {
1856
+ if (hash2[i >> 1] >> 4 >= 8 && address[i]) {
1857
+ address[i] = address[i].toUpperCase();
1858
+ }
1859
+ if ((hash2[i >> 1] & 15) >= 8 && address[i + 1]) {
1860
+ address[i + 1] = address[i + 1].toUpperCase();
1861
+ }
1862
+ }
1863
+ const result = `0x${address.join("")}`;
1864
+ checksumAddressCache.set(`${address_}.${chainId}`, result);
1865
+ return result;
1866
+ }
1867
+
1868
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/errors/cursor.js
1869
+ var NegativeOffsetError = class extends BaseError2 {
1870
+ constructor({ offset }) {
1871
+ super(`Offset \`${offset}\` cannot be negative.`, {
1872
+ name: "NegativeOffsetError"
1873
+ });
1874
+ }
1875
+ };
1876
+ var PositionOutOfBoundsError = class extends BaseError2 {
1877
+ constructor({ length, position }) {
1878
+ super(`Position \`${position}\` is out of bounds (\`0 < position < ${length}\`).`, { name: "PositionOutOfBoundsError" });
1879
+ }
1880
+ };
1881
+ var RecursiveReadLimitExceededError = class extends BaseError2 {
1882
+ constructor({ count, limit }) {
1883
+ super(`Recursive read limit of \`${limit}\` exceeded (recursive read count: \`${count}\`).`, { name: "RecursiveReadLimitExceededError" });
1884
+ }
1885
+ };
1886
+
1887
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/cursor.js
1888
+ var staticCursor = {
1889
+ bytes: new Uint8Array(),
1890
+ dataView: new DataView(new ArrayBuffer(0)),
1891
+ position: 0,
1892
+ positionReadCount: /* @__PURE__ */ new Map(),
1893
+ recursiveReadCount: 0,
1894
+ recursiveReadLimit: Number.POSITIVE_INFINITY,
1895
+ assertReadLimit() {
1896
+ if (this.recursiveReadCount >= this.recursiveReadLimit)
1897
+ throw new RecursiveReadLimitExceededError({
1898
+ count: this.recursiveReadCount + 1,
1899
+ limit: this.recursiveReadLimit
1900
+ });
1901
+ },
1902
+ assertPosition(position) {
1903
+ if (position < 0 || position > this.bytes.length - 1)
1904
+ throw new PositionOutOfBoundsError({
1905
+ length: this.bytes.length,
1906
+ position
1907
+ });
1908
+ },
1909
+ decrementPosition(offset) {
1910
+ if (offset < 0)
1911
+ throw new NegativeOffsetError({ offset });
1912
+ const position = this.position - offset;
1913
+ this.assertPosition(position);
1914
+ this.position = position;
1915
+ },
1916
+ getReadCount(position) {
1917
+ return this.positionReadCount.get(position || this.position) || 0;
1918
+ },
1919
+ incrementPosition(offset) {
1920
+ if (offset < 0)
1921
+ throw new NegativeOffsetError({ offset });
1922
+ const position = this.position + offset;
1923
+ this.assertPosition(position);
1924
+ this.position = position;
1925
+ },
1926
+ inspectByte(position_) {
1927
+ const position = position_ ?? this.position;
1928
+ this.assertPosition(position);
1929
+ return this.bytes[position];
1930
+ },
1931
+ inspectBytes(length, position_) {
1932
+ const position = position_ ?? this.position;
1933
+ this.assertPosition(position + length - 1);
1934
+ return this.bytes.subarray(position, position + length);
1935
+ },
1936
+ inspectUint8(position_) {
1937
+ const position = position_ ?? this.position;
1938
+ this.assertPosition(position);
1939
+ return this.bytes[position];
1940
+ },
1941
+ inspectUint16(position_) {
1942
+ const position = position_ ?? this.position;
1943
+ this.assertPosition(position + 1);
1944
+ return this.dataView.getUint16(position);
1945
+ },
1946
+ inspectUint24(position_) {
1947
+ const position = position_ ?? this.position;
1948
+ this.assertPosition(position + 2);
1949
+ return (this.dataView.getUint16(position) << 8) + this.dataView.getUint8(position + 2);
1950
+ },
1951
+ inspectUint32(position_) {
1952
+ const position = position_ ?? this.position;
1953
+ this.assertPosition(position + 3);
1954
+ return this.dataView.getUint32(position);
1955
+ },
1956
+ pushByte(byte) {
1957
+ this.assertPosition(this.position);
1958
+ this.bytes[this.position] = byte;
1959
+ this.position++;
1960
+ },
1961
+ pushBytes(bytes2) {
1962
+ this.assertPosition(this.position + bytes2.length - 1);
1963
+ this.bytes.set(bytes2, this.position);
1964
+ this.position += bytes2.length;
1965
+ },
1966
+ pushUint8(value) {
1967
+ this.assertPosition(this.position);
1968
+ this.bytes[this.position] = value;
1969
+ this.position++;
1970
+ },
1971
+ pushUint16(value) {
1972
+ this.assertPosition(this.position + 1);
1973
+ this.dataView.setUint16(this.position, value);
1974
+ this.position += 2;
1975
+ },
1976
+ pushUint24(value) {
1977
+ this.assertPosition(this.position + 2);
1978
+ this.dataView.setUint16(this.position, value >> 8);
1979
+ this.dataView.setUint8(this.position + 2, value & ~4294967040);
1980
+ this.position += 3;
1981
+ },
1982
+ pushUint32(value) {
1983
+ this.assertPosition(this.position + 3);
1984
+ this.dataView.setUint32(this.position, value);
1985
+ this.position += 4;
1986
+ },
1987
+ readByte() {
1988
+ this.assertReadLimit();
1989
+ this._touch();
1990
+ const value = this.inspectByte();
1991
+ this.position++;
1992
+ return value;
1993
+ },
1994
+ readBytes(length, size2) {
1995
+ this.assertReadLimit();
1996
+ this._touch();
1997
+ const value = this.inspectBytes(length);
1998
+ this.position += size2 ?? length;
1999
+ return value;
2000
+ },
2001
+ readUint8() {
2002
+ this.assertReadLimit();
2003
+ this._touch();
2004
+ const value = this.inspectUint8();
2005
+ this.position += 1;
2006
+ return value;
2007
+ },
2008
+ readUint16() {
2009
+ this.assertReadLimit();
2010
+ this._touch();
2011
+ const value = this.inspectUint16();
2012
+ this.position += 2;
2013
+ return value;
2014
+ },
2015
+ readUint24() {
2016
+ this.assertReadLimit();
2017
+ this._touch();
2018
+ const value = this.inspectUint24();
2019
+ this.position += 3;
2020
+ return value;
2021
+ },
2022
+ readUint32() {
2023
+ this.assertReadLimit();
2024
+ this._touch();
2025
+ const value = this.inspectUint32();
2026
+ this.position += 4;
2027
+ return value;
2028
+ },
2029
+ get remaining() {
2030
+ return this.bytes.length - this.position;
2031
+ },
2032
+ setPosition(position) {
2033
+ const oldPosition = this.position;
2034
+ this.assertPosition(position);
2035
+ this.position = position;
2036
+ return () => this.position = oldPosition;
2037
+ },
2038
+ _touch() {
2039
+ if (this.recursiveReadLimit === Number.POSITIVE_INFINITY)
2040
+ return;
2041
+ const count = this.getReadCount();
2042
+ this.positionReadCount.set(this.position, count + 1);
2043
+ if (count > 0)
2044
+ this.recursiveReadCount++;
2045
+ }
2046
+ };
2047
+ function createCursor(bytes2, { recursiveReadLimit = 8192 } = {}) {
2048
+ const cursor = Object.create(staticCursor);
2049
+ cursor.bytes = bytes2;
2050
+ cursor.dataView = new DataView(bytes2.buffer, bytes2.byteOffset, bytes2.byteLength);
2051
+ cursor.positionReadCount = /* @__PURE__ */ new Map();
2052
+ cursor.recursiveReadLimit = recursiveReadLimit;
2053
+ return cursor;
2054
+ }
2055
+
2056
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/encoding/fromBytes.js
2057
+ function bytesToBigInt(bytes2, opts = {}) {
2058
+ if (typeof opts.size !== "undefined")
2059
+ assertSize(bytes2, { size: opts.size });
2060
+ const hex = bytesToHex(bytes2, opts);
2061
+ return hexToBigInt(hex, opts);
2062
+ }
2063
+ function bytesToBool(bytes_, opts = {}) {
2064
+ let bytes2 = bytes_;
2065
+ if (typeof opts.size !== "undefined") {
2066
+ assertSize(bytes2, { size: opts.size });
2067
+ bytes2 = trim(bytes2);
2068
+ }
2069
+ if (bytes2.length > 1 || bytes2[0] > 1)
2070
+ throw new InvalidBytesBooleanError(bytes2);
2071
+ return Boolean(bytes2[0]);
2072
+ }
2073
+ function bytesToNumber(bytes2, opts = {}) {
2074
+ if (typeof opts.size !== "undefined")
2075
+ assertSize(bytes2, { size: opts.size });
2076
+ const hex = bytesToHex(bytes2, opts);
2077
+ return hexToNumber(hex, opts);
2078
+ }
2079
+ function bytesToString(bytes_, opts = {}) {
2080
+ let bytes2 = bytes_;
2081
+ if (typeof opts.size !== "undefined") {
2082
+ assertSize(bytes2, { size: opts.size });
2083
+ bytes2 = trim(bytes2, { dir: "right" });
2084
+ }
2085
+ return new TextDecoder().decode(bytes2);
2086
+ }
2087
+
2088
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/data/concat.js
2089
+ function concat(values) {
2090
+ if (typeof values[0] === "string")
2091
+ return concatHex(values);
2092
+ return concatBytes(values);
2093
+ }
2094
+ function concatBytes(values) {
2095
+ let length = 0;
2096
+ for (const arr of values) {
2097
+ length += arr.length;
2098
+ }
2099
+ const result = new Uint8Array(length);
2100
+ let offset = 0;
2101
+ for (const arr of values) {
2102
+ result.set(arr, offset);
2103
+ offset += arr.length;
2104
+ }
2105
+ return result;
2106
+ }
2107
+ function concatHex(values) {
2108
+ return `0x${values.reduce((acc, x) => acc + x.replace("0x", ""), "")}`;
2109
+ }
2110
+
2111
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/abi/encodeAbiParameters.js
2112
+ function encodeAbiParameters(params, values) {
2113
+ if (params.length !== values.length)
2114
+ throw new AbiEncodingLengthMismatchError({
2115
+ expectedLength: params.length,
2116
+ givenLength: values.length
2117
+ });
2118
+ const preparedParams = prepareParams({
2119
+ params,
2120
+ values
2121
+ });
2122
+ const data = encodeParams(preparedParams);
2123
+ if (data.length === 0)
2124
+ return "0x";
2125
+ return data;
2126
+ }
2127
+ function prepareParams({ params, values }) {
2128
+ const preparedParams = [];
2129
+ for (let i = 0; i < params.length; i++) {
2130
+ preparedParams.push(prepareParam({ param: params[i], value: values[i] }));
2131
+ }
2132
+ return preparedParams;
2133
+ }
2134
+ function prepareParam({ param, value }) {
2135
+ const arrayComponents = getArrayComponents(param.type);
2136
+ if (arrayComponents) {
2137
+ const [length, type] = arrayComponents;
2138
+ return encodeArray(value, { length, param: { ...param, type } });
2139
+ }
2140
+ if (param.type === "tuple") {
2141
+ return encodeTuple(value, {
2142
+ param
2143
+ });
2144
+ }
2145
+ if (param.type === "address") {
2146
+ return encodeAddress(value);
2147
+ }
2148
+ if (param.type === "bool") {
2149
+ return encodeBool(value);
2150
+ }
2151
+ if (param.type.startsWith("uint") || param.type.startsWith("int")) {
2152
+ const signed = param.type.startsWith("int");
2153
+ return encodeNumber(value, { signed });
2154
+ }
2155
+ if (param.type.startsWith("bytes")) {
2156
+ return encodeBytes(value, { param });
2157
+ }
2158
+ if (param.type === "string") {
2159
+ return encodeString(value);
2160
+ }
2161
+ throw new InvalidAbiEncodingTypeError(param.type, {
2162
+ docsPath: "/docs/contract/encodeAbiParameters"
2163
+ });
2164
+ }
2165
+ function encodeParams(preparedParams) {
2166
+ let staticSize = 0;
2167
+ for (let i = 0; i < preparedParams.length; i++) {
2168
+ const { dynamic, encoded } = preparedParams[i];
2169
+ if (dynamic)
2170
+ staticSize += 32;
2171
+ else
2172
+ staticSize += size(encoded);
2173
+ }
2174
+ const staticParams = [];
2175
+ const dynamicParams = [];
2176
+ let dynamicSize = 0;
2177
+ for (let i = 0; i < preparedParams.length; i++) {
2178
+ const { dynamic, encoded } = preparedParams[i];
2179
+ if (dynamic) {
2180
+ staticParams.push(numberToHex(staticSize + dynamicSize, { size: 32 }));
2181
+ dynamicParams.push(encoded);
2182
+ dynamicSize += size(encoded);
2183
+ } else {
2184
+ staticParams.push(encoded);
2185
+ }
2186
+ }
2187
+ return concat([...staticParams, ...dynamicParams]);
2188
+ }
2189
+ function encodeAddress(value) {
2190
+ if (!isAddress(value))
2191
+ throw new InvalidAddressError({ address: value });
2192
+ return { dynamic: false, encoded: padHex(value.toLowerCase()) };
2193
+ }
2194
+ function encodeArray(value, { length, param }) {
2195
+ const dynamic = length === null;
2196
+ if (!Array.isArray(value))
2197
+ throw new InvalidArrayError(value);
2198
+ if (!dynamic && value.length !== length)
2199
+ throw new AbiEncodingArrayLengthMismatchError({
2200
+ expectedLength: length,
2201
+ givenLength: value.length,
2202
+ type: `${param.type}[${length}]`
2203
+ });
2204
+ let dynamicChild = false;
2205
+ const preparedParams = [];
2206
+ for (let i = 0; i < value.length; i++) {
2207
+ const preparedParam = prepareParam({ param, value: value[i] });
2208
+ if (preparedParam.dynamic)
2209
+ dynamicChild = true;
2210
+ preparedParams.push(preparedParam);
2211
+ }
2212
+ if (dynamic || dynamicChild) {
2213
+ const data = encodeParams(preparedParams);
2214
+ if (dynamic) {
2215
+ const length2 = numberToHex(preparedParams.length, { size: 32 });
2216
+ return {
2217
+ dynamic: true,
2218
+ encoded: preparedParams.length > 0 ? concat([length2, data]) : length2
2219
+ };
2220
+ }
2221
+ if (dynamicChild)
2222
+ return { dynamic: true, encoded: data };
2223
+ }
2224
+ return {
2225
+ dynamic: false,
2226
+ encoded: concat(preparedParams.map(({ encoded }) => encoded))
2227
+ };
2228
+ }
2229
+ function encodeBytes(value, { param }) {
2230
+ const [, paramSize] = param.type.split("bytes");
2231
+ const bytesSize = size(value);
2232
+ if (!paramSize) {
2233
+ let value_ = value;
2234
+ if (bytesSize % 32 !== 0)
2235
+ value_ = padHex(value_, {
2236
+ dir: "right",
2237
+ size: Math.ceil((value.length - 2) / 2 / 32) * 32
2238
+ });
2239
+ return {
2240
+ dynamic: true,
2241
+ encoded: concat([padHex(numberToHex(bytesSize, { size: 32 })), value_])
2242
+ };
2243
+ }
2244
+ if (bytesSize !== Number.parseInt(paramSize))
2245
+ throw new AbiEncodingBytesSizeMismatchError({
2246
+ expectedSize: Number.parseInt(paramSize),
2247
+ value
2248
+ });
2249
+ return { dynamic: false, encoded: padHex(value, { dir: "right" }) };
2250
+ }
2251
+ function encodeBool(value) {
2252
+ if (typeof value !== "boolean")
2253
+ throw new BaseError2(`Invalid boolean value: "${value}" (type: ${typeof value}). Expected: \`true\` or \`false\`.`);
2254
+ return { dynamic: false, encoded: padHex(boolToHex(value)) };
2255
+ }
2256
+ function encodeNumber(value, { signed }) {
2257
+ return {
2258
+ dynamic: false,
2259
+ encoded: numberToHex(value, {
2260
+ size: 32,
2261
+ signed
2262
+ })
2263
+ };
2264
+ }
2265
+ function encodeString(value) {
2266
+ const hexValue = stringToHex(value);
2267
+ const partsLength = Math.ceil(size(hexValue) / 32);
2268
+ const parts = [];
2269
+ for (let i = 0; i < partsLength; i++) {
2270
+ parts.push(padHex(slice(hexValue, i * 32, (i + 1) * 32), {
2271
+ dir: "right"
2272
+ }));
2273
+ }
2274
+ return {
2275
+ dynamic: true,
2276
+ encoded: concat([
2277
+ padHex(numberToHex(size(hexValue), { size: 32 })),
2278
+ ...parts
2279
+ ])
2280
+ };
2281
+ }
2282
+ function encodeTuple(value, { param }) {
2283
+ let dynamic = false;
2284
+ const preparedParams = [];
2285
+ for (let i = 0; i < param.components.length; i++) {
2286
+ const param_ = param.components[i];
2287
+ const index = Array.isArray(value) ? i : param_.name;
2288
+ const preparedParam = prepareParam({
2289
+ param: param_,
2290
+ value: value[index]
2291
+ });
2292
+ preparedParams.push(preparedParam);
2293
+ if (preparedParam.dynamic)
2294
+ dynamic = true;
2295
+ }
2296
+ return {
2297
+ dynamic,
2298
+ encoded: dynamic ? encodeParams(preparedParams) : concat(preparedParams.map(({ encoded }) => encoded))
2299
+ };
2300
+ }
2301
+ function getArrayComponents(type) {
2302
+ const matches = type.match(/^(.*)\[(\d+)?\]$/);
2303
+ return matches ? (
2304
+ // Return `null` if the array is dynamic.
2305
+ [matches[2] ? Number(matches[2]) : null, matches[1]]
2306
+ ) : void 0;
2307
+ }
2308
+
2309
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/abi/decodeAbiParameters.js
2310
+ function decodeAbiParameters(params, data) {
2311
+ const bytes2 = typeof data === "string" ? hexToBytes(data) : data;
2312
+ const cursor = createCursor(bytes2);
2313
+ if (size(bytes2) === 0 && params.length > 0)
2314
+ throw new AbiDecodingZeroDataError();
2315
+ if (size(data) && size(data) < 32)
2316
+ throw new AbiDecodingDataSizeTooSmallError({
2317
+ data: typeof data === "string" ? data : bytesToHex(data),
2318
+ params,
2319
+ size: size(data)
2320
+ });
2321
+ let consumed = 0;
2322
+ const values = [];
2323
+ for (let i = 0; i < params.length; ++i) {
2324
+ const param = params[i];
2325
+ cursor.setPosition(consumed);
2326
+ const [data2, consumed_] = decodeParameter(cursor, param, {
2327
+ staticPosition: 0
2328
+ });
2329
+ consumed += consumed_;
2330
+ values.push(data2);
2331
+ }
2332
+ return values;
2333
+ }
2334
+ function decodeParameter(cursor, param, { staticPosition }) {
2335
+ const arrayComponents = getArrayComponents(param.type);
2336
+ if (arrayComponents) {
2337
+ const [length, type] = arrayComponents;
2338
+ return decodeArray(cursor, { ...param, type }, { length, staticPosition });
2339
+ }
2340
+ if (param.type === "tuple")
2341
+ return decodeTuple(cursor, param, { staticPosition });
2342
+ if (param.type === "address")
2343
+ return decodeAddress(cursor);
2344
+ if (param.type === "bool")
2345
+ return decodeBool(cursor);
2346
+ if (param.type.startsWith("bytes"))
2347
+ return decodeBytes(cursor, param, { staticPosition });
2348
+ if (param.type.startsWith("uint") || param.type.startsWith("int"))
2349
+ return decodeNumber(cursor, param);
2350
+ if (param.type === "string")
2351
+ return decodeString(cursor, { staticPosition });
2352
+ throw new InvalidAbiDecodingTypeError(param.type, {
2353
+ docsPath: "/docs/contract/decodeAbiParameters"
2354
+ });
2355
+ }
2356
+ var sizeOfLength = 32;
2357
+ var sizeOfOffset = 32;
2358
+ function decodeAddress(cursor) {
2359
+ const value = cursor.readBytes(32);
2360
+ return [checksumAddress(bytesToHex(sliceBytes(value, -20))), 32];
2361
+ }
2362
+ function decodeArray(cursor, param, { length, staticPosition }) {
2363
+ if (!length) {
2364
+ const offset = bytesToNumber(cursor.readBytes(sizeOfOffset));
2365
+ const start = staticPosition + offset;
2366
+ const startOfData = start + sizeOfLength;
2367
+ cursor.setPosition(start);
2368
+ const length2 = bytesToNumber(cursor.readBytes(sizeOfLength));
2369
+ const dynamicChild = hasDynamicChild(param);
2370
+ let consumed2 = 0;
2371
+ const value2 = [];
2372
+ for (let i = 0; i < length2; ++i) {
2373
+ cursor.setPosition(startOfData + (dynamicChild ? i * 32 : consumed2));
2374
+ const [data, consumed_] = decodeParameter(cursor, param, {
2375
+ staticPosition: startOfData
2376
+ });
2377
+ consumed2 += consumed_;
2378
+ value2.push(data);
2379
+ }
2380
+ cursor.setPosition(staticPosition + 32);
2381
+ return [value2, 32];
2382
+ }
2383
+ if (hasDynamicChild(param)) {
2384
+ const offset = bytesToNumber(cursor.readBytes(sizeOfOffset));
2385
+ const start = staticPosition + offset;
2386
+ const value2 = [];
2387
+ for (let i = 0; i < length; ++i) {
2388
+ cursor.setPosition(start + i * 32);
2389
+ const [data] = decodeParameter(cursor, param, {
2390
+ staticPosition: start
2391
+ });
2392
+ value2.push(data);
2393
+ }
2394
+ cursor.setPosition(staticPosition + 32);
2395
+ return [value2, 32];
2396
+ }
2397
+ let consumed = 0;
2398
+ const value = [];
2399
+ for (let i = 0; i < length; ++i) {
2400
+ const [data, consumed_] = decodeParameter(cursor, param, {
2401
+ staticPosition: staticPosition + consumed
2402
+ });
2403
+ consumed += consumed_;
2404
+ value.push(data);
2405
+ }
2406
+ return [value, consumed];
2407
+ }
2408
+ function decodeBool(cursor) {
2409
+ return [bytesToBool(cursor.readBytes(32), { size: 32 }), 32];
2410
+ }
2411
+ function decodeBytes(cursor, param, { staticPosition }) {
2412
+ const [_, size2] = param.type.split("bytes");
2413
+ if (!size2) {
2414
+ const offset = bytesToNumber(cursor.readBytes(32));
2415
+ cursor.setPosition(staticPosition + offset);
2416
+ const length = bytesToNumber(cursor.readBytes(32));
2417
+ if (length === 0) {
2418
+ cursor.setPosition(staticPosition + 32);
2419
+ return ["0x", 32];
2420
+ }
2421
+ const data = cursor.readBytes(length);
2422
+ cursor.setPosition(staticPosition + 32);
2423
+ return [bytesToHex(data), 32];
2424
+ }
2425
+ const value = bytesToHex(cursor.readBytes(Number.parseInt(size2), 32));
2426
+ return [value, 32];
2427
+ }
2428
+ function decodeNumber(cursor, param) {
2429
+ const signed = param.type.startsWith("int");
2430
+ const size2 = Number.parseInt(param.type.split("int")[1] || "256");
2431
+ const value = cursor.readBytes(32);
2432
+ return [
2433
+ size2 > 48 ? bytesToBigInt(value, { signed }) : bytesToNumber(value, { signed }),
2434
+ 32
2435
+ ];
2436
+ }
2437
+ function decodeTuple(cursor, param, { staticPosition }) {
2438
+ const hasUnnamedChild = param.components.length === 0 || param.components.some(({ name }) => !name);
2439
+ const value = hasUnnamedChild ? [] : {};
2440
+ let consumed = 0;
2441
+ if (hasDynamicChild(param)) {
2442
+ const offset = bytesToNumber(cursor.readBytes(sizeOfOffset));
2443
+ const start = staticPosition + offset;
2444
+ for (let i = 0; i < param.components.length; ++i) {
2445
+ const component = param.components[i];
2446
+ cursor.setPosition(start + consumed);
2447
+ const [data, consumed_] = decodeParameter(cursor, component, {
2448
+ staticPosition: start
2449
+ });
2450
+ consumed += consumed_;
2451
+ value[hasUnnamedChild ? i : component?.name] = data;
2452
+ }
2453
+ cursor.setPosition(staticPosition + 32);
2454
+ return [value, 32];
2455
+ }
2456
+ for (let i = 0; i < param.components.length; ++i) {
2457
+ const component = param.components[i];
2458
+ const [data, consumed_] = decodeParameter(cursor, component, {
2459
+ staticPosition
2460
+ });
2461
+ value[hasUnnamedChild ? i : component?.name] = data;
2462
+ consumed += consumed_;
2463
+ }
2464
+ return [value, consumed];
2465
+ }
2466
+ function decodeString(cursor, { staticPosition }) {
2467
+ const offset = bytesToNumber(cursor.readBytes(32));
2468
+ const start = staticPosition + offset;
2469
+ cursor.setPosition(start);
2470
+ const length = bytesToNumber(cursor.readBytes(32));
2471
+ if (length === 0) {
2472
+ cursor.setPosition(staticPosition + 32);
2473
+ return ["", 32];
2474
+ }
2475
+ const data = cursor.readBytes(length, 32);
2476
+ const value = bytesToString(trim(data));
2477
+ cursor.setPosition(staticPosition + 32);
2478
+ return [value, 32];
2479
+ }
2480
+ function hasDynamicChild(param) {
2481
+ const { type } = param;
2482
+ if (type === "string")
2483
+ return true;
2484
+ if (type === "bytes")
2485
+ return true;
2486
+ if (type.endsWith("[]"))
2487
+ return true;
2488
+ if (type === "tuple")
2489
+ return param.components?.some(hasDynamicChild);
2490
+ const arrayComponents = getArrayComponents(param.type);
2491
+ if (arrayComponents && hasDynamicChild({ ...param, type: arrayComponents[1] }))
2492
+ return true;
2493
+ return false;
2494
+ }
2495
+
2496
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/abi/decodeErrorResult.js
2497
+ function decodeErrorResult(parameters) {
2498
+ const { abi, data } = parameters;
2499
+ const signature = slice(data, 0, 4);
2500
+ if (signature === "0x")
2501
+ throw new AbiDecodingZeroDataError();
2502
+ const abi_ = [...abi || [], solidityError, solidityPanic];
2503
+ const abiItem = abi_.find((x) => x.type === "error" && signature === toFunctionSelector(formatAbiItem2(x)));
2504
+ if (!abiItem)
2505
+ throw new AbiErrorSignatureNotFoundError(signature, {
2506
+ docsPath: "/docs/contract/decodeErrorResult"
2507
+ });
2508
+ return {
2509
+ abiItem,
2510
+ args: "inputs" in abiItem && abiItem.inputs && abiItem.inputs.length > 0 ? decodeAbiParameters(abiItem.inputs, slice(data, 4)) : void 0,
2511
+ errorName: abiItem.name
2512
+ };
2513
+ }
2514
+
2515
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/stringify.js
2516
+ var stringify = (value, replacer, space) => JSON.stringify(value, (key, value_) => {
2517
+ const value2 = typeof value_ === "bigint" ? value_.toString() : value_;
2518
+ return typeof replacer === "function" ? replacer(key, value2) : value2;
2519
+ }, space);
2520
+
2521
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/hash/toEventSelector.js
2522
+ var toEventSelector = toSignatureHash;
2523
+
2524
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/abi/getAbiItem.js
2525
+ function getAbiItem(parameters) {
2526
+ const { abi, args = [], name } = parameters;
2527
+ const isSelector = isHex(name, { strict: false });
2528
+ const abiItems = abi.filter((abiItem) => {
2529
+ if (isSelector) {
2530
+ if (abiItem.type === "function")
2531
+ return toFunctionSelector(abiItem) === name;
2532
+ if (abiItem.type === "event")
2533
+ return toEventSelector(abiItem) === name;
2534
+ return false;
2535
+ }
2536
+ return "name" in abiItem && abiItem.name === name;
2537
+ });
2538
+ if (abiItems.length === 0)
2539
+ return void 0;
2540
+ if (abiItems.length === 1)
2541
+ return abiItems[0];
2542
+ let matchedAbiItem = void 0;
2543
+ for (const abiItem of abiItems) {
2544
+ if (!("inputs" in abiItem))
2545
+ continue;
2546
+ if (!args || args.length === 0) {
2547
+ if (!abiItem.inputs || abiItem.inputs.length === 0)
2548
+ return abiItem;
2549
+ continue;
2550
+ }
2551
+ if (!abiItem.inputs)
2552
+ continue;
2553
+ if (abiItem.inputs.length === 0)
2554
+ continue;
2555
+ if (abiItem.inputs.length !== args.length)
2556
+ continue;
2557
+ const matched = args.every((arg, index) => {
2558
+ const abiParameter = "inputs" in abiItem && abiItem.inputs[index];
2559
+ if (!abiParameter)
2560
+ return false;
2561
+ return isArgOfType(arg, abiParameter);
2562
+ });
2563
+ if (matched) {
2564
+ if (matchedAbiItem && "inputs" in matchedAbiItem && matchedAbiItem.inputs) {
2565
+ const ambiguousTypes = getAmbiguousTypes(abiItem.inputs, matchedAbiItem.inputs, args);
2566
+ if (ambiguousTypes)
2567
+ throw new AbiItemAmbiguityError({
2568
+ abiItem,
2569
+ type: ambiguousTypes[0]
2570
+ }, {
2571
+ abiItem: matchedAbiItem,
2572
+ type: ambiguousTypes[1]
2573
+ });
2574
+ }
2575
+ matchedAbiItem = abiItem;
2576
+ }
2577
+ }
2578
+ if (matchedAbiItem)
2579
+ return matchedAbiItem;
2580
+ return abiItems[0];
2581
+ }
2582
+ function isArgOfType(arg, abiParameter) {
2583
+ const argType = typeof arg;
2584
+ const abiParameterType = abiParameter.type;
2585
+ switch (abiParameterType) {
2586
+ case "address":
2587
+ return isAddress(arg, { strict: false });
2588
+ case "bool":
2589
+ return argType === "boolean";
2590
+ case "function":
2591
+ return argType === "string";
2592
+ case "string":
2593
+ return argType === "string";
2594
+ default: {
2595
+ if (abiParameterType === "tuple" && "components" in abiParameter)
2596
+ return Object.values(abiParameter.components).every((component, index) => {
2597
+ return isArgOfType(Object.values(arg)[index], component);
2598
+ });
2599
+ 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))
2600
+ return argType === "number" || argType === "bigint";
2601
+ if (/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(abiParameterType))
2602
+ return argType === "string" || arg instanceof Uint8Array;
2603
+ if (/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(abiParameterType)) {
2604
+ return Array.isArray(arg) && arg.every((x) => isArgOfType(x, {
2605
+ ...abiParameter,
2606
+ // Pop off `[]` or `[M]` from end of type
2607
+ type: abiParameterType.replace(/(\[[0-9]{0,}\])$/, "")
2608
+ }));
2609
+ }
2610
+ return false;
2611
+ }
2612
+ }
2613
+ }
2614
+ function getAmbiguousTypes(sourceParameters, targetParameters, args) {
2615
+ for (const parameterIndex in sourceParameters) {
2616
+ const sourceParameter = sourceParameters[parameterIndex];
2617
+ const targetParameter = targetParameters[parameterIndex];
2618
+ if (sourceParameter.type === "tuple" && targetParameter.type === "tuple" && "components" in sourceParameter && "components" in targetParameter)
2619
+ return getAmbiguousTypes(sourceParameter.components, targetParameter.components, args[parameterIndex]);
2620
+ const types = [sourceParameter.type, targetParameter.type];
2621
+ const ambiguous = (() => {
2622
+ if (types.includes("address") && types.includes("bytes20"))
2623
+ return true;
2624
+ if (types.includes("address") && types.includes("string"))
2625
+ return isAddress(args[parameterIndex], { strict: false });
2626
+ if (types.includes("address") && types.includes("bytes"))
2627
+ return isAddress(args[parameterIndex], { strict: false });
2628
+ return false;
2629
+ })();
2630
+ if (ambiguous)
2631
+ return types;
2632
+ }
2633
+ return;
2634
+ }
2635
+
2636
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/constants/unit.js
2637
+ var etherUnits = {
2638
+ gwei: 9,
2639
+ wei: 18
2640
+ };
2641
+ var gweiUnits = {
2642
+ ether: -9,
2643
+ wei: 9
2644
+ };
2645
+
2646
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/unit/formatUnits.js
2647
+ function formatUnits(value, decimals) {
2648
+ let display = value.toString();
2649
+ const negative = display.startsWith("-");
2650
+ if (negative)
2651
+ display = display.slice(1);
2652
+ display = display.padStart(decimals, "0");
2653
+ let [integer, fraction] = [
2654
+ display.slice(0, display.length - decimals),
2655
+ display.slice(display.length - decimals)
2656
+ ];
2657
+ fraction = fraction.replace(/(0+)$/, "");
2658
+ return `${negative ? "-" : ""}${integer || "0"}${fraction ? `.${fraction}` : ""}`;
2659
+ }
2660
+
2661
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/unit/formatEther.js
2662
+ function formatEther(wei, unit = "wei") {
2663
+ return formatUnits(wei, etherUnits[unit]);
2664
+ }
2665
+
2666
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/unit/formatGwei.js
2667
+ function formatGwei(wei, unit = "wei") {
2668
+ return formatUnits(wei, gweiUnits[unit]);
2669
+ }
2670
+
2671
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/errors/stateOverride.js
2672
+ var AccountStateConflictError = class extends BaseError2 {
2673
+ constructor({ address }) {
2674
+ super(`State for account "${address}" is set multiple times.`, {
2675
+ name: "AccountStateConflictError"
2676
+ });
2677
+ }
2678
+ };
2679
+ var StateAssignmentConflictError = class extends BaseError2 {
2680
+ constructor() {
2681
+ super("state and stateDiff are set on the same account.", {
2682
+ name: "StateAssignmentConflictError"
2683
+ });
2684
+ }
2685
+ };
2686
+ function prettyStateMapping(stateMapping) {
2687
+ return stateMapping.reduce((pretty, { slot, value }) => {
2688
+ return `${pretty} ${slot}: ${value}
2689
+ `;
2690
+ }, "");
2691
+ }
2692
+ function prettyStateOverride(stateOverride) {
2693
+ return stateOverride.reduce((pretty, { address, ...state }) => {
2694
+ let val = `${pretty} ${address}:
2695
+ `;
2696
+ if (state.nonce)
2697
+ val += ` nonce: ${state.nonce}
2698
+ `;
2699
+ if (state.balance)
2700
+ val += ` balance: ${state.balance}
2701
+ `;
2702
+ if (state.code)
2703
+ val += ` code: ${state.code}
2704
+ `;
2705
+ if (state.state) {
2706
+ val += " state:\n";
2707
+ val += prettyStateMapping(state.state);
2708
+ }
2709
+ if (state.stateDiff) {
2710
+ val += " stateDiff:\n";
2711
+ val += prettyStateMapping(state.stateDiff);
2712
+ }
2713
+ return val;
2714
+ }, " State Override:\n").slice(0, -1);
2715
+ }
2716
+
2717
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/errors/transaction.js
2718
+ function prettyPrint(args) {
2719
+ const entries = Object.entries(args).map(([key, value]) => {
2720
+ if (value === void 0 || value === false)
2721
+ return null;
2722
+ return [key, value];
2723
+ }).filter(Boolean);
2724
+ const maxLength = entries.reduce((acc, [key]) => Math.max(acc, key.length), 0);
2725
+ return entries.map(([key, value]) => ` ${`${key}:`.padEnd(maxLength + 1)} ${value}`).join("\n");
2726
+ }
2727
+ var FeeConflictError = class extends BaseError2 {
2728
+ constructor() {
2729
+ super([
2730
+ "Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.",
2731
+ "Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."
2732
+ ].join("\n"), { name: "FeeConflictError" });
2733
+ }
2734
+ };
2735
+
2736
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/errors/utils.js
2737
+ var getUrl = (url) => url;
2738
+
2739
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/errors/contract.js
2740
+ var CallExecutionError = class extends BaseError2 {
2741
+ constructor(cause, { account: account_, docsPath: docsPath4, chain, data, gas, gasPrice, maxFeePerGas, maxPriorityFeePerGas, nonce, to, value, stateOverride }) {
2742
+ const account = account_ ? parseAccount(account_) : void 0;
2743
+ let prettyArgs = prettyPrint({
2744
+ from: account?.address,
2745
+ to,
2746
+ value: typeof value !== "undefined" && `${formatEther(value)} ${chain?.nativeCurrency?.symbol || "ETH"}`,
2747
+ data,
2748
+ gas,
2749
+ gasPrice: typeof gasPrice !== "undefined" && `${formatGwei(gasPrice)} gwei`,
2750
+ maxFeePerGas: typeof maxFeePerGas !== "undefined" && `${formatGwei(maxFeePerGas)} gwei`,
2751
+ maxPriorityFeePerGas: typeof maxPriorityFeePerGas !== "undefined" && `${formatGwei(maxPriorityFeePerGas)} gwei`,
2752
+ nonce
2753
+ });
2754
+ if (stateOverride) {
2755
+ prettyArgs += `
2756
+ ${prettyStateOverride(stateOverride)}`;
2757
+ }
2758
+ super(cause.shortMessage, {
2759
+ cause,
2760
+ docsPath: docsPath4,
2761
+ metaMessages: [
2762
+ ...cause.metaMessages ? [...cause.metaMessages, " "] : [],
2763
+ "Raw Call Arguments:",
2764
+ prettyArgs
2765
+ ].filter(Boolean),
2766
+ name: "CallExecutionError"
2767
+ });
2768
+ Object.defineProperty(this, "cause", {
2769
+ enumerable: true,
2770
+ configurable: true,
2771
+ writable: true,
2772
+ value: void 0
2773
+ });
2774
+ this.cause = cause;
2775
+ }
2776
+ };
2777
+ var CounterfactualDeploymentFailedError = class extends BaseError2 {
2778
+ constructor({ factory }) {
2779
+ super(`Deployment for counterfactual contract call failed${factory ? ` for factory "${factory}".` : ""}`, {
2780
+ metaMessages: [
2781
+ "Please ensure:",
2782
+ "- The `factory` is a valid contract deployment factory (ie. Create2 Factory, ERC-4337 Factory, etc).",
2783
+ "- The `factoryData` is a valid encoded function call for contract deployment function on the factory."
2784
+ ],
2785
+ name: "CounterfactualDeploymentFailedError"
2786
+ });
2787
+ }
2788
+ };
2789
+ var RawContractError = class extends BaseError2 {
2790
+ constructor({ data, message }) {
2791
+ super(message || "", { name: "RawContractError" });
2792
+ Object.defineProperty(this, "code", {
2793
+ enumerable: true,
2794
+ configurable: true,
2795
+ writable: true,
2796
+ value: 3
2797
+ });
2798
+ Object.defineProperty(this, "data", {
2799
+ enumerable: true,
2800
+ configurable: true,
2801
+ writable: true,
2802
+ value: void 0
2803
+ });
2804
+ this.data = data;
2805
+ }
2806
+ };
2807
+
2808
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/abi/decodeFunctionResult.js
2809
+ var docsPath = "/docs/contract/decodeFunctionResult";
2810
+ function decodeFunctionResult(parameters) {
2811
+ const { abi, args, functionName, data } = parameters;
2812
+ let abiItem = abi[0];
2813
+ if (functionName) {
2814
+ const item = getAbiItem({ abi, args, name: functionName });
2815
+ if (!item)
2816
+ throw new AbiFunctionNotFoundError(functionName, { docsPath });
2817
+ abiItem = item;
2818
+ }
2819
+ if (abiItem.type !== "function")
2820
+ throw new AbiFunctionNotFoundError(void 0, { docsPath });
2821
+ if (!abiItem.outputs)
2822
+ throw new AbiFunctionOutputsNotFoundError(abiItem.name, { docsPath });
2823
+ const values = decodeAbiParameters(abiItem.outputs, data);
2824
+ if (values && values.length > 1)
2825
+ return values;
2826
+ if (values && values.length === 1)
2827
+ return values[0];
2828
+ return void 0;
2829
+ }
2830
+
2831
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/abi/encodeDeployData.js
2832
+ var docsPath2 = "/docs/contract/encodeDeployData";
2833
+ function encodeDeployData(parameters) {
2834
+ const { abi, args, bytecode } = parameters;
2835
+ if (!args || args.length === 0)
2836
+ return bytecode;
2837
+ const description = abi.find((x) => "type" in x && x.type === "constructor");
2838
+ if (!description)
2839
+ throw new AbiConstructorNotFoundError({ docsPath: docsPath2 });
2840
+ if (!("inputs" in description))
2841
+ throw new AbiConstructorParamsNotFoundError({ docsPath: docsPath2 });
2842
+ if (!description.inputs || description.inputs.length === 0)
2843
+ throw new AbiConstructorParamsNotFoundError({ docsPath: docsPath2 });
2844
+ const data = encodeAbiParameters(description.inputs, args);
2845
+ return concatHex([bytecode, data]);
2846
+ }
2847
+
2848
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/abi/prepareEncodeFunctionData.js
2849
+ var docsPath3 = "/docs/contract/encodeFunctionData";
2850
+ function prepareEncodeFunctionData(parameters) {
2851
+ const { abi, args, functionName } = parameters;
2852
+ let abiItem = abi[0];
2853
+ if (functionName) {
2854
+ const item = getAbiItem({
2855
+ abi,
2856
+ args,
2857
+ name: functionName
2858
+ });
2859
+ if (!item)
2860
+ throw new AbiFunctionNotFoundError(functionName, { docsPath: docsPath3 });
2861
+ abiItem = item;
2862
+ }
2863
+ if (abiItem.type !== "function")
2864
+ throw new AbiFunctionNotFoundError(void 0, { docsPath: docsPath3 });
2865
+ return {
2866
+ abi: [abiItem],
2867
+ functionName: toFunctionSelector(formatAbiItem2(abiItem))
2868
+ };
2869
+ }
2870
+
2871
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/abi/encodeFunctionData.js
2872
+ function encodeFunctionData(parameters) {
2873
+ const { args } = parameters;
2874
+ const { abi, functionName } = (() => {
2875
+ if (parameters.abi.length === 1 && parameters.functionName?.startsWith("0x"))
2876
+ return parameters;
2877
+ return prepareEncodeFunctionData(parameters);
2878
+ })();
2879
+ const abiItem = abi[0];
2880
+ const signature = functionName;
2881
+ const data = "inputs" in abiItem && abiItem.inputs ? encodeAbiParameters(abiItem.inputs, args ?? []) : void 0;
2882
+ return concatHex([signature, data ?? "0x"]);
2883
+ }
2884
+
2885
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/chain/getChainContractAddress.js
2886
+ function getChainContractAddress({ blockNumber, chain, contract: name }) {
2887
+ const contract = chain?.contracts?.[name];
2888
+ if (!contract)
2889
+ throw new ChainDoesNotSupportContract({
2890
+ chain,
2891
+ contract: { name }
2892
+ });
2893
+ if (blockNumber && contract.blockCreated && contract.blockCreated > blockNumber)
2894
+ throw new ChainDoesNotSupportContract({
2895
+ blockNumber,
2896
+ chain,
2897
+ contract: {
2898
+ name,
2899
+ blockCreated: contract.blockCreated
2900
+ }
2901
+ });
2902
+ return contract.address;
2903
+ }
2904
+
2905
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/errors/node.js
2906
+ var ExecutionRevertedError = class extends BaseError2 {
2907
+ constructor({ cause, message } = {}) {
2908
+ const reason = message?.replace("execution reverted: ", "")?.replace("execution reverted", "");
2909
+ super(`Execution reverted ${reason ? `with reason: ${reason}` : "for an unknown reason"}.`, {
2910
+ cause,
2911
+ name: "ExecutionRevertedError"
2912
+ });
2913
+ }
2914
+ };
2915
+ Object.defineProperty(ExecutionRevertedError, "code", {
2916
+ enumerable: true,
2917
+ configurable: true,
2918
+ writable: true,
2919
+ value: 3
2920
+ });
2921
+ Object.defineProperty(ExecutionRevertedError, "nodeMessage", {
2922
+ enumerable: true,
2923
+ configurable: true,
2924
+ writable: true,
2925
+ value: /execution reverted/
2926
+ });
2927
+ var FeeCapTooHighError = class extends BaseError2 {
2928
+ constructor({ cause, maxFeePerGas } = {}) {
2929
+ super(`The fee cap (\`maxFeePerGas\`${maxFeePerGas ? ` = ${formatGwei(maxFeePerGas)} gwei` : ""}) cannot be higher than the maximum allowed value (2^256-1).`, {
2930
+ cause,
2931
+ name: "FeeCapTooHighError"
2932
+ });
2933
+ }
2934
+ };
2935
+ Object.defineProperty(FeeCapTooHighError, "nodeMessage", {
2936
+ enumerable: true,
2937
+ configurable: true,
2938
+ writable: true,
2939
+ value: /max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/
2940
+ });
2941
+ var FeeCapTooLowError = class extends BaseError2 {
2942
+ constructor({ cause, maxFeePerGas } = {}) {
2943
+ super(`The fee cap (\`maxFeePerGas\`${maxFeePerGas ? ` = ${formatGwei(maxFeePerGas)}` : ""} gwei) cannot be lower than the block base fee.`, {
2944
+ cause,
2945
+ name: "FeeCapTooLowError"
2946
+ });
2947
+ }
2948
+ };
2949
+ Object.defineProperty(FeeCapTooLowError, "nodeMessage", {
2950
+ enumerable: true,
2951
+ configurable: true,
2952
+ writable: true,
2953
+ value: /max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/
2954
+ });
2955
+ var NonceTooHighError = class extends BaseError2 {
2956
+ constructor({ cause, nonce } = {}) {
2957
+ super(`Nonce provided for the transaction ${nonce ? `(${nonce}) ` : ""}is higher than the next one expected.`, { cause, name: "NonceTooHighError" });
2958
+ }
2959
+ };
2960
+ Object.defineProperty(NonceTooHighError, "nodeMessage", {
2961
+ enumerable: true,
2962
+ configurable: true,
2963
+ writable: true,
2964
+ value: /nonce too high/
2965
+ });
2966
+ var NonceTooLowError = class extends BaseError2 {
2967
+ constructor({ cause, nonce } = {}) {
2968
+ super([
2969
+ `Nonce provided for the transaction ${nonce ? `(${nonce}) ` : ""}is lower than the current nonce of the account.`,
2970
+ "Try increasing the nonce or find the latest nonce with `getTransactionCount`."
2971
+ ].join("\n"), { cause, name: "NonceTooLowError" });
2972
+ }
2973
+ };
2974
+ Object.defineProperty(NonceTooLowError, "nodeMessage", {
2975
+ enumerable: true,
2976
+ configurable: true,
2977
+ writable: true,
2978
+ value: /nonce too low|transaction already imported|already known/
2979
+ });
2980
+ var NonceMaxValueError = class extends BaseError2 {
2981
+ constructor({ cause, nonce } = {}) {
2982
+ super(`Nonce provided for the transaction ${nonce ? `(${nonce}) ` : ""}exceeds the maximum allowed nonce.`, { cause, name: "NonceMaxValueError" });
2983
+ }
2984
+ };
2985
+ Object.defineProperty(NonceMaxValueError, "nodeMessage", {
2986
+ enumerable: true,
2987
+ configurable: true,
2988
+ writable: true,
2989
+ value: /nonce has max value/
2990
+ });
2991
+ var InsufficientFundsError = class extends BaseError2 {
2992
+ constructor({ cause } = {}) {
2993
+ super([
2994
+ "The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."
2995
+ ].join("\n"), {
2996
+ cause,
2997
+ metaMessages: [
2998
+ "This error could arise when the account does not have enough funds to:",
2999
+ " - pay for the total gas fee,",
3000
+ " - pay for the value to send.",
3001
+ " ",
3002
+ "The cost of the transaction is calculated as `gas * gas fee + value`, where:",
3003
+ " - `gas` is the amount of gas needed for transaction to execute,",
3004
+ " - `gas fee` is the gas fee,",
3005
+ " - `value` is the amount of ether to send to the recipient."
3006
+ ],
3007
+ name: "InsufficientFundsError"
3008
+ });
3009
+ }
3010
+ };
3011
+ Object.defineProperty(InsufficientFundsError, "nodeMessage", {
3012
+ enumerable: true,
3013
+ configurable: true,
3014
+ writable: true,
3015
+ value: /insufficient funds|exceeds transaction sender account balance/
3016
+ });
3017
+ var IntrinsicGasTooHighError = class extends BaseError2 {
3018
+ constructor({ cause, gas } = {}) {
3019
+ super(`The amount of gas ${gas ? `(${gas}) ` : ""}provided for the transaction exceeds the limit allowed for the block.`, {
3020
+ cause,
3021
+ name: "IntrinsicGasTooHighError"
3022
+ });
3023
+ }
3024
+ };
3025
+ Object.defineProperty(IntrinsicGasTooHighError, "nodeMessage", {
3026
+ enumerable: true,
3027
+ configurable: true,
3028
+ writable: true,
3029
+ value: /intrinsic gas too high|gas limit reached/
3030
+ });
3031
+ var IntrinsicGasTooLowError = class extends BaseError2 {
3032
+ constructor({ cause, gas } = {}) {
3033
+ super(`The amount of gas ${gas ? `(${gas}) ` : ""}provided for the transaction is too low.`, {
3034
+ cause,
3035
+ name: "IntrinsicGasTooLowError"
3036
+ });
3037
+ }
3038
+ };
3039
+ Object.defineProperty(IntrinsicGasTooLowError, "nodeMessage", {
3040
+ enumerable: true,
3041
+ configurable: true,
3042
+ writable: true,
3043
+ value: /intrinsic gas too low/
3044
+ });
3045
+ var TransactionTypeNotSupportedError = class extends BaseError2 {
3046
+ constructor({ cause }) {
3047
+ super("The transaction type is not supported for this chain.", {
3048
+ cause,
3049
+ name: "TransactionTypeNotSupportedError"
3050
+ });
3051
+ }
3052
+ };
3053
+ Object.defineProperty(TransactionTypeNotSupportedError, "nodeMessage", {
3054
+ enumerable: true,
3055
+ configurable: true,
3056
+ writable: true,
3057
+ value: /transaction type not valid/
3058
+ });
3059
+ var TipAboveFeeCapError = class extends BaseError2 {
3060
+ constructor({ cause, maxPriorityFeePerGas, maxFeePerGas } = {}) {
3061
+ super([
3062
+ `The provided tip (\`maxPriorityFeePerGas\`${maxPriorityFeePerGas ? ` = ${formatGwei(maxPriorityFeePerGas)} gwei` : ""}) cannot be higher than the fee cap (\`maxFeePerGas\`${maxFeePerGas ? ` = ${formatGwei(maxFeePerGas)} gwei` : ""}).`
3063
+ ].join("\n"), {
3064
+ cause,
3065
+ name: "TipAboveFeeCapError"
3066
+ });
3067
+ }
3068
+ };
3069
+ Object.defineProperty(TipAboveFeeCapError, "nodeMessage", {
3070
+ enumerable: true,
3071
+ configurable: true,
3072
+ writable: true,
3073
+ value: /max priority fee per gas higher than max fee per gas|tip higher than fee cap/
3074
+ });
3075
+ var UnknownNodeError = class extends BaseError2 {
3076
+ constructor({ cause }) {
3077
+ super(`An error occurred while executing: ${cause?.shortMessage}`, {
3078
+ cause,
3079
+ name: "UnknownNodeError"
3080
+ });
3081
+ }
3082
+ };
3083
+
3084
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/errors/request.js
3085
+ var HttpRequestError = class extends BaseError2 {
3086
+ constructor({ body, cause, details, headers, status, url }) {
3087
+ super("HTTP request failed.", {
3088
+ cause,
3089
+ details,
3090
+ metaMessages: [
3091
+ status && `Status: ${status}`,
3092
+ `URL: ${getUrl(url)}`,
3093
+ body && `Request body: ${stringify(body)}`
3094
+ ].filter(Boolean),
3095
+ name: "HttpRequestError"
3096
+ });
3097
+ Object.defineProperty(this, "body", {
3098
+ enumerable: true,
3099
+ configurable: true,
3100
+ writable: true,
3101
+ value: void 0
3102
+ });
3103
+ Object.defineProperty(this, "headers", {
3104
+ enumerable: true,
3105
+ configurable: true,
3106
+ writable: true,
3107
+ value: void 0
3108
+ });
3109
+ Object.defineProperty(this, "status", {
3110
+ enumerable: true,
3111
+ configurable: true,
3112
+ writable: true,
3113
+ value: void 0
3114
+ });
3115
+ Object.defineProperty(this, "url", {
3116
+ enumerable: true,
3117
+ configurable: true,
3118
+ writable: true,
3119
+ value: void 0
3120
+ });
3121
+ this.body = body;
3122
+ this.headers = headers;
3123
+ this.status = status;
3124
+ this.url = url;
3125
+ }
3126
+ };
3127
+
3128
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/errors/getNodeError.js
3129
+ function getNodeError(err, args) {
3130
+ const message = (err.details || "").toLowerCase();
3131
+ const executionRevertedError = err instanceof BaseError2 ? err.walk((e) => e?.code === ExecutionRevertedError.code) : err;
3132
+ if (executionRevertedError instanceof BaseError2)
3133
+ return new ExecutionRevertedError({
3134
+ cause: err,
3135
+ message: executionRevertedError.details
3136
+ });
3137
+ if (ExecutionRevertedError.nodeMessage.test(message))
3138
+ return new ExecutionRevertedError({
3139
+ cause: err,
3140
+ message: err.details
3141
+ });
3142
+ if (FeeCapTooHighError.nodeMessage.test(message))
3143
+ return new FeeCapTooHighError({
3144
+ cause: err,
3145
+ maxFeePerGas: args?.maxFeePerGas
3146
+ });
3147
+ if (FeeCapTooLowError.nodeMessage.test(message))
3148
+ return new FeeCapTooLowError({
3149
+ cause: err,
3150
+ maxFeePerGas: args?.maxFeePerGas
3151
+ });
3152
+ if (NonceTooHighError.nodeMessage.test(message))
3153
+ return new NonceTooHighError({ cause: err, nonce: args?.nonce });
3154
+ if (NonceTooLowError.nodeMessage.test(message))
3155
+ return new NonceTooLowError({ cause: err, nonce: args?.nonce });
3156
+ if (NonceMaxValueError.nodeMessage.test(message))
3157
+ return new NonceMaxValueError({ cause: err, nonce: args?.nonce });
3158
+ if (InsufficientFundsError.nodeMessage.test(message))
3159
+ return new InsufficientFundsError({ cause: err });
3160
+ if (IntrinsicGasTooHighError.nodeMessage.test(message))
3161
+ return new IntrinsicGasTooHighError({ cause: err, gas: args?.gas });
3162
+ if (IntrinsicGasTooLowError.nodeMessage.test(message))
3163
+ return new IntrinsicGasTooLowError({ cause: err, gas: args?.gas });
3164
+ if (TransactionTypeNotSupportedError.nodeMessage.test(message))
3165
+ return new TransactionTypeNotSupportedError({ cause: err });
3166
+ if (TipAboveFeeCapError.nodeMessage.test(message))
3167
+ return new TipAboveFeeCapError({
3168
+ cause: err,
3169
+ maxFeePerGas: args?.maxFeePerGas,
3170
+ maxPriorityFeePerGas: args?.maxPriorityFeePerGas
3171
+ });
3172
+ return new UnknownNodeError({
3173
+ cause: err
3174
+ });
3175
+ }
3176
+
3177
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/errors/getCallError.js
3178
+ function getCallError(err, { docsPath: docsPath4, ...args }) {
3179
+ const cause = (() => {
3180
+ const cause2 = getNodeError(err, args);
3181
+ if (cause2 instanceof UnknownNodeError)
3182
+ return err;
3183
+ return cause2;
3184
+ })();
3185
+ return new CallExecutionError(cause, {
3186
+ docsPath: docsPath4,
3187
+ ...args
3188
+ });
3189
+ }
3190
+
3191
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/formatters/extract.js
3192
+ function extract(value_, { format }) {
3193
+ if (!format)
3194
+ return {};
3195
+ const value = {};
3196
+ function extract_(formatted2) {
3197
+ const keys = Object.keys(formatted2);
3198
+ for (const key of keys) {
3199
+ if (key in value_)
3200
+ value[key] = value_[key];
3201
+ if (formatted2[key] && typeof formatted2[key] === "object" && !Array.isArray(formatted2[key]))
3202
+ extract_(formatted2[key]);
3203
+ }
3204
+ }
3205
+ const formatted = format(value_ || {});
3206
+ extract_(formatted);
3207
+ return value;
3208
+ }
3209
+
3210
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/formatters/transactionRequest.js
3211
+ var rpcTransactionType = {
3212
+ legacy: "0x0",
3213
+ eip2930: "0x1",
3214
+ eip1559: "0x2",
3215
+ eip4844: "0x3",
3216
+ eip7702: "0x4"
3217
+ };
3218
+ function formatTransactionRequest(request) {
3219
+ const rpcRequest = {};
3220
+ if (typeof request.authorizationList !== "undefined")
3221
+ rpcRequest.authorizationList = formatAuthorizationList(request.authorizationList);
3222
+ if (typeof request.accessList !== "undefined")
3223
+ rpcRequest.accessList = request.accessList;
3224
+ if (typeof request.blobVersionedHashes !== "undefined")
3225
+ rpcRequest.blobVersionedHashes = request.blobVersionedHashes;
3226
+ if (typeof request.blobs !== "undefined") {
3227
+ if (typeof request.blobs[0] !== "string")
3228
+ rpcRequest.blobs = request.blobs.map((x) => bytesToHex(x));
3229
+ else
3230
+ rpcRequest.blobs = request.blobs;
3231
+ }
3232
+ if (typeof request.data !== "undefined")
3233
+ rpcRequest.data = request.data;
3234
+ if (typeof request.from !== "undefined")
3235
+ rpcRequest.from = request.from;
3236
+ if (typeof request.gas !== "undefined")
3237
+ rpcRequest.gas = numberToHex(request.gas);
3238
+ if (typeof request.gasPrice !== "undefined")
3239
+ rpcRequest.gasPrice = numberToHex(request.gasPrice);
3240
+ if (typeof request.maxFeePerBlobGas !== "undefined")
3241
+ rpcRequest.maxFeePerBlobGas = numberToHex(request.maxFeePerBlobGas);
3242
+ if (typeof request.maxFeePerGas !== "undefined")
3243
+ rpcRequest.maxFeePerGas = numberToHex(request.maxFeePerGas);
3244
+ if (typeof request.maxPriorityFeePerGas !== "undefined")
3245
+ rpcRequest.maxPriorityFeePerGas = numberToHex(request.maxPriorityFeePerGas);
3246
+ if (typeof request.nonce !== "undefined")
3247
+ rpcRequest.nonce = numberToHex(request.nonce);
3248
+ if (typeof request.to !== "undefined")
3249
+ rpcRequest.to = request.to;
3250
+ if (typeof request.type !== "undefined")
3251
+ rpcRequest.type = rpcTransactionType[request.type];
3252
+ if (typeof request.value !== "undefined")
3253
+ rpcRequest.value = numberToHex(request.value);
3254
+ return rpcRequest;
3255
+ }
3256
+ function formatAuthorizationList(authorizationList) {
3257
+ return authorizationList.map((authorization) => ({
3258
+ address: authorization.contractAddress,
3259
+ r: authorization.r,
3260
+ s: authorization.s,
3261
+ chainId: numberToHex(authorization.chainId),
3262
+ nonce: numberToHex(authorization.nonce),
3263
+ ...typeof authorization.yParity !== "undefined" ? { yParity: numberToHex(authorization.yParity) } : {},
3264
+ ...typeof authorization.v !== "undefined" && typeof authorization.yParity === "undefined" ? { v: numberToHex(authorization.v) } : {}
3265
+ }));
3266
+ }
3267
+
3268
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/promise/createBatchScheduler.js
3269
+ var schedulerCache = /* @__PURE__ */ new Map();
3270
+ function createBatchScheduler({ fn, id, shouldSplitBatch, wait = 0, sort }) {
3271
+ const exec = async () => {
3272
+ const scheduler = getScheduler();
3273
+ flush();
3274
+ const args = scheduler.map(({ args: args2 }) => args2);
3275
+ if (args.length === 0)
3276
+ return;
3277
+ fn(args).then((data) => {
3278
+ if (sort && Array.isArray(data))
3279
+ data.sort(sort);
3280
+ for (let i = 0; i < scheduler.length; i++) {
3281
+ const { pendingPromise } = scheduler[i];
3282
+ pendingPromise.resolve?.([data[i], data]);
3283
+ }
3284
+ }).catch((err) => {
3285
+ for (let i = 0; i < scheduler.length; i++) {
3286
+ const { pendingPromise } = scheduler[i];
3287
+ pendingPromise.reject?.(err);
3288
+ }
3289
+ });
3290
+ };
3291
+ const flush = () => schedulerCache.delete(id);
3292
+ const getBatchedArgs = () => getScheduler().map(({ args }) => args);
3293
+ const getScheduler = () => schedulerCache.get(id) || [];
3294
+ const setScheduler = (item) => schedulerCache.set(id, [...getScheduler(), item]);
3295
+ return {
3296
+ flush,
3297
+ async schedule(args) {
3298
+ const pendingPromise = {};
3299
+ const promise = new Promise((resolve, reject) => {
3300
+ pendingPromise.resolve = resolve;
3301
+ pendingPromise.reject = reject;
3302
+ });
3303
+ const split2 = shouldSplitBatch?.([...getBatchedArgs(), args]);
3304
+ if (split2)
3305
+ exec();
3306
+ const hasActiveScheduler = getScheduler().length > 0;
3307
+ if (hasActiveScheduler) {
3308
+ setScheduler({ args, pendingPromise });
3309
+ return promise;
3310
+ }
3311
+ setScheduler({ args, pendingPromise });
3312
+ setTimeout(exec, wait);
3313
+ return promise;
3314
+ }
3315
+ };
3316
+ }
3317
+
3318
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/stateOverride.js
3319
+ function serializeStateMapping(stateMapping) {
3320
+ if (!stateMapping || stateMapping.length === 0)
3321
+ return void 0;
3322
+ return stateMapping.reduce((acc, { slot, value }) => {
3323
+ if (slot.length !== 66)
3324
+ throw new InvalidBytesLengthError({
3325
+ size: slot.length,
3326
+ targetSize: 66,
3327
+ type: "hex"
3328
+ });
3329
+ if (value.length !== 66)
3330
+ throw new InvalidBytesLengthError({
3331
+ size: value.length,
3332
+ targetSize: 66,
3333
+ type: "hex"
3334
+ });
3335
+ acc[slot] = value;
3336
+ return acc;
3337
+ }, {});
3338
+ }
3339
+ function serializeAccountStateOverride(parameters) {
3340
+ const { balance, nonce, state, stateDiff, code } = parameters;
3341
+ const rpcAccountStateOverride = {};
3342
+ if (code !== void 0)
3343
+ rpcAccountStateOverride.code = code;
3344
+ if (balance !== void 0)
3345
+ rpcAccountStateOverride.balance = numberToHex(balance);
3346
+ if (nonce !== void 0)
3347
+ rpcAccountStateOverride.nonce = numberToHex(nonce);
3348
+ if (state !== void 0)
3349
+ rpcAccountStateOverride.state = serializeStateMapping(state);
3350
+ if (stateDiff !== void 0) {
3351
+ if (rpcAccountStateOverride.state)
3352
+ throw new StateAssignmentConflictError();
3353
+ rpcAccountStateOverride.stateDiff = serializeStateMapping(stateDiff);
3354
+ }
3355
+ return rpcAccountStateOverride;
3356
+ }
3357
+ function serializeStateOverride(parameters) {
3358
+ if (!parameters)
3359
+ return void 0;
3360
+ const rpcStateOverride = {};
3361
+ for (const { address, ...accountState } of parameters) {
3362
+ if (!isAddress(address, { strict: false }))
3363
+ throw new InvalidAddressError({ address });
3364
+ if (rpcStateOverride[address])
3365
+ throw new AccountStateConflictError({ address });
3366
+ rpcStateOverride[address] = serializeAccountStateOverride(accountState);
3367
+ }
3368
+ return rpcStateOverride;
3369
+ }
3370
+
3371
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/constants/number.js
3372
+ var maxInt8 = 2n ** (8n - 1n) - 1n;
3373
+ var maxInt16 = 2n ** (16n - 1n) - 1n;
3374
+ var maxInt24 = 2n ** (24n - 1n) - 1n;
3375
+ var maxInt32 = 2n ** (32n - 1n) - 1n;
3376
+ var maxInt40 = 2n ** (40n - 1n) - 1n;
3377
+ var maxInt48 = 2n ** (48n - 1n) - 1n;
3378
+ var maxInt56 = 2n ** (56n - 1n) - 1n;
3379
+ var maxInt64 = 2n ** (64n - 1n) - 1n;
3380
+ var maxInt72 = 2n ** (72n - 1n) - 1n;
3381
+ var maxInt80 = 2n ** (80n - 1n) - 1n;
3382
+ var maxInt88 = 2n ** (88n - 1n) - 1n;
3383
+ var maxInt96 = 2n ** (96n - 1n) - 1n;
3384
+ var maxInt104 = 2n ** (104n - 1n) - 1n;
3385
+ var maxInt112 = 2n ** (112n - 1n) - 1n;
3386
+ var maxInt120 = 2n ** (120n - 1n) - 1n;
3387
+ var maxInt128 = 2n ** (128n - 1n) - 1n;
3388
+ var maxInt136 = 2n ** (136n - 1n) - 1n;
3389
+ var maxInt144 = 2n ** (144n - 1n) - 1n;
3390
+ var maxInt152 = 2n ** (152n - 1n) - 1n;
3391
+ var maxInt160 = 2n ** (160n - 1n) - 1n;
3392
+ var maxInt168 = 2n ** (168n - 1n) - 1n;
3393
+ var maxInt176 = 2n ** (176n - 1n) - 1n;
3394
+ var maxInt184 = 2n ** (184n - 1n) - 1n;
3395
+ var maxInt192 = 2n ** (192n - 1n) - 1n;
3396
+ var maxInt200 = 2n ** (200n - 1n) - 1n;
3397
+ var maxInt208 = 2n ** (208n - 1n) - 1n;
3398
+ var maxInt216 = 2n ** (216n - 1n) - 1n;
3399
+ var maxInt224 = 2n ** (224n - 1n) - 1n;
3400
+ var maxInt232 = 2n ** (232n - 1n) - 1n;
3401
+ var maxInt240 = 2n ** (240n - 1n) - 1n;
3402
+ var maxInt248 = 2n ** (248n - 1n) - 1n;
3403
+ var maxInt256 = 2n ** (256n - 1n) - 1n;
3404
+ var minInt8 = -(2n ** (8n - 1n));
3405
+ var minInt16 = -(2n ** (16n - 1n));
3406
+ var minInt24 = -(2n ** (24n - 1n));
3407
+ var minInt32 = -(2n ** (32n - 1n));
3408
+ var minInt40 = -(2n ** (40n - 1n));
3409
+ var minInt48 = -(2n ** (48n - 1n));
3410
+ var minInt56 = -(2n ** (56n - 1n));
3411
+ var minInt64 = -(2n ** (64n - 1n));
3412
+ var minInt72 = -(2n ** (72n - 1n));
3413
+ var minInt80 = -(2n ** (80n - 1n));
3414
+ var minInt88 = -(2n ** (88n - 1n));
3415
+ var minInt96 = -(2n ** (96n - 1n));
3416
+ var minInt104 = -(2n ** (104n - 1n));
3417
+ var minInt112 = -(2n ** (112n - 1n));
3418
+ var minInt120 = -(2n ** (120n - 1n));
3419
+ var minInt128 = -(2n ** (128n - 1n));
3420
+ var minInt136 = -(2n ** (136n - 1n));
3421
+ var minInt144 = -(2n ** (144n - 1n));
3422
+ var minInt152 = -(2n ** (152n - 1n));
3423
+ var minInt160 = -(2n ** (160n - 1n));
3424
+ var minInt168 = -(2n ** (168n - 1n));
3425
+ var minInt176 = -(2n ** (176n - 1n));
3426
+ var minInt184 = -(2n ** (184n - 1n));
3427
+ var minInt192 = -(2n ** (192n - 1n));
3428
+ var minInt200 = -(2n ** (200n - 1n));
3429
+ var minInt208 = -(2n ** (208n - 1n));
3430
+ var minInt216 = -(2n ** (216n - 1n));
3431
+ var minInt224 = -(2n ** (224n - 1n));
3432
+ var minInt232 = -(2n ** (232n - 1n));
3433
+ var minInt240 = -(2n ** (240n - 1n));
3434
+ var minInt248 = -(2n ** (248n - 1n));
3435
+ var minInt256 = -(2n ** (256n - 1n));
3436
+ var maxUint8 = 2n ** 8n - 1n;
3437
+ var maxUint16 = 2n ** 16n - 1n;
3438
+ var maxUint24 = 2n ** 24n - 1n;
3439
+ var maxUint32 = 2n ** 32n - 1n;
3440
+ var maxUint40 = 2n ** 40n - 1n;
3441
+ var maxUint48 = 2n ** 48n - 1n;
3442
+ var maxUint56 = 2n ** 56n - 1n;
3443
+ var maxUint64 = 2n ** 64n - 1n;
3444
+ var maxUint72 = 2n ** 72n - 1n;
3445
+ var maxUint80 = 2n ** 80n - 1n;
3446
+ var maxUint88 = 2n ** 88n - 1n;
3447
+ var maxUint96 = 2n ** 96n - 1n;
3448
+ var maxUint104 = 2n ** 104n - 1n;
3449
+ var maxUint112 = 2n ** 112n - 1n;
3450
+ var maxUint120 = 2n ** 120n - 1n;
3451
+ var maxUint128 = 2n ** 128n - 1n;
3452
+ var maxUint136 = 2n ** 136n - 1n;
3453
+ var maxUint144 = 2n ** 144n - 1n;
3454
+ var maxUint152 = 2n ** 152n - 1n;
3455
+ var maxUint160 = 2n ** 160n - 1n;
3456
+ var maxUint168 = 2n ** 168n - 1n;
3457
+ var maxUint176 = 2n ** 176n - 1n;
3458
+ var maxUint184 = 2n ** 184n - 1n;
3459
+ var maxUint192 = 2n ** 192n - 1n;
3460
+ var maxUint200 = 2n ** 200n - 1n;
3461
+ var maxUint208 = 2n ** 208n - 1n;
3462
+ var maxUint216 = 2n ** 216n - 1n;
3463
+ var maxUint224 = 2n ** 224n - 1n;
3464
+ var maxUint232 = 2n ** 232n - 1n;
3465
+ var maxUint240 = 2n ** 240n - 1n;
3466
+ var maxUint248 = 2n ** 248n - 1n;
3467
+ var maxUint256 = 2n ** 256n - 1n;
3468
+
3469
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/transaction/assertRequest.js
3470
+ function assertRequest(args) {
3471
+ const { account: account_, gasPrice, maxFeePerGas, maxPriorityFeePerGas, to } = args;
3472
+ const account = account_ ? parseAccount(account_) : void 0;
3473
+ if (account && !isAddress(account.address))
3474
+ throw new InvalidAddressError({ address: account.address });
3475
+ if (to && !isAddress(to))
3476
+ throw new InvalidAddressError({ address: to });
3477
+ if (typeof gasPrice !== "undefined" && (typeof maxFeePerGas !== "undefined" || typeof maxPriorityFeePerGas !== "undefined"))
3478
+ throw new FeeConflictError();
3479
+ if (maxFeePerGas && maxFeePerGas > maxUint256)
3480
+ throw new FeeCapTooHighError({ maxFeePerGas });
3481
+ if (maxPriorityFeePerGas && maxFeePerGas && maxPriorityFeePerGas > maxFeePerGas)
3482
+ throw new TipAboveFeeCapError({ maxFeePerGas, maxPriorityFeePerGas });
3483
+ }
3484
+
3485
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/actions/public/call.js
3486
+ async function call(client, args) {
3487
+ const { account: account_ = client.account, batch = Boolean(client.batch?.multicall), blockNumber, blockTag = "latest", accessList, blobs, code, data: data_, factory, factoryData, gas, gasPrice, maxFeePerBlobGas, maxFeePerGas, maxPriorityFeePerGas, nonce, to, value, stateOverride, ...rest } = args;
3488
+ const account = account_ ? parseAccount(account_) : void 0;
3489
+ if (code && (factory || factoryData))
3490
+ throw new BaseError2("Cannot provide both `code` & `factory`/`factoryData` as parameters.");
3491
+ if (code && to)
3492
+ throw new BaseError2("Cannot provide both `code` & `to` as parameters.");
3493
+ const deploylessCallViaBytecode = code && data_;
3494
+ const deploylessCallViaFactory = factory && factoryData && to && data_;
3495
+ const deploylessCall = deploylessCallViaBytecode || deploylessCallViaFactory;
3496
+ const data = (() => {
3497
+ if (deploylessCallViaBytecode)
3498
+ return toDeploylessCallViaBytecodeData({
3499
+ code,
3500
+ data: data_
3501
+ });
3502
+ if (deploylessCallViaFactory)
3503
+ return toDeploylessCallViaFactoryData({
3504
+ data: data_,
3505
+ factory,
3506
+ factoryData,
3507
+ to
3508
+ });
3509
+ return data_;
3510
+ })();
3511
+ try {
3512
+ assertRequest(args);
3513
+ const blockNumberHex = blockNumber ? numberToHex(blockNumber) : void 0;
3514
+ const block = blockNumberHex || blockTag;
3515
+ const rpcStateOverride = serializeStateOverride(stateOverride);
3516
+ const chainFormat = client.chain?.formatters?.transactionRequest?.format;
3517
+ const format = chainFormat || formatTransactionRequest;
3518
+ const request = format({
3519
+ // Pick out extra data that might exist on the chain's transaction request type.
3520
+ ...extract(rest, { format: chainFormat }),
3521
+ from: account?.address,
3522
+ accessList,
3523
+ blobs,
3524
+ data,
3525
+ gas,
3526
+ gasPrice,
3527
+ maxFeePerBlobGas,
3528
+ maxFeePerGas,
3529
+ maxPriorityFeePerGas,
3530
+ nonce,
3531
+ to: deploylessCall ? void 0 : to,
3532
+ value
3533
+ });
3534
+ if (batch && shouldPerformMulticall({ request }) && !rpcStateOverride) {
3535
+ try {
3536
+ return await scheduleMulticall(client, {
3537
+ ...request,
3538
+ blockNumber,
3539
+ blockTag
3540
+ });
3541
+ } catch (err) {
3542
+ if (!(err instanceof ClientChainNotConfiguredError) && !(err instanceof ChainDoesNotSupportContract))
3543
+ throw err;
3544
+ }
3545
+ }
3546
+ const response = await client.request({
3547
+ method: "eth_call",
3548
+ params: rpcStateOverride ? [
3549
+ request,
3550
+ block,
3551
+ rpcStateOverride
3552
+ ] : [request, block]
3553
+ });
3554
+ if (response === "0x")
3555
+ return { data: void 0 };
3556
+ return { data: response };
3557
+ } catch (err) {
3558
+ const data2 = getRevertErrorData(err);
3559
+ const { offchainLookup: offchainLookup2, offchainLookupSignature: offchainLookupSignature2 } = await import("./ccip-VJWDNI4X.js");
3560
+ if (client.ccipRead !== false && data2?.slice(0, 10) === offchainLookupSignature2 && to)
3561
+ return { data: await offchainLookup2(client, { data: data2, to }) };
3562
+ if (deploylessCall && data2?.slice(0, 10) === "0x101bb98d")
3563
+ throw new CounterfactualDeploymentFailedError({ factory });
3564
+ throw getCallError(err, {
3565
+ ...args,
3566
+ account,
3567
+ chain: client.chain
3568
+ });
3569
+ }
3570
+ }
3571
+ function shouldPerformMulticall({ request }) {
3572
+ const { data, to, ...request_ } = request;
3573
+ if (!data)
3574
+ return false;
3575
+ if (data.startsWith(aggregate3Signature))
3576
+ return false;
3577
+ if (!to)
3578
+ return false;
3579
+ if (Object.values(request_).filter((x) => typeof x !== "undefined").length > 0)
3580
+ return false;
3581
+ return true;
3582
+ }
3583
+ async function scheduleMulticall(client, args) {
3584
+ const { batchSize = 1024, wait = 0 } = typeof client.batch?.multicall === "object" ? client.batch.multicall : {};
3585
+ const { blockNumber, blockTag = "latest", data, multicallAddress: multicallAddress_, to } = args;
3586
+ let multicallAddress = multicallAddress_;
3587
+ if (!multicallAddress) {
3588
+ if (!client.chain)
3589
+ throw new ClientChainNotConfiguredError();
3590
+ multicallAddress = getChainContractAddress({
3591
+ blockNumber,
3592
+ chain: client.chain,
3593
+ contract: "multicall3"
3594
+ });
3595
+ }
3596
+ const blockNumberHex = blockNumber ? numberToHex(blockNumber) : void 0;
3597
+ const block = blockNumberHex || blockTag;
3598
+ const { schedule } = createBatchScheduler({
3599
+ id: `${client.uid}.${block}`,
3600
+ wait,
3601
+ shouldSplitBatch(args2) {
3602
+ const size2 = args2.reduce((size3, { data: data2 }) => size3 + (data2.length - 2), 0);
3603
+ return size2 > batchSize * 2;
3604
+ },
3605
+ fn: async (requests) => {
3606
+ const calls = requests.map((request) => ({
3607
+ allowFailure: true,
3608
+ callData: request.data,
3609
+ target: request.to
3610
+ }));
3611
+ const calldata = encodeFunctionData({
3612
+ abi: multicall3Abi,
3613
+ args: [calls],
3614
+ functionName: "aggregate3"
3615
+ });
3616
+ const data2 = await client.request({
3617
+ method: "eth_call",
3618
+ params: [
3619
+ {
3620
+ data: calldata,
3621
+ to: multicallAddress
3622
+ },
3623
+ block
3624
+ ]
3625
+ });
3626
+ return decodeFunctionResult({
3627
+ abi: multicall3Abi,
3628
+ args: [calls],
3629
+ functionName: "aggregate3",
3630
+ data: data2 || "0x"
3631
+ });
3632
+ }
3633
+ });
3634
+ const [{ returnData, success }] = await schedule({ data, to });
3635
+ if (!success)
3636
+ throw new RawContractError({ data: returnData });
3637
+ if (returnData === "0x")
3638
+ return { data: void 0 };
3639
+ return { data: returnData };
3640
+ }
3641
+ function toDeploylessCallViaBytecodeData(parameters) {
3642
+ const { code, data } = parameters;
3643
+ return encodeDeployData({
3644
+ abi: parseAbi(["constructor(bytes, bytes)"]),
3645
+ bytecode: deploylessCallViaBytecodeBytecode,
3646
+ args: [code, data]
3647
+ });
3648
+ }
3649
+ function toDeploylessCallViaFactoryData(parameters) {
3650
+ const { data, factory, factoryData, to } = parameters;
3651
+ return encodeDeployData({
3652
+ abi: parseAbi(["constructor(address, bytes, address, bytes)"]),
3653
+ bytecode: deploylessCallViaFactoryBytecode,
3654
+ args: [to, data, factory, factoryData]
3655
+ });
3656
+ }
3657
+ function getRevertErrorData(err) {
3658
+ if (!(err instanceof BaseError2))
3659
+ return void 0;
3660
+ const error = err.walk();
3661
+ return typeof error?.data === "object" ? error.data?.data : error.data;
3662
+ }
3663
+
3664
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/errors/ccip.js
3665
+ var OffchainLookupError = class extends BaseError2 {
3666
+ constructor({ callbackSelector, cause, data, extraData, sender, urls }) {
3667
+ super(cause.shortMessage || "An error occurred while fetching for an offchain result.", {
3668
+ cause,
3669
+ metaMessages: [
3670
+ ...cause.metaMessages || [],
3671
+ cause.metaMessages?.length ? "" : [],
3672
+ "Offchain Gateway Call:",
3673
+ urls && [
3674
+ " Gateway URL(s):",
3675
+ ...urls.map((url) => ` ${getUrl(url)}`)
3676
+ ],
3677
+ ` Sender: ${sender}`,
3678
+ ` Data: ${data}`,
3679
+ ` Callback selector: ${callbackSelector}`,
3680
+ ` Extra data: ${extraData}`
3681
+ ].flat(),
3682
+ name: "OffchainLookupError"
3683
+ });
3684
+ }
3685
+ };
3686
+ var OffchainLookupResponseMalformedError = class extends BaseError2 {
3687
+ constructor({ result, url }) {
3688
+ super("Offchain gateway response is malformed. Response data must be a hex value.", {
3689
+ metaMessages: [
3690
+ `Gateway URL: ${getUrl(url)}`,
3691
+ `Response: ${stringify(result)}`
3692
+ ],
3693
+ name: "OffchainLookupResponseMalformedError"
3694
+ });
3695
+ }
3696
+ };
3697
+ var OffchainLookupSenderMismatchError = class extends BaseError2 {
3698
+ constructor({ sender, to }) {
3699
+ super("Reverted sender address does not match target contract address (`to`).", {
3700
+ metaMessages: [
3701
+ `Contract address: ${to}`,
3702
+ `OffchainLookup sender address: ${sender}`
3703
+ ],
3704
+ name: "OffchainLookupSenderMismatchError"
3705
+ });
3706
+ }
3707
+ };
3708
+
3709
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/address/isAddressEqual.js
3710
+ function isAddressEqual(a, b) {
3711
+ if (!isAddress(a, { strict: false }))
3712
+ throw new InvalidAddressError({ address: a });
3713
+ if (!isAddress(b, { strict: false }))
3714
+ throw new InvalidAddressError({ address: b });
3715
+ return a.toLowerCase() === b.toLowerCase();
3716
+ }
3717
+
3718
+ // ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/ccip.js
3719
+ var offchainLookupSignature = "0x556f1830";
3720
+ var offchainLookupAbiItem = {
3721
+ name: "OffchainLookup",
3722
+ type: "error",
3723
+ inputs: [
3724
+ {
3725
+ name: "sender",
3726
+ type: "address"
3727
+ },
3728
+ {
3729
+ name: "urls",
3730
+ type: "string[]"
3731
+ },
3732
+ {
3733
+ name: "callData",
3734
+ type: "bytes"
3735
+ },
3736
+ {
3737
+ name: "callbackFunction",
3738
+ type: "bytes4"
3739
+ },
3740
+ {
3741
+ name: "extraData",
3742
+ type: "bytes"
3743
+ }
3744
+ ]
3745
+ };
3746
+ async function offchainLookup(client, { blockNumber, blockTag, data, to }) {
3747
+ const { args } = decodeErrorResult({
3748
+ data,
3749
+ abi: [offchainLookupAbiItem]
3750
+ });
3751
+ const [sender, urls, callData, callbackSelector, extraData] = args;
3752
+ const { ccipRead } = client;
3753
+ const ccipRequest_ = ccipRead && typeof ccipRead?.request === "function" ? ccipRead.request : ccipRequest;
3754
+ try {
3755
+ if (!isAddressEqual(to, sender))
3756
+ throw new OffchainLookupSenderMismatchError({ sender, to });
3757
+ const result = await ccipRequest_({ data: callData, sender, urls });
3758
+ const { data: data_ } = await call(client, {
3759
+ blockNumber,
3760
+ blockTag,
3761
+ data: concat([
3762
+ callbackSelector,
3763
+ encodeAbiParameters([{ type: "bytes" }, { type: "bytes" }], [result, extraData])
3764
+ ]),
3765
+ to
3766
+ });
3767
+ return data_;
3768
+ } catch (err) {
3769
+ throw new OffchainLookupError({
3770
+ callbackSelector,
3771
+ cause: err,
3772
+ data,
3773
+ extraData,
3774
+ sender,
3775
+ urls
3776
+ });
3777
+ }
3778
+ }
3779
+ async function ccipRequest({ data, sender, urls }) {
3780
+ let error = new Error("An unknown error occurred.");
3781
+ for (let i = 0; i < urls.length; i++) {
3782
+ const url = urls[i];
3783
+ const method = url.includes("{data}") ? "GET" : "POST";
3784
+ const body = method === "POST" ? { data, sender } : void 0;
3785
+ try {
3786
+ const response = await fetch(url.replace("{sender}", sender).replace("{data}", data), {
3787
+ body: JSON.stringify(body),
3788
+ method
3789
+ });
3790
+ let result;
3791
+ if (response.headers.get("Content-Type")?.startsWith("application/json")) {
3792
+ result = (await response.json()).data;
3793
+ } else {
3794
+ result = await response.text();
3795
+ }
3796
+ if (!response.ok) {
3797
+ error = new HttpRequestError({
3798
+ body,
3799
+ details: result?.error ? stringify(result.error) : response.statusText,
3800
+ headers: response.headers,
3801
+ status: response.status,
3802
+ url
3803
+ });
3804
+ continue;
3805
+ }
3806
+ if (!isHex(result)) {
3807
+ error = new OffchainLookupResponseMalformedError({
3808
+ result,
3809
+ url
3810
+ });
3811
+ continue;
3812
+ }
3813
+ return result;
3814
+ } catch (err) {
3815
+ error = new HttpRequestError({
3816
+ body,
3817
+ details: err.message,
3818
+ url
3819
+ });
3820
+ }
3821
+ }
3822
+ throw error;
3823
+ }
3824
+
3825
+ export {
3826
+ stringToHex,
3827
+ encodeAbiParameters,
3828
+ offchainLookupSignature,
3829
+ offchainLookupAbiItem,
3830
+ offchainLookup,
3831
+ ccipRequest
3832
+ };
3833
+ //# sourceMappingURL=chunk-LIWKL347.js.map