@lagoon-protocol/v0-core 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +2279 -18
- package/dist/esm/index.js +2280 -18
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/addresses.d.ts +28 -0
- package/dist/types/addresses.d.ts.map +1 -1
- package/dist/types/chain.d.ts +37 -1
- package/dist/types/chain.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/proxy/DelayProxyAdmin.d.ts +58 -0
- package/dist/types/proxy/DelayProxyAdmin.d.ts.map +1 -0
- package/dist/types/proxy/index.d.ts +2 -0
- package/dist/types/proxy/index.d.ts.map +1 -0
- package/dist/types/vault/EncodingUtils.d.ts +128 -0
- package/dist/types/vault/EncodingUtils.d.ts.map +1 -0
- package/dist/types/vault/VaultUtils.d.ts +0 -9
- package/dist/types/vault/VaultUtils.d.ts.map +1 -1
- package/dist/types/vault/index.d.ts +1 -0
- package/dist/types/vault/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -25,6 +25,2112 @@ var __export = (target, all) => {
|
|
|
25
25
|
set: (newValue) => all[name] = () => newValue
|
|
26
26
|
});
|
|
27
27
|
};
|
|
28
|
+
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
29
|
+
|
|
30
|
+
// ../../node_modules/abitype/dist/esm/version.js
|
|
31
|
+
var version = "1.0.8";
|
|
32
|
+
|
|
33
|
+
// ../../node_modules/abitype/dist/esm/errors.js
|
|
34
|
+
var BaseError;
|
|
35
|
+
var init_errors = __esm(() => {
|
|
36
|
+
BaseError = class BaseError extends Error {
|
|
37
|
+
constructor(shortMessage, args = {}) {
|
|
38
|
+
const details = args.cause instanceof BaseError ? args.cause.details : args.cause?.message ? args.cause.message : args.details;
|
|
39
|
+
const docsPath = args.cause instanceof BaseError ? args.cause.docsPath || args.docsPath : args.docsPath;
|
|
40
|
+
const message = [
|
|
41
|
+
shortMessage || "An error occurred.",
|
|
42
|
+
"",
|
|
43
|
+
...args.metaMessages ? [...args.metaMessages, ""] : [],
|
|
44
|
+
...docsPath ? [`Docs: https://abitype.dev${docsPath}`] : [],
|
|
45
|
+
...details ? [`Details: ${details}`] : [],
|
|
46
|
+
`Version: abitype@${version}`
|
|
47
|
+
].join(`
|
|
48
|
+
`);
|
|
49
|
+
super(message);
|
|
50
|
+
Object.defineProperty(this, "details", {
|
|
51
|
+
enumerable: true,
|
|
52
|
+
configurable: true,
|
|
53
|
+
writable: true,
|
|
54
|
+
value: undefined
|
|
55
|
+
});
|
|
56
|
+
Object.defineProperty(this, "docsPath", {
|
|
57
|
+
enumerable: true,
|
|
58
|
+
configurable: true,
|
|
59
|
+
writable: true,
|
|
60
|
+
value: undefined
|
|
61
|
+
});
|
|
62
|
+
Object.defineProperty(this, "metaMessages", {
|
|
63
|
+
enumerable: true,
|
|
64
|
+
configurable: true,
|
|
65
|
+
writable: true,
|
|
66
|
+
value: undefined
|
|
67
|
+
});
|
|
68
|
+
Object.defineProperty(this, "shortMessage", {
|
|
69
|
+
enumerable: true,
|
|
70
|
+
configurable: true,
|
|
71
|
+
writable: true,
|
|
72
|
+
value: undefined
|
|
73
|
+
});
|
|
74
|
+
Object.defineProperty(this, "name", {
|
|
75
|
+
enumerable: true,
|
|
76
|
+
configurable: true,
|
|
77
|
+
writable: true,
|
|
78
|
+
value: "AbiTypeError"
|
|
79
|
+
});
|
|
80
|
+
if (args.cause)
|
|
81
|
+
this.cause = args.cause;
|
|
82
|
+
this.details = details;
|
|
83
|
+
this.docsPath = docsPath;
|
|
84
|
+
this.metaMessages = args.metaMessages;
|
|
85
|
+
this.shortMessage = shortMessage;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
// ../../node_modules/abitype/dist/esm/regex.js
|
|
91
|
+
function execTyped(regex, string) {
|
|
92
|
+
const match = regex.exec(string);
|
|
93
|
+
return match?.groups;
|
|
94
|
+
}
|
|
95
|
+
var bytesRegex, integerRegex, isTupleRegex;
|
|
96
|
+
var init_regex = __esm(() => {
|
|
97
|
+
bytesRegex = /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/;
|
|
98
|
+
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)?$/;
|
|
99
|
+
isTupleRegex = /^\(.+?\).*?$/;
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
// ../../node_modules/abitype/dist/esm/human-readable/formatAbiParameter.js
|
|
103
|
+
function formatAbiParameter(abiParameter) {
|
|
104
|
+
let type = abiParameter.type;
|
|
105
|
+
if (tupleRegex.test(abiParameter.type) && "components" in abiParameter) {
|
|
106
|
+
type = "(";
|
|
107
|
+
const length = abiParameter.components.length;
|
|
108
|
+
for (let i = 0;i < length; i++) {
|
|
109
|
+
const component = abiParameter.components[i];
|
|
110
|
+
type += formatAbiParameter(component);
|
|
111
|
+
if (i < length - 1)
|
|
112
|
+
type += ", ";
|
|
113
|
+
}
|
|
114
|
+
const result = execTyped(tupleRegex, abiParameter.type);
|
|
115
|
+
type += `)${result?.array ?? ""}`;
|
|
116
|
+
return formatAbiParameter({
|
|
117
|
+
...abiParameter,
|
|
118
|
+
type
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
if ("indexed" in abiParameter && abiParameter.indexed)
|
|
122
|
+
type = `${type} indexed`;
|
|
123
|
+
if (abiParameter.name)
|
|
124
|
+
return `${type} ${abiParameter.name}`;
|
|
125
|
+
return type;
|
|
126
|
+
}
|
|
127
|
+
var tupleRegex;
|
|
128
|
+
var init_formatAbiParameter = __esm(() => {
|
|
129
|
+
init_regex();
|
|
130
|
+
tupleRegex = /^tuple(?<array>(\[(\d*)\])*)$/;
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
// ../../node_modules/abitype/dist/esm/human-readable/formatAbiParameters.js
|
|
134
|
+
function formatAbiParameters(abiParameters) {
|
|
135
|
+
let params = "";
|
|
136
|
+
const length = abiParameters.length;
|
|
137
|
+
for (let i = 0;i < length; i++) {
|
|
138
|
+
const abiParameter = abiParameters[i];
|
|
139
|
+
params += formatAbiParameter(abiParameter);
|
|
140
|
+
if (i !== length - 1)
|
|
141
|
+
params += ", ";
|
|
142
|
+
}
|
|
143
|
+
return params;
|
|
144
|
+
}
|
|
145
|
+
var init_formatAbiParameters = __esm(() => {
|
|
146
|
+
init_formatAbiParameter();
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
// ../../node_modules/abitype/dist/esm/human-readable/formatAbiItem.js
|
|
150
|
+
function formatAbiItem(abiItem) {
|
|
151
|
+
if (abiItem.type === "function")
|
|
152
|
+
return `function ${abiItem.name}(${formatAbiParameters(abiItem.inputs)})${abiItem.stateMutability && abiItem.stateMutability !== "nonpayable" ? ` ${abiItem.stateMutability}` : ""}${abiItem.outputs?.length ? ` returns (${formatAbiParameters(abiItem.outputs)})` : ""}`;
|
|
153
|
+
if (abiItem.type === "event")
|
|
154
|
+
return `event ${abiItem.name}(${formatAbiParameters(abiItem.inputs)})`;
|
|
155
|
+
if (abiItem.type === "error")
|
|
156
|
+
return `error ${abiItem.name}(${formatAbiParameters(abiItem.inputs)})`;
|
|
157
|
+
if (abiItem.type === "constructor")
|
|
158
|
+
return `constructor(${formatAbiParameters(abiItem.inputs)})${abiItem.stateMutability === "payable" ? " payable" : ""}`;
|
|
159
|
+
if (abiItem.type === "fallback")
|
|
160
|
+
return `fallback() external${abiItem.stateMutability === "payable" ? " payable" : ""}`;
|
|
161
|
+
return "receive() external payable";
|
|
162
|
+
}
|
|
163
|
+
var init_formatAbiItem = __esm(() => {
|
|
164
|
+
init_formatAbiParameters();
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
// ../../node_modules/abitype/dist/esm/human-readable/runtime/signatures.js
|
|
168
|
+
function isStructSignature(signature) {
|
|
169
|
+
return structSignatureRegex.test(signature);
|
|
170
|
+
}
|
|
171
|
+
function execStructSignature(signature) {
|
|
172
|
+
return execTyped(structSignatureRegex, signature);
|
|
173
|
+
}
|
|
174
|
+
var structSignatureRegex, modifiers, eventModifiers, functionModifiers;
|
|
175
|
+
var init_signatures = __esm(() => {
|
|
176
|
+
init_regex();
|
|
177
|
+
structSignatureRegex = /^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;
|
|
178
|
+
modifiers = new Set([
|
|
179
|
+
"memory",
|
|
180
|
+
"indexed",
|
|
181
|
+
"storage",
|
|
182
|
+
"calldata"
|
|
183
|
+
]);
|
|
184
|
+
eventModifiers = new Set(["indexed"]);
|
|
185
|
+
functionModifiers = new Set([
|
|
186
|
+
"calldata",
|
|
187
|
+
"memory",
|
|
188
|
+
"storage"
|
|
189
|
+
]);
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
// ../../node_modules/abitype/dist/esm/human-readable/errors/abiItem.js
|
|
193
|
+
var UnknownTypeError, UnknownSolidityTypeError;
|
|
194
|
+
var init_abiItem = __esm(() => {
|
|
195
|
+
init_errors();
|
|
196
|
+
UnknownTypeError = class UnknownTypeError extends BaseError {
|
|
197
|
+
constructor({ type }) {
|
|
198
|
+
super("Unknown type.", {
|
|
199
|
+
metaMessages: [
|
|
200
|
+
`Type "${type}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`
|
|
201
|
+
]
|
|
202
|
+
});
|
|
203
|
+
Object.defineProperty(this, "name", {
|
|
204
|
+
enumerable: true,
|
|
205
|
+
configurable: true,
|
|
206
|
+
writable: true,
|
|
207
|
+
value: "UnknownTypeError"
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
UnknownSolidityTypeError = class UnknownSolidityTypeError extends BaseError {
|
|
212
|
+
constructor({ type }) {
|
|
213
|
+
super("Unknown type.", {
|
|
214
|
+
metaMessages: [`Type "${type}" is not a valid ABI type.`]
|
|
215
|
+
});
|
|
216
|
+
Object.defineProperty(this, "name", {
|
|
217
|
+
enumerable: true,
|
|
218
|
+
configurable: true,
|
|
219
|
+
writable: true,
|
|
220
|
+
value: "UnknownSolidityTypeError"
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
// ../../node_modules/abitype/dist/esm/human-readable/errors/abiParameter.js
|
|
227
|
+
var InvalidAbiParameterError, InvalidAbiParametersError, InvalidParameterError, SolidityProtectedKeywordError, InvalidModifierError, InvalidFunctionModifierError, InvalidAbiTypeParameterError;
|
|
228
|
+
var init_abiParameter = __esm(() => {
|
|
229
|
+
init_errors();
|
|
230
|
+
InvalidAbiParameterError = class InvalidAbiParameterError extends BaseError {
|
|
231
|
+
constructor({ param }) {
|
|
232
|
+
super("Failed to parse ABI parameter.", {
|
|
233
|
+
details: `parseAbiParameter(${JSON.stringify(param, null, 2)})`,
|
|
234
|
+
docsPath: "/api/human#parseabiparameter-1"
|
|
235
|
+
});
|
|
236
|
+
Object.defineProperty(this, "name", {
|
|
237
|
+
enumerable: true,
|
|
238
|
+
configurable: true,
|
|
239
|
+
writable: true,
|
|
240
|
+
value: "InvalidAbiParameterError"
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
InvalidAbiParametersError = class InvalidAbiParametersError extends BaseError {
|
|
245
|
+
constructor({ params }) {
|
|
246
|
+
super("Failed to parse ABI parameters.", {
|
|
247
|
+
details: `parseAbiParameters(${JSON.stringify(params, null, 2)})`,
|
|
248
|
+
docsPath: "/api/human#parseabiparameters-1"
|
|
249
|
+
});
|
|
250
|
+
Object.defineProperty(this, "name", {
|
|
251
|
+
enumerable: true,
|
|
252
|
+
configurable: true,
|
|
253
|
+
writable: true,
|
|
254
|
+
value: "InvalidAbiParametersError"
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
InvalidParameterError = class InvalidParameterError extends BaseError {
|
|
259
|
+
constructor({ param }) {
|
|
260
|
+
super("Invalid ABI parameter.", {
|
|
261
|
+
details: param
|
|
262
|
+
});
|
|
263
|
+
Object.defineProperty(this, "name", {
|
|
264
|
+
enumerable: true,
|
|
265
|
+
configurable: true,
|
|
266
|
+
writable: true,
|
|
267
|
+
value: "InvalidParameterError"
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
SolidityProtectedKeywordError = class SolidityProtectedKeywordError extends BaseError {
|
|
272
|
+
constructor({ param, name }) {
|
|
273
|
+
super("Invalid ABI parameter.", {
|
|
274
|
+
details: param,
|
|
275
|
+
metaMessages: [
|
|
276
|
+
`"${name}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`
|
|
277
|
+
]
|
|
278
|
+
});
|
|
279
|
+
Object.defineProperty(this, "name", {
|
|
280
|
+
enumerable: true,
|
|
281
|
+
configurable: true,
|
|
282
|
+
writable: true,
|
|
283
|
+
value: "SolidityProtectedKeywordError"
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
InvalidModifierError = class InvalidModifierError extends BaseError {
|
|
288
|
+
constructor({ param, type, modifier }) {
|
|
289
|
+
super("Invalid ABI parameter.", {
|
|
290
|
+
details: param,
|
|
291
|
+
metaMessages: [
|
|
292
|
+
`Modifier "${modifier}" not allowed${type ? ` in "${type}" type` : ""}.`
|
|
293
|
+
]
|
|
294
|
+
});
|
|
295
|
+
Object.defineProperty(this, "name", {
|
|
296
|
+
enumerable: true,
|
|
297
|
+
configurable: true,
|
|
298
|
+
writable: true,
|
|
299
|
+
value: "InvalidModifierError"
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
InvalidFunctionModifierError = class InvalidFunctionModifierError extends BaseError {
|
|
304
|
+
constructor({ param, type, modifier }) {
|
|
305
|
+
super("Invalid ABI parameter.", {
|
|
306
|
+
details: param,
|
|
307
|
+
metaMessages: [
|
|
308
|
+
`Modifier "${modifier}" not allowed${type ? ` in "${type}" type` : ""}.`,
|
|
309
|
+
`Data location can only be specified for array, struct, or mapping types, but "${modifier}" was given.`
|
|
310
|
+
]
|
|
311
|
+
});
|
|
312
|
+
Object.defineProperty(this, "name", {
|
|
313
|
+
enumerable: true,
|
|
314
|
+
configurable: true,
|
|
315
|
+
writable: true,
|
|
316
|
+
value: "InvalidFunctionModifierError"
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
InvalidAbiTypeParameterError = class InvalidAbiTypeParameterError extends BaseError {
|
|
321
|
+
constructor({ abiParameter }) {
|
|
322
|
+
super("Invalid ABI parameter.", {
|
|
323
|
+
details: JSON.stringify(abiParameter, null, 2),
|
|
324
|
+
metaMessages: ["ABI parameter type is invalid."]
|
|
325
|
+
});
|
|
326
|
+
Object.defineProperty(this, "name", {
|
|
327
|
+
enumerable: true,
|
|
328
|
+
configurable: true,
|
|
329
|
+
writable: true,
|
|
330
|
+
value: "InvalidAbiTypeParameterError"
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
// ../../node_modules/abitype/dist/esm/human-readable/errors/signature.js
|
|
337
|
+
var InvalidSignatureError, InvalidStructSignatureError;
|
|
338
|
+
var init_signature = __esm(() => {
|
|
339
|
+
init_errors();
|
|
340
|
+
InvalidSignatureError = class InvalidSignatureError extends BaseError {
|
|
341
|
+
constructor({ signature, type }) {
|
|
342
|
+
super(`Invalid ${type} signature.`, {
|
|
343
|
+
details: signature
|
|
344
|
+
});
|
|
345
|
+
Object.defineProperty(this, "name", {
|
|
346
|
+
enumerable: true,
|
|
347
|
+
configurable: true,
|
|
348
|
+
writable: true,
|
|
349
|
+
value: "InvalidSignatureError"
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
};
|
|
353
|
+
InvalidStructSignatureError = class InvalidStructSignatureError extends BaseError {
|
|
354
|
+
constructor({ signature }) {
|
|
355
|
+
super("Invalid struct signature.", {
|
|
356
|
+
details: signature,
|
|
357
|
+
metaMessages: ["No properties exist."]
|
|
358
|
+
});
|
|
359
|
+
Object.defineProperty(this, "name", {
|
|
360
|
+
enumerable: true,
|
|
361
|
+
configurable: true,
|
|
362
|
+
writable: true,
|
|
363
|
+
value: "InvalidStructSignatureError"
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
};
|
|
367
|
+
});
|
|
368
|
+
|
|
369
|
+
// ../../node_modules/abitype/dist/esm/human-readable/errors/struct.js
|
|
370
|
+
var CircularReferenceError;
|
|
371
|
+
var init_struct = __esm(() => {
|
|
372
|
+
init_errors();
|
|
373
|
+
CircularReferenceError = class CircularReferenceError extends BaseError {
|
|
374
|
+
constructor({ type }) {
|
|
375
|
+
super("Circular reference detected.", {
|
|
376
|
+
metaMessages: [`Struct "${type}" is a circular reference.`]
|
|
377
|
+
});
|
|
378
|
+
Object.defineProperty(this, "name", {
|
|
379
|
+
enumerable: true,
|
|
380
|
+
configurable: true,
|
|
381
|
+
writable: true,
|
|
382
|
+
value: "CircularReferenceError"
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
};
|
|
386
|
+
});
|
|
387
|
+
|
|
388
|
+
// ../../node_modules/abitype/dist/esm/human-readable/errors/splitParameters.js
|
|
389
|
+
var InvalidParenthesisError;
|
|
390
|
+
var init_splitParameters = __esm(() => {
|
|
391
|
+
init_errors();
|
|
392
|
+
InvalidParenthesisError = class InvalidParenthesisError extends BaseError {
|
|
393
|
+
constructor({ current, depth }) {
|
|
394
|
+
super("Unbalanced parentheses.", {
|
|
395
|
+
metaMessages: [
|
|
396
|
+
`"${current.trim()}" has too many ${depth > 0 ? "opening" : "closing"} parentheses.`
|
|
397
|
+
],
|
|
398
|
+
details: `Depth "${depth}"`
|
|
399
|
+
});
|
|
400
|
+
Object.defineProperty(this, "name", {
|
|
401
|
+
enumerable: true,
|
|
402
|
+
configurable: true,
|
|
403
|
+
writable: true,
|
|
404
|
+
value: "InvalidParenthesisError"
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
};
|
|
408
|
+
});
|
|
409
|
+
|
|
410
|
+
// ../../node_modules/abitype/dist/esm/human-readable/runtime/cache.js
|
|
411
|
+
function getParameterCacheKey(param, type, structs) {
|
|
412
|
+
let structKey = "";
|
|
413
|
+
if (structs)
|
|
414
|
+
for (const struct of Object.entries(structs)) {
|
|
415
|
+
if (!struct)
|
|
416
|
+
continue;
|
|
417
|
+
let propertyKey = "";
|
|
418
|
+
for (const property of struct[1]) {
|
|
419
|
+
propertyKey += `[${property.type}${property.name ? `:${property.name}` : ""}]`;
|
|
420
|
+
}
|
|
421
|
+
structKey += `(${struct[0]}{${propertyKey}})`;
|
|
422
|
+
}
|
|
423
|
+
if (type)
|
|
424
|
+
return `${type}:${param}${structKey}`;
|
|
425
|
+
return param;
|
|
426
|
+
}
|
|
427
|
+
var parameterCache;
|
|
428
|
+
var init_cache = __esm(() => {
|
|
429
|
+
parameterCache = new Map([
|
|
430
|
+
["address", { type: "address" }],
|
|
431
|
+
["bool", { type: "bool" }],
|
|
432
|
+
["bytes", { type: "bytes" }],
|
|
433
|
+
["bytes32", { type: "bytes32" }],
|
|
434
|
+
["int", { type: "int256" }],
|
|
435
|
+
["int256", { type: "int256" }],
|
|
436
|
+
["string", { type: "string" }],
|
|
437
|
+
["uint", { type: "uint256" }],
|
|
438
|
+
["uint8", { type: "uint8" }],
|
|
439
|
+
["uint16", { type: "uint16" }],
|
|
440
|
+
["uint24", { type: "uint24" }],
|
|
441
|
+
["uint32", { type: "uint32" }],
|
|
442
|
+
["uint64", { type: "uint64" }],
|
|
443
|
+
["uint96", { type: "uint96" }],
|
|
444
|
+
["uint112", { type: "uint112" }],
|
|
445
|
+
["uint160", { type: "uint160" }],
|
|
446
|
+
["uint192", { type: "uint192" }],
|
|
447
|
+
["uint256", { type: "uint256" }],
|
|
448
|
+
["address owner", { type: "address", name: "owner" }],
|
|
449
|
+
["address to", { type: "address", name: "to" }],
|
|
450
|
+
["bool approved", { type: "bool", name: "approved" }],
|
|
451
|
+
["bytes _data", { type: "bytes", name: "_data" }],
|
|
452
|
+
["bytes data", { type: "bytes", name: "data" }],
|
|
453
|
+
["bytes signature", { type: "bytes", name: "signature" }],
|
|
454
|
+
["bytes32 hash", { type: "bytes32", name: "hash" }],
|
|
455
|
+
["bytes32 r", { type: "bytes32", name: "r" }],
|
|
456
|
+
["bytes32 root", { type: "bytes32", name: "root" }],
|
|
457
|
+
["bytes32 s", { type: "bytes32", name: "s" }],
|
|
458
|
+
["string name", { type: "string", name: "name" }],
|
|
459
|
+
["string symbol", { type: "string", name: "symbol" }],
|
|
460
|
+
["string tokenURI", { type: "string", name: "tokenURI" }],
|
|
461
|
+
["uint tokenId", { type: "uint256", name: "tokenId" }],
|
|
462
|
+
["uint8 v", { type: "uint8", name: "v" }],
|
|
463
|
+
["uint256 balance", { type: "uint256", name: "balance" }],
|
|
464
|
+
["uint256 tokenId", { type: "uint256", name: "tokenId" }],
|
|
465
|
+
["uint256 value", { type: "uint256", name: "value" }],
|
|
466
|
+
[
|
|
467
|
+
"event:address indexed from",
|
|
468
|
+
{ type: "address", name: "from", indexed: true }
|
|
469
|
+
],
|
|
470
|
+
["event:address indexed to", { type: "address", name: "to", indexed: true }],
|
|
471
|
+
[
|
|
472
|
+
"event:uint indexed tokenId",
|
|
473
|
+
{ type: "uint256", name: "tokenId", indexed: true }
|
|
474
|
+
],
|
|
475
|
+
[
|
|
476
|
+
"event:uint256 indexed tokenId",
|
|
477
|
+
{ type: "uint256", name: "tokenId", indexed: true }
|
|
478
|
+
]
|
|
479
|
+
]);
|
|
480
|
+
});
|
|
481
|
+
|
|
482
|
+
// ../../node_modules/abitype/dist/esm/human-readable/runtime/utils.js
|
|
483
|
+
function parseAbiParameter(param, options) {
|
|
484
|
+
const parameterCacheKey = getParameterCacheKey(param, options?.type, options?.structs);
|
|
485
|
+
if (parameterCache.has(parameterCacheKey))
|
|
486
|
+
return parameterCache.get(parameterCacheKey);
|
|
487
|
+
const isTuple = isTupleRegex.test(param);
|
|
488
|
+
const match = execTyped(isTuple ? abiParameterWithTupleRegex : abiParameterWithoutTupleRegex, param);
|
|
489
|
+
if (!match)
|
|
490
|
+
throw new InvalidParameterError({ param });
|
|
491
|
+
if (match.name && isSolidityKeyword(match.name))
|
|
492
|
+
throw new SolidityProtectedKeywordError({ param, name: match.name });
|
|
493
|
+
const name = match.name ? { name: match.name } : {};
|
|
494
|
+
const indexed = match.modifier === "indexed" ? { indexed: true } : {};
|
|
495
|
+
const structs = options?.structs ?? {};
|
|
496
|
+
let type;
|
|
497
|
+
let components = {};
|
|
498
|
+
if (isTuple) {
|
|
499
|
+
type = "tuple";
|
|
500
|
+
const params = splitParameters(match.type);
|
|
501
|
+
const components_ = [];
|
|
502
|
+
const length = params.length;
|
|
503
|
+
for (let i = 0;i < length; i++) {
|
|
504
|
+
components_.push(parseAbiParameter(params[i], { structs }));
|
|
505
|
+
}
|
|
506
|
+
components = { components: components_ };
|
|
507
|
+
} else if (match.type in structs) {
|
|
508
|
+
type = "tuple";
|
|
509
|
+
components = { components: structs[match.type] };
|
|
510
|
+
} else if (dynamicIntegerRegex.test(match.type)) {
|
|
511
|
+
type = `${match.type}256`;
|
|
512
|
+
} else {
|
|
513
|
+
type = match.type;
|
|
514
|
+
if (!(options?.type === "struct") && !isSolidityType(type))
|
|
515
|
+
throw new UnknownSolidityTypeError({ type });
|
|
516
|
+
}
|
|
517
|
+
if (match.modifier) {
|
|
518
|
+
if (!options?.modifiers?.has?.(match.modifier))
|
|
519
|
+
throw new InvalidModifierError({
|
|
520
|
+
param,
|
|
521
|
+
type: options?.type,
|
|
522
|
+
modifier: match.modifier
|
|
523
|
+
});
|
|
524
|
+
if (functionModifiers.has(match.modifier) && !isValidDataLocation(type, !!match.array))
|
|
525
|
+
throw new InvalidFunctionModifierError({
|
|
526
|
+
param,
|
|
527
|
+
type: options?.type,
|
|
528
|
+
modifier: match.modifier
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
const abiParameter = {
|
|
532
|
+
type: `${type}${match.array ?? ""}`,
|
|
533
|
+
...name,
|
|
534
|
+
...indexed,
|
|
535
|
+
...components
|
|
536
|
+
};
|
|
537
|
+
parameterCache.set(parameterCacheKey, abiParameter);
|
|
538
|
+
return abiParameter;
|
|
539
|
+
}
|
|
540
|
+
function splitParameters(params, result = [], current = "", depth = 0) {
|
|
541
|
+
const length = params.trim().length;
|
|
542
|
+
for (let i = 0;i < length; i++) {
|
|
543
|
+
const char = params[i];
|
|
544
|
+
const tail = params.slice(i + 1);
|
|
545
|
+
switch (char) {
|
|
546
|
+
case ",":
|
|
547
|
+
return depth === 0 ? splitParameters(tail, [...result, current.trim()]) : splitParameters(tail, result, `${current}${char}`, depth);
|
|
548
|
+
case "(":
|
|
549
|
+
return splitParameters(tail, result, `${current}${char}`, depth + 1);
|
|
550
|
+
case ")":
|
|
551
|
+
return splitParameters(tail, result, `${current}${char}`, depth - 1);
|
|
552
|
+
default:
|
|
553
|
+
return splitParameters(tail, result, `${current}${char}`, depth);
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
if (current === "")
|
|
557
|
+
return result;
|
|
558
|
+
if (depth !== 0)
|
|
559
|
+
throw new InvalidParenthesisError({ current, depth });
|
|
560
|
+
result.push(current.trim());
|
|
561
|
+
return result;
|
|
562
|
+
}
|
|
563
|
+
function isSolidityType(type) {
|
|
564
|
+
return type === "address" || type === "bool" || type === "function" || type === "string" || bytesRegex.test(type) || integerRegex.test(type);
|
|
565
|
+
}
|
|
566
|
+
function isSolidityKeyword(name) {
|
|
567
|
+
return name === "address" || name === "bool" || name === "function" || name === "string" || name === "tuple" || bytesRegex.test(name) || integerRegex.test(name) || protectedKeywordsRegex.test(name);
|
|
568
|
+
}
|
|
569
|
+
function isValidDataLocation(type, isArray) {
|
|
570
|
+
return isArray || type === "bytes" || type === "string" || type === "tuple";
|
|
571
|
+
}
|
|
572
|
+
var abiParameterWithoutTupleRegex, abiParameterWithTupleRegex, dynamicIntegerRegex, protectedKeywordsRegex;
|
|
573
|
+
var init_utils = __esm(() => {
|
|
574
|
+
init_regex();
|
|
575
|
+
init_abiItem();
|
|
576
|
+
init_abiParameter();
|
|
577
|
+
init_splitParameters();
|
|
578
|
+
init_cache();
|
|
579
|
+
init_signatures();
|
|
580
|
+
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$_]*))?$/;
|
|
581
|
+
abiParameterWithTupleRegex = /^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/;
|
|
582
|
+
dynamicIntegerRegex = /^u?int$/;
|
|
583
|
+
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)$/;
|
|
584
|
+
});
|
|
585
|
+
|
|
586
|
+
// ../../node_modules/abitype/dist/esm/human-readable/runtime/structs.js
|
|
587
|
+
function parseStructs(signatures) {
|
|
588
|
+
const shallowStructs = {};
|
|
589
|
+
const signaturesLength = signatures.length;
|
|
590
|
+
for (let i = 0;i < signaturesLength; i++) {
|
|
591
|
+
const signature = signatures[i];
|
|
592
|
+
if (!isStructSignature(signature))
|
|
593
|
+
continue;
|
|
594
|
+
const match = execStructSignature(signature);
|
|
595
|
+
if (!match)
|
|
596
|
+
throw new InvalidSignatureError({ signature, type: "struct" });
|
|
597
|
+
const properties = match.properties.split(";");
|
|
598
|
+
const components = [];
|
|
599
|
+
const propertiesLength = properties.length;
|
|
600
|
+
for (let k = 0;k < propertiesLength; k++) {
|
|
601
|
+
const property = properties[k];
|
|
602
|
+
const trimmed = property.trim();
|
|
603
|
+
if (!trimmed)
|
|
604
|
+
continue;
|
|
605
|
+
const abiParameter = parseAbiParameter(trimmed, {
|
|
606
|
+
type: "struct"
|
|
607
|
+
});
|
|
608
|
+
components.push(abiParameter);
|
|
609
|
+
}
|
|
610
|
+
if (!components.length)
|
|
611
|
+
throw new InvalidStructSignatureError({ signature });
|
|
612
|
+
shallowStructs[match.name] = components;
|
|
613
|
+
}
|
|
614
|
+
const resolvedStructs = {};
|
|
615
|
+
const entries = Object.entries(shallowStructs);
|
|
616
|
+
const entriesLength = entries.length;
|
|
617
|
+
for (let i = 0;i < entriesLength; i++) {
|
|
618
|
+
const [name, parameters] = entries[i];
|
|
619
|
+
resolvedStructs[name] = resolveStructs(parameters, shallowStructs);
|
|
620
|
+
}
|
|
621
|
+
return resolvedStructs;
|
|
622
|
+
}
|
|
623
|
+
function resolveStructs(abiParameters, structs, ancestors = new Set) {
|
|
624
|
+
const components = [];
|
|
625
|
+
const length = abiParameters.length;
|
|
626
|
+
for (let i = 0;i < length; i++) {
|
|
627
|
+
const abiParameter = abiParameters[i];
|
|
628
|
+
const isTuple = isTupleRegex.test(abiParameter.type);
|
|
629
|
+
if (isTuple)
|
|
630
|
+
components.push(abiParameter);
|
|
631
|
+
else {
|
|
632
|
+
const match = execTyped(typeWithoutTupleRegex, abiParameter.type);
|
|
633
|
+
if (!match?.type)
|
|
634
|
+
throw new InvalidAbiTypeParameterError({ abiParameter });
|
|
635
|
+
const { array, type } = match;
|
|
636
|
+
if (type in structs) {
|
|
637
|
+
if (ancestors.has(type))
|
|
638
|
+
throw new CircularReferenceError({ type });
|
|
639
|
+
components.push({
|
|
640
|
+
...abiParameter,
|
|
641
|
+
type: `tuple${array ?? ""}`,
|
|
642
|
+
components: resolveStructs(structs[type] ?? [], structs, new Set([...ancestors, type]))
|
|
643
|
+
});
|
|
644
|
+
} else {
|
|
645
|
+
if (isSolidityType(type))
|
|
646
|
+
components.push(abiParameter);
|
|
647
|
+
else
|
|
648
|
+
throw new UnknownTypeError({ type });
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
return components;
|
|
653
|
+
}
|
|
654
|
+
var typeWithoutTupleRegex;
|
|
655
|
+
var init_structs = __esm(() => {
|
|
656
|
+
init_regex();
|
|
657
|
+
init_abiItem();
|
|
658
|
+
init_abiParameter();
|
|
659
|
+
init_signature();
|
|
660
|
+
init_struct();
|
|
661
|
+
init_signatures();
|
|
662
|
+
init_utils();
|
|
663
|
+
typeWithoutTupleRegex = /^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;
|
|
664
|
+
});
|
|
665
|
+
|
|
666
|
+
// ../../node_modules/abitype/dist/esm/human-readable/parseAbiParameter.js
|
|
667
|
+
function parseAbiParameter2(param) {
|
|
668
|
+
let abiParameter;
|
|
669
|
+
if (typeof param === "string")
|
|
670
|
+
abiParameter = parseAbiParameter(param, {
|
|
671
|
+
modifiers
|
|
672
|
+
});
|
|
673
|
+
else {
|
|
674
|
+
const structs = parseStructs(param);
|
|
675
|
+
const length = param.length;
|
|
676
|
+
for (let i = 0;i < length; i++) {
|
|
677
|
+
const signature = param[i];
|
|
678
|
+
if (isStructSignature(signature))
|
|
679
|
+
continue;
|
|
680
|
+
abiParameter = parseAbiParameter(signature, { modifiers, structs });
|
|
681
|
+
break;
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
if (!abiParameter)
|
|
685
|
+
throw new InvalidAbiParameterError({ param });
|
|
686
|
+
return abiParameter;
|
|
687
|
+
}
|
|
688
|
+
var init_parseAbiParameter = __esm(() => {
|
|
689
|
+
init_abiParameter();
|
|
690
|
+
init_signatures();
|
|
691
|
+
init_structs();
|
|
692
|
+
init_utils();
|
|
693
|
+
});
|
|
694
|
+
|
|
695
|
+
// ../../node_modules/abitype/dist/esm/human-readable/parseAbiParameters.js
|
|
696
|
+
function parseAbiParameters(params) {
|
|
697
|
+
const abiParameters = [];
|
|
698
|
+
if (typeof params === "string") {
|
|
699
|
+
const parameters = splitParameters(params);
|
|
700
|
+
const length = parameters.length;
|
|
701
|
+
for (let i = 0;i < length; i++) {
|
|
702
|
+
abiParameters.push(parseAbiParameter(parameters[i], { modifiers }));
|
|
703
|
+
}
|
|
704
|
+
} else {
|
|
705
|
+
const structs = parseStructs(params);
|
|
706
|
+
const length = params.length;
|
|
707
|
+
for (let i = 0;i < length; i++) {
|
|
708
|
+
const signature = params[i];
|
|
709
|
+
if (isStructSignature(signature))
|
|
710
|
+
continue;
|
|
711
|
+
const parameters = splitParameters(signature);
|
|
712
|
+
const length2 = parameters.length;
|
|
713
|
+
for (let k = 0;k < length2; k++) {
|
|
714
|
+
abiParameters.push(parseAbiParameter(parameters[k], { modifiers, structs }));
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
if (abiParameters.length === 0)
|
|
719
|
+
throw new InvalidAbiParametersError({ params });
|
|
720
|
+
return abiParameters;
|
|
721
|
+
}
|
|
722
|
+
var init_parseAbiParameters = __esm(() => {
|
|
723
|
+
init_abiParameter();
|
|
724
|
+
init_signatures();
|
|
725
|
+
init_structs();
|
|
726
|
+
init_utils();
|
|
727
|
+
init_utils();
|
|
728
|
+
});
|
|
729
|
+
|
|
730
|
+
// ../../node_modules/abitype/dist/esm/exports/index.js
|
|
731
|
+
var init_exports = __esm(() => {
|
|
732
|
+
init_formatAbiItem();
|
|
733
|
+
init_parseAbiParameter();
|
|
734
|
+
init_parseAbiParameters();
|
|
735
|
+
});
|
|
736
|
+
|
|
737
|
+
// ../../node_modules/viem/_esm/utils/abi/formatAbiItem.js
|
|
738
|
+
function formatAbiItem2(abiItem, { includeName = false } = {}) {
|
|
739
|
+
if (abiItem.type !== "function" && abiItem.type !== "event" && abiItem.type !== "error")
|
|
740
|
+
throw new InvalidDefinitionTypeError(abiItem.type);
|
|
741
|
+
return `${abiItem.name}(${formatAbiParams(abiItem.inputs, { includeName })})`;
|
|
742
|
+
}
|
|
743
|
+
function formatAbiParams(params, { includeName = false } = {}) {
|
|
744
|
+
if (!params)
|
|
745
|
+
return "";
|
|
746
|
+
return params.map((param) => formatAbiParam(param, { includeName })).join(includeName ? ", " : ",");
|
|
747
|
+
}
|
|
748
|
+
function formatAbiParam(param, { includeName }) {
|
|
749
|
+
if (param.type.startsWith("tuple")) {
|
|
750
|
+
return `(${formatAbiParams(param.components, { includeName })})${param.type.slice("tuple".length)}`;
|
|
751
|
+
}
|
|
752
|
+
return param.type + (includeName && param.name ? ` ${param.name}` : "");
|
|
753
|
+
}
|
|
754
|
+
var init_formatAbiItem2 = __esm(() => {
|
|
755
|
+
init_abi();
|
|
756
|
+
});
|
|
757
|
+
|
|
758
|
+
// ../../node_modules/viem/_esm/utils/data/isHex.js
|
|
759
|
+
function isHex(value, { strict = true } = {}) {
|
|
760
|
+
if (!value)
|
|
761
|
+
return false;
|
|
762
|
+
if (typeof value !== "string")
|
|
763
|
+
return false;
|
|
764
|
+
return strict ? /^0x[0-9a-fA-F]*$/.test(value) : value.startsWith("0x");
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
// ../../node_modules/viem/_esm/utils/data/size.js
|
|
768
|
+
function size(value) {
|
|
769
|
+
if (isHex(value, { strict: false }))
|
|
770
|
+
return Math.ceil((value.length - 2) / 2);
|
|
771
|
+
return value.length;
|
|
772
|
+
}
|
|
773
|
+
var init_size = () => {};
|
|
774
|
+
|
|
775
|
+
// ../../node_modules/viem/_esm/errors/version.js
|
|
776
|
+
var version2 = "2.31.3";
|
|
777
|
+
|
|
778
|
+
// ../../node_modules/viem/_esm/errors/base.js
|
|
779
|
+
function walk(err, fn) {
|
|
780
|
+
if (fn?.(err))
|
|
781
|
+
return err;
|
|
782
|
+
if (err && typeof err === "object" && "cause" in err && err.cause !== undefined)
|
|
783
|
+
return walk(err.cause, fn);
|
|
784
|
+
return fn ? null : err;
|
|
785
|
+
}
|
|
786
|
+
var errorConfig, BaseError2;
|
|
787
|
+
var init_base = __esm(() => {
|
|
788
|
+
errorConfig = {
|
|
789
|
+
getDocsUrl: ({ docsBaseUrl, docsPath = "", docsSlug }) => docsPath ? `${docsBaseUrl ?? "https://viem.sh"}${docsPath}${docsSlug ? `#${docsSlug}` : ""}` : undefined,
|
|
790
|
+
version: `viem@${version2}`
|
|
791
|
+
};
|
|
792
|
+
BaseError2 = class BaseError2 extends Error {
|
|
793
|
+
constructor(shortMessage, args = {}) {
|
|
794
|
+
const details = (() => {
|
|
795
|
+
if (args.cause instanceof BaseError2)
|
|
796
|
+
return args.cause.details;
|
|
797
|
+
if (args.cause?.message)
|
|
798
|
+
return args.cause.message;
|
|
799
|
+
return args.details;
|
|
800
|
+
})();
|
|
801
|
+
const docsPath = (() => {
|
|
802
|
+
if (args.cause instanceof BaseError2)
|
|
803
|
+
return args.cause.docsPath || args.docsPath;
|
|
804
|
+
return args.docsPath;
|
|
805
|
+
})();
|
|
806
|
+
const docsUrl = errorConfig.getDocsUrl?.({ ...args, docsPath });
|
|
807
|
+
const message = [
|
|
808
|
+
shortMessage || "An error occurred.",
|
|
809
|
+
"",
|
|
810
|
+
...args.metaMessages ? [...args.metaMessages, ""] : [],
|
|
811
|
+
...docsUrl ? [`Docs: ${docsUrl}`] : [],
|
|
812
|
+
...details ? [`Details: ${details}`] : [],
|
|
813
|
+
...errorConfig.version ? [`Version: ${errorConfig.version}`] : []
|
|
814
|
+
].join(`
|
|
815
|
+
`);
|
|
816
|
+
super(message, args.cause ? { cause: args.cause } : undefined);
|
|
817
|
+
Object.defineProperty(this, "details", {
|
|
818
|
+
enumerable: true,
|
|
819
|
+
configurable: true,
|
|
820
|
+
writable: true,
|
|
821
|
+
value: undefined
|
|
822
|
+
});
|
|
823
|
+
Object.defineProperty(this, "docsPath", {
|
|
824
|
+
enumerable: true,
|
|
825
|
+
configurable: true,
|
|
826
|
+
writable: true,
|
|
827
|
+
value: undefined
|
|
828
|
+
});
|
|
829
|
+
Object.defineProperty(this, "metaMessages", {
|
|
830
|
+
enumerable: true,
|
|
831
|
+
configurable: true,
|
|
832
|
+
writable: true,
|
|
833
|
+
value: undefined
|
|
834
|
+
});
|
|
835
|
+
Object.defineProperty(this, "shortMessage", {
|
|
836
|
+
enumerable: true,
|
|
837
|
+
configurable: true,
|
|
838
|
+
writable: true,
|
|
839
|
+
value: undefined
|
|
840
|
+
});
|
|
841
|
+
Object.defineProperty(this, "version", {
|
|
842
|
+
enumerable: true,
|
|
843
|
+
configurable: true,
|
|
844
|
+
writable: true,
|
|
845
|
+
value: undefined
|
|
846
|
+
});
|
|
847
|
+
Object.defineProperty(this, "name", {
|
|
848
|
+
enumerable: true,
|
|
849
|
+
configurable: true,
|
|
850
|
+
writable: true,
|
|
851
|
+
value: "BaseError"
|
|
852
|
+
});
|
|
853
|
+
this.details = details;
|
|
854
|
+
this.docsPath = docsPath;
|
|
855
|
+
this.metaMessages = args.metaMessages;
|
|
856
|
+
this.name = args.name ?? this.name;
|
|
857
|
+
this.shortMessage = shortMessage;
|
|
858
|
+
this.version = version2;
|
|
859
|
+
}
|
|
860
|
+
walk(fn) {
|
|
861
|
+
return walk(this, fn);
|
|
862
|
+
}
|
|
863
|
+
};
|
|
864
|
+
});
|
|
865
|
+
|
|
866
|
+
// ../../node_modules/viem/_esm/errors/abi.js
|
|
867
|
+
var AbiEncodingArrayLengthMismatchError, AbiEncodingBytesSizeMismatchError, AbiEncodingLengthMismatchError, AbiFunctionNotFoundError, AbiItemAmbiguityError, InvalidAbiEncodingTypeError, InvalidArrayError, InvalidDefinitionTypeError;
|
|
868
|
+
var init_abi = __esm(() => {
|
|
869
|
+
init_formatAbiItem2();
|
|
870
|
+
init_size();
|
|
871
|
+
init_base();
|
|
872
|
+
AbiEncodingArrayLengthMismatchError = class AbiEncodingArrayLengthMismatchError extends BaseError2 {
|
|
873
|
+
constructor({ expectedLength, givenLength, type }) {
|
|
874
|
+
super([
|
|
875
|
+
`ABI encoding array length mismatch for type ${type}.`,
|
|
876
|
+
`Expected length: ${expectedLength}`,
|
|
877
|
+
`Given length: ${givenLength}`
|
|
878
|
+
].join(`
|
|
879
|
+
`), { name: "AbiEncodingArrayLengthMismatchError" });
|
|
880
|
+
}
|
|
881
|
+
};
|
|
882
|
+
AbiEncodingBytesSizeMismatchError = class AbiEncodingBytesSizeMismatchError extends BaseError2 {
|
|
883
|
+
constructor({ expectedSize, value }) {
|
|
884
|
+
super(`Size of bytes "${value}" (bytes${size(value)}) does not match expected size (bytes${expectedSize}).`, { name: "AbiEncodingBytesSizeMismatchError" });
|
|
885
|
+
}
|
|
886
|
+
};
|
|
887
|
+
AbiEncodingLengthMismatchError = class AbiEncodingLengthMismatchError extends BaseError2 {
|
|
888
|
+
constructor({ expectedLength, givenLength }) {
|
|
889
|
+
super([
|
|
890
|
+
"ABI encoding params/values length mismatch.",
|
|
891
|
+
`Expected length (params): ${expectedLength}`,
|
|
892
|
+
`Given length (values): ${givenLength}`
|
|
893
|
+
].join(`
|
|
894
|
+
`), { name: "AbiEncodingLengthMismatchError" });
|
|
895
|
+
}
|
|
896
|
+
};
|
|
897
|
+
AbiFunctionNotFoundError = class AbiFunctionNotFoundError extends BaseError2 {
|
|
898
|
+
constructor(functionName, { docsPath } = {}) {
|
|
899
|
+
super([
|
|
900
|
+
`Function ${functionName ? `"${functionName}" ` : ""}not found on ABI.`,
|
|
901
|
+
"Make sure you are using the correct ABI and that the function exists on it."
|
|
902
|
+
].join(`
|
|
903
|
+
`), {
|
|
904
|
+
docsPath,
|
|
905
|
+
name: "AbiFunctionNotFoundError"
|
|
906
|
+
});
|
|
907
|
+
}
|
|
908
|
+
};
|
|
909
|
+
AbiItemAmbiguityError = class AbiItemAmbiguityError extends BaseError2 {
|
|
910
|
+
constructor(x, y) {
|
|
911
|
+
super("Found ambiguous types in overloaded ABI items.", {
|
|
912
|
+
metaMessages: [
|
|
913
|
+
`\`${x.type}\` in \`${formatAbiItem2(x.abiItem)}\`, and`,
|
|
914
|
+
`\`${y.type}\` in \`${formatAbiItem2(y.abiItem)}\``,
|
|
915
|
+
"",
|
|
916
|
+
"These types encode differently and cannot be distinguished at runtime.",
|
|
917
|
+
"Remove one of the ambiguous items in the ABI."
|
|
918
|
+
],
|
|
919
|
+
name: "AbiItemAmbiguityError"
|
|
920
|
+
});
|
|
921
|
+
}
|
|
922
|
+
};
|
|
923
|
+
InvalidAbiEncodingTypeError = class InvalidAbiEncodingTypeError extends BaseError2 {
|
|
924
|
+
constructor(type, { docsPath }) {
|
|
925
|
+
super([
|
|
926
|
+
`Type "${type}" is not a valid encoding type.`,
|
|
927
|
+
"Please provide a valid ABI type."
|
|
928
|
+
].join(`
|
|
929
|
+
`), { docsPath, name: "InvalidAbiEncodingType" });
|
|
930
|
+
}
|
|
931
|
+
};
|
|
932
|
+
InvalidArrayError = class InvalidArrayError extends BaseError2 {
|
|
933
|
+
constructor(value) {
|
|
934
|
+
super([`Value "${value}" is not a valid array.`].join(`
|
|
935
|
+
`), {
|
|
936
|
+
name: "InvalidArrayError"
|
|
937
|
+
});
|
|
938
|
+
}
|
|
939
|
+
};
|
|
940
|
+
InvalidDefinitionTypeError = class InvalidDefinitionTypeError extends BaseError2 {
|
|
941
|
+
constructor(type) {
|
|
942
|
+
super([
|
|
943
|
+
`"${type}" is not a valid definition type.`,
|
|
944
|
+
'Valid types: "function", "event", "error"'
|
|
945
|
+
].join(`
|
|
946
|
+
`), { name: "InvalidDefinitionTypeError" });
|
|
947
|
+
}
|
|
948
|
+
};
|
|
949
|
+
});
|
|
950
|
+
|
|
951
|
+
// ../../node_modules/viem/_esm/errors/data.js
|
|
952
|
+
var SliceOffsetOutOfBoundsError, SizeExceedsPaddingSizeError;
|
|
953
|
+
var init_data = __esm(() => {
|
|
954
|
+
init_base();
|
|
955
|
+
SliceOffsetOutOfBoundsError = class SliceOffsetOutOfBoundsError extends BaseError2 {
|
|
956
|
+
constructor({ offset, position, size: size2 }) {
|
|
957
|
+
super(`Slice ${position === "start" ? "starting" : "ending"} at offset "${offset}" is out-of-bounds (size: ${size2}).`, { name: "SliceOffsetOutOfBoundsError" });
|
|
958
|
+
}
|
|
959
|
+
};
|
|
960
|
+
SizeExceedsPaddingSizeError = class SizeExceedsPaddingSizeError extends BaseError2 {
|
|
961
|
+
constructor({ size: size2, targetSize, type }) {
|
|
962
|
+
super(`${type.charAt(0).toUpperCase()}${type.slice(1).toLowerCase()} size (${size2}) exceeds padding size (${targetSize}).`, { name: "SizeExceedsPaddingSizeError" });
|
|
963
|
+
}
|
|
964
|
+
};
|
|
965
|
+
});
|
|
966
|
+
|
|
967
|
+
// ../../node_modules/viem/_esm/utils/data/pad.js
|
|
968
|
+
function pad(hexOrBytes, { dir, size: size2 = 32 } = {}) {
|
|
969
|
+
if (typeof hexOrBytes === "string")
|
|
970
|
+
return padHex(hexOrBytes, { dir, size: size2 });
|
|
971
|
+
return padBytes(hexOrBytes, { dir, size: size2 });
|
|
972
|
+
}
|
|
973
|
+
function padHex(hex_, { dir, size: size2 = 32 } = {}) {
|
|
974
|
+
if (size2 === null)
|
|
975
|
+
return hex_;
|
|
976
|
+
const hex = hex_.replace("0x", "");
|
|
977
|
+
if (hex.length > size2 * 2)
|
|
978
|
+
throw new SizeExceedsPaddingSizeError({
|
|
979
|
+
size: Math.ceil(hex.length / 2),
|
|
980
|
+
targetSize: size2,
|
|
981
|
+
type: "hex"
|
|
982
|
+
});
|
|
983
|
+
return `0x${hex[dir === "right" ? "padEnd" : "padStart"](size2 * 2, "0")}`;
|
|
984
|
+
}
|
|
985
|
+
function padBytes(bytes, { dir, size: size2 = 32 } = {}) {
|
|
986
|
+
if (size2 === null)
|
|
987
|
+
return bytes;
|
|
988
|
+
if (bytes.length > size2)
|
|
989
|
+
throw new SizeExceedsPaddingSizeError({
|
|
990
|
+
size: bytes.length,
|
|
991
|
+
targetSize: size2,
|
|
992
|
+
type: "bytes"
|
|
993
|
+
});
|
|
994
|
+
const paddedBytes = new Uint8Array(size2);
|
|
995
|
+
for (let i = 0;i < size2; i++) {
|
|
996
|
+
const padEnd = dir === "right";
|
|
997
|
+
paddedBytes[padEnd ? i : size2 - i - 1] = bytes[padEnd ? i : bytes.length - i - 1];
|
|
998
|
+
}
|
|
999
|
+
return paddedBytes;
|
|
1000
|
+
}
|
|
1001
|
+
var init_pad = __esm(() => {
|
|
1002
|
+
init_data();
|
|
1003
|
+
});
|
|
1004
|
+
|
|
1005
|
+
// ../../node_modules/viem/_esm/errors/encoding.js
|
|
1006
|
+
var IntegerOutOfRangeError, SizeOverflowError;
|
|
1007
|
+
var init_encoding = __esm(() => {
|
|
1008
|
+
init_base();
|
|
1009
|
+
IntegerOutOfRangeError = class IntegerOutOfRangeError extends BaseError2 {
|
|
1010
|
+
constructor({ max, min, signed, size: size2, value }) {
|
|
1011
|
+
super(`Number "${value}" is not in safe ${size2 ? `${size2 * 8}-bit ${signed ? "signed" : "unsigned"} ` : ""}integer range ${max ? `(${min} to ${max})` : `(above ${min})`}`, { name: "IntegerOutOfRangeError" });
|
|
1012
|
+
}
|
|
1013
|
+
};
|
|
1014
|
+
SizeOverflowError = class SizeOverflowError extends BaseError2 {
|
|
1015
|
+
constructor({ givenSize, maxSize }) {
|
|
1016
|
+
super(`Size cannot exceed ${maxSize} bytes. Given size: ${givenSize} bytes.`, { name: "SizeOverflowError" });
|
|
1017
|
+
}
|
|
1018
|
+
};
|
|
1019
|
+
});
|
|
1020
|
+
|
|
1021
|
+
// ../../node_modules/viem/_esm/utils/encoding/fromHex.js
|
|
1022
|
+
function assertSize(hexOrBytes, { size: size2 }) {
|
|
1023
|
+
if (size(hexOrBytes) > size2)
|
|
1024
|
+
throw new SizeOverflowError({
|
|
1025
|
+
givenSize: size(hexOrBytes),
|
|
1026
|
+
maxSize: size2
|
|
1027
|
+
});
|
|
1028
|
+
}
|
|
1029
|
+
var init_fromHex = __esm(() => {
|
|
1030
|
+
init_encoding();
|
|
1031
|
+
init_size();
|
|
1032
|
+
});
|
|
1033
|
+
|
|
1034
|
+
// ../../node_modules/viem/_esm/utils/encoding/toHex.js
|
|
1035
|
+
function toHex(value, opts = {}) {
|
|
1036
|
+
if (typeof value === "number" || typeof value === "bigint")
|
|
1037
|
+
return numberToHex(value, opts);
|
|
1038
|
+
if (typeof value === "string") {
|
|
1039
|
+
return stringToHex(value, opts);
|
|
1040
|
+
}
|
|
1041
|
+
if (typeof value === "boolean")
|
|
1042
|
+
return boolToHex(value, opts);
|
|
1043
|
+
return bytesToHex(value, opts);
|
|
1044
|
+
}
|
|
1045
|
+
function boolToHex(value, opts = {}) {
|
|
1046
|
+
const hex = `0x${Number(value)}`;
|
|
1047
|
+
if (typeof opts.size === "number") {
|
|
1048
|
+
assertSize(hex, { size: opts.size });
|
|
1049
|
+
return pad(hex, { size: opts.size });
|
|
1050
|
+
}
|
|
1051
|
+
return hex;
|
|
1052
|
+
}
|
|
1053
|
+
function bytesToHex(value, opts = {}) {
|
|
1054
|
+
let string = "";
|
|
1055
|
+
for (let i = 0;i < value.length; i++) {
|
|
1056
|
+
string += hexes[value[i]];
|
|
1057
|
+
}
|
|
1058
|
+
const hex = `0x${string}`;
|
|
1059
|
+
if (typeof opts.size === "number") {
|
|
1060
|
+
assertSize(hex, { size: opts.size });
|
|
1061
|
+
return pad(hex, { dir: "right", size: opts.size });
|
|
1062
|
+
}
|
|
1063
|
+
return hex;
|
|
1064
|
+
}
|
|
1065
|
+
function numberToHex(value_, opts = {}) {
|
|
1066
|
+
const { signed, size: size2 } = opts;
|
|
1067
|
+
const value = BigInt(value_);
|
|
1068
|
+
let maxValue;
|
|
1069
|
+
if (size2) {
|
|
1070
|
+
if (signed)
|
|
1071
|
+
maxValue = (1n << BigInt(size2) * 8n - 1n) - 1n;
|
|
1072
|
+
else
|
|
1073
|
+
maxValue = 2n ** (BigInt(size2) * 8n) - 1n;
|
|
1074
|
+
} else if (typeof value_ === "number") {
|
|
1075
|
+
maxValue = BigInt(Number.MAX_SAFE_INTEGER);
|
|
1076
|
+
}
|
|
1077
|
+
const minValue = typeof maxValue === "bigint" && signed ? -maxValue - 1n : 0;
|
|
1078
|
+
if (maxValue && value > maxValue || value < minValue) {
|
|
1079
|
+
const suffix = typeof value_ === "bigint" ? "n" : "";
|
|
1080
|
+
throw new IntegerOutOfRangeError({
|
|
1081
|
+
max: maxValue ? `${maxValue}${suffix}` : undefined,
|
|
1082
|
+
min: `${minValue}${suffix}`,
|
|
1083
|
+
signed,
|
|
1084
|
+
size: size2,
|
|
1085
|
+
value: `${value_}${suffix}`
|
|
1086
|
+
});
|
|
1087
|
+
}
|
|
1088
|
+
const hex = `0x${(signed && value < 0 ? (1n << BigInt(size2 * 8)) + BigInt(value) : value).toString(16)}`;
|
|
1089
|
+
if (size2)
|
|
1090
|
+
return pad(hex, { size: size2 });
|
|
1091
|
+
return hex;
|
|
1092
|
+
}
|
|
1093
|
+
function stringToHex(value_, opts = {}) {
|
|
1094
|
+
const value = encoder.encode(value_);
|
|
1095
|
+
return bytesToHex(value, opts);
|
|
1096
|
+
}
|
|
1097
|
+
var hexes, encoder;
|
|
1098
|
+
var init_toHex = __esm(() => {
|
|
1099
|
+
init_encoding();
|
|
1100
|
+
init_pad();
|
|
1101
|
+
init_fromHex();
|
|
1102
|
+
hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_v, i) => i.toString(16).padStart(2, "0"));
|
|
1103
|
+
encoder = /* @__PURE__ */ new TextEncoder;
|
|
1104
|
+
});
|
|
1105
|
+
|
|
1106
|
+
// ../../node_modules/viem/_esm/utils/encoding/toBytes.js
|
|
1107
|
+
function toBytes(value, opts = {}) {
|
|
1108
|
+
if (typeof value === "number" || typeof value === "bigint")
|
|
1109
|
+
return numberToBytes(value, opts);
|
|
1110
|
+
if (typeof value === "boolean")
|
|
1111
|
+
return boolToBytes(value, opts);
|
|
1112
|
+
if (isHex(value))
|
|
1113
|
+
return hexToBytes(value, opts);
|
|
1114
|
+
return stringToBytes(value, opts);
|
|
1115
|
+
}
|
|
1116
|
+
function boolToBytes(value, opts = {}) {
|
|
1117
|
+
const bytes = new Uint8Array(1);
|
|
1118
|
+
bytes[0] = Number(value);
|
|
1119
|
+
if (typeof opts.size === "number") {
|
|
1120
|
+
assertSize(bytes, { size: opts.size });
|
|
1121
|
+
return pad(bytes, { size: opts.size });
|
|
1122
|
+
}
|
|
1123
|
+
return bytes;
|
|
1124
|
+
}
|
|
1125
|
+
function charCodeToBase16(char) {
|
|
1126
|
+
if (char >= charCodeMap.zero && char <= charCodeMap.nine)
|
|
1127
|
+
return char - charCodeMap.zero;
|
|
1128
|
+
if (char >= charCodeMap.A && char <= charCodeMap.F)
|
|
1129
|
+
return char - (charCodeMap.A - 10);
|
|
1130
|
+
if (char >= charCodeMap.a && char <= charCodeMap.f)
|
|
1131
|
+
return char - (charCodeMap.a - 10);
|
|
1132
|
+
return;
|
|
1133
|
+
}
|
|
1134
|
+
function hexToBytes(hex_, opts = {}) {
|
|
1135
|
+
let hex = hex_;
|
|
1136
|
+
if (opts.size) {
|
|
1137
|
+
assertSize(hex, { size: opts.size });
|
|
1138
|
+
hex = pad(hex, { dir: "right", size: opts.size });
|
|
1139
|
+
}
|
|
1140
|
+
let hexString = hex.slice(2);
|
|
1141
|
+
if (hexString.length % 2)
|
|
1142
|
+
hexString = `0${hexString}`;
|
|
1143
|
+
const length = hexString.length / 2;
|
|
1144
|
+
const bytes = new Uint8Array(length);
|
|
1145
|
+
for (let index = 0, j = 0;index < length; index++) {
|
|
1146
|
+
const nibbleLeft = charCodeToBase16(hexString.charCodeAt(j++));
|
|
1147
|
+
const nibbleRight = charCodeToBase16(hexString.charCodeAt(j++));
|
|
1148
|
+
if (nibbleLeft === undefined || nibbleRight === undefined) {
|
|
1149
|
+
throw new BaseError2(`Invalid byte sequence ("${hexString[j - 2]}${hexString[j - 1]}" in "${hexString}").`);
|
|
1150
|
+
}
|
|
1151
|
+
bytes[index] = nibbleLeft * 16 + nibbleRight;
|
|
1152
|
+
}
|
|
1153
|
+
return bytes;
|
|
1154
|
+
}
|
|
1155
|
+
function numberToBytes(value, opts) {
|
|
1156
|
+
const hex = numberToHex(value, opts);
|
|
1157
|
+
return hexToBytes(hex);
|
|
1158
|
+
}
|
|
1159
|
+
function stringToBytes(value, opts = {}) {
|
|
1160
|
+
const bytes = encoder2.encode(value);
|
|
1161
|
+
if (typeof opts.size === "number") {
|
|
1162
|
+
assertSize(bytes, { size: opts.size });
|
|
1163
|
+
return pad(bytes, { dir: "right", size: opts.size });
|
|
1164
|
+
}
|
|
1165
|
+
return bytes;
|
|
1166
|
+
}
|
|
1167
|
+
var encoder2, charCodeMap;
|
|
1168
|
+
var init_toBytes = __esm(() => {
|
|
1169
|
+
init_base();
|
|
1170
|
+
init_pad();
|
|
1171
|
+
init_fromHex();
|
|
1172
|
+
init_toHex();
|
|
1173
|
+
encoder2 = /* @__PURE__ */ new TextEncoder;
|
|
1174
|
+
charCodeMap = {
|
|
1175
|
+
zero: 48,
|
|
1176
|
+
nine: 57,
|
|
1177
|
+
A: 65,
|
|
1178
|
+
F: 70,
|
|
1179
|
+
a: 97,
|
|
1180
|
+
f: 102
|
|
1181
|
+
};
|
|
1182
|
+
});
|
|
1183
|
+
|
|
1184
|
+
// ../../node_modules/@noble/hashes/esm/_u64.js
|
|
1185
|
+
function fromBig(n, le = false) {
|
|
1186
|
+
if (le)
|
|
1187
|
+
return { h: Number(n & U32_MASK64), l: Number(n >> _32n & U32_MASK64) };
|
|
1188
|
+
return { h: Number(n >> _32n & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
|
|
1189
|
+
}
|
|
1190
|
+
function split(lst, le = false) {
|
|
1191
|
+
const len = lst.length;
|
|
1192
|
+
let Ah = new Uint32Array(len);
|
|
1193
|
+
let Al = new Uint32Array(len);
|
|
1194
|
+
for (let i = 0;i < len; i++) {
|
|
1195
|
+
const { h, l } = fromBig(lst[i], le);
|
|
1196
|
+
[Ah[i], Al[i]] = [h, l];
|
|
1197
|
+
}
|
|
1198
|
+
return [Ah, Al];
|
|
1199
|
+
}
|
|
1200
|
+
var U32_MASK64, _32n, rotlSH = (h, l, s) => h << s | l >>> 32 - s, rotlSL = (h, l, s) => l << s | h >>> 32 - s, rotlBH = (h, l, s) => l << s - 32 | h >>> 64 - s, rotlBL = (h, l, s) => h << s - 32 | l >>> 64 - s;
|
|
1201
|
+
var init__u64 = __esm(() => {
|
|
1202
|
+
U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
|
|
1203
|
+
_32n = /* @__PURE__ */ BigInt(32);
|
|
1204
|
+
});
|
|
1205
|
+
|
|
1206
|
+
// ../../node_modules/@noble/hashes/esm/utils.js
|
|
1207
|
+
function isBytes(a) {
|
|
1208
|
+
return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
|
|
1209
|
+
}
|
|
1210
|
+
function anumber(n) {
|
|
1211
|
+
if (!Number.isSafeInteger(n) || n < 0)
|
|
1212
|
+
throw new Error("positive integer expected, got " + n);
|
|
1213
|
+
}
|
|
1214
|
+
function abytes(b, ...lengths) {
|
|
1215
|
+
if (!isBytes(b))
|
|
1216
|
+
throw new Error("Uint8Array expected");
|
|
1217
|
+
if (lengths.length > 0 && !lengths.includes(b.length))
|
|
1218
|
+
throw new Error("Uint8Array expected of length " + lengths + ", got length=" + b.length);
|
|
1219
|
+
}
|
|
1220
|
+
function aexists(instance, checkFinished = true) {
|
|
1221
|
+
if (instance.destroyed)
|
|
1222
|
+
throw new Error("Hash instance has been destroyed");
|
|
1223
|
+
if (checkFinished && instance.finished)
|
|
1224
|
+
throw new Error("Hash#digest() has already been called");
|
|
1225
|
+
}
|
|
1226
|
+
function aoutput(out, instance) {
|
|
1227
|
+
abytes(out);
|
|
1228
|
+
const min = instance.outputLen;
|
|
1229
|
+
if (out.length < min) {
|
|
1230
|
+
throw new Error("digestInto() expects output buffer of length at least " + min);
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
function u32(arr) {
|
|
1234
|
+
return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
|
|
1235
|
+
}
|
|
1236
|
+
function clean(...arrays) {
|
|
1237
|
+
for (let i = 0;i < arrays.length; i++) {
|
|
1238
|
+
arrays[i].fill(0);
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
function byteSwap(word) {
|
|
1242
|
+
return word << 24 & 4278190080 | word << 8 & 16711680 | word >>> 8 & 65280 | word >>> 24 & 255;
|
|
1243
|
+
}
|
|
1244
|
+
function byteSwap32(arr) {
|
|
1245
|
+
for (let i = 0;i < arr.length; i++) {
|
|
1246
|
+
arr[i] = byteSwap(arr[i]);
|
|
1247
|
+
}
|
|
1248
|
+
return arr;
|
|
1249
|
+
}
|
|
1250
|
+
function utf8ToBytes(str) {
|
|
1251
|
+
if (typeof str !== "string")
|
|
1252
|
+
throw new Error("string expected");
|
|
1253
|
+
return new Uint8Array(new TextEncoder().encode(str));
|
|
1254
|
+
}
|
|
1255
|
+
function toBytes2(data) {
|
|
1256
|
+
if (typeof data === "string")
|
|
1257
|
+
data = utf8ToBytes(data);
|
|
1258
|
+
abytes(data);
|
|
1259
|
+
return data;
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1262
|
+
class Hash {
|
|
1263
|
+
}
|
|
1264
|
+
function createHasher(hashCons) {
|
|
1265
|
+
const hashC = (msg) => hashCons().update(toBytes2(msg)).digest();
|
|
1266
|
+
const tmp = hashCons();
|
|
1267
|
+
hashC.outputLen = tmp.outputLen;
|
|
1268
|
+
hashC.blockLen = tmp.blockLen;
|
|
1269
|
+
hashC.create = () => hashCons();
|
|
1270
|
+
return hashC;
|
|
1271
|
+
}
|
|
1272
|
+
var isLE, swap32IfBE;
|
|
1273
|
+
var init_utils2 = __esm(() => {
|
|
1274
|
+
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
1275
|
+
isLE = /* @__PURE__ */ (() => new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68)();
|
|
1276
|
+
swap32IfBE = isLE ? (u) => u : byteSwap32;
|
|
1277
|
+
});
|
|
1278
|
+
|
|
1279
|
+
// ../../node_modules/@noble/hashes/esm/sha3.js
|
|
1280
|
+
function keccakP(s, rounds = 24) {
|
|
1281
|
+
const B = new Uint32Array(5 * 2);
|
|
1282
|
+
for (let round = 24 - rounds;round < 24; round++) {
|
|
1283
|
+
for (let x = 0;x < 10; x++)
|
|
1284
|
+
B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];
|
|
1285
|
+
for (let x = 0;x < 10; x += 2) {
|
|
1286
|
+
const idx1 = (x + 8) % 10;
|
|
1287
|
+
const idx0 = (x + 2) % 10;
|
|
1288
|
+
const B0 = B[idx0];
|
|
1289
|
+
const B1 = B[idx0 + 1];
|
|
1290
|
+
const Th = rotlH(B0, B1, 1) ^ B[idx1];
|
|
1291
|
+
const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];
|
|
1292
|
+
for (let y = 0;y < 50; y += 10) {
|
|
1293
|
+
s[x + y] ^= Th;
|
|
1294
|
+
s[x + y + 1] ^= Tl;
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
let curH = s[2];
|
|
1298
|
+
let curL = s[3];
|
|
1299
|
+
for (let t = 0;t < 24; t++) {
|
|
1300
|
+
const shift = SHA3_ROTL[t];
|
|
1301
|
+
const Th = rotlH(curH, curL, shift);
|
|
1302
|
+
const Tl = rotlL(curH, curL, shift);
|
|
1303
|
+
const PI = SHA3_PI[t];
|
|
1304
|
+
curH = s[PI];
|
|
1305
|
+
curL = s[PI + 1];
|
|
1306
|
+
s[PI] = Th;
|
|
1307
|
+
s[PI + 1] = Tl;
|
|
1308
|
+
}
|
|
1309
|
+
for (let y = 0;y < 50; y += 10) {
|
|
1310
|
+
for (let x = 0;x < 10; x++)
|
|
1311
|
+
B[x] = s[y + x];
|
|
1312
|
+
for (let x = 0;x < 10; x++)
|
|
1313
|
+
s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];
|
|
1314
|
+
}
|
|
1315
|
+
s[0] ^= SHA3_IOTA_H[round];
|
|
1316
|
+
s[1] ^= SHA3_IOTA_L[round];
|
|
1317
|
+
}
|
|
1318
|
+
clean(B);
|
|
1319
|
+
}
|
|
1320
|
+
var _0n, _1n, _2n, _7n, _256n, _0x71n, SHA3_PI, SHA3_ROTL, _SHA3_IOTA, IOTAS, SHA3_IOTA_H, SHA3_IOTA_L, rotlH = (h, l, s) => s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s), rotlL = (h, l, s) => s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s), Keccak, gen = (suffix, blockLen, outputLen) => createHasher(() => new Keccak(blockLen, suffix, outputLen)), keccak_256;
|
|
1321
|
+
var init_sha3 = __esm(() => {
|
|
1322
|
+
init__u64();
|
|
1323
|
+
init_utils2();
|
|
1324
|
+
_0n = BigInt(0);
|
|
1325
|
+
_1n = BigInt(1);
|
|
1326
|
+
_2n = BigInt(2);
|
|
1327
|
+
_7n = BigInt(7);
|
|
1328
|
+
_256n = BigInt(256);
|
|
1329
|
+
_0x71n = BigInt(113);
|
|
1330
|
+
SHA3_PI = [];
|
|
1331
|
+
SHA3_ROTL = [];
|
|
1332
|
+
_SHA3_IOTA = [];
|
|
1333
|
+
for (let round = 0, R = _1n, x = 1, y = 0;round < 24; round++) {
|
|
1334
|
+
[x, y] = [y, (2 * x + 3 * y) % 5];
|
|
1335
|
+
SHA3_PI.push(2 * (5 * y + x));
|
|
1336
|
+
SHA3_ROTL.push((round + 1) * (round + 2) / 2 % 64);
|
|
1337
|
+
let t = _0n;
|
|
1338
|
+
for (let j = 0;j < 7; j++) {
|
|
1339
|
+
R = (R << _1n ^ (R >> _7n) * _0x71n) % _256n;
|
|
1340
|
+
if (R & _2n)
|
|
1341
|
+
t ^= _1n << (_1n << /* @__PURE__ */ BigInt(j)) - _1n;
|
|
1342
|
+
}
|
|
1343
|
+
_SHA3_IOTA.push(t);
|
|
1344
|
+
}
|
|
1345
|
+
IOTAS = split(_SHA3_IOTA, true);
|
|
1346
|
+
SHA3_IOTA_H = IOTAS[0];
|
|
1347
|
+
SHA3_IOTA_L = IOTAS[1];
|
|
1348
|
+
Keccak = class Keccak extends Hash {
|
|
1349
|
+
constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {
|
|
1350
|
+
super();
|
|
1351
|
+
this.pos = 0;
|
|
1352
|
+
this.posOut = 0;
|
|
1353
|
+
this.finished = false;
|
|
1354
|
+
this.destroyed = false;
|
|
1355
|
+
this.enableXOF = false;
|
|
1356
|
+
this.blockLen = blockLen;
|
|
1357
|
+
this.suffix = suffix;
|
|
1358
|
+
this.outputLen = outputLen;
|
|
1359
|
+
this.enableXOF = enableXOF;
|
|
1360
|
+
this.rounds = rounds;
|
|
1361
|
+
anumber(outputLen);
|
|
1362
|
+
if (!(0 < blockLen && blockLen < 200))
|
|
1363
|
+
throw new Error("only keccak-f1600 function is supported");
|
|
1364
|
+
this.state = new Uint8Array(200);
|
|
1365
|
+
this.state32 = u32(this.state);
|
|
1366
|
+
}
|
|
1367
|
+
clone() {
|
|
1368
|
+
return this._cloneInto();
|
|
1369
|
+
}
|
|
1370
|
+
keccak() {
|
|
1371
|
+
swap32IfBE(this.state32);
|
|
1372
|
+
keccakP(this.state32, this.rounds);
|
|
1373
|
+
swap32IfBE(this.state32);
|
|
1374
|
+
this.posOut = 0;
|
|
1375
|
+
this.pos = 0;
|
|
1376
|
+
}
|
|
1377
|
+
update(data) {
|
|
1378
|
+
aexists(this);
|
|
1379
|
+
data = toBytes2(data);
|
|
1380
|
+
abytes(data);
|
|
1381
|
+
const { blockLen, state } = this;
|
|
1382
|
+
const len = data.length;
|
|
1383
|
+
for (let pos = 0;pos < len; ) {
|
|
1384
|
+
const take = Math.min(blockLen - this.pos, len - pos);
|
|
1385
|
+
for (let i = 0;i < take; i++)
|
|
1386
|
+
state[this.pos++] ^= data[pos++];
|
|
1387
|
+
if (this.pos === blockLen)
|
|
1388
|
+
this.keccak();
|
|
1389
|
+
}
|
|
1390
|
+
return this;
|
|
1391
|
+
}
|
|
1392
|
+
finish() {
|
|
1393
|
+
if (this.finished)
|
|
1394
|
+
return;
|
|
1395
|
+
this.finished = true;
|
|
1396
|
+
const { state, suffix, pos, blockLen } = this;
|
|
1397
|
+
state[pos] ^= suffix;
|
|
1398
|
+
if ((suffix & 128) !== 0 && pos === blockLen - 1)
|
|
1399
|
+
this.keccak();
|
|
1400
|
+
state[blockLen - 1] ^= 128;
|
|
1401
|
+
this.keccak();
|
|
1402
|
+
}
|
|
1403
|
+
writeInto(out) {
|
|
1404
|
+
aexists(this, false);
|
|
1405
|
+
abytes(out);
|
|
1406
|
+
this.finish();
|
|
1407
|
+
const bufferOut = this.state;
|
|
1408
|
+
const { blockLen } = this;
|
|
1409
|
+
for (let pos = 0, len = out.length;pos < len; ) {
|
|
1410
|
+
if (this.posOut >= blockLen)
|
|
1411
|
+
this.keccak();
|
|
1412
|
+
const take = Math.min(blockLen - this.posOut, len - pos);
|
|
1413
|
+
out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);
|
|
1414
|
+
this.posOut += take;
|
|
1415
|
+
pos += take;
|
|
1416
|
+
}
|
|
1417
|
+
return out;
|
|
1418
|
+
}
|
|
1419
|
+
xofInto(out) {
|
|
1420
|
+
if (!this.enableXOF)
|
|
1421
|
+
throw new Error("XOF is not possible for this instance");
|
|
1422
|
+
return this.writeInto(out);
|
|
1423
|
+
}
|
|
1424
|
+
xof(bytes) {
|
|
1425
|
+
anumber(bytes);
|
|
1426
|
+
return this.xofInto(new Uint8Array(bytes));
|
|
1427
|
+
}
|
|
1428
|
+
digestInto(out) {
|
|
1429
|
+
aoutput(out, this);
|
|
1430
|
+
if (this.finished)
|
|
1431
|
+
throw new Error("digest() was already called");
|
|
1432
|
+
this.writeInto(out);
|
|
1433
|
+
this.destroy();
|
|
1434
|
+
return out;
|
|
1435
|
+
}
|
|
1436
|
+
digest() {
|
|
1437
|
+
return this.digestInto(new Uint8Array(this.outputLen));
|
|
1438
|
+
}
|
|
1439
|
+
destroy() {
|
|
1440
|
+
this.destroyed = true;
|
|
1441
|
+
clean(this.state);
|
|
1442
|
+
}
|
|
1443
|
+
_cloneInto(to) {
|
|
1444
|
+
const { blockLen, suffix, outputLen, rounds, enableXOF } = this;
|
|
1445
|
+
to || (to = new Keccak(blockLen, suffix, outputLen, enableXOF, rounds));
|
|
1446
|
+
to.state32.set(this.state32);
|
|
1447
|
+
to.pos = this.pos;
|
|
1448
|
+
to.posOut = this.posOut;
|
|
1449
|
+
to.finished = this.finished;
|
|
1450
|
+
to.rounds = rounds;
|
|
1451
|
+
to.suffix = suffix;
|
|
1452
|
+
to.outputLen = outputLen;
|
|
1453
|
+
to.enableXOF = enableXOF;
|
|
1454
|
+
to.destroyed = this.destroyed;
|
|
1455
|
+
return to;
|
|
1456
|
+
}
|
|
1457
|
+
};
|
|
1458
|
+
keccak_256 = /* @__PURE__ */ (() => gen(1, 136, 256 / 8))();
|
|
1459
|
+
});
|
|
1460
|
+
|
|
1461
|
+
// ../../node_modules/viem/_esm/utils/hash/keccak256.js
|
|
1462
|
+
function keccak256(value, to_) {
|
|
1463
|
+
const to = to_ || "hex";
|
|
1464
|
+
const bytes = keccak_256(isHex(value, { strict: false }) ? toBytes(value) : value);
|
|
1465
|
+
if (to === "bytes")
|
|
1466
|
+
return bytes;
|
|
1467
|
+
return toHex(bytes);
|
|
1468
|
+
}
|
|
1469
|
+
var init_keccak256 = __esm(() => {
|
|
1470
|
+
init_sha3();
|
|
1471
|
+
init_toBytes();
|
|
1472
|
+
init_toHex();
|
|
1473
|
+
});
|
|
1474
|
+
|
|
1475
|
+
// ../../node_modules/viem/_esm/utils/hash/hashSignature.js
|
|
1476
|
+
function hashSignature(sig) {
|
|
1477
|
+
return hash(sig);
|
|
1478
|
+
}
|
|
1479
|
+
var hash = (value) => keccak256(toBytes(value));
|
|
1480
|
+
var init_hashSignature = __esm(() => {
|
|
1481
|
+
init_toBytes();
|
|
1482
|
+
init_keccak256();
|
|
1483
|
+
});
|
|
1484
|
+
|
|
1485
|
+
// ../../node_modules/viem/_esm/utils/hash/normalizeSignature.js
|
|
1486
|
+
function normalizeSignature(signature) {
|
|
1487
|
+
let active = true;
|
|
1488
|
+
let current = "";
|
|
1489
|
+
let level = 0;
|
|
1490
|
+
let result = "";
|
|
1491
|
+
let valid = false;
|
|
1492
|
+
for (let i = 0;i < signature.length; i++) {
|
|
1493
|
+
const char = signature[i];
|
|
1494
|
+
if (["(", ")", ","].includes(char))
|
|
1495
|
+
active = true;
|
|
1496
|
+
if (char === "(")
|
|
1497
|
+
level++;
|
|
1498
|
+
if (char === ")")
|
|
1499
|
+
level--;
|
|
1500
|
+
if (!active)
|
|
1501
|
+
continue;
|
|
1502
|
+
if (level === 0) {
|
|
1503
|
+
if (char === " " && ["event", "function", ""].includes(result))
|
|
1504
|
+
result = "";
|
|
1505
|
+
else {
|
|
1506
|
+
result += char;
|
|
1507
|
+
if (char === ")") {
|
|
1508
|
+
valid = true;
|
|
1509
|
+
break;
|
|
1510
|
+
}
|
|
1511
|
+
}
|
|
1512
|
+
continue;
|
|
1513
|
+
}
|
|
1514
|
+
if (char === " ") {
|
|
1515
|
+
if (signature[i - 1] !== "," && current !== "," && current !== ",(") {
|
|
1516
|
+
current = "";
|
|
1517
|
+
active = false;
|
|
1518
|
+
}
|
|
1519
|
+
continue;
|
|
1520
|
+
}
|
|
1521
|
+
result += char;
|
|
1522
|
+
current += char;
|
|
1523
|
+
}
|
|
1524
|
+
if (!valid)
|
|
1525
|
+
throw new BaseError2("Unable to normalize signature.");
|
|
1526
|
+
return result;
|
|
1527
|
+
}
|
|
1528
|
+
var init_normalizeSignature = __esm(() => {
|
|
1529
|
+
init_base();
|
|
1530
|
+
});
|
|
1531
|
+
|
|
1532
|
+
// ../../node_modules/viem/_esm/utils/hash/toSignature.js
|
|
1533
|
+
var toSignature = (def) => {
|
|
1534
|
+
const def_ = (() => {
|
|
1535
|
+
if (typeof def === "string")
|
|
1536
|
+
return def;
|
|
1537
|
+
return formatAbiItem(def);
|
|
1538
|
+
})();
|
|
1539
|
+
return normalizeSignature(def_);
|
|
1540
|
+
};
|
|
1541
|
+
var init_toSignature = __esm(() => {
|
|
1542
|
+
init_exports();
|
|
1543
|
+
init_normalizeSignature();
|
|
1544
|
+
});
|
|
1545
|
+
|
|
1546
|
+
// ../../node_modules/viem/_esm/utils/hash/toSignatureHash.js
|
|
1547
|
+
function toSignatureHash(fn) {
|
|
1548
|
+
return hashSignature(toSignature(fn));
|
|
1549
|
+
}
|
|
1550
|
+
var init_toSignatureHash = __esm(() => {
|
|
1551
|
+
init_hashSignature();
|
|
1552
|
+
init_toSignature();
|
|
1553
|
+
});
|
|
1554
|
+
|
|
1555
|
+
// ../../node_modules/viem/_esm/utils/hash/toEventSelector.js
|
|
1556
|
+
var toEventSelector;
|
|
1557
|
+
var init_toEventSelector = __esm(() => {
|
|
1558
|
+
init_toSignatureHash();
|
|
1559
|
+
toEventSelector = toSignatureHash;
|
|
1560
|
+
});
|
|
1561
|
+
|
|
1562
|
+
// ../../node_modules/viem/_esm/errors/address.js
|
|
1563
|
+
var InvalidAddressError;
|
|
1564
|
+
var init_address = __esm(() => {
|
|
1565
|
+
init_base();
|
|
1566
|
+
InvalidAddressError = class InvalidAddressError extends BaseError2 {
|
|
1567
|
+
constructor({ address }) {
|
|
1568
|
+
super(`Address "${address}" is invalid.`, {
|
|
1569
|
+
metaMessages: [
|
|
1570
|
+
"- Address must be a hex value of 20 bytes (40 hex characters).",
|
|
1571
|
+
"- Address must match its checksum counterpart."
|
|
1572
|
+
],
|
|
1573
|
+
name: "InvalidAddressError"
|
|
1574
|
+
});
|
|
1575
|
+
}
|
|
1576
|
+
};
|
|
1577
|
+
});
|
|
1578
|
+
|
|
1579
|
+
// ../../node_modules/viem/_esm/utils/lru.js
|
|
1580
|
+
var LruMap;
|
|
1581
|
+
var init_lru = __esm(() => {
|
|
1582
|
+
LruMap = class LruMap extends Map {
|
|
1583
|
+
constructor(size2) {
|
|
1584
|
+
super();
|
|
1585
|
+
Object.defineProperty(this, "maxSize", {
|
|
1586
|
+
enumerable: true,
|
|
1587
|
+
configurable: true,
|
|
1588
|
+
writable: true,
|
|
1589
|
+
value: undefined
|
|
1590
|
+
});
|
|
1591
|
+
this.maxSize = size2;
|
|
1592
|
+
}
|
|
1593
|
+
get(key) {
|
|
1594
|
+
const value = super.get(key);
|
|
1595
|
+
if (super.has(key) && value !== undefined) {
|
|
1596
|
+
this.delete(key);
|
|
1597
|
+
super.set(key, value);
|
|
1598
|
+
}
|
|
1599
|
+
return value;
|
|
1600
|
+
}
|
|
1601
|
+
set(key, value) {
|
|
1602
|
+
super.set(key, value);
|
|
1603
|
+
if (this.maxSize && this.size > this.maxSize) {
|
|
1604
|
+
const firstKey = this.keys().next().value;
|
|
1605
|
+
if (firstKey)
|
|
1606
|
+
this.delete(firstKey);
|
|
1607
|
+
}
|
|
1608
|
+
return this;
|
|
1609
|
+
}
|
|
1610
|
+
};
|
|
1611
|
+
});
|
|
1612
|
+
|
|
1613
|
+
// ../../node_modules/viem/_esm/utils/address/getAddress.js
|
|
1614
|
+
function checksumAddress(address_, chainId) {
|
|
1615
|
+
if (checksumAddressCache.has(`${address_}.${chainId}`))
|
|
1616
|
+
return checksumAddressCache.get(`${address_}.${chainId}`);
|
|
1617
|
+
const hexAddress = chainId ? `${chainId}${address_.toLowerCase()}` : address_.substring(2).toLowerCase();
|
|
1618
|
+
const hash2 = keccak256(stringToBytes(hexAddress), "bytes");
|
|
1619
|
+
const address = (chainId ? hexAddress.substring(`${chainId}0x`.length) : hexAddress).split("");
|
|
1620
|
+
for (let i = 0;i < 40; i += 2) {
|
|
1621
|
+
if (hash2[i >> 1] >> 4 >= 8 && address[i]) {
|
|
1622
|
+
address[i] = address[i].toUpperCase();
|
|
1623
|
+
}
|
|
1624
|
+
if ((hash2[i >> 1] & 15) >= 8 && address[i + 1]) {
|
|
1625
|
+
address[i + 1] = address[i + 1].toUpperCase();
|
|
1626
|
+
}
|
|
1627
|
+
}
|
|
1628
|
+
const result = `0x${address.join("")}`;
|
|
1629
|
+
checksumAddressCache.set(`${address_}.${chainId}`, result);
|
|
1630
|
+
return result;
|
|
1631
|
+
}
|
|
1632
|
+
var checksumAddressCache;
|
|
1633
|
+
var init_getAddress = __esm(() => {
|
|
1634
|
+
init_toBytes();
|
|
1635
|
+
init_keccak256();
|
|
1636
|
+
init_lru();
|
|
1637
|
+
checksumAddressCache = /* @__PURE__ */ new LruMap(8192);
|
|
1638
|
+
});
|
|
1639
|
+
|
|
1640
|
+
// ../../node_modules/viem/_esm/utils/address/isAddress.js
|
|
1641
|
+
function isAddress(address, options) {
|
|
1642
|
+
const { strict = true } = options ?? {};
|
|
1643
|
+
const cacheKey = `${address}.${strict}`;
|
|
1644
|
+
if (isAddressCache.has(cacheKey))
|
|
1645
|
+
return isAddressCache.get(cacheKey);
|
|
1646
|
+
const result = (() => {
|
|
1647
|
+
if (!addressRegex.test(address))
|
|
1648
|
+
return false;
|
|
1649
|
+
if (address.toLowerCase() === address)
|
|
1650
|
+
return true;
|
|
1651
|
+
if (strict)
|
|
1652
|
+
return checksumAddress(address) === address;
|
|
1653
|
+
return true;
|
|
1654
|
+
})();
|
|
1655
|
+
isAddressCache.set(cacheKey, result);
|
|
1656
|
+
return result;
|
|
1657
|
+
}
|
|
1658
|
+
var addressRegex, isAddressCache;
|
|
1659
|
+
var init_isAddress = __esm(() => {
|
|
1660
|
+
init_lru();
|
|
1661
|
+
init_getAddress();
|
|
1662
|
+
addressRegex = /^0x[a-fA-F0-9]{40}$/;
|
|
1663
|
+
isAddressCache = /* @__PURE__ */ new LruMap(8192);
|
|
1664
|
+
});
|
|
1665
|
+
|
|
1666
|
+
// ../../node_modules/viem/_esm/utils/data/concat.js
|
|
1667
|
+
function concat(values) {
|
|
1668
|
+
if (typeof values[0] === "string")
|
|
1669
|
+
return concatHex(values);
|
|
1670
|
+
return concatBytes(values);
|
|
1671
|
+
}
|
|
1672
|
+
function concatBytes(values) {
|
|
1673
|
+
let length = 0;
|
|
1674
|
+
for (const arr of values) {
|
|
1675
|
+
length += arr.length;
|
|
1676
|
+
}
|
|
1677
|
+
const result = new Uint8Array(length);
|
|
1678
|
+
let offset = 0;
|
|
1679
|
+
for (const arr of values) {
|
|
1680
|
+
result.set(arr, offset);
|
|
1681
|
+
offset += arr.length;
|
|
1682
|
+
}
|
|
1683
|
+
return result;
|
|
1684
|
+
}
|
|
1685
|
+
function concatHex(values) {
|
|
1686
|
+
return `0x${values.reduce((acc, x) => acc + x.replace("0x", ""), "")}`;
|
|
1687
|
+
}
|
|
1688
|
+
|
|
1689
|
+
// ../../node_modules/viem/_esm/utils/data/slice.js
|
|
1690
|
+
function slice(value, start, end, { strict } = {}) {
|
|
1691
|
+
if (isHex(value, { strict: false }))
|
|
1692
|
+
return sliceHex(value, start, end, {
|
|
1693
|
+
strict
|
|
1694
|
+
});
|
|
1695
|
+
return sliceBytes(value, start, end, {
|
|
1696
|
+
strict
|
|
1697
|
+
});
|
|
1698
|
+
}
|
|
1699
|
+
function assertStartOffset(value, start) {
|
|
1700
|
+
if (typeof start === "number" && start > 0 && start > size(value) - 1)
|
|
1701
|
+
throw new SliceOffsetOutOfBoundsError({
|
|
1702
|
+
offset: start,
|
|
1703
|
+
position: "start",
|
|
1704
|
+
size: size(value)
|
|
1705
|
+
});
|
|
1706
|
+
}
|
|
1707
|
+
function assertEndOffset(value, start, end) {
|
|
1708
|
+
if (typeof start === "number" && typeof end === "number" && size(value) !== end - start) {
|
|
1709
|
+
throw new SliceOffsetOutOfBoundsError({
|
|
1710
|
+
offset: end,
|
|
1711
|
+
position: "end",
|
|
1712
|
+
size: size(value)
|
|
1713
|
+
});
|
|
1714
|
+
}
|
|
1715
|
+
}
|
|
1716
|
+
function sliceBytes(value_, start, end, { strict } = {}) {
|
|
1717
|
+
assertStartOffset(value_, start);
|
|
1718
|
+
const value = value_.slice(start, end);
|
|
1719
|
+
if (strict)
|
|
1720
|
+
assertEndOffset(value, start, end);
|
|
1721
|
+
return value;
|
|
1722
|
+
}
|
|
1723
|
+
function sliceHex(value_, start, end, { strict } = {}) {
|
|
1724
|
+
assertStartOffset(value_, start);
|
|
1725
|
+
const value = `0x${value_.replace("0x", "").slice((start ?? 0) * 2, (end ?? value_.length) * 2)}`;
|
|
1726
|
+
if (strict)
|
|
1727
|
+
assertEndOffset(value, start, end);
|
|
1728
|
+
return value;
|
|
1729
|
+
}
|
|
1730
|
+
var init_slice = __esm(() => {
|
|
1731
|
+
init_data();
|
|
1732
|
+
init_size();
|
|
1733
|
+
});
|
|
1734
|
+
|
|
1735
|
+
// ../../node_modules/viem/_esm/utils/regex.js
|
|
1736
|
+
var integerRegex2;
|
|
1737
|
+
var init_regex2 = __esm(() => {
|
|
1738
|
+
integerRegex2 = /^(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)?$/;
|
|
1739
|
+
});
|
|
1740
|
+
|
|
1741
|
+
// ../../node_modules/viem/_esm/utils/abi/encodeAbiParameters.js
|
|
1742
|
+
function encodeAbiParameters(params, values) {
|
|
1743
|
+
if (params.length !== values.length)
|
|
1744
|
+
throw new AbiEncodingLengthMismatchError({
|
|
1745
|
+
expectedLength: params.length,
|
|
1746
|
+
givenLength: values.length
|
|
1747
|
+
});
|
|
1748
|
+
const preparedParams = prepareParams({
|
|
1749
|
+
params,
|
|
1750
|
+
values
|
|
1751
|
+
});
|
|
1752
|
+
const data = encodeParams(preparedParams);
|
|
1753
|
+
if (data.length === 0)
|
|
1754
|
+
return "0x";
|
|
1755
|
+
return data;
|
|
1756
|
+
}
|
|
1757
|
+
function prepareParams({ params, values }) {
|
|
1758
|
+
const preparedParams = [];
|
|
1759
|
+
for (let i = 0;i < params.length; i++) {
|
|
1760
|
+
preparedParams.push(prepareParam({ param: params[i], value: values[i] }));
|
|
1761
|
+
}
|
|
1762
|
+
return preparedParams;
|
|
1763
|
+
}
|
|
1764
|
+
function prepareParam({ param, value }) {
|
|
1765
|
+
const arrayComponents = getArrayComponents(param.type);
|
|
1766
|
+
if (arrayComponents) {
|
|
1767
|
+
const [length, type] = arrayComponents;
|
|
1768
|
+
return encodeArray(value, { length, param: { ...param, type } });
|
|
1769
|
+
}
|
|
1770
|
+
if (param.type === "tuple") {
|
|
1771
|
+
return encodeTuple(value, {
|
|
1772
|
+
param
|
|
1773
|
+
});
|
|
1774
|
+
}
|
|
1775
|
+
if (param.type === "address") {
|
|
1776
|
+
return encodeAddress(value);
|
|
1777
|
+
}
|
|
1778
|
+
if (param.type === "bool") {
|
|
1779
|
+
return encodeBool(value);
|
|
1780
|
+
}
|
|
1781
|
+
if (param.type.startsWith("uint") || param.type.startsWith("int")) {
|
|
1782
|
+
const signed = param.type.startsWith("int");
|
|
1783
|
+
const [, , size2 = "256"] = integerRegex2.exec(param.type) ?? [];
|
|
1784
|
+
return encodeNumber(value, {
|
|
1785
|
+
signed,
|
|
1786
|
+
size: Number(size2)
|
|
1787
|
+
});
|
|
1788
|
+
}
|
|
1789
|
+
if (param.type.startsWith("bytes")) {
|
|
1790
|
+
return encodeBytes(value, { param });
|
|
1791
|
+
}
|
|
1792
|
+
if (param.type === "string") {
|
|
1793
|
+
return encodeString(value);
|
|
1794
|
+
}
|
|
1795
|
+
throw new InvalidAbiEncodingTypeError(param.type, {
|
|
1796
|
+
docsPath: "/docs/contract/encodeAbiParameters"
|
|
1797
|
+
});
|
|
1798
|
+
}
|
|
1799
|
+
function encodeParams(preparedParams) {
|
|
1800
|
+
let staticSize = 0;
|
|
1801
|
+
for (let i = 0;i < preparedParams.length; i++) {
|
|
1802
|
+
const { dynamic, encoded } = preparedParams[i];
|
|
1803
|
+
if (dynamic)
|
|
1804
|
+
staticSize += 32;
|
|
1805
|
+
else
|
|
1806
|
+
staticSize += size(encoded);
|
|
1807
|
+
}
|
|
1808
|
+
const staticParams = [];
|
|
1809
|
+
const dynamicParams = [];
|
|
1810
|
+
let dynamicSize = 0;
|
|
1811
|
+
for (let i = 0;i < preparedParams.length; i++) {
|
|
1812
|
+
const { dynamic, encoded } = preparedParams[i];
|
|
1813
|
+
if (dynamic) {
|
|
1814
|
+
staticParams.push(numberToHex(staticSize + dynamicSize, { size: 32 }));
|
|
1815
|
+
dynamicParams.push(encoded);
|
|
1816
|
+
dynamicSize += size(encoded);
|
|
1817
|
+
} else {
|
|
1818
|
+
staticParams.push(encoded);
|
|
1819
|
+
}
|
|
1820
|
+
}
|
|
1821
|
+
return concat([...staticParams, ...dynamicParams]);
|
|
1822
|
+
}
|
|
1823
|
+
function encodeAddress(value) {
|
|
1824
|
+
if (!isAddress(value))
|
|
1825
|
+
throw new InvalidAddressError({ address: value });
|
|
1826
|
+
return { dynamic: false, encoded: padHex(value.toLowerCase()) };
|
|
1827
|
+
}
|
|
1828
|
+
function encodeArray(value, { length, param }) {
|
|
1829
|
+
const dynamic = length === null;
|
|
1830
|
+
if (!Array.isArray(value))
|
|
1831
|
+
throw new InvalidArrayError(value);
|
|
1832
|
+
if (!dynamic && value.length !== length)
|
|
1833
|
+
throw new AbiEncodingArrayLengthMismatchError({
|
|
1834
|
+
expectedLength: length,
|
|
1835
|
+
givenLength: value.length,
|
|
1836
|
+
type: `${param.type}[${length}]`
|
|
1837
|
+
});
|
|
1838
|
+
let dynamicChild = false;
|
|
1839
|
+
const preparedParams = [];
|
|
1840
|
+
for (let i = 0;i < value.length; i++) {
|
|
1841
|
+
const preparedParam = prepareParam({ param, value: value[i] });
|
|
1842
|
+
if (preparedParam.dynamic)
|
|
1843
|
+
dynamicChild = true;
|
|
1844
|
+
preparedParams.push(preparedParam);
|
|
1845
|
+
}
|
|
1846
|
+
if (dynamic || dynamicChild) {
|
|
1847
|
+
const data = encodeParams(preparedParams);
|
|
1848
|
+
if (dynamic) {
|
|
1849
|
+
const length2 = numberToHex(preparedParams.length, { size: 32 });
|
|
1850
|
+
return {
|
|
1851
|
+
dynamic: true,
|
|
1852
|
+
encoded: preparedParams.length > 0 ? concat([length2, data]) : length2
|
|
1853
|
+
};
|
|
1854
|
+
}
|
|
1855
|
+
if (dynamicChild)
|
|
1856
|
+
return { dynamic: true, encoded: data };
|
|
1857
|
+
}
|
|
1858
|
+
return {
|
|
1859
|
+
dynamic: false,
|
|
1860
|
+
encoded: concat(preparedParams.map(({ encoded }) => encoded))
|
|
1861
|
+
};
|
|
1862
|
+
}
|
|
1863
|
+
function encodeBytes(value, { param }) {
|
|
1864
|
+
const [, paramSize] = param.type.split("bytes");
|
|
1865
|
+
const bytesSize = size(value);
|
|
1866
|
+
if (!paramSize) {
|
|
1867
|
+
let value_ = value;
|
|
1868
|
+
if (bytesSize % 32 !== 0)
|
|
1869
|
+
value_ = padHex(value_, {
|
|
1870
|
+
dir: "right",
|
|
1871
|
+
size: Math.ceil((value.length - 2) / 2 / 32) * 32
|
|
1872
|
+
});
|
|
1873
|
+
return {
|
|
1874
|
+
dynamic: true,
|
|
1875
|
+
encoded: concat([padHex(numberToHex(bytesSize, { size: 32 })), value_])
|
|
1876
|
+
};
|
|
1877
|
+
}
|
|
1878
|
+
if (bytesSize !== Number.parseInt(paramSize))
|
|
1879
|
+
throw new AbiEncodingBytesSizeMismatchError({
|
|
1880
|
+
expectedSize: Number.parseInt(paramSize),
|
|
1881
|
+
value
|
|
1882
|
+
});
|
|
1883
|
+
return { dynamic: false, encoded: padHex(value, { dir: "right" }) };
|
|
1884
|
+
}
|
|
1885
|
+
function encodeBool(value) {
|
|
1886
|
+
if (typeof value !== "boolean")
|
|
1887
|
+
throw new BaseError2(`Invalid boolean value: "${value}" (type: ${typeof value}). Expected: \`true\` or \`false\`.`);
|
|
1888
|
+
return { dynamic: false, encoded: padHex(boolToHex(value)) };
|
|
1889
|
+
}
|
|
1890
|
+
function encodeNumber(value, { signed, size: size2 = 256 }) {
|
|
1891
|
+
if (typeof size2 === "number") {
|
|
1892
|
+
const max = 2n ** (BigInt(size2) - (signed ? 1n : 0n)) - 1n;
|
|
1893
|
+
const min = signed ? -max - 1n : 0n;
|
|
1894
|
+
if (value > max || value < min)
|
|
1895
|
+
throw new IntegerOutOfRangeError({
|
|
1896
|
+
max: max.toString(),
|
|
1897
|
+
min: min.toString(),
|
|
1898
|
+
signed,
|
|
1899
|
+
size: size2 / 8,
|
|
1900
|
+
value: value.toString()
|
|
1901
|
+
});
|
|
1902
|
+
}
|
|
1903
|
+
return {
|
|
1904
|
+
dynamic: false,
|
|
1905
|
+
encoded: numberToHex(value, {
|
|
1906
|
+
size: 32,
|
|
1907
|
+
signed
|
|
1908
|
+
})
|
|
1909
|
+
};
|
|
1910
|
+
}
|
|
1911
|
+
function encodeString(value) {
|
|
1912
|
+
const hexValue = stringToHex(value);
|
|
1913
|
+
const partsLength = Math.ceil(size(hexValue) / 32);
|
|
1914
|
+
const parts = [];
|
|
1915
|
+
for (let i = 0;i < partsLength; i++) {
|
|
1916
|
+
parts.push(padHex(slice(hexValue, i * 32, (i + 1) * 32), {
|
|
1917
|
+
dir: "right"
|
|
1918
|
+
}));
|
|
1919
|
+
}
|
|
1920
|
+
return {
|
|
1921
|
+
dynamic: true,
|
|
1922
|
+
encoded: concat([
|
|
1923
|
+
padHex(numberToHex(size(hexValue), { size: 32 })),
|
|
1924
|
+
...parts
|
|
1925
|
+
])
|
|
1926
|
+
};
|
|
1927
|
+
}
|
|
1928
|
+
function encodeTuple(value, { param }) {
|
|
1929
|
+
let dynamic = false;
|
|
1930
|
+
const preparedParams = [];
|
|
1931
|
+
for (let i = 0;i < param.components.length; i++) {
|
|
1932
|
+
const param_ = param.components[i];
|
|
1933
|
+
const index = Array.isArray(value) ? i : param_.name;
|
|
1934
|
+
const preparedParam = prepareParam({
|
|
1935
|
+
param: param_,
|
|
1936
|
+
value: value[index]
|
|
1937
|
+
});
|
|
1938
|
+
preparedParams.push(preparedParam);
|
|
1939
|
+
if (preparedParam.dynamic)
|
|
1940
|
+
dynamic = true;
|
|
1941
|
+
}
|
|
1942
|
+
return {
|
|
1943
|
+
dynamic,
|
|
1944
|
+
encoded: dynamic ? encodeParams(preparedParams) : concat(preparedParams.map(({ encoded }) => encoded))
|
|
1945
|
+
};
|
|
1946
|
+
}
|
|
1947
|
+
function getArrayComponents(type) {
|
|
1948
|
+
const matches = type.match(/^(.*)\[(\d+)?\]$/);
|
|
1949
|
+
return matches ? [matches[2] ? Number(matches[2]) : null, matches[1]] : undefined;
|
|
1950
|
+
}
|
|
1951
|
+
var init_encodeAbiParameters = __esm(() => {
|
|
1952
|
+
init_abi();
|
|
1953
|
+
init_address();
|
|
1954
|
+
init_base();
|
|
1955
|
+
init_encoding();
|
|
1956
|
+
init_isAddress();
|
|
1957
|
+
init_pad();
|
|
1958
|
+
init_size();
|
|
1959
|
+
init_slice();
|
|
1960
|
+
init_toHex();
|
|
1961
|
+
init_regex2();
|
|
1962
|
+
});
|
|
1963
|
+
|
|
1964
|
+
// ../../node_modules/viem/_esm/utils/hash/toFunctionSelector.js
|
|
1965
|
+
var toFunctionSelector = (fn) => slice(toSignatureHash(fn), 0, 4);
|
|
1966
|
+
var init_toFunctionSelector = __esm(() => {
|
|
1967
|
+
init_slice();
|
|
1968
|
+
init_toSignatureHash();
|
|
1969
|
+
});
|
|
1970
|
+
|
|
1971
|
+
// ../../node_modules/viem/_esm/utils/abi/getAbiItem.js
|
|
1972
|
+
function getAbiItem(parameters) {
|
|
1973
|
+
const { abi, args = [], name } = parameters;
|
|
1974
|
+
const isSelector = isHex(name, { strict: false });
|
|
1975
|
+
const abiItems = abi.filter((abiItem) => {
|
|
1976
|
+
if (isSelector) {
|
|
1977
|
+
if (abiItem.type === "function")
|
|
1978
|
+
return toFunctionSelector(abiItem) === name;
|
|
1979
|
+
if (abiItem.type === "event")
|
|
1980
|
+
return toEventSelector(abiItem) === name;
|
|
1981
|
+
return false;
|
|
1982
|
+
}
|
|
1983
|
+
return "name" in abiItem && abiItem.name === name;
|
|
1984
|
+
});
|
|
1985
|
+
if (abiItems.length === 0)
|
|
1986
|
+
return;
|
|
1987
|
+
if (abiItems.length === 1)
|
|
1988
|
+
return abiItems[0];
|
|
1989
|
+
let matchedAbiItem = undefined;
|
|
1990
|
+
for (const abiItem of abiItems) {
|
|
1991
|
+
if (!("inputs" in abiItem))
|
|
1992
|
+
continue;
|
|
1993
|
+
if (!args || args.length === 0) {
|
|
1994
|
+
if (!abiItem.inputs || abiItem.inputs.length === 0)
|
|
1995
|
+
return abiItem;
|
|
1996
|
+
continue;
|
|
1997
|
+
}
|
|
1998
|
+
if (!abiItem.inputs)
|
|
1999
|
+
continue;
|
|
2000
|
+
if (abiItem.inputs.length === 0)
|
|
2001
|
+
continue;
|
|
2002
|
+
if (abiItem.inputs.length !== args.length)
|
|
2003
|
+
continue;
|
|
2004
|
+
const matched = args.every((arg, index) => {
|
|
2005
|
+
const abiParameter = "inputs" in abiItem && abiItem.inputs[index];
|
|
2006
|
+
if (!abiParameter)
|
|
2007
|
+
return false;
|
|
2008
|
+
return isArgOfType(arg, abiParameter);
|
|
2009
|
+
});
|
|
2010
|
+
if (matched) {
|
|
2011
|
+
if (matchedAbiItem && "inputs" in matchedAbiItem && matchedAbiItem.inputs) {
|
|
2012
|
+
const ambiguousTypes = getAmbiguousTypes(abiItem.inputs, matchedAbiItem.inputs, args);
|
|
2013
|
+
if (ambiguousTypes)
|
|
2014
|
+
throw new AbiItemAmbiguityError({
|
|
2015
|
+
abiItem,
|
|
2016
|
+
type: ambiguousTypes[0]
|
|
2017
|
+
}, {
|
|
2018
|
+
abiItem: matchedAbiItem,
|
|
2019
|
+
type: ambiguousTypes[1]
|
|
2020
|
+
});
|
|
2021
|
+
}
|
|
2022
|
+
matchedAbiItem = abiItem;
|
|
2023
|
+
}
|
|
2024
|
+
}
|
|
2025
|
+
if (matchedAbiItem)
|
|
2026
|
+
return matchedAbiItem;
|
|
2027
|
+
return abiItems[0];
|
|
2028
|
+
}
|
|
2029
|
+
function isArgOfType(arg, abiParameter) {
|
|
2030
|
+
const argType = typeof arg;
|
|
2031
|
+
const abiParameterType = abiParameter.type;
|
|
2032
|
+
switch (abiParameterType) {
|
|
2033
|
+
case "address":
|
|
2034
|
+
return isAddress(arg, { strict: false });
|
|
2035
|
+
case "bool":
|
|
2036
|
+
return argType === "boolean";
|
|
2037
|
+
case "function":
|
|
2038
|
+
return argType === "string";
|
|
2039
|
+
case "string":
|
|
2040
|
+
return argType === "string";
|
|
2041
|
+
default: {
|
|
2042
|
+
if (abiParameterType === "tuple" && "components" in abiParameter)
|
|
2043
|
+
return Object.values(abiParameter.components).every((component, index) => {
|
|
2044
|
+
return isArgOfType(Object.values(arg)[index], component);
|
|
2045
|
+
});
|
|
2046
|
+
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))
|
|
2047
|
+
return argType === "number" || argType === "bigint";
|
|
2048
|
+
if (/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(abiParameterType))
|
|
2049
|
+
return argType === "string" || arg instanceof Uint8Array;
|
|
2050
|
+
if (/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(abiParameterType)) {
|
|
2051
|
+
return Array.isArray(arg) && arg.every((x) => isArgOfType(x, {
|
|
2052
|
+
...abiParameter,
|
|
2053
|
+
type: abiParameterType.replace(/(\[[0-9]{0,}\])$/, "")
|
|
2054
|
+
}));
|
|
2055
|
+
}
|
|
2056
|
+
return false;
|
|
2057
|
+
}
|
|
2058
|
+
}
|
|
2059
|
+
}
|
|
2060
|
+
function getAmbiguousTypes(sourceParameters, targetParameters, args) {
|
|
2061
|
+
for (const parameterIndex in sourceParameters) {
|
|
2062
|
+
const sourceParameter = sourceParameters[parameterIndex];
|
|
2063
|
+
const targetParameter = targetParameters[parameterIndex];
|
|
2064
|
+
if (sourceParameter.type === "tuple" && targetParameter.type === "tuple" && "components" in sourceParameter && "components" in targetParameter)
|
|
2065
|
+
return getAmbiguousTypes(sourceParameter.components, targetParameter.components, args[parameterIndex]);
|
|
2066
|
+
const types = [sourceParameter.type, targetParameter.type];
|
|
2067
|
+
const ambiguous = (() => {
|
|
2068
|
+
if (types.includes("address") && types.includes("bytes20"))
|
|
2069
|
+
return true;
|
|
2070
|
+
if (types.includes("address") && types.includes("string"))
|
|
2071
|
+
return isAddress(args[parameterIndex], { strict: false });
|
|
2072
|
+
if (types.includes("address") && types.includes("bytes"))
|
|
2073
|
+
return isAddress(args[parameterIndex], { strict: false });
|
|
2074
|
+
return false;
|
|
2075
|
+
})();
|
|
2076
|
+
if (ambiguous)
|
|
2077
|
+
return types;
|
|
2078
|
+
}
|
|
2079
|
+
return;
|
|
2080
|
+
}
|
|
2081
|
+
var init_getAbiItem = __esm(() => {
|
|
2082
|
+
init_abi();
|
|
2083
|
+
init_isAddress();
|
|
2084
|
+
init_toEventSelector();
|
|
2085
|
+
init_toFunctionSelector();
|
|
2086
|
+
});
|
|
2087
|
+
|
|
2088
|
+
// ../../node_modules/viem/_esm/utils/abi/prepareEncodeFunctionData.js
|
|
2089
|
+
function prepareEncodeFunctionData(parameters) {
|
|
2090
|
+
const { abi, args, functionName } = parameters;
|
|
2091
|
+
let abiItem = abi[0];
|
|
2092
|
+
if (functionName) {
|
|
2093
|
+
const item = getAbiItem({
|
|
2094
|
+
abi,
|
|
2095
|
+
args,
|
|
2096
|
+
name: functionName
|
|
2097
|
+
});
|
|
2098
|
+
if (!item)
|
|
2099
|
+
throw new AbiFunctionNotFoundError(functionName, { docsPath });
|
|
2100
|
+
abiItem = item;
|
|
2101
|
+
}
|
|
2102
|
+
if (abiItem.type !== "function")
|
|
2103
|
+
throw new AbiFunctionNotFoundError(undefined, { docsPath });
|
|
2104
|
+
return {
|
|
2105
|
+
abi: [abiItem],
|
|
2106
|
+
functionName: toFunctionSelector(formatAbiItem2(abiItem))
|
|
2107
|
+
};
|
|
2108
|
+
}
|
|
2109
|
+
var docsPath = "/docs/contract/encodeFunctionData";
|
|
2110
|
+
var init_prepareEncodeFunctionData = __esm(() => {
|
|
2111
|
+
init_abi();
|
|
2112
|
+
init_toFunctionSelector();
|
|
2113
|
+
init_formatAbiItem2();
|
|
2114
|
+
init_getAbiItem();
|
|
2115
|
+
});
|
|
2116
|
+
|
|
2117
|
+
// ../../node_modules/viem/_esm/utils/abi/encodeFunctionData.js
|
|
2118
|
+
function encodeFunctionData(parameters) {
|
|
2119
|
+
const { args } = parameters;
|
|
2120
|
+
const { abi, functionName } = (() => {
|
|
2121
|
+
if (parameters.abi.length === 1 && parameters.functionName?.startsWith("0x"))
|
|
2122
|
+
return parameters;
|
|
2123
|
+
return prepareEncodeFunctionData(parameters);
|
|
2124
|
+
})();
|
|
2125
|
+
const abiItem = abi[0];
|
|
2126
|
+
const signature = functionName;
|
|
2127
|
+
const data = "inputs" in abiItem && abiItem.inputs ? encodeAbiParameters(abiItem.inputs, args ?? []) : undefined;
|
|
2128
|
+
return concatHex([signature, data ?? "0x"]);
|
|
2129
|
+
}
|
|
2130
|
+
var init_encodeFunctionData = __esm(() => {
|
|
2131
|
+
init_encodeAbiParameters();
|
|
2132
|
+
init_prepareEncodeFunctionData();
|
|
2133
|
+
});
|
|
28
2134
|
|
|
29
2135
|
// src/index.ts
|
|
30
2136
|
var exports_src = {};
|
|
@@ -47,6 +2153,8 @@ __export(exports_src, {
|
|
|
47
2153
|
NATIVE_ADDRESS: () => NATIVE_ADDRESS,
|
|
48
2154
|
MathLib: () => MathLib,
|
|
49
2155
|
LATEST_VERSION: () => LATEST_VERSION,
|
|
2156
|
+
EncodingUtils: () => EncodingUtils,
|
|
2157
|
+
DelayProxyAdmin: () => DelayProxyAdmin,
|
|
50
2158
|
ChainUtils: () => ChainUtils,
|
|
51
2159
|
ChainId: () => ChainId,
|
|
52
2160
|
CacheMissError: () => CacheMissError
|
|
@@ -193,15 +2301,6 @@ class Token {
|
|
|
193
2301
|
var VaultUtils;
|
|
194
2302
|
((VaultUtils) => {
|
|
195
2303
|
VaultUtils.VIRTUAL_ASSETS = 1n;
|
|
196
|
-
VaultUtils.ERC20_STORAGE_LOCATION = "0x52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace00";
|
|
197
|
-
VaultUtils.ERC4626_STORAGE_LOCATION = "0x0773e532dfede91f04b12a73d3d2acd361424f41f76b4fb79f090161e36b4e00";
|
|
198
|
-
VaultUtils.ERC7540_STORAGE_LOCATION = "0x5c74d456014b1c0eb4368d944667a568313858a3029a650ff0cb7b56f8b57a00";
|
|
199
|
-
VaultUtils.FEE_MANAGER_STORAGE_LOCATION = "0xa5292f7ccd85acc1b3080c01f5da9af7799f2c26826bd4d79081d6511780bd00";
|
|
200
|
-
VaultUtils.OWNABLE_STORAGE_LOCATION = "0x9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300";
|
|
201
|
-
VaultUtils.OWNABLE_2_STEP_UPGRADEABLE_STORAGE_LOCATION = "0x237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c00";
|
|
202
|
-
VaultUtils.ROLES_STORAGE_LOCATION = "0x7c302ed2c673c3d6b4551cf74a01ee649f887e14fd20d13dbca1b6099534d900";
|
|
203
|
-
VaultUtils.VAULT_STORAGE_LOCATION = "0x0e6b3200a60a991c539f47dddaca04a18eb4bcf2b53906fb44751d827f001400";
|
|
204
|
-
VaultUtils.WHITELISTABLE_STORAGE_LOCATION = "0x083cc98ab296d1a1f01854b5f7a2f47df4425a56ba7b35f7faa3a336067e4800";
|
|
205
2304
|
VaultUtils.ONE_SHARE = 10n ** 18n;
|
|
206
2305
|
function decimalsOffset(decimals) {
|
|
207
2306
|
return MathLib.zeroFloorSub(18n, decimals);
|
|
@@ -393,6 +2492,87 @@ class Vault extends Token {
|
|
|
393
2492
|
throw new Error("Unknown version");
|
|
394
2493
|
}
|
|
395
2494
|
}
|
|
2495
|
+
// ../../node_modules/viem/_esm/index.js
|
|
2496
|
+
init_exports();
|
|
2497
|
+
init_encodeAbiParameters();
|
|
2498
|
+
init_encodeFunctionData();
|
|
2499
|
+
|
|
2500
|
+
// src/vault/EncodingUtils.ts
|
|
2501
|
+
var EncodingUtils;
|
|
2502
|
+
((EncodingUtils) => {
|
|
2503
|
+
EncodingUtils.ERC20_STORAGE_LOCATION = "0x52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace00";
|
|
2504
|
+
EncodingUtils.ERC4626_STORAGE_LOCATION = "0x0773e532dfede91f04b12a73d3d2acd361424f41f76b4fb79f090161e36b4e00";
|
|
2505
|
+
EncodingUtils.ERC7540_STORAGE_LOCATION = "0x5c74d456014b1c0eb4368d944667a568313858a3029a650ff0cb7b56f8b57a00";
|
|
2506
|
+
EncodingUtils.FEE_MANAGER_STORAGE_LOCATION = "0xa5292f7ccd85acc1b3080c01f5da9af7799f2c26826bd4d79081d6511780bd00";
|
|
2507
|
+
EncodingUtils.OWNABLE_STORAGE_LOCATION = "0x9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300";
|
|
2508
|
+
EncodingUtils.OWNABLE_2_STEP_UPGRADEABLE_STORAGE_LOCATION = "0x237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c00";
|
|
2509
|
+
EncodingUtils.ROLES_STORAGE_LOCATION = "0x7c302ed2c673c3d6b4551cf74a01ee649f887e14fd20d13dbca1b6099534d900";
|
|
2510
|
+
EncodingUtils.VAULT_STORAGE_LOCATION = "0x0e6b3200a60a991c539f47dddaca04a18eb4bcf2b53906fb44751d827f001400";
|
|
2511
|
+
EncodingUtils.WHITELISTABLE_STORAGE_LOCATION = "0x083cc98ab296d1a1f01854b5f7a2f47df4425a56ba7b35f7faa3a336067e4800";
|
|
2512
|
+
function initializeEncodedCall(vault) {
|
|
2513
|
+
const initAbiParams = parseAbiParameter2([
|
|
2514
|
+
"InitStruct init",
|
|
2515
|
+
"struct InitStruct { address underlying; string name; string symbol; address safe; address whitelistManager; address valuationManager; address admin; address feeReceiver; uint16 managementRate; uint16 performanceRate; bool enableWhitelist; uint256 rateUpdateCooldown; }"
|
|
2516
|
+
]);
|
|
2517
|
+
const initStructEncoded = encodeAbiParameters([initAbiParams], [
|
|
2518
|
+
{
|
|
2519
|
+
underlying: vault.asset,
|
|
2520
|
+
name: vault.name ?? "",
|
|
2521
|
+
symbol: vault.symbol ?? "",
|
|
2522
|
+
safe: vault.safe,
|
|
2523
|
+
whitelistManager: vault.whitelistManager,
|
|
2524
|
+
valuationManager: vault.valuationManager,
|
|
2525
|
+
admin: vault.owner,
|
|
2526
|
+
feeReceiver: vault.feeReceiver,
|
|
2527
|
+
managementRate: vault.feeRates.managementRate,
|
|
2528
|
+
performanceRate: vault.feeRates.performanceRate,
|
|
2529
|
+
enableWhitelist: vault.isWhitelistActivated,
|
|
2530
|
+
rateUpdateCooldown: vault.cooldown
|
|
2531
|
+
}
|
|
2532
|
+
]);
|
|
2533
|
+
return encodeFunctionData({
|
|
2534
|
+
abi: [
|
|
2535
|
+
{
|
|
2536
|
+
type: "function",
|
|
2537
|
+
name: "initialize",
|
|
2538
|
+
stateMutability: "nonpayable",
|
|
2539
|
+
inputs: [
|
|
2540
|
+
{ name: "initStruct", type: "bytes" },
|
|
2541
|
+
{ name: "registry", type: "address" },
|
|
2542
|
+
{ name: "wrappedNative", type: "address" }
|
|
2543
|
+
],
|
|
2544
|
+
outputs: []
|
|
2545
|
+
}
|
|
2546
|
+
],
|
|
2547
|
+
functionName: "initialize",
|
|
2548
|
+
args: [initStructEncoded, vault.feeRegistry, vault.wrappedNativeToken]
|
|
2549
|
+
});
|
|
2550
|
+
}
|
|
2551
|
+
EncodingUtils.initializeEncodedCall = initializeEncodedCall;
|
|
2552
|
+
function siloConstructorEncodedParams(vault) {
|
|
2553
|
+
const constructorEncoded = encodeAbiParameters(parseAbiParameters("address,address"), [vault.asset, vault.wrappedNativeToken]);
|
|
2554
|
+
return constructorEncoded;
|
|
2555
|
+
}
|
|
2556
|
+
EncodingUtils.siloConstructorEncodedParams = siloConstructorEncodedParams;
|
|
2557
|
+
function beaconProxyConstructorEncodedParams(vault, beacon) {
|
|
2558
|
+
const data = initializeEncodedCall(vault);
|
|
2559
|
+
return encodeAbiParameters(parseAbiParameters("address beacon, bytes data"), [beacon, data]);
|
|
2560
|
+
}
|
|
2561
|
+
EncodingUtils.beaconProxyConstructorEncodedParams = beaconProxyConstructorEncodedParams;
|
|
2562
|
+
function optinProxyConstructorEncodedParams(params) {
|
|
2563
|
+
return encodeAbiParameters(parseAbiParameters("address _logic, address _logicRegistry, address _initialOwner, uint256 _initialDelay, bytes _data"), [params.logic, params.logicRegistry, params.initialOwner, params.initialDelay, params.data]);
|
|
2564
|
+
}
|
|
2565
|
+
EncodingUtils.optinProxyConstructorEncodedParams = optinProxyConstructorEncodedParams;
|
|
2566
|
+
function optinProxyWithVaultInitConstructorEncodedParams(vault, params) {
|
|
2567
|
+
const initData = initializeEncodedCall(vault);
|
|
2568
|
+
return optinProxyConstructorEncodedParams({ ...params, data: initData });
|
|
2569
|
+
}
|
|
2570
|
+
EncodingUtils.optinProxyWithVaultInitConstructorEncodedParams = optinProxyWithVaultInitConstructorEncodedParams;
|
|
2571
|
+
function delayProxyAdminConstructorEncodedParams(params) {
|
|
2572
|
+
return encodeAbiParameters(parseAbiParameters("address initialOwner, uint256 initialDelay"), [params.initialOwner, params.initialDelay]);
|
|
2573
|
+
}
|
|
2574
|
+
EncodingUtils.delayProxyAdminConstructorEncodedParams = delayProxyAdminConstructorEncodedParams;
|
|
2575
|
+
})(EncodingUtils ||= {});
|
|
396
2576
|
// src/vault/SettleData.ts
|
|
397
2577
|
class SettleData {
|
|
398
2578
|
static _CACHE = {};
|
|
@@ -430,6 +2610,35 @@ class CacheMissError extends Error {
|
|
|
430
2610
|
this.msg = msg;
|
|
431
2611
|
}
|
|
432
2612
|
}
|
|
2613
|
+
// src/proxy/DelayProxyAdmin.ts
|
|
2614
|
+
class DelayProxyAdmin {
|
|
2615
|
+
address;
|
|
2616
|
+
owner;
|
|
2617
|
+
MAX_DELAY = 2592000n;
|
|
2618
|
+
MIN_DELAY = 86400n;
|
|
2619
|
+
implementationUpdateTime;
|
|
2620
|
+
newImplementation;
|
|
2621
|
+
delayUpdateTime;
|
|
2622
|
+
newDelay;
|
|
2623
|
+
delay;
|
|
2624
|
+
constructor({
|
|
2625
|
+
address,
|
|
2626
|
+
owner,
|
|
2627
|
+
implementationUpdateTime,
|
|
2628
|
+
newImplementation,
|
|
2629
|
+
delayUpdateTime,
|
|
2630
|
+
newDelay,
|
|
2631
|
+
delay
|
|
2632
|
+
}) {
|
|
2633
|
+
this.address = address;
|
|
2634
|
+
this.owner = owner;
|
|
2635
|
+
this.implementationUpdateTime = BigInt(implementationUpdateTime);
|
|
2636
|
+
this.newImplementation = newImplementation;
|
|
2637
|
+
this.delayUpdateTime = BigInt(delayUpdateTime);
|
|
2638
|
+
this.newDelay = BigInt(newDelay);
|
|
2639
|
+
this.delay = BigInt(delay);
|
|
2640
|
+
}
|
|
2641
|
+
}
|
|
433
2642
|
// src/chain.ts
|
|
434
2643
|
var ChainId;
|
|
435
2644
|
((ChainId2) => {
|
|
@@ -452,6 +2661,9 @@ var ChainId;
|
|
|
452
2661
|
ChainId2[ChainId2["BerachainMainnet"] = 80094] = "BerachainMainnet";
|
|
453
2662
|
ChainId2[ChainId2["MantleMainnet"] = 5000] = "MantleMainnet";
|
|
454
2663
|
ChainId2[ChainId2["AvalancheMainnet"] = 43114] = "AvalancheMainnet";
|
|
2664
|
+
ChainId2[ChainId2["TacMainnet"] = 239] = "TacMainnet";
|
|
2665
|
+
ChainId2[ChainId2["KatanaMainnet"] = 747474] = "KatanaMainnet";
|
|
2666
|
+
ChainId2[ChainId2["BscMainnet"] = 64] = "BscMainnet";
|
|
455
2667
|
})(ChainId ||= {});
|
|
456
2668
|
var ChainUtils;
|
|
457
2669
|
((ChainUtils) => {
|
|
@@ -600,6 +2812,27 @@ var ChainUtils;
|
|
|
600
2812
|
nativeCurrency: { name: "Avalanche", symbol: "AVAX", decimals: 18 },
|
|
601
2813
|
explorerUrl: "https://snowtrace.io",
|
|
602
2814
|
identifier: "avalanche"
|
|
2815
|
+
},
|
|
2816
|
+
[239 /* TacMainnet */]: {
|
|
2817
|
+
name: "Tac",
|
|
2818
|
+
id: 239 /* TacMainnet */,
|
|
2819
|
+
nativeCurrency: { name: "Tac", symbol: "TAC", decimals: 18 },
|
|
2820
|
+
explorerUrl: "https://explorer.tac.build/",
|
|
2821
|
+
identifier: "tac"
|
|
2822
|
+
},
|
|
2823
|
+
[747474 /* KatanaMainnet */]: {
|
|
2824
|
+
name: "Katana",
|
|
2825
|
+
id: 747474 /* KatanaMainnet */,
|
|
2826
|
+
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
2827
|
+
explorerUrl: "https://katanascan.com/",
|
|
2828
|
+
identifier: "katana"
|
|
2829
|
+
},
|
|
2830
|
+
[64 /* BscMainnet */]: {
|
|
2831
|
+
name: "Binance Smart Chain",
|
|
2832
|
+
id: 64 /* BscMainnet */,
|
|
2833
|
+
nativeCurrency: { name: "Binance", symbol: "BNB", decimals: 18 },
|
|
2834
|
+
explorerUrl: "https://bscscan.com/",
|
|
2835
|
+
identifier: "bsc"
|
|
603
2836
|
}
|
|
604
2837
|
};
|
|
605
2838
|
})(ChainUtils ||= {});
|
|
@@ -611,7 +2844,8 @@ var addresses = {
|
|
|
611
2844
|
beaconProxyFactory: "0x09C8803f7Dc251f9FaAE5f56E3B91f8A6d0b70ee",
|
|
612
2845
|
feeRegistry: "0x6dA4D1859bA1d02D095D2246142CdAd52233e27C",
|
|
613
2846
|
v0_5_0: "0xe50554ec802375c9c3f9c087a8a7bb8c26d3dedf",
|
|
614
|
-
wrappedNative: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
|
|
2847
|
+
wrappedNative: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
|
|
2848
|
+
optinFactory: "0x8D6f5479B14348186faE9BC7E636e947c260f9B1"
|
|
615
2849
|
},
|
|
616
2850
|
[42161 /* ArbitrumMainnet */]: {
|
|
617
2851
|
beaconProxyFactory: "0x58a7729125acA9e5E9C687018E66bfDd5b2D4490",
|
|
@@ -621,49 +2855,76 @@ var addresses = {
|
|
|
621
2855
|
dev: {
|
|
622
2856
|
beaconProxyFactory: "0x29f3dba953C57814A5579e08462724B9C760333e",
|
|
623
2857
|
feeRegistry: "0x45BA44B8899D39abdc383a25bB17fcD18240c6Bc"
|
|
624
|
-
}
|
|
2858
|
+
},
|
|
2859
|
+
optinFactory: "0x9De724B0efEe0FbA07FE21a16B9Bf9bBb5204Fb4"
|
|
625
2860
|
},
|
|
626
2861
|
[8453 /* BaseMainnet */]: {
|
|
627
2862
|
beaconProxyFactory: "0xC953Fd298FdfA8Ed0D38ee73772D3e21Bf19c61b",
|
|
628
2863
|
feeRegistry: "0x6dA4D1859bA1d02D095D2246142CdAd52233e27C",
|
|
629
2864
|
v0_5_0: "0xE50554ec802375C9c3F9c087a8a7bb8C26d3DEDf",
|
|
630
|
-
wrappedNative: "0x4200000000000000000000000000000000000006"
|
|
2865
|
+
wrappedNative: "0x4200000000000000000000000000000000000006",
|
|
2866
|
+
optinFactory: "0x6FC0F2320483fa03FBFdF626DDbAE2CC4B112b51"
|
|
631
2867
|
},
|
|
632
2868
|
[130 /* UnichainMainnet */]: {
|
|
633
2869
|
beaconProxyFactory: "0xaba1A2e157Dae248f8630cA550bd826725Ff745c",
|
|
634
2870
|
feeRegistry: "0x652716FaD571f04D26a3c8fFd9E593F17123Ab20",
|
|
635
2871
|
v0_5_0: "0xE50554ec802375C9c3F9c087a8a7bb8C26d3DEDf",
|
|
636
|
-
wrappedNative: "0x4200000000000000000000000000000000000006"
|
|
2872
|
+
wrappedNative: "0x4200000000000000000000000000000000000006",
|
|
2873
|
+
optinFactory: "0x6FC0F2320483fa03FBFdF626DDbAE2CC4B112b51"
|
|
637
2874
|
},
|
|
638
2875
|
[80094 /* BerachainMainnet */]: {
|
|
639
2876
|
beaconProxyFactory: "0x7cf8cf276450bd568187fdc0b0959d30ec599853",
|
|
640
2877
|
feeRegistry: "0xaba1A2e157Dae248f8630cA550bd826725Ff745c",
|
|
641
2878
|
v0_5_0: "0xE50554ec802375C9c3F9c087a8a7bb8C26d3DEDf",
|
|
642
|
-
wrappedNative: "0x6969696969696969696969696969696969696969"
|
|
2879
|
+
wrappedNative: "0x6969696969696969696969696969696969696969",
|
|
2880
|
+
optinFactory: "0x245d1C095a0fFa6f1Af0f7Df81818DeFc9Cfc69D"
|
|
643
2881
|
},
|
|
644
2882
|
[146 /* SonicMainnet */]: {
|
|
645
2883
|
beaconProxyFactory: "0x99CD0b8b32B15922f0754Fddc21323b5278c5261",
|
|
646
2884
|
feeRegistry: "0xab4aC28D10a4Bc279aD073B1D74Bfa0E385C010C",
|
|
647
2885
|
v0_5_0: "0xE50554ec802375C9c3F9c087a8a7bb8C26d3DEDf",
|
|
648
|
-
wrappedNative: "0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38"
|
|
2886
|
+
wrappedNative: "0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38",
|
|
2887
|
+
optinFactory: "0x6FC0F2320483fa03FBFdF626DDbAE2CC4B112b51"
|
|
649
2888
|
},
|
|
650
2889
|
[5000 /* MantleMainnet */]: {
|
|
651
2890
|
beaconProxyFactory: "0x57D969B556C6AebB3Ac8f54c98CF3a3f921d5659",
|
|
652
2891
|
feeRegistry: "0x47A144e67834408716cB40Fa87fc886D63362ddC",
|
|
653
2892
|
v0_4_0: "0xA7260Cee56B679eC05a736A7b603b8DA8525Dd69",
|
|
654
|
-
wrappedNative: "0x78c1b0C915c4FAA5FffA6CAbf0219DA63d7f4cb8"
|
|
2893
|
+
wrappedNative: "0x78c1b0C915c4FAA5FffA6CAbf0219DA63d7f4cb8",
|
|
2894
|
+
optinFactory: "0xc094c224ce0406bc338e00837b96ad2e265f7287"
|
|
655
2895
|
},
|
|
656
2896
|
[480 /* WorldChainMainnet */]: {
|
|
657
2897
|
beaconProxyFactory: "0x600fA26581771F56221FC9847A834B3E5fd34AF7",
|
|
658
2898
|
feeRegistry: "0x68e793658def657551fd4D3cA6Bc04b4E7723655",
|
|
659
2899
|
v0_5_0: "0x1D42DbDde553F4099691A25F712bbd8f2686E355 ",
|
|
660
|
-
wrappedNative: "0x4200000000000000000000000000000000000006"
|
|
2900
|
+
wrappedNative: "0x4200000000000000000000000000000000000006",
|
|
2901
|
+
optinFactory: "0xC094C224ce0406BC338E00837B96aD2e265F7287"
|
|
661
2902
|
},
|
|
662
2903
|
[43114 /* AvalancheMainnet */]: {
|
|
663
2904
|
beaconProxyFactory: "0x5e231c6d030a5c0f51fa7d0f891d3f50a928c685",
|
|
664
2905
|
feeRegistry: "0xD7F69ba99c6981Eab5579Aa16871Ae94c509d578",
|
|
665
2906
|
v0_5_0: "0x33F65C8D025b5418C7f8dd248C2Ec1d31881D465",
|
|
666
|
-
wrappedNative: "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7"
|
|
2907
|
+
wrappedNative: "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",
|
|
2908
|
+
optinFactory: "0xC094C224ce0406BC338E00837B96aD2e265F7287"
|
|
2909
|
+
},
|
|
2910
|
+
[239 /* TacMainnet */]: {
|
|
2911
|
+
feeRegistry: "0x3408C51BFc34CBF7112a20Fb3F4Bc9b74aed7982",
|
|
2912
|
+
v0_5_0: "0x11652Aead69716E1D5D132F3bf0848D2fD422b8a",
|
|
2913
|
+
wrappedNative: "0xB63B9f0eb4A6E6f191529D71d4D88cc8900Df2C9",
|
|
2914
|
+
optinFactory: "0x66Ab87A9282dF99E38C148114F815a9C073ECA8D"
|
|
2915
|
+
},
|
|
2916
|
+
[747474 /* KatanaMainnet */]: {
|
|
2917
|
+
beaconProxyFactory: "0x37f4b3f0102fdc1ff0c7ef644751052fb276dc6e",
|
|
2918
|
+
feeRegistry: "0xC0Ef4c34A118a1bEc0912B8Ba8C6424F871A1628",
|
|
2919
|
+
v0_5_0: "0x7fe0c16eAa18562f1E37E6f6B205fDA70164e2fb",
|
|
2920
|
+
wrappedNative: "0x4200000000000000000000000000000000000006",
|
|
2921
|
+
optinFactory: "0xC094C224ce0406BC338E00837B96aD2e265F7287"
|
|
2922
|
+
},
|
|
2923
|
+
[64 /* BscMainnet */]: {
|
|
2924
|
+
feeRegistry: "0x9c275714Fb882988FbbFfdc39a162E0cc9feA64c",
|
|
2925
|
+
v0_5_0: "0x7175E7E5C246e2E5c8C54Ede2ee0180e39fcA879",
|
|
2926
|
+
wrappedNative: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",
|
|
2927
|
+
optinFactory: "0x3f680aB9E51EEED9381dE5275f4995611Ff884d5"
|
|
667
2928
|
}
|
|
668
2929
|
};
|
|
669
2930
|
// src/utils.ts
|