@mortiseagentvault/sdk 0.0.0-stage → 0.1.1

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/index.js ADDED
@@ -0,0 +1,4272 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropNames = Object.getOwnPropertyNames;
3
+ var __esm = (fn, res, err) => function __init() {
4
+ if (err) throw err[0];
5
+ try {
6
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
7
+ } catch (e) {
8
+ throw err = [e], e;
9
+ }
10
+ };
11
+ var __export = (target, all) => {
12
+ for (var name in all)
13
+ __defProp(target, name, { get: all[name], enumerable: true });
14
+ };
15
+
16
+ // ../node_modules/abitype/dist/esm/regex.js
17
+ function execTyped(regex, string) {
18
+ const match = regex.exec(string);
19
+ return match?.groups;
20
+ }
21
+ var init_regex = __esm({
22
+ "../node_modules/abitype/dist/esm/regex.js"() {
23
+ }
24
+ });
25
+
26
+ // ../node_modules/abitype/dist/esm/human-readable/formatAbiParameter.js
27
+ function formatAbiParameter(abiParameter) {
28
+ let type = abiParameter.type;
29
+ if (tupleRegex.test(abiParameter.type) && "components" in abiParameter) {
30
+ type = "(";
31
+ const length = abiParameter.components.length;
32
+ for (let i = 0; i < length; i++) {
33
+ const component = abiParameter.components[i];
34
+ type += formatAbiParameter(component);
35
+ if (i < length - 1)
36
+ type += ", ";
37
+ }
38
+ const result = execTyped(tupleRegex, abiParameter.type);
39
+ type += `)${result?.array || ""}`;
40
+ return formatAbiParameter({
41
+ ...abiParameter,
42
+ type
43
+ });
44
+ }
45
+ if ("indexed" in abiParameter && abiParameter.indexed)
46
+ type = `${type} indexed`;
47
+ if (abiParameter.name)
48
+ return `${type} ${abiParameter.name}`;
49
+ return type;
50
+ }
51
+ var tupleRegex;
52
+ var init_formatAbiParameter = __esm({
53
+ "../node_modules/abitype/dist/esm/human-readable/formatAbiParameter.js"() {
54
+ init_regex();
55
+ tupleRegex = /^tuple(?<array>(\[(\d*)\])*)$/;
56
+ }
57
+ });
58
+
59
+ // ../node_modules/abitype/dist/esm/human-readable/formatAbiParameters.js
60
+ function formatAbiParameters(abiParameters) {
61
+ let params = "";
62
+ const length = abiParameters.length;
63
+ for (let i = 0; i < length; i++) {
64
+ const abiParameter = abiParameters[i];
65
+ params += formatAbiParameter(abiParameter);
66
+ if (i !== length - 1)
67
+ params += ", ";
68
+ }
69
+ return params;
70
+ }
71
+ var init_formatAbiParameters = __esm({
72
+ "../node_modules/abitype/dist/esm/human-readable/formatAbiParameters.js"() {
73
+ init_formatAbiParameter();
74
+ }
75
+ });
76
+
77
+ // ../node_modules/abitype/dist/esm/human-readable/formatAbiItem.js
78
+ function formatAbiItem(abiItem) {
79
+ if (abiItem.type === "function")
80
+ return `function ${abiItem.name}(${formatAbiParameters(abiItem.inputs)})${abiItem.stateMutability && abiItem.stateMutability !== "nonpayable" ? ` ${abiItem.stateMutability}` : ""}${abiItem.outputs?.length ? ` returns (${formatAbiParameters(abiItem.outputs)})` : ""}`;
81
+ if (abiItem.type === "event")
82
+ return `event ${abiItem.name}(${formatAbiParameters(abiItem.inputs)})`;
83
+ if (abiItem.type === "error")
84
+ return `error ${abiItem.name}(${formatAbiParameters(abiItem.inputs)})`;
85
+ if (abiItem.type === "constructor")
86
+ return `constructor(${formatAbiParameters(abiItem.inputs)})${abiItem.stateMutability === "payable" ? " payable" : ""}`;
87
+ if (abiItem.type === "fallback")
88
+ return `fallback() external${abiItem.stateMutability === "payable" ? " payable" : ""}`;
89
+ return "receive() external payable";
90
+ }
91
+ var init_formatAbiItem = __esm({
92
+ "../node_modules/abitype/dist/esm/human-readable/formatAbiItem.js"() {
93
+ init_formatAbiParameters();
94
+ }
95
+ });
96
+
97
+ // ../node_modules/abitype/dist/esm/exports/index.js
98
+ var init_exports = __esm({
99
+ "../node_modules/abitype/dist/esm/exports/index.js"() {
100
+ init_formatAbiItem();
101
+ }
102
+ });
103
+
104
+ // ../node_modules/viem/_esm/utils/abi/formatAbiItem.js
105
+ function formatAbiItem2(abiItem, { includeName = false } = {}) {
106
+ if (abiItem.type !== "function" && abiItem.type !== "event" && abiItem.type !== "error")
107
+ throw new InvalidDefinitionTypeError(abiItem.type);
108
+ return `${abiItem.name}(${formatAbiParams(abiItem.inputs, { includeName })})`;
109
+ }
110
+ function formatAbiParams(params, { includeName = false } = {}) {
111
+ if (!params)
112
+ return "";
113
+ return params.map((param) => formatAbiParam(param, { includeName })).join(includeName ? ", " : ",");
114
+ }
115
+ function formatAbiParam(param, { includeName }) {
116
+ if (param.type.startsWith("tuple")) {
117
+ return `(${formatAbiParams(param.components, { includeName })})${param.type.slice("tuple".length)}`;
118
+ }
119
+ return param.type + (includeName && param.name ? ` ${param.name}` : "");
120
+ }
121
+ var init_formatAbiItem2 = __esm({
122
+ "../node_modules/viem/_esm/utils/abi/formatAbiItem.js"() {
123
+ init_abi();
124
+ }
125
+ });
126
+
127
+ // ../node_modules/viem/_esm/utils/data/size.js
128
+ function size(value) {
129
+ if (typeof value === "string" && value.startsWith("0x"))
130
+ return Math.ceil((value.length - 2) / 2);
131
+ return value.length;
132
+ }
133
+ var init_size = __esm({
134
+ "../node_modules/viem/_esm/utils/data/size.js"() {
135
+ }
136
+ });
137
+
138
+ // ../node_modules/viem/_esm/errors/version.js
139
+ var version;
140
+ var init_version = __esm({
141
+ "../node_modules/viem/_esm/errors/version.js"() {
142
+ version = "2.58.8";
143
+ }
144
+ });
145
+
146
+ // ../node_modules/viem/_esm/errors/base.js
147
+ function walk(err, fn) {
148
+ if (fn?.(err))
149
+ return err;
150
+ if (err && typeof err === "object" && "cause" in err && err.cause !== void 0)
151
+ return walk(err.cause, fn);
152
+ return fn ? null : err;
153
+ }
154
+ var errorConfig, BaseError;
155
+ var init_base = __esm({
156
+ "../node_modules/viem/_esm/errors/base.js"() {
157
+ init_version();
158
+ errorConfig = {
159
+ getDocsUrl: ({ docsBaseUrl, docsPath: docsPath3 = "", docsSlug }) => docsPath3 ? `${docsBaseUrl ?? "https://viem.sh"}${docsPath3}${docsSlug ? `#${docsSlug}` : ""}` : void 0,
160
+ version: `viem@${version}`
161
+ };
162
+ BaseError = class _BaseError extends Error {
163
+ details;
164
+ docsPath;
165
+ metaMessages;
166
+ shortMessage;
167
+ version;
168
+ name = "BaseError";
169
+ constructor(shortMessage, args = {}) {
170
+ const details = (() => {
171
+ if (args.cause instanceof _BaseError)
172
+ return args.cause.details;
173
+ if (args.cause?.message)
174
+ return args.cause.message;
175
+ return args.details;
176
+ })();
177
+ const docsPath3 = (() => {
178
+ if (args.cause instanceof _BaseError)
179
+ return args.cause.docsPath || args.docsPath;
180
+ return args.docsPath;
181
+ })();
182
+ const docsUrl = errorConfig.getDocsUrl?.({ ...args, docsPath: docsPath3 });
183
+ const message = [
184
+ shortMessage || "An error occurred.",
185
+ "",
186
+ ...args.metaMessages ? [...args.metaMessages, ""] : [],
187
+ ...docsUrl ? [`Docs: ${docsUrl}`] : [],
188
+ ...details ? [`Details: ${details}`] : [],
189
+ ...errorConfig.version ? [`Version: ${errorConfig.version}`] : []
190
+ ].join("\n");
191
+ super(message, args.cause ? { cause: args.cause } : void 0);
192
+ this.details = details;
193
+ this.docsPath = docsPath3;
194
+ this.metaMessages = args.metaMessages;
195
+ this.name = args.name ?? this.name;
196
+ this.shortMessage = shortMessage;
197
+ this.version = version;
198
+ }
199
+ walk(fn) {
200
+ return walk(this, fn);
201
+ }
202
+ };
203
+ }
204
+ });
205
+
206
+ // ../node_modules/viem/_esm/errors/abi.js
207
+ var AbiDecodingDataSizeTooSmallError, AbiDecodingZeroDataError, AbiEncodingArrayLengthMismatchError, AbiEncodingBytesSizeMismatchError, AbiEncodingLengthMismatchError, AbiErrorSignatureNotFoundError, AbiEventSignatureEmptyTopicsError, AbiEventSignatureNotFoundError, AbiFunctionNotFoundError, AbiFunctionSignatureNotFoundError, AbiItemAmbiguityError, DecodeLogDataMismatch, DecodeLogTopicsMismatch, InvalidAbiEncodingTypeError, InvalidAbiDecodingTypeError, InvalidArrayError, InvalidDefinitionTypeError;
208
+ var init_abi = __esm({
209
+ "../node_modules/viem/_esm/errors/abi.js"() {
210
+ init_formatAbiItem2();
211
+ init_size();
212
+ init_base();
213
+ AbiDecodingDataSizeTooSmallError = class extends BaseError {
214
+ data;
215
+ params;
216
+ size;
217
+ constructor({ data, params, size: size2 }) {
218
+ super([`Data size of ${size2} bytes is too small for given parameters.`].join("\n"), {
219
+ metaMessages: [
220
+ `Params: (${formatAbiParams(params, { includeName: true })})`,
221
+ `Data: ${data} (${size2} bytes)`
222
+ ],
223
+ name: "AbiDecodingDataSizeTooSmallError"
224
+ });
225
+ this.data = data;
226
+ this.params = params;
227
+ this.size = size2;
228
+ }
229
+ };
230
+ AbiDecodingZeroDataError = class extends BaseError {
231
+ constructor({ cause } = {}) {
232
+ super('Cannot decode zero data ("0x") with ABI parameters.', {
233
+ name: "AbiDecodingZeroDataError",
234
+ cause
235
+ });
236
+ }
237
+ };
238
+ AbiEncodingArrayLengthMismatchError = class extends BaseError {
239
+ constructor({ expectedLength, givenLength, type }) {
240
+ super([
241
+ `ABI encoding array length mismatch for type ${type}.`,
242
+ `Expected length: ${expectedLength}`,
243
+ `Given length: ${givenLength}`
244
+ ].join("\n"), { name: "AbiEncodingArrayLengthMismatchError" });
245
+ }
246
+ };
247
+ AbiEncodingBytesSizeMismatchError = class extends BaseError {
248
+ constructor({ expectedSize, value }) {
249
+ super(`Size of bytes "${value}" (bytes${size(value)}) does not match expected size (bytes${expectedSize}).`, { name: "AbiEncodingBytesSizeMismatchError" });
250
+ }
251
+ };
252
+ AbiEncodingLengthMismatchError = class extends BaseError {
253
+ constructor({ expectedLength, givenLength }) {
254
+ super([
255
+ "ABI encoding params/values length mismatch.",
256
+ `Expected length (params): ${expectedLength}`,
257
+ `Given length (values): ${givenLength}`
258
+ ].join("\n"), { name: "AbiEncodingLengthMismatchError" });
259
+ }
260
+ };
261
+ AbiErrorSignatureNotFoundError = class extends BaseError {
262
+ signature;
263
+ constructor(signature, { docsPath: docsPath3, cause }) {
264
+ super([
265
+ `Encoded error signature "${signature}" not found on ABI.`,
266
+ "Make sure you are using the correct ABI and that the error exists on it.",
267
+ `You can look up the decoded signature here: https://4byte.sourcify.dev/?q=${signature}.`
268
+ ].join("\n"), {
269
+ docsPath: docsPath3,
270
+ name: "AbiErrorSignatureNotFoundError",
271
+ cause
272
+ });
273
+ this.signature = signature;
274
+ }
275
+ };
276
+ AbiEventSignatureEmptyTopicsError = class extends BaseError {
277
+ constructor({ docsPath: docsPath3 }) {
278
+ super("Cannot extract event signature from empty topics.", {
279
+ docsPath: docsPath3,
280
+ name: "AbiEventSignatureEmptyTopicsError"
281
+ });
282
+ }
283
+ };
284
+ AbiEventSignatureNotFoundError = class extends BaseError {
285
+ constructor(signature, { docsPath: docsPath3 }) {
286
+ super([
287
+ `Encoded event signature "${signature}" not found on ABI.`,
288
+ "Make sure you are using the correct ABI and that the event exists on it.",
289
+ `You can look up the signature here: https://4byte.sourcify.dev/?q=${signature}.`
290
+ ].join("\n"), {
291
+ docsPath: docsPath3,
292
+ name: "AbiEventSignatureNotFoundError"
293
+ });
294
+ }
295
+ };
296
+ AbiFunctionNotFoundError = class extends BaseError {
297
+ constructor(functionName, { docsPath: docsPath3 } = {}) {
298
+ super([
299
+ `Function ${functionName ? `"${functionName}" ` : ""}not found on ABI.`,
300
+ "Make sure you are using the correct ABI and that the function exists on it."
301
+ ].join("\n"), {
302
+ docsPath: docsPath3,
303
+ name: "AbiFunctionNotFoundError"
304
+ });
305
+ }
306
+ };
307
+ AbiFunctionSignatureNotFoundError = class extends BaseError {
308
+ constructor(signature, { docsPath: docsPath3 }) {
309
+ super([
310
+ `Encoded function signature "${signature}" not found on ABI.`,
311
+ "Make sure you are using the correct ABI and that the function exists on it.",
312
+ `You can look up the signature here: https://4byte.sourcify.dev/?q=${signature}.`
313
+ ].join("\n"), {
314
+ docsPath: docsPath3,
315
+ name: "AbiFunctionSignatureNotFoundError"
316
+ });
317
+ }
318
+ };
319
+ AbiItemAmbiguityError = class extends BaseError {
320
+ constructor(x, y) {
321
+ super("Found ambiguous types in overloaded ABI items.", {
322
+ metaMessages: [
323
+ `\`${x.type}\` in \`${formatAbiItem2(x.abiItem)}\`, and`,
324
+ `\`${y.type}\` in \`${formatAbiItem2(y.abiItem)}\``,
325
+ "",
326
+ "These types encode differently and cannot be distinguished at runtime.",
327
+ "Remove one of the ambiguous items in the ABI."
328
+ ],
329
+ name: "AbiItemAmbiguityError"
330
+ });
331
+ }
332
+ };
333
+ DecodeLogDataMismatch = class extends BaseError {
334
+ abiItem;
335
+ data;
336
+ params;
337
+ size;
338
+ constructor({ abiItem, data, params, size: size2 }) {
339
+ super([
340
+ `Data size of ${size2} bytes is too small for non-indexed event parameters.`
341
+ ].join("\n"), {
342
+ metaMessages: [
343
+ `Params: (${formatAbiParams(params, { includeName: true })})`,
344
+ `Data: ${data} (${size2} bytes)`
345
+ ],
346
+ name: "DecodeLogDataMismatch"
347
+ });
348
+ this.abiItem = abiItem;
349
+ this.data = data;
350
+ this.params = params;
351
+ this.size = size2;
352
+ }
353
+ };
354
+ DecodeLogTopicsMismatch = class extends BaseError {
355
+ abiItem;
356
+ constructor({ abiItem, param }) {
357
+ super([
358
+ `Expected a topic for indexed event parameter${param.name ? ` "${param.name}"` : ""} on event "${formatAbiItem2(abiItem, { includeName: true })}".`
359
+ ].join("\n"), { name: "DecodeLogTopicsMismatch" });
360
+ this.abiItem = abiItem;
361
+ }
362
+ };
363
+ InvalidAbiEncodingTypeError = class extends BaseError {
364
+ constructor(type, { docsPath: docsPath3 }) {
365
+ super([
366
+ `Type "${type}" is not a valid encoding type.`,
367
+ "Please provide a valid ABI type."
368
+ ].join("\n"), { docsPath: docsPath3, name: "InvalidAbiEncodingTypeError" });
369
+ }
370
+ };
371
+ InvalidAbiDecodingTypeError = class extends BaseError {
372
+ constructor(type, { docsPath: docsPath3 }) {
373
+ super([
374
+ `Type "${type}" is not a valid decoding type.`,
375
+ "Please provide a valid ABI type."
376
+ ].join("\n"), { docsPath: docsPath3, name: "InvalidAbiDecodingTypeError" });
377
+ }
378
+ };
379
+ InvalidArrayError = class extends BaseError {
380
+ constructor(value) {
381
+ super([`Value "${value}" is not a valid array.`].join("\n"), {
382
+ name: "InvalidArrayError"
383
+ });
384
+ }
385
+ };
386
+ InvalidDefinitionTypeError = class extends BaseError {
387
+ constructor(type) {
388
+ super([
389
+ `"${type}" is not a valid definition type.`,
390
+ 'Valid types: "function", "event", "error"'
391
+ ].join("\n"), { name: "InvalidDefinitionTypeError" });
392
+ }
393
+ };
394
+ }
395
+ });
396
+
397
+ // ../node_modules/viem/_esm/utils/data/isHex.js
398
+ function isHex(value, { even = false, strict = true } = {}) {
399
+ if (!value)
400
+ return false;
401
+ if (typeof value !== "string")
402
+ return false;
403
+ if (even && value.length % 2 !== 0)
404
+ return false;
405
+ return strict ? /^0x[0-9a-fA-F]*$/.test(value) : value.startsWith("0x");
406
+ }
407
+ var init_isHex = __esm({
408
+ "../node_modules/viem/_esm/utils/data/isHex.js"() {
409
+ }
410
+ });
411
+
412
+ // ../node_modules/viem/_esm/errors/data.js
413
+ var SliceOffsetOutOfBoundsError, SizeExceedsPaddingSizeError;
414
+ var init_data = __esm({
415
+ "../node_modules/viem/_esm/errors/data.js"() {
416
+ init_base();
417
+ SliceOffsetOutOfBoundsError = class extends BaseError {
418
+ constructor({ offset, position, size: size2 }) {
419
+ super(`Slice ${position === "start" ? "starting" : "ending"} at offset "${offset}" is out-of-bounds (size: ${size2}).`, { name: "SliceOffsetOutOfBoundsError" });
420
+ }
421
+ };
422
+ SizeExceedsPaddingSizeError = class extends BaseError {
423
+ constructor({ size: size2, targetSize, type }) {
424
+ super(`${type.charAt(0).toUpperCase()}${type.slice(1).toLowerCase()} size (${size2}) exceeds padding size (${targetSize}).`, { name: "SizeExceedsPaddingSizeError" });
425
+ }
426
+ };
427
+ }
428
+ });
429
+
430
+ // ../node_modules/viem/_esm/utils/data/pad.js
431
+ function pad(hexOrBytes, { dir, size: size2 = 32 } = {}) {
432
+ if (typeof hexOrBytes === "string")
433
+ return padHex(hexOrBytes, { dir, size: size2 });
434
+ return padBytes(hexOrBytes, { dir, size: size2 });
435
+ }
436
+ function padHex(hex_, { dir, size: size2 = 32 } = {}) {
437
+ if (size2 === null)
438
+ return hex_;
439
+ const hex = hex_.startsWith("0x") ? hex_.slice(2) : hex_.replace("0x", "");
440
+ if (hex.length > size2 * 2)
441
+ throw new SizeExceedsPaddingSizeError({
442
+ size: Math.ceil(hex.length / 2),
443
+ targetSize: size2,
444
+ type: "hex"
445
+ });
446
+ return `0x${hex[dir === "right" ? "padEnd" : "padStart"](size2 * 2, "0")}`;
447
+ }
448
+ function padBytes(bytes, { dir, size: size2 = 32 } = {}) {
449
+ if (size2 === null)
450
+ return bytes;
451
+ if (bytes.length > size2)
452
+ throw new SizeExceedsPaddingSizeError({
453
+ size: bytes.length,
454
+ targetSize: size2,
455
+ type: "bytes"
456
+ });
457
+ const paddedBytes = new Uint8Array(size2);
458
+ if (Number.isSafeInteger(size2)) {
459
+ if (bytes.length > 0)
460
+ paddedBytes.set(bytes, dir === "right" ? 0 : size2 - bytes.length);
461
+ return paddedBytes;
462
+ }
463
+ for (let i = 0; i < size2; i++) {
464
+ const padEnd = dir === "right";
465
+ paddedBytes[padEnd ? i : size2 - i - 1] = bytes[padEnd ? i : bytes.length - i - 1];
466
+ }
467
+ return paddedBytes;
468
+ }
469
+ var init_pad = __esm({
470
+ "../node_modules/viem/_esm/utils/data/pad.js"() {
471
+ init_data();
472
+ }
473
+ });
474
+
475
+ // ../node_modules/viem/_esm/errors/encoding.js
476
+ var IntegerOutOfRangeError, InvalidBytesBooleanError, SizeOverflowError;
477
+ var init_encoding = __esm({
478
+ "../node_modules/viem/_esm/errors/encoding.js"() {
479
+ init_base();
480
+ IntegerOutOfRangeError = class extends BaseError {
481
+ constructor({ max, min, signed, size: size2, value }) {
482
+ super(`Number "${value}" is not in safe ${size2 ? `${size2 * 8}-bit ${signed ? "signed" : "unsigned"} ` : ""}integer range ${max ? `(${min} to ${max})` : `(above ${min})`}`, { name: "IntegerOutOfRangeError" });
483
+ }
484
+ };
485
+ InvalidBytesBooleanError = class extends BaseError {
486
+ constructor(bytes) {
487
+ super(`Bytes value "${bytes}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`, {
488
+ name: "InvalidBytesBooleanError"
489
+ });
490
+ }
491
+ };
492
+ SizeOverflowError = class extends BaseError {
493
+ constructor({ givenSize, maxSize }) {
494
+ super(`Size cannot exceed ${maxSize} bytes. Given size: ${givenSize} bytes.`, { name: "SizeOverflowError" });
495
+ }
496
+ };
497
+ }
498
+ });
499
+
500
+ // ../node_modules/viem/_esm/utils/data/trim.js
501
+ function trim(hexOrBytes, { dir = "left" } = {}) {
502
+ if (typeof hexOrBytes === "string") {
503
+ let data2 = hexOrBytes.startsWith("0x") ? hexOrBytes.slice(2) : hexOrBytes.replace("0x", "");
504
+ let count2 = 0;
505
+ if (dir === "left") {
506
+ while (count2 < data2.length - 1 && data2.charCodeAt(count2) === 48)
507
+ count2++;
508
+ data2 = data2.slice(count2);
509
+ } else {
510
+ while (count2 < data2.length - 2 && data2.charCodeAt(data2.length - count2 - 1) === 48 && data2.charCodeAt(data2.length - count2 - 2) === 48)
511
+ count2 += 2;
512
+ data2 = data2.slice(0, data2.length - count2);
513
+ }
514
+ if (data2.length === 1 && dir === "right")
515
+ data2 = `${data2}0`;
516
+ return `0x${data2.length % 2 === 1 ? `0${data2}` : data2}`;
517
+ }
518
+ const data = hexOrBytes;
519
+ let count = 0;
520
+ if (dir === "left") {
521
+ while (count < data.length - 1 && data[count] === 0)
522
+ count++;
523
+ return data.slice(count);
524
+ }
525
+ while (count < data.length - 1 && data[data.length - count - 1] === 0)
526
+ count++;
527
+ return data.slice(0, data.length - count);
528
+ }
529
+ var init_trim = __esm({
530
+ "../node_modules/viem/_esm/utils/data/trim.js"() {
531
+ }
532
+ });
533
+
534
+ // ../node_modules/viem/_esm/utils/encoding/fromHex.js
535
+ function assertSize(hexOrBytes, { size: size2 }) {
536
+ if (size(hexOrBytes) > size2)
537
+ throw new SizeOverflowError({
538
+ givenSize: size(hexOrBytes),
539
+ maxSize: size2
540
+ });
541
+ }
542
+ function hexToBigInt(hex, opts = {}) {
543
+ const { signed } = opts;
544
+ if (opts.size)
545
+ assertSize(hex, { size: opts.size });
546
+ const value = BigInt(hex);
547
+ if (!signed)
548
+ return value;
549
+ const size2 = Math.ceil((hex.length - 2) / 2);
550
+ const max = (1n << BigInt(size2) * 8n - 1n) - 1n;
551
+ if (value <= max)
552
+ return value;
553
+ if (typeof hex === "string" && hex.startsWith("0x"))
554
+ return BigInt.asIntN(size2 * 8, value);
555
+ return value - BigInt(`0x${"f".padStart(size2 * 2, "f")}`) - 1n;
556
+ }
557
+ function hexToNumber(hex, opts = {}) {
558
+ const { signed, size: size2 } = opts;
559
+ if (!signed && !size2 && typeof hex === "string" && hex.startsWith("0x")) {
560
+ const number2 = Number(hex);
561
+ if (Number.isSafeInteger(number2))
562
+ return number2;
563
+ }
564
+ const value = hexToBigInt(hex, opts);
565
+ const number = Number(value);
566
+ if (!Number.isSafeInteger(number))
567
+ throw new IntegerOutOfRangeError({
568
+ max: `${Number.MAX_SAFE_INTEGER}`,
569
+ min: `${Number.MIN_SAFE_INTEGER}`,
570
+ signed,
571
+ size: size2,
572
+ value: `${value}n`
573
+ });
574
+ return number;
575
+ }
576
+ var init_fromHex = __esm({
577
+ "../node_modules/viem/_esm/utils/encoding/fromHex.js"() {
578
+ init_encoding();
579
+ init_size();
580
+ }
581
+ });
582
+
583
+ // ../node_modules/viem/_esm/utils/encoding/toHex.js
584
+ function toHex(value, opts = {}) {
585
+ if (typeof value === "number" || typeof value === "bigint")
586
+ return numberToHex(value, opts);
587
+ if (typeof value === "string") {
588
+ return stringToHex(value, opts);
589
+ }
590
+ if (typeof value === "boolean")
591
+ return boolToHex(value, opts);
592
+ return bytesToHex(value, opts);
593
+ }
594
+ function boolToHex(value, opts = {}) {
595
+ const hex = `0x${Number(value)}`;
596
+ if (typeof opts.size === "number") {
597
+ assertSize(hex, { size: opts.size });
598
+ return pad(hex, { size: opts.size });
599
+ }
600
+ return hex;
601
+ }
602
+ function bytesToHex(value, opts = {}) {
603
+ let string = "";
604
+ if (nativeToHex && value instanceof Uint8Array && value.length > 0)
605
+ string = nativeToHex.call(value);
606
+ else
607
+ for (let i = 0; i < value.length; i++) {
608
+ string += hexes[value[i]];
609
+ }
610
+ const hex = `0x${string}`;
611
+ if (typeof opts.size === "number") {
612
+ assertSize(hex, { size: opts.size });
613
+ return pad(hex, { dir: "right", size: opts.size });
614
+ }
615
+ return hex;
616
+ }
617
+ function numberToHex(value_, opts = {}) {
618
+ const { signed, size: size2 } = opts;
619
+ if (!signed && (typeof value_ === "bigint" ? value_ >= 0n : Number.isSafeInteger(value_) && value_ >= 0)) {
620
+ const hex2 = value_.toString(16);
621
+ if (!size2)
622
+ return `0x${hex2}`;
623
+ if (Number.isSafeInteger(size2) && size2 > 0 && hex2.length <= size2 * 2)
624
+ return `0x${hex2.padStart(size2 * 2, "0")}`;
625
+ }
626
+ const value = BigInt(value_);
627
+ let maxValue;
628
+ if (size2) {
629
+ if (signed)
630
+ maxValue = (1n << BigInt(size2) * 8n - 1n) - 1n;
631
+ else
632
+ maxValue = 2n ** (BigInt(size2) * 8n) - 1n;
633
+ } else if (typeof value_ === "number") {
634
+ maxValue = BigInt(Number.MAX_SAFE_INTEGER);
635
+ }
636
+ const minValue = typeof maxValue === "bigint" && signed ? -maxValue - 1n : 0;
637
+ if (maxValue && value > maxValue || value < minValue) {
638
+ const suffix = typeof value_ === "bigint" ? "n" : "";
639
+ throw new IntegerOutOfRangeError({
640
+ max: maxValue ? `${maxValue}${suffix}` : void 0,
641
+ min: `${minValue}${suffix}`,
642
+ signed,
643
+ size: size2,
644
+ value: `${value_}${suffix}`
645
+ });
646
+ }
647
+ const hex = `0x${(signed && value < 0 ? (1n << BigInt(size2 * 8)) + BigInt(value) : value).toString(16)}`;
648
+ if (size2)
649
+ return pad(hex, { size: size2 });
650
+ return hex;
651
+ }
652
+ function stringToHex(value_, opts = {}) {
653
+ return bytesToHex(stringToBytes(value_), opts);
654
+ }
655
+ var hexes, nativeToHex;
656
+ var init_toHex = __esm({
657
+ "../node_modules/viem/_esm/utils/encoding/toHex.js"() {
658
+ init_encoding();
659
+ init_pad();
660
+ init_fromHex();
661
+ init_toBytes();
662
+ hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_v, i) => i.toString(16).padStart(2, "0"));
663
+ nativeToHex = /* @__PURE__ */ (() => Uint8Array.prototype.toHex)();
664
+ }
665
+ });
666
+
667
+ // ../node_modules/viem/_esm/utils/encoding/toBytes.js
668
+ function toBytes(value, opts = {}) {
669
+ if (typeof value === "number" || typeof value === "bigint")
670
+ return numberToBytes(value, opts);
671
+ if (typeof value === "boolean")
672
+ return boolToBytes(value, opts);
673
+ if (!opts.size && typeof value === "string" && value.startsWith("0x")) {
674
+ const bytes = decodeHex(value);
675
+ if (bytes)
676
+ return bytes;
677
+ }
678
+ if (isHex(value))
679
+ return hexToBytes(value, opts);
680
+ return stringToBytes(value, opts);
681
+ }
682
+ function boolToBytes(value, opts = {}) {
683
+ const bytes = new Uint8Array(1);
684
+ bytes[0] = Number(value);
685
+ if (typeof opts.size === "number") {
686
+ assertSize(bytes, { size: opts.size });
687
+ return pad(bytes, { size: opts.size });
688
+ }
689
+ return bytes;
690
+ }
691
+ function decodeHex(hex, size2) {
692
+ const odd = hex.length & 1;
693
+ const length = hex.length - 1 >> 1;
694
+ const bytes = new Uint8Array(size2 || length);
695
+ let i = 0;
696
+ let j = 2;
697
+ if (odd) {
698
+ const code = hex.charCodeAt(j++);
699
+ const nibble = code < 128 ? nibbles[code] : -1;
700
+ if (nibble < 0)
701
+ return void 0;
702
+ bytes[i++] = nibble;
703
+ }
704
+ for (; i < length; i++) {
705
+ const a = hex.charCodeAt(j++);
706
+ const b = hex.charCodeAt(j++);
707
+ const high = a < 128 ? nibbles[a] : -1;
708
+ const low = b < 128 ? nibbles[b] : -1;
709
+ if ((high | low) < 0)
710
+ return void 0;
711
+ bytes[i] = high << 4 | low;
712
+ }
713
+ return bytes;
714
+ }
715
+ function charCodeToBase16(char) {
716
+ if (char >= charCodeMap.zero && char <= charCodeMap.nine)
717
+ return char - charCodeMap.zero;
718
+ if (char >= charCodeMap.A && char <= charCodeMap.F)
719
+ return char - (charCodeMap.A - 10);
720
+ if (char >= charCodeMap.a && char <= charCodeMap.f)
721
+ return char - (charCodeMap.a - 10);
722
+ return void 0;
723
+ }
724
+ function hexToBytes(hex, opts = {}) {
725
+ const size2 = opts.size;
726
+ if (typeof hex === "string" && hex.length >= 2 && (!size2 || Number.isSafeInteger(size2) && size2 > 0)) {
727
+ if (size2)
728
+ assertSize(hex, { size: size2 });
729
+ const bytes2 = decodeHex(hex, size2);
730
+ if (bytes2)
731
+ return bytes2;
732
+ }
733
+ let hexString = hex.slice(2);
734
+ if (hexString.length % 2)
735
+ hexString = `0${hexString}`;
736
+ if (opts.size) {
737
+ assertSize(hex, { size: opts.size });
738
+ hexString = hexString.padEnd(opts.size * 2, "0");
739
+ }
740
+ const length = hexString.length / 2;
741
+ const bytes = new Uint8Array(length);
742
+ for (let index = 0, j = 0; index < length; index++) {
743
+ const nibbleLeft = charCodeToBase16(hexString.charCodeAt(j++));
744
+ const nibbleRight = charCodeToBase16(hexString.charCodeAt(j++));
745
+ if (nibbleLeft === void 0 || nibbleRight === void 0) {
746
+ throw new BaseError(`Invalid byte sequence ("${hexString[j - 2]}${hexString[j - 1]}" in "${hexString}").`);
747
+ }
748
+ bytes[index] = nibbleLeft * 16 + nibbleRight;
749
+ }
750
+ return bytes;
751
+ }
752
+ function numberToBytes(value, opts) {
753
+ const hex = numberToHex(value, opts);
754
+ return hexToBytes(hex);
755
+ }
756
+ function stringToBytes(value, opts = {}) {
757
+ const bytes = (() => {
758
+ if (typeof value === "string" && value.length <= 64) {
759
+ const bytes2 = new Uint8Array(value.length);
760
+ let i = 0;
761
+ for (; i < value.length; i++) {
762
+ const code = value.charCodeAt(i);
763
+ if (code > 127)
764
+ break;
765
+ bytes2[i] = code;
766
+ }
767
+ if (i === value.length)
768
+ return bytes2;
769
+ }
770
+ return encoder.encode(value);
771
+ })();
772
+ if (typeof opts.size === "number") {
773
+ assertSize(bytes, { size: opts.size });
774
+ return pad(bytes, { dir: "right", size: opts.size });
775
+ }
776
+ return bytes;
777
+ }
778
+ var encoder, nibbles, charCodeMap;
779
+ var init_toBytes = __esm({
780
+ "../node_modules/viem/_esm/utils/encoding/toBytes.js"() {
781
+ init_base();
782
+ init_isHex();
783
+ init_pad();
784
+ init_fromHex();
785
+ init_toHex();
786
+ encoder = /* @__PURE__ */ new TextEncoder();
787
+ nibbles = /* @__PURE__ */ (() => {
788
+ const table = new Int8Array(128).fill(-1);
789
+ for (let i = 0; i < 10; i++)
790
+ table[48 + i] = i;
791
+ for (let i = 0; i < 6; i++)
792
+ table[65 + i] = table[97 + i] = 10 + i;
793
+ return table;
794
+ })();
795
+ charCodeMap = {
796
+ zero: 48,
797
+ nine: 57,
798
+ A: 65,
799
+ F: 70,
800
+ a: 97,
801
+ f: 102
802
+ };
803
+ }
804
+ });
805
+
806
+ // ../node_modules/@noble/hashes/esm/_u64.js
807
+ function fromBig(n, le = false) {
808
+ if (le)
809
+ return { h: Number(n & U32_MASK64), l: Number(n >> _32n & U32_MASK64) };
810
+ return { h: Number(n >> _32n & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
811
+ }
812
+ function split(lst, le = false) {
813
+ const len = lst.length;
814
+ let Ah = new Uint32Array(len);
815
+ let Al = new Uint32Array(len);
816
+ for (let i = 0; i < len; i++) {
817
+ const { h, l } = fromBig(lst[i], le);
818
+ [Ah[i], Al[i]] = [h, l];
819
+ }
820
+ return [Ah, Al];
821
+ }
822
+ var U32_MASK64, _32n, rotlSH, rotlSL, rotlBH, rotlBL;
823
+ var init_u64 = __esm({
824
+ "../node_modules/@noble/hashes/esm/_u64.js"() {
825
+ U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
826
+ _32n = /* @__PURE__ */ BigInt(32);
827
+ rotlSH = (h, l, s) => h << s | l >>> 32 - s;
828
+ rotlSL = (h, l, s) => l << s | h >>> 32 - s;
829
+ rotlBH = (h, l, s) => l << s - 32 | h >>> 64 - s;
830
+ rotlBL = (h, l, s) => h << s - 32 | l >>> 64 - s;
831
+ }
832
+ });
833
+
834
+ // ../node_modules/@noble/hashes/esm/utils.js
835
+ function isBytes(a) {
836
+ return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
837
+ }
838
+ function anumber(n) {
839
+ if (!Number.isSafeInteger(n) || n < 0)
840
+ throw new Error("positive integer expected, got " + n);
841
+ }
842
+ function abytes(b, ...lengths) {
843
+ if (!isBytes(b))
844
+ throw new Error("Uint8Array expected");
845
+ if (lengths.length > 0 && !lengths.includes(b.length))
846
+ throw new Error("Uint8Array expected of length " + lengths + ", got length=" + b.length);
847
+ }
848
+ function aexists(instance, checkFinished = true) {
849
+ if (instance.destroyed)
850
+ throw new Error("Hash instance has been destroyed");
851
+ if (checkFinished && instance.finished)
852
+ throw new Error("Hash#digest() has already been called");
853
+ }
854
+ function aoutput(out, instance) {
855
+ abytes(out);
856
+ const min = instance.outputLen;
857
+ if (out.length < min) {
858
+ throw new Error("digestInto() expects output buffer of length at least " + min);
859
+ }
860
+ }
861
+ function u32(arr) {
862
+ return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
863
+ }
864
+ function clean(...arrays) {
865
+ for (let i = 0; i < arrays.length; i++) {
866
+ arrays[i].fill(0);
867
+ }
868
+ }
869
+ function byteSwap(word2) {
870
+ return word2 << 24 & 4278190080 | word2 << 8 & 16711680 | word2 >>> 8 & 65280 | word2 >>> 24 & 255;
871
+ }
872
+ function byteSwap32(arr) {
873
+ for (let i = 0; i < arr.length; i++) {
874
+ arr[i] = byteSwap(arr[i]);
875
+ }
876
+ return arr;
877
+ }
878
+ function utf8ToBytes(str) {
879
+ if (typeof str !== "string")
880
+ throw new Error("string expected");
881
+ return new Uint8Array(new TextEncoder().encode(str));
882
+ }
883
+ function toBytes2(data) {
884
+ if (typeof data === "string")
885
+ data = utf8ToBytes(data);
886
+ abytes(data);
887
+ return data;
888
+ }
889
+ function createHasher(hashCons) {
890
+ const hashC = (msg) => hashCons().update(toBytes2(msg)).digest();
891
+ const tmp = hashCons();
892
+ hashC.outputLen = tmp.outputLen;
893
+ hashC.blockLen = tmp.blockLen;
894
+ hashC.create = () => hashCons();
895
+ return hashC;
896
+ }
897
+ var isLE, swap32IfBE, Hash;
898
+ var init_utils = __esm({
899
+ "../node_modules/@noble/hashes/esm/utils.js"() {
900
+ isLE = /* @__PURE__ */ (() => new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68)();
901
+ swap32IfBE = isLE ? (u) => u : byteSwap32;
902
+ Hash = class {
903
+ };
904
+ }
905
+ });
906
+
907
+ // ../node_modules/@noble/hashes/esm/sha3.js
908
+ function keccakP(s, rounds = 24) {
909
+ const B = new Uint32Array(5 * 2);
910
+ for (let round = 24 - rounds; round < 24; round++) {
911
+ for (let x = 0; x < 10; x++)
912
+ B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];
913
+ for (let x = 0; x < 10; x += 2) {
914
+ const idx1 = (x + 8) % 10;
915
+ const idx0 = (x + 2) % 10;
916
+ const B0 = B[idx0];
917
+ const B1 = B[idx0 + 1];
918
+ const Th = rotlH(B0, B1, 1) ^ B[idx1];
919
+ const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];
920
+ for (let y = 0; y < 50; y += 10) {
921
+ s[x + y] ^= Th;
922
+ s[x + y + 1] ^= Tl;
923
+ }
924
+ }
925
+ let curH = s[2];
926
+ let curL = s[3];
927
+ for (let t = 0; t < 24; t++) {
928
+ const shift = SHA3_ROTL[t];
929
+ const Th = rotlH(curH, curL, shift);
930
+ const Tl = rotlL(curH, curL, shift);
931
+ const PI = SHA3_PI[t];
932
+ curH = s[PI];
933
+ curL = s[PI + 1];
934
+ s[PI] = Th;
935
+ s[PI + 1] = Tl;
936
+ }
937
+ for (let y = 0; y < 50; y += 10) {
938
+ for (let x = 0; x < 10; x++)
939
+ B[x] = s[y + x];
940
+ for (let x = 0; x < 10; x++)
941
+ s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];
942
+ }
943
+ s[0] ^= SHA3_IOTA_H[round];
944
+ s[1] ^= SHA3_IOTA_L[round];
945
+ }
946
+ clean(B);
947
+ }
948
+ var _0n, _1n, _2n, _7n, _256n, _0x71n, SHA3_PI, SHA3_ROTL, _SHA3_IOTA, IOTAS, SHA3_IOTA_H, SHA3_IOTA_L, rotlH, rotlL, Keccak, gen, keccak_256;
949
+ var init_sha3 = __esm({
950
+ "../node_modules/@noble/hashes/esm/sha3.js"() {
951
+ init_u64();
952
+ init_utils();
953
+ _0n = BigInt(0);
954
+ _1n = BigInt(1);
955
+ _2n = BigInt(2);
956
+ _7n = BigInt(7);
957
+ _256n = BigInt(256);
958
+ _0x71n = BigInt(113);
959
+ SHA3_PI = [];
960
+ SHA3_ROTL = [];
961
+ _SHA3_IOTA = [];
962
+ for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {
963
+ [x, y] = [y, (2 * x + 3 * y) % 5];
964
+ SHA3_PI.push(2 * (5 * y + x));
965
+ SHA3_ROTL.push((round + 1) * (round + 2) / 2 % 64);
966
+ let t = _0n;
967
+ for (let j = 0; j < 7; j++) {
968
+ R = (R << _1n ^ (R >> _7n) * _0x71n) % _256n;
969
+ if (R & _2n)
970
+ t ^= _1n << (_1n << /* @__PURE__ */ BigInt(j)) - _1n;
971
+ }
972
+ _SHA3_IOTA.push(t);
973
+ }
974
+ IOTAS = split(_SHA3_IOTA, true);
975
+ SHA3_IOTA_H = IOTAS[0];
976
+ SHA3_IOTA_L = IOTAS[1];
977
+ rotlH = (h, l, s) => s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s);
978
+ rotlL = (h, l, s) => s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s);
979
+ Keccak = class _Keccak extends Hash {
980
+ // NOTE: we accept arguments in bytes instead of bits here.
981
+ constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {
982
+ super();
983
+ this.pos = 0;
984
+ this.posOut = 0;
985
+ this.finished = false;
986
+ this.destroyed = false;
987
+ this.enableXOF = false;
988
+ this.blockLen = blockLen;
989
+ this.suffix = suffix;
990
+ this.outputLen = outputLen;
991
+ this.enableXOF = enableXOF;
992
+ this.rounds = rounds;
993
+ anumber(outputLen);
994
+ if (!(0 < blockLen && blockLen < 200))
995
+ throw new Error("only keccak-f1600 function is supported");
996
+ this.state = new Uint8Array(200);
997
+ this.state32 = u32(this.state);
998
+ }
999
+ clone() {
1000
+ return this._cloneInto();
1001
+ }
1002
+ keccak() {
1003
+ swap32IfBE(this.state32);
1004
+ keccakP(this.state32, this.rounds);
1005
+ swap32IfBE(this.state32);
1006
+ this.posOut = 0;
1007
+ this.pos = 0;
1008
+ }
1009
+ update(data) {
1010
+ aexists(this);
1011
+ data = toBytes2(data);
1012
+ abytes(data);
1013
+ const { blockLen, state } = this;
1014
+ const len = data.length;
1015
+ for (let pos = 0; pos < len; ) {
1016
+ const take = Math.min(blockLen - this.pos, len - pos);
1017
+ for (let i = 0; i < take; i++)
1018
+ state[this.pos++] ^= data[pos++];
1019
+ if (this.pos === blockLen)
1020
+ this.keccak();
1021
+ }
1022
+ return this;
1023
+ }
1024
+ finish() {
1025
+ if (this.finished)
1026
+ return;
1027
+ this.finished = true;
1028
+ const { state, suffix, pos, blockLen } = this;
1029
+ state[pos] ^= suffix;
1030
+ if ((suffix & 128) !== 0 && pos === blockLen - 1)
1031
+ this.keccak();
1032
+ state[blockLen - 1] ^= 128;
1033
+ this.keccak();
1034
+ }
1035
+ writeInto(out) {
1036
+ aexists(this, false);
1037
+ abytes(out);
1038
+ this.finish();
1039
+ const bufferOut = this.state;
1040
+ const { blockLen } = this;
1041
+ for (let pos = 0, len = out.length; pos < len; ) {
1042
+ if (this.posOut >= blockLen)
1043
+ this.keccak();
1044
+ const take = Math.min(blockLen - this.posOut, len - pos);
1045
+ out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);
1046
+ this.posOut += take;
1047
+ pos += take;
1048
+ }
1049
+ return out;
1050
+ }
1051
+ xofInto(out) {
1052
+ if (!this.enableXOF)
1053
+ throw new Error("XOF is not possible for this instance");
1054
+ return this.writeInto(out);
1055
+ }
1056
+ xof(bytes) {
1057
+ anumber(bytes);
1058
+ return this.xofInto(new Uint8Array(bytes));
1059
+ }
1060
+ digestInto(out) {
1061
+ aoutput(out, this);
1062
+ if (this.finished)
1063
+ throw new Error("digest() was already called");
1064
+ this.writeInto(out);
1065
+ this.destroy();
1066
+ return out;
1067
+ }
1068
+ digest() {
1069
+ return this.digestInto(new Uint8Array(this.outputLen));
1070
+ }
1071
+ destroy() {
1072
+ this.destroyed = true;
1073
+ clean(this.state);
1074
+ }
1075
+ _cloneInto(to) {
1076
+ const { blockLen, suffix, outputLen, rounds, enableXOF } = this;
1077
+ to || (to = new _Keccak(blockLen, suffix, outputLen, enableXOF, rounds));
1078
+ to.state32.set(this.state32);
1079
+ to.pos = this.pos;
1080
+ to.posOut = this.posOut;
1081
+ to.finished = this.finished;
1082
+ to.rounds = rounds;
1083
+ to.suffix = suffix;
1084
+ to.outputLen = outputLen;
1085
+ to.enableXOF = enableXOF;
1086
+ to.destroyed = this.destroyed;
1087
+ return to;
1088
+ }
1089
+ };
1090
+ gen = (suffix, blockLen, outputLen) => createHasher(() => new Keccak(blockLen, suffix, outputLen));
1091
+ keccak_256 = /* @__PURE__ */ (() => gen(1, 136, 256 / 8))();
1092
+ }
1093
+ });
1094
+
1095
+ // ../node_modules/viem/_esm/utils/hash/keccak256.js
1096
+ function keccak256(value, to_) {
1097
+ const to = to_ || "hex";
1098
+ const bytes = keccak_256(isHex(value, { strict: false }) ? toBytes(value) : value);
1099
+ if (to === "bytes")
1100
+ return bytes;
1101
+ return toHex(bytes);
1102
+ }
1103
+ var init_keccak256 = __esm({
1104
+ "../node_modules/viem/_esm/utils/hash/keccak256.js"() {
1105
+ init_sha3();
1106
+ init_isHex();
1107
+ init_toBytes();
1108
+ init_toHex();
1109
+ }
1110
+ });
1111
+
1112
+ // ../node_modules/viem/_esm/utils/lru.js
1113
+ var LruMap;
1114
+ var init_lru = __esm({
1115
+ "../node_modules/viem/_esm/utils/lru.js"() {
1116
+ LruMap = class extends Map {
1117
+ maxSize;
1118
+ constructor(size2) {
1119
+ super();
1120
+ this.maxSize = size2;
1121
+ }
1122
+ get(key) {
1123
+ const value = super.get(key);
1124
+ if (super.has(key)) {
1125
+ super.delete(key);
1126
+ super.set(key, value);
1127
+ }
1128
+ return value;
1129
+ }
1130
+ set(key, value) {
1131
+ if (super.has(key))
1132
+ super.delete(key);
1133
+ super.set(key, value);
1134
+ if (this.maxSize && this.size > this.maxSize) {
1135
+ const firstKey = super.keys().next().value;
1136
+ if (firstKey !== void 0)
1137
+ super.delete(firstKey);
1138
+ }
1139
+ return this;
1140
+ }
1141
+ };
1142
+ }
1143
+ });
1144
+
1145
+ // ../node_modules/viem/_esm/utils/hash/hashSignature.js
1146
+ function hashSignature(sig) {
1147
+ return hash(sig);
1148
+ }
1149
+ var hash;
1150
+ var init_hashSignature = __esm({
1151
+ "../node_modules/viem/_esm/utils/hash/hashSignature.js"() {
1152
+ init_toBytes();
1153
+ init_keccak256();
1154
+ hash = (value) => keccak256(toBytes(value));
1155
+ }
1156
+ });
1157
+
1158
+ // ../node_modules/viem/_esm/utils/hash/normalizeSignature.js
1159
+ function normalizeSignature(signature) {
1160
+ let active = true;
1161
+ let current = "";
1162
+ let level = 0;
1163
+ let result = "";
1164
+ let valid = false;
1165
+ for (let i = 0; i < signature.length; i++) {
1166
+ const char = signature[i];
1167
+ if (char === "(" || char === ")" || char === ",")
1168
+ active = true;
1169
+ if (char === "(")
1170
+ level++;
1171
+ if (char === ")")
1172
+ level--;
1173
+ if (!active)
1174
+ continue;
1175
+ if (level === 0) {
1176
+ if (char === " " && (result === "event" || result === "function" || result === "error" || result === ""))
1177
+ result = "";
1178
+ else {
1179
+ result += char;
1180
+ if (char === ")") {
1181
+ valid = true;
1182
+ break;
1183
+ }
1184
+ }
1185
+ continue;
1186
+ }
1187
+ if (char === " ") {
1188
+ if (!current.endsWith(",") && !current.endsWith("(")) {
1189
+ current = "";
1190
+ active = false;
1191
+ }
1192
+ continue;
1193
+ }
1194
+ result += char;
1195
+ current += char;
1196
+ }
1197
+ if (!valid)
1198
+ throw new BaseError("Unable to normalize signature.");
1199
+ return result;
1200
+ }
1201
+ var init_normalizeSignature = __esm({
1202
+ "../node_modules/viem/_esm/utils/hash/normalizeSignature.js"() {
1203
+ init_base();
1204
+ }
1205
+ });
1206
+
1207
+ // ../node_modules/viem/_esm/utils/hash/toSignature.js
1208
+ var toSignature;
1209
+ var init_toSignature = __esm({
1210
+ "../node_modules/viem/_esm/utils/hash/toSignature.js"() {
1211
+ init_exports();
1212
+ init_normalizeSignature();
1213
+ toSignature = (def) => {
1214
+ const def_ = (() => {
1215
+ if (typeof def === "string")
1216
+ return def;
1217
+ return formatAbiItem(def);
1218
+ })();
1219
+ return normalizeSignature(def_);
1220
+ };
1221
+ }
1222
+ });
1223
+
1224
+ // ../node_modules/viem/_esm/utils/hash/toSignatureHash.js
1225
+ function toSignatureHash(fn) {
1226
+ const definition = typeof fn === "string" ? fn : formatAbiItem(fn);
1227
+ const cached = signatureHashCache.get(definition);
1228
+ if (cached)
1229
+ return cached;
1230
+ const hash2 = hashSignature(toSignature(definition));
1231
+ signatureHashCache.set(definition, hash2);
1232
+ return hash2;
1233
+ }
1234
+ var signatureHashCache;
1235
+ var init_toSignatureHash = __esm({
1236
+ "../node_modules/viem/_esm/utils/hash/toSignatureHash.js"() {
1237
+ init_exports();
1238
+ init_lru();
1239
+ init_hashSignature();
1240
+ init_toSignature();
1241
+ signatureHashCache = /* @__PURE__ */ new LruMap(8192);
1242
+ }
1243
+ });
1244
+
1245
+ // ../node_modules/viem/_esm/utils/hash/toEventSelector.js
1246
+ var toEventSelector;
1247
+ var init_toEventSelector = __esm({
1248
+ "../node_modules/viem/_esm/utils/hash/toEventSelector.js"() {
1249
+ init_toSignatureHash();
1250
+ toEventSelector = toSignatureHash;
1251
+ }
1252
+ });
1253
+
1254
+ // ../node_modules/viem/_esm/errors/address.js
1255
+ var InvalidAddressError;
1256
+ var init_address = __esm({
1257
+ "../node_modules/viem/_esm/errors/address.js"() {
1258
+ init_base();
1259
+ InvalidAddressError = class extends BaseError {
1260
+ constructor({ address }) {
1261
+ super(`Address "${address}" is invalid.`, {
1262
+ metaMessages: [
1263
+ "- Address must be a hex value of 20 bytes (40 hex characters).",
1264
+ "- Address must match its checksum counterpart."
1265
+ ],
1266
+ name: "InvalidAddressError"
1267
+ });
1268
+ }
1269
+ };
1270
+ }
1271
+ });
1272
+
1273
+ // ../node_modules/viem/_esm/utils/address/getAddress.js
1274
+ function checksumAddress(address_, chainId) {
1275
+ const lower = address_.toLowerCase();
1276
+ const cacheKey = `${lower}.${chainId}`;
1277
+ const cached = checksumAddressCache.get(cacheKey);
1278
+ if (cached)
1279
+ return cached;
1280
+ const hexAddress = chainId ? `${chainId}${lower}` : lower.substring(2);
1281
+ const hash2 = keccak256(stringToBytes(hexAddress), "bytes");
1282
+ const address = (chainId ? hexAddress.substring(`${chainId}0x`.length) : hexAddress).split("");
1283
+ for (let i = 0; i < 40; i += 2) {
1284
+ if (hash2[i >> 1] >> 4 >= 8 && address[i]) {
1285
+ address[i] = address[i].toUpperCase();
1286
+ }
1287
+ if ((hash2[i >> 1] & 15) >= 8 && address[i + 1]) {
1288
+ address[i + 1] = address[i + 1].toUpperCase();
1289
+ }
1290
+ }
1291
+ const result = `0x${address.join("")}`;
1292
+ checksumAddressCache.set(cacheKey, result);
1293
+ return result;
1294
+ }
1295
+ var checksumAddressCache;
1296
+ var init_getAddress = __esm({
1297
+ "../node_modules/viem/_esm/utils/address/getAddress.js"() {
1298
+ init_toBytes();
1299
+ init_keccak256();
1300
+ init_lru();
1301
+ checksumAddressCache = /* @__PURE__ */ new LruMap(8192);
1302
+ }
1303
+ });
1304
+
1305
+ // ../node_modules/viem/_esm/utils/address/isAddress.js
1306
+ function isAddress(address, options) {
1307
+ const { strict = true } = options ?? {};
1308
+ if (!addressRegex.test(address))
1309
+ return false;
1310
+ if (!strict || address.toLowerCase() === address)
1311
+ return true;
1312
+ let result = isAddressCache.get(address);
1313
+ if (result === void 0) {
1314
+ result = checksumAddress(address) === address;
1315
+ isAddressCache.set(address, result);
1316
+ }
1317
+ return result;
1318
+ }
1319
+ var addressRegex, isAddressCache;
1320
+ var init_isAddress = __esm({
1321
+ "../node_modules/viem/_esm/utils/address/isAddress.js"() {
1322
+ init_lru();
1323
+ init_getAddress();
1324
+ addressRegex = /^0x[a-fA-F0-9]{40}$/;
1325
+ isAddressCache = /* @__PURE__ */ new LruMap(8192);
1326
+ }
1327
+ });
1328
+
1329
+ // ../node_modules/viem/_esm/utils/data/concat.js
1330
+ function concat(values) {
1331
+ if (typeof values[0] === "string")
1332
+ return concatHex(values);
1333
+ return concatBytes(values);
1334
+ }
1335
+ function concatBytes(values) {
1336
+ let length = 0;
1337
+ for (const arr of values) {
1338
+ length += arr.length;
1339
+ }
1340
+ const result = new Uint8Array(length);
1341
+ let offset = 0;
1342
+ for (const arr of values) {
1343
+ result.set(arr, offset);
1344
+ offset += arr.length;
1345
+ }
1346
+ return result;
1347
+ }
1348
+ function concatHex(values) {
1349
+ let result = "";
1350
+ for (const value of values)
1351
+ result += value.startsWith("0x") ? value.slice(2) : value.replace("0x", "");
1352
+ return `0x${result}`;
1353
+ }
1354
+ var init_concat = __esm({
1355
+ "../node_modules/viem/_esm/utils/data/concat.js"() {
1356
+ }
1357
+ });
1358
+
1359
+ // ../node_modules/viem/_esm/utils/regex.js
1360
+ var bytesRegex, integerRegex;
1361
+ var init_regex2 = __esm({
1362
+ "../node_modules/viem/_esm/utils/regex.js"() {
1363
+ bytesRegex = /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/;
1364
+ 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)?$/;
1365
+ }
1366
+ });
1367
+
1368
+ // ../node_modules/viem/_esm/utils/abi/encodeAbiParameters.js
1369
+ function encodeAbiParameters(params, values) {
1370
+ if (params.length !== values.length)
1371
+ throw new AbiEncodingLengthMismatchError({
1372
+ expectedLength: params.length,
1373
+ givenLength: values.length
1374
+ });
1375
+ const compiled = new Array(params.length);
1376
+ const parts = new Array(params.length);
1377
+ for (let i = 0; i < params.length; i++) {
1378
+ compiled[i] = compile(params[i]);
1379
+ parts[i] = encode(compiled[i], values[i]);
1380
+ }
1381
+ return ["0x", encodeParts(compiled, parts)].join("");
1382
+ }
1383
+ function compile(param) {
1384
+ const compiled = {
1385
+ child: void 0,
1386
+ components: void 0,
1387
+ dynamic: false,
1388
+ kind: "other",
1389
+ length: null,
1390
+ max: 0n,
1391
+ min: 0n,
1392
+ param,
1393
+ signed: false,
1394
+ size: 0
1395
+ };
1396
+ if (typeof param !== "object" || param === null)
1397
+ return compiled;
1398
+ const { type } = param;
1399
+ if (typeof type !== "string")
1400
+ return compiled;
1401
+ const arrayComponents = getArrayComponents(type);
1402
+ if (arrayComponents) {
1403
+ const [length, innerType] = arrayComponents;
1404
+ const child = compile({ ...param, type: innerType });
1405
+ compiled.kind = "array";
1406
+ compiled.length = length;
1407
+ compiled.child = child;
1408
+ compiled.dynamic = length === null || child.dynamic;
1409
+ return compiled;
1410
+ }
1411
+ if (type === "tuple") {
1412
+ const { components } = param;
1413
+ if (components === void 0 || components === null)
1414
+ return compiled;
1415
+ compiled.kind = "tuple";
1416
+ compiled.components = Array.from({ length: components.length }, (_, i) => compile(components[i]));
1417
+ compiled.dynamic = compiled.components.some(({ dynamic }) => dynamic);
1418
+ return compiled;
1419
+ }
1420
+ if (type === "address")
1421
+ compiled.kind = "address";
1422
+ else if (type === "bool")
1423
+ compiled.kind = "bool";
1424
+ else if (type.startsWith("uint") || type.startsWith("int")) {
1425
+ const signed = type.startsWith("int");
1426
+ const [, , size2 = "256"] = integerRegex.exec(type) ?? [];
1427
+ const key = signed ? `i${size2}` : size2;
1428
+ let bounds = integerBounds.get(key);
1429
+ if (!bounds) {
1430
+ const max = 2n ** (BigInt(size2) - (signed ? 1n : 0n)) - 1n;
1431
+ bounds = [signed ? -max - 1n : 0n, max];
1432
+ integerBounds.set(key, bounds);
1433
+ }
1434
+ compiled.kind = "number";
1435
+ compiled.signed = signed;
1436
+ compiled.size = Number(size2);
1437
+ compiled.min = bounds[0];
1438
+ compiled.max = bounds[1];
1439
+ } else if (type.startsWith("bytes")) {
1440
+ compiled.kind = "bytes";
1441
+ compiled.size = bytesRegex.test(type) ? Number(type.slice(5)) : -1;
1442
+ compiled.dynamic = !type.split("bytes")[1];
1443
+ } else if (type === "string") {
1444
+ compiled.kind = "string";
1445
+ compiled.dynamic = true;
1446
+ }
1447
+ return compiled;
1448
+ }
1449
+ function encode(compiled, value) {
1450
+ const { kind, param } = compiled;
1451
+ if (kind === "array")
1452
+ return encodeArrayValue(compiled, value);
1453
+ if (kind === "tuple")
1454
+ return encodeTupleValue(compiled, value);
1455
+ if (kind === "address") {
1456
+ if (!isAddress(value))
1457
+ throw new InvalidAddressError({ address: value });
1458
+ return `000000000000000000000000${value.toLowerCase().slice(2)}`;
1459
+ }
1460
+ if (kind === "bool") {
1461
+ if (typeof value !== "boolean")
1462
+ throw new BaseError(`Invalid boolean value: "${value}" (type: ${typeof value}). Expected: \`true\` or \`false\`.`);
1463
+ return value ? `${zeros.slice(1)}1` : zeros;
1464
+ }
1465
+ if (kind === "bytes") {
1466
+ const { size: size2 } = compiled;
1467
+ if (typeof value === "string" && value.length % 2 === 0 && value.startsWith("0x") && value.indexOf("0x", 2) === -1) {
1468
+ const data = value.slice(2);
1469
+ const length = data.length / 2;
1470
+ if (size2 === 0)
1471
+ return word(length) + data.padEnd(Math.ceil(length / 32) * 64, "0");
1472
+ if (length === size2)
1473
+ return data.padEnd(64, "0");
1474
+ }
1475
+ return encodeBytes(value, { param }).encoded.slice(2);
1476
+ }
1477
+ if (kind === "number") {
1478
+ const { max, min, signed, size: size2 } = compiled;
1479
+ if (value > max || value < min)
1480
+ throw new IntegerOutOfRangeError({
1481
+ max: max.toString(),
1482
+ min: min.toString(),
1483
+ signed,
1484
+ size: size2 / 8,
1485
+ value: value.toString()
1486
+ });
1487
+ if (typeof value !== "bigint" && !(typeof value === "number" && Number.isSafeInteger(value)))
1488
+ return numberToHex(value, { size: 32, signed }).slice(2);
1489
+ const hex = (value < 0 ? (1n << 256n) + BigInt(value) : value).toString(16);
1490
+ return zeros.slice(hex.length) + hex;
1491
+ }
1492
+ if (kind === "string") {
1493
+ const data = stringToHex(value).slice(2);
1494
+ const remainder = data.length % 64;
1495
+ return word(data.length / 2) + data + (remainder ? zeros.slice(remainder) : "");
1496
+ }
1497
+ const type = param.type;
1498
+ getArrayComponents(type);
1499
+ if (type === "tuple")
1500
+ param.components.length;
1501
+ throw new InvalidAbiEncodingTypeError(type, {
1502
+ docsPath: "/docs/contract/encodeAbiParameters"
1503
+ });
1504
+ }
1505
+ function encodeArrayValue(compiled, value) {
1506
+ const { length } = compiled;
1507
+ const child = compiled.child;
1508
+ if (!Array.isArray(value))
1509
+ throw new InvalidArrayError(value);
1510
+ if (length !== null && value.length !== length)
1511
+ throw new AbiEncodingArrayLengthMismatchError({
1512
+ expectedLength: length,
1513
+ givenLength: value.length,
1514
+ type: `${child.param.type}[${length}]`
1515
+ });
1516
+ const dynamicChild = value.length === 0 ? isDynamicType(child.param) : child.dynamic;
1517
+ let data = "";
1518
+ if (dynamicChild) {
1519
+ let head = "";
1520
+ let offset = value.length * 32;
1521
+ for (let i = 0; i < value.length; i++) {
1522
+ const part = encode(child, value[i]);
1523
+ head += word(offset);
1524
+ data += part;
1525
+ offset += Math.ceil(part.length / 2);
1526
+ }
1527
+ data = head + data;
1528
+ } else
1529
+ for (let i = 0; i < value.length; i++)
1530
+ data += encode(child, value[i]);
1531
+ if (length === null)
1532
+ return word(value.length) + data;
1533
+ return data;
1534
+ }
1535
+ function encodeTupleValue(compiled, value) {
1536
+ const components = compiled.components;
1537
+ const isArray = Array.isArray(value);
1538
+ const parts = new Array(components.length);
1539
+ for (let i = 0; i < components.length; i++) {
1540
+ const component = components[i];
1541
+ parts[i] = encode(component, value[isArray ? i : component.param.name]);
1542
+ }
1543
+ if (compiled.dynamic)
1544
+ return encodeParts(components, parts);
1545
+ let data = "";
1546
+ for (let i = 0; i < parts.length; i++)
1547
+ data += parts[i];
1548
+ return data;
1549
+ }
1550
+ function encodeParts(compiled, parts) {
1551
+ let offset = 0;
1552
+ for (let i = 0; i < parts.length; i++)
1553
+ offset += compiled[i].dynamic ? 32 : Math.ceil(parts[i].length / 2);
1554
+ let head = "";
1555
+ let tail = "";
1556
+ for (let i = 0; i < parts.length; i++) {
1557
+ const part = parts[i];
1558
+ if (compiled[i].dynamic) {
1559
+ head += word(offset);
1560
+ tail += part;
1561
+ offset += Math.ceil(part.length / 2);
1562
+ } else
1563
+ head += part;
1564
+ }
1565
+ return head + tail;
1566
+ }
1567
+ function word(value) {
1568
+ const hex = value.toString(16);
1569
+ return zeros.slice(hex.length) + hex;
1570
+ }
1571
+ function encodeBytes(value, { param }) {
1572
+ const [, paramSize] = param.type.split("bytes");
1573
+ const hex = value.length % 2 ? `0x0${value.slice(2)}` : value;
1574
+ const bytesSize = size(hex);
1575
+ if (!paramSize) {
1576
+ let value_ = hex;
1577
+ if (bytesSize % 32 !== 0)
1578
+ value_ = padHex(value_, {
1579
+ dir: "right",
1580
+ size: Math.ceil(bytesSize / 32) * 32
1581
+ });
1582
+ return {
1583
+ dynamic: true,
1584
+ encoded: concatHex([
1585
+ padHex(numberToHex(bytesSize, { size: 32 })),
1586
+ value_
1587
+ ])
1588
+ };
1589
+ }
1590
+ if (bytesSize !== Number.parseInt(paramSize, 10))
1591
+ throw new AbiEncodingBytesSizeMismatchError({
1592
+ expectedSize: Number.parseInt(paramSize, 10),
1593
+ value
1594
+ });
1595
+ return { dynamic: false, encoded: padHex(hex, { dir: "right" }) };
1596
+ }
1597
+ function getArrayComponents(type) {
1598
+ const matches = type.match(/^(.*)\[(\d+)?\]$/);
1599
+ return matches ? (
1600
+ // Return `null` if the array is dynamic.
1601
+ [matches[2] ? Number(matches[2]) : null, matches[1]]
1602
+ ) : void 0;
1603
+ }
1604
+ function isDynamicType(param) {
1605
+ const { type } = param;
1606
+ if (type === "string")
1607
+ return true;
1608
+ if (type === "bytes")
1609
+ return true;
1610
+ if (type.endsWith("[]"))
1611
+ return true;
1612
+ if (type === "tuple")
1613
+ return param.components.some(isDynamicType);
1614
+ const arrayComponents = getArrayComponents(type);
1615
+ if (arrayComponents)
1616
+ return isDynamicType({ ...param, type: arrayComponents[1] });
1617
+ return false;
1618
+ }
1619
+ var zeros, integerBounds;
1620
+ var init_encodeAbiParameters = __esm({
1621
+ "../node_modules/viem/_esm/utils/abi/encodeAbiParameters.js"() {
1622
+ init_abi();
1623
+ init_address();
1624
+ init_base();
1625
+ init_encoding();
1626
+ init_isAddress();
1627
+ init_concat();
1628
+ init_pad();
1629
+ init_size();
1630
+ init_toHex();
1631
+ init_regex2();
1632
+ zeros = "0".repeat(64);
1633
+ integerBounds = /* @__PURE__ */ new Map();
1634
+ }
1635
+ });
1636
+
1637
+ // ../node_modules/viem/_esm/utils/data/slice.js
1638
+ function slice(value, start, end, { strict } = {}) {
1639
+ if (isHex(value, { strict: false }))
1640
+ return sliceHex(value, start, end, {
1641
+ strict
1642
+ });
1643
+ return sliceBytes(value, start, end, {
1644
+ strict
1645
+ });
1646
+ }
1647
+ function assertStartOffset(value, start) {
1648
+ if (typeof start === "number" && start > 0 && start > size(value) - 1)
1649
+ throw new SliceOffsetOutOfBoundsError({
1650
+ offset: start,
1651
+ position: "start",
1652
+ size: size(value)
1653
+ });
1654
+ }
1655
+ function assertEndOffset(value, start, end) {
1656
+ if (typeof start === "number" && typeof end === "number" && size(value) !== end - start) {
1657
+ throw new SliceOffsetOutOfBoundsError({
1658
+ offset: end,
1659
+ position: "end",
1660
+ size: size(value)
1661
+ });
1662
+ }
1663
+ }
1664
+ function sliceBytes(value_, start, end, { strict } = {}) {
1665
+ assertStartOffset(value_, start);
1666
+ const value = value_.slice(start, end);
1667
+ if (strict)
1668
+ assertEndOffset(value, start, end);
1669
+ return value;
1670
+ }
1671
+ function sliceHex(value_, start, end, { strict } = {}) {
1672
+ assertStartOffset(value_, start);
1673
+ const hex = value_.startsWith("0x") ? value_.slice(2) : value_.replace("0x", "");
1674
+ const value = `0x${hex.slice((start ?? 0) * 2, (end ?? value_.length) * 2)}`;
1675
+ if (strict)
1676
+ assertEndOffset(value, start, end);
1677
+ return value;
1678
+ }
1679
+ var init_slice = __esm({
1680
+ "../node_modules/viem/_esm/utils/data/slice.js"() {
1681
+ init_data();
1682
+ init_isHex();
1683
+ init_size();
1684
+ }
1685
+ });
1686
+
1687
+ // ../node_modules/viem/_esm/utils/hash/toFunctionSelector.js
1688
+ var toFunctionSelector;
1689
+ var init_toFunctionSelector = __esm({
1690
+ "../node_modules/viem/_esm/utils/hash/toFunctionSelector.js"() {
1691
+ init_slice();
1692
+ init_toSignatureHash();
1693
+ toFunctionSelector = (fn) => slice(toSignatureHash(fn), 0, 4);
1694
+ }
1695
+ });
1696
+
1697
+ // ../node_modules/viem/_esm/utils/abi/getAbiItem.js
1698
+ function getAbiItem(parameters) {
1699
+ const { abi, args = [], name } = parameters;
1700
+ const isSelector = isHex(name, { strict: false });
1701
+ const abiItems = abi.filter((abiItem) => {
1702
+ if (isSelector) {
1703
+ if (abiItem.type === "function")
1704
+ return toFunctionSelector(abiItem) === name;
1705
+ if (abiItem.type === "event")
1706
+ return toEventSelector(abiItem) === name;
1707
+ return false;
1708
+ }
1709
+ return "name" in abiItem && abiItem.name === name;
1710
+ });
1711
+ if (abiItems.length === 0)
1712
+ return void 0;
1713
+ if (abiItems.length === 1)
1714
+ return abiItems[0];
1715
+ let matchedAbiItem;
1716
+ for (const abiItem of abiItems) {
1717
+ if (!("inputs" in abiItem))
1718
+ continue;
1719
+ if (!args || args.length === 0) {
1720
+ if (!abiItem.inputs || abiItem.inputs.length === 0)
1721
+ return abiItem;
1722
+ continue;
1723
+ }
1724
+ if (!abiItem.inputs)
1725
+ continue;
1726
+ if (abiItem.inputs.length === 0)
1727
+ continue;
1728
+ if (abiItem.inputs.length !== args.length)
1729
+ continue;
1730
+ const matched = args.every((arg, index) => {
1731
+ const abiParameter = "inputs" in abiItem && abiItem.inputs[index];
1732
+ if (!abiParameter)
1733
+ return false;
1734
+ return isArgOfType(arg, abiParameter);
1735
+ });
1736
+ if (matched) {
1737
+ if (matchedAbiItem && "inputs" in matchedAbiItem && matchedAbiItem.inputs) {
1738
+ const ambiguousTypes = getAmbiguousTypes(abiItem.inputs, matchedAbiItem.inputs, args);
1739
+ if (ambiguousTypes)
1740
+ throw new AbiItemAmbiguityError({
1741
+ abiItem,
1742
+ type: ambiguousTypes[0]
1743
+ }, {
1744
+ abiItem: matchedAbiItem,
1745
+ type: ambiguousTypes[1]
1746
+ });
1747
+ }
1748
+ matchedAbiItem = abiItem;
1749
+ }
1750
+ }
1751
+ if (matchedAbiItem)
1752
+ return matchedAbiItem;
1753
+ return abiItems[0];
1754
+ }
1755
+ function isArgOfType(arg, abiParameter) {
1756
+ const argType = typeof arg;
1757
+ const abiParameterType = abiParameter.type;
1758
+ switch (abiParameterType) {
1759
+ case "address":
1760
+ return isAddress(arg, { strict: false });
1761
+ case "bool":
1762
+ return argType === "boolean";
1763
+ case "function":
1764
+ return argType === "string";
1765
+ case "string":
1766
+ return argType === "string";
1767
+ default: {
1768
+ if (abiParameterType === "tuple" && "components" in abiParameter)
1769
+ return Object.values(abiParameter.components).every((component, index) => {
1770
+ return argType === "object" && isArgOfType(getComponentValue(arg, component, index), component);
1771
+ });
1772
+ 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)) {
1773
+ if (typeof arg !== "bigint" && typeof arg !== "number")
1774
+ return false;
1775
+ if (typeof arg === "number" && !Number.isInteger(arg))
1776
+ return false;
1777
+ const signed = abiParameterType.startsWith("int");
1778
+ const bits = Number.parseInt(abiParameterType.replace(/^u?int/, "") || "256", 10);
1779
+ const max = 2n ** (BigInt(bits) - (signed ? 1n : 0n)) - 1n;
1780
+ const min = signed ? -max - 1n : 0n;
1781
+ return arg >= min && arg <= max;
1782
+ }
1783
+ if (/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(abiParameterType)) {
1784
+ if (typeof arg !== "string" && !(arg instanceof Uint8Array))
1785
+ return false;
1786
+ const bytes = abiParameterType.slice(5);
1787
+ if (!bytes)
1788
+ return arg instanceof Uint8Array || isHex(arg);
1789
+ if (typeof arg === "string" && !isHex(arg))
1790
+ return false;
1791
+ return size(arg) === Number.parseInt(bytes, 10);
1792
+ }
1793
+ const arrayComponents = getArrayComponents(abiParameterType);
1794
+ if (arrayComponents) {
1795
+ const [length, type] = arrayComponents;
1796
+ return Array.isArray(arg) && (length === null || arg.length === length) && arg.every((x) => isArgOfType(x, { ...abiParameter, type }));
1797
+ }
1798
+ return false;
1799
+ }
1800
+ }
1801
+ }
1802
+ function getAmbiguousTypes(sourceParameters, targetParameters, args) {
1803
+ for (const parameterIndex in sourceParameters) {
1804
+ const sourceParameter = sourceParameters[parameterIndex];
1805
+ const targetParameter = targetParameters[parameterIndex];
1806
+ if (!targetParameter)
1807
+ continue;
1808
+ if (sourceParameter.type === "tuple" && targetParameter.type === "tuple" && "components" in sourceParameter && "components" in targetParameter) {
1809
+ const value2 = args[parameterIndex];
1810
+ const types2 = getAmbiguousTypes(sourceParameter.components, targetParameter.components, sourceParameter.components.map((component, index) => getComponentValue(value2, component, index)));
1811
+ if (types2)
1812
+ return types2;
1813
+ continue;
1814
+ }
1815
+ const sourceArray = getArrayComponents(sourceParameter.type);
1816
+ const targetArray = getArrayComponents(targetParameter.type);
1817
+ if (sourceArray && targetArray) {
1818
+ const types2 = getAmbiguousTypes([{ ...sourceParameter, type: sourceArray[1] }], [{ ...targetParameter, type: targetArray[1] }], [args[parameterIndex]?.[0]]);
1819
+ if (types2)
1820
+ return types2;
1821
+ if (sourceArray[1] === targetArray[1] && sourceParameter.type !== targetParameter.type)
1822
+ return [sourceParameter.type, targetParameter.type];
1823
+ continue;
1824
+ }
1825
+ const types = [sourceParameter.type, targetParameter.type];
1826
+ const value = args[parameterIndex];
1827
+ const ambiguous = (() => {
1828
+ if (types.includes("address") && (types.includes("string") || types.includes("bytes")))
1829
+ return value === void 0 || isAddress(value, { strict: false });
1830
+ if (sourceParameter.type !== targetParameter.type)
1831
+ return true;
1832
+ return false;
1833
+ })();
1834
+ if (ambiguous)
1835
+ return types;
1836
+ }
1837
+ return;
1838
+ }
1839
+ function getComponentValue(arg, component, index) {
1840
+ if (Array.isArray(arg))
1841
+ return arg[index];
1842
+ return arg?.[component.name];
1843
+ }
1844
+ var init_getAbiItem = __esm({
1845
+ "../node_modules/viem/_esm/utils/abi/getAbiItem.js"() {
1846
+ init_abi();
1847
+ init_isHex();
1848
+ init_isAddress();
1849
+ init_size();
1850
+ init_toEventSelector();
1851
+ init_toFunctionSelector();
1852
+ init_encodeAbiParameters();
1853
+ }
1854
+ });
1855
+
1856
+ // ../node_modules/viem/_esm/utils/abi/prepareEncodeFunctionData.js
1857
+ function prepareEncodeFunctionData(parameters) {
1858
+ const { abi, args, functionName } = parameters;
1859
+ let abiItem = abi[0];
1860
+ if (functionName) {
1861
+ const item = getAbiItem({
1862
+ abi,
1863
+ args,
1864
+ name: functionName
1865
+ });
1866
+ if (!item)
1867
+ throw new AbiFunctionNotFoundError(functionName, { docsPath });
1868
+ abiItem = item;
1869
+ }
1870
+ if (abiItem.type !== "function")
1871
+ throw new AbiFunctionNotFoundError(void 0, { docsPath });
1872
+ const signature = formatAbiItem2(abiItem);
1873
+ let selector = selectors.get(signature);
1874
+ if (!selector) {
1875
+ selector = toFunctionSelector(signature);
1876
+ selectors.set(signature, selector);
1877
+ }
1878
+ return {
1879
+ abi: [abiItem],
1880
+ functionName: selector
1881
+ };
1882
+ }
1883
+ var docsPath, selectors;
1884
+ var init_prepareEncodeFunctionData = __esm({
1885
+ "../node_modules/viem/_esm/utils/abi/prepareEncodeFunctionData.js"() {
1886
+ init_abi();
1887
+ init_toFunctionSelector();
1888
+ init_lru();
1889
+ init_formatAbiItem2();
1890
+ init_getAbiItem();
1891
+ docsPath = "/docs/contract/encodeFunctionData";
1892
+ selectors = /* @__PURE__ */ new LruMap(1024);
1893
+ }
1894
+ });
1895
+
1896
+ // ../node_modules/viem/_esm/utils/abi/encodeFunctionData.js
1897
+ function encodeFunctionData(parameters) {
1898
+ const { args } = parameters;
1899
+ const { abi, functionName } = (() => {
1900
+ if (parameters.abi.length === 1 && parameters.functionName?.startsWith("0x"))
1901
+ return parameters;
1902
+ return prepareEncodeFunctionData(parameters);
1903
+ })();
1904
+ const abiItem = abi[0];
1905
+ const signature = functionName;
1906
+ if (!("inputs" in abiItem && abiItem.inputs))
1907
+ return signature;
1908
+ const data = encodeAbiParameters(abiItem.inputs, args ?? []);
1909
+ return `${signature}${data.slice(2)}`;
1910
+ }
1911
+ var init_encodeFunctionData = __esm({
1912
+ "../node_modules/viem/_esm/utils/abi/encodeFunctionData.js"() {
1913
+ init_encodeAbiParameters();
1914
+ init_prepareEncodeFunctionData();
1915
+ }
1916
+ });
1917
+
1918
+ // ../node_modules/viem/_esm/constants/solidity.js
1919
+ var solidityError, solidityPanic;
1920
+ var init_solidity = __esm({
1921
+ "../node_modules/viem/_esm/constants/solidity.js"() {
1922
+ solidityError = {
1923
+ inputs: [
1924
+ {
1925
+ name: "message",
1926
+ type: "string"
1927
+ }
1928
+ ],
1929
+ name: "Error",
1930
+ type: "error"
1931
+ };
1932
+ solidityPanic = {
1933
+ inputs: [
1934
+ {
1935
+ name: "reason",
1936
+ type: "uint256"
1937
+ }
1938
+ ],
1939
+ name: "Panic",
1940
+ type: "error"
1941
+ };
1942
+ }
1943
+ });
1944
+
1945
+ // ../node_modules/viem/_esm/errors/cursor.js
1946
+ var NegativeOffsetError, PositionOutOfBoundsError, RecursiveReadLimitExceededError;
1947
+ var init_cursor = __esm({
1948
+ "../node_modules/viem/_esm/errors/cursor.js"() {
1949
+ init_base();
1950
+ NegativeOffsetError = class extends BaseError {
1951
+ constructor({ offset }) {
1952
+ super(`Offset \`${offset}\` cannot be negative.`, {
1953
+ name: "NegativeOffsetError"
1954
+ });
1955
+ }
1956
+ };
1957
+ PositionOutOfBoundsError = class extends BaseError {
1958
+ constructor({ length, position }) {
1959
+ super(`Position \`${position}\` is out of bounds (\`0 < position < ${length}\`).`, { name: "PositionOutOfBoundsError" });
1960
+ }
1961
+ };
1962
+ RecursiveReadLimitExceededError = class extends BaseError {
1963
+ constructor({ count, limit }) {
1964
+ super(`Recursive read limit of \`${limit}\` exceeded (recursive read count: \`${count}\`).`, { name: "RecursiveReadLimitExceededError" });
1965
+ }
1966
+ };
1967
+ }
1968
+ });
1969
+
1970
+ // ../node_modules/viem/_esm/utils/cursor.js
1971
+ function createCursor(bytes, { recursiveReadLimit = 8192 } = {}) {
1972
+ const cursor = Object.create(staticCursor);
1973
+ cursor.bytes = bytes;
1974
+ cursor._dataView = void 0;
1975
+ cursor.positionReads = void 0;
1976
+ cursor.recursiveReadLimit = recursiveReadLimit;
1977
+ return cursor;
1978
+ }
1979
+ var staticCursor;
1980
+ var init_cursor2 = __esm({
1981
+ "../node_modules/viem/_esm/utils/cursor.js"() {
1982
+ init_cursor();
1983
+ staticCursor = {
1984
+ bytes: new Uint8Array(),
1985
+ // Created on first use: most cursors (e.g. ABI decoding) only read bytes.
1986
+ get dataView() {
1987
+ const cursor = this;
1988
+ cursor._dataView ??= new DataView(this.bytes.buffer ?? this.bytes, this.bytes.byteOffset, this.bytes.byteLength);
1989
+ return cursor._dataView;
1990
+ },
1991
+ position: 0,
1992
+ positionReads: void 0,
1993
+ recursiveReadCount: 0,
1994
+ recursiveReadLimit: Number.POSITIVE_INFINITY,
1995
+ assertReadLimit() {
1996
+ if (this.recursiveReadCount >= this.recursiveReadLimit)
1997
+ throw new RecursiveReadLimitExceededError({
1998
+ count: this.recursiveReadCount + 1,
1999
+ limit: this.recursiveReadLimit
2000
+ });
2001
+ },
2002
+ assertPosition(position) {
2003
+ if (position < 0 || position > this.bytes.length - 1)
2004
+ throw new PositionOutOfBoundsError({
2005
+ length: this.bytes.length,
2006
+ position
2007
+ });
2008
+ },
2009
+ decrementPosition(offset) {
2010
+ if (offset < 0)
2011
+ throw new NegativeOffsetError({ offset });
2012
+ const position = this.position - offset;
2013
+ this.assertPosition(position);
2014
+ this.position = position;
2015
+ },
2016
+ incrementPosition(offset) {
2017
+ if (offset < 0)
2018
+ throw new NegativeOffsetError({ offset });
2019
+ const position = this.position + offset;
2020
+ this.assertPosition(position);
2021
+ this.position = position;
2022
+ },
2023
+ inspectByte(position_) {
2024
+ const position = position_ ?? this.position;
2025
+ this.assertPosition(position);
2026
+ return this.bytes[position];
2027
+ },
2028
+ inspectBytes(length, position_) {
2029
+ const position = position_ ?? this.position;
2030
+ this.assertPosition(position + length - 1);
2031
+ return this.bytes.subarray(position, position + length);
2032
+ },
2033
+ inspectUint8(position_) {
2034
+ const position = position_ ?? this.position;
2035
+ this.assertPosition(position);
2036
+ return this.bytes[position];
2037
+ },
2038
+ inspectUint16(position_) {
2039
+ const position = position_ ?? this.position;
2040
+ this.assertPosition(position + 1);
2041
+ return this.dataView.getUint16(position);
2042
+ },
2043
+ inspectUint24(position_) {
2044
+ const position = position_ ?? this.position;
2045
+ this.assertPosition(position + 2);
2046
+ return (this.dataView.getUint16(position) << 8) + this.dataView.getUint8(position + 2);
2047
+ },
2048
+ inspectUint32(position_) {
2049
+ const position = position_ ?? this.position;
2050
+ this.assertPosition(position + 3);
2051
+ return this.dataView.getUint32(position);
2052
+ },
2053
+ pushByte(byte) {
2054
+ this.assertPosition(this.position);
2055
+ this.bytes[this.position] = byte;
2056
+ this.position++;
2057
+ },
2058
+ pushBytes(bytes) {
2059
+ this.assertPosition(this.position + bytes.length - 1);
2060
+ this.bytes.set(bytes, this.position);
2061
+ this.position += bytes.length;
2062
+ },
2063
+ pushUint8(value) {
2064
+ this.assertPosition(this.position);
2065
+ this.bytes[this.position] = value;
2066
+ this.position++;
2067
+ },
2068
+ pushUint16(value) {
2069
+ this.assertPosition(this.position + 1);
2070
+ this.dataView.setUint16(this.position, value);
2071
+ this.position += 2;
2072
+ },
2073
+ pushUint24(value) {
2074
+ this.assertPosition(this.position + 2);
2075
+ this.dataView.setUint16(this.position, value >> 8);
2076
+ this.dataView.setUint8(this.position + 2, value & ~4294967040);
2077
+ this.position += 3;
2078
+ },
2079
+ pushUint32(value) {
2080
+ this.assertPosition(this.position + 3);
2081
+ this.dataView.setUint32(this.position, value);
2082
+ this.position += 4;
2083
+ },
2084
+ readByte() {
2085
+ this.assertReadLimit();
2086
+ this._touch();
2087
+ const value = this.inspectByte();
2088
+ this.position++;
2089
+ return value;
2090
+ },
2091
+ readBytes(length, size2) {
2092
+ this.assertReadLimit();
2093
+ this._touch();
2094
+ const value = this.inspectBytes(length);
2095
+ this.position += size2 ?? length;
2096
+ return value;
2097
+ },
2098
+ readUint8() {
2099
+ this.assertReadLimit();
2100
+ this._touch();
2101
+ const value = this.inspectUint8();
2102
+ this.position += 1;
2103
+ return value;
2104
+ },
2105
+ readUint16() {
2106
+ this.assertReadLimit();
2107
+ this._touch();
2108
+ const value = this.inspectUint16();
2109
+ this.position += 2;
2110
+ return value;
2111
+ },
2112
+ readUint24() {
2113
+ this.assertReadLimit();
2114
+ this._touch();
2115
+ const value = this.inspectUint24();
2116
+ this.position += 3;
2117
+ return value;
2118
+ },
2119
+ readUint32() {
2120
+ this.assertReadLimit();
2121
+ this._touch();
2122
+ const value = this.inspectUint32();
2123
+ this.position += 4;
2124
+ return value;
2125
+ },
2126
+ get remaining() {
2127
+ return this.bytes.length - this.position;
2128
+ },
2129
+ setPosition(position) {
2130
+ const oldPosition = this.position;
2131
+ this.assertPosition(position);
2132
+ this.position = position;
2133
+ return () => this.position = oldPosition;
2134
+ },
2135
+ _touch() {
2136
+ if (this.recursiveReadLimit === Number.POSITIVE_INFINITY)
2137
+ return;
2138
+ const index = this.position >>> 3;
2139
+ let reads = this.positionReads;
2140
+ if (!reads || index >= reads.length) {
2141
+ const next = new Uint8Array(Math.max(index + 1, (reads?.length ?? 8) * 2));
2142
+ if (reads)
2143
+ next.set(reads);
2144
+ reads = this.positionReads = next;
2145
+ }
2146
+ const mask = 1 << (this.position & 7);
2147
+ if (reads[index] & mask)
2148
+ this.recursiveReadCount++;
2149
+ else
2150
+ reads[index] |= mask;
2151
+ }
2152
+ };
2153
+ }
2154
+ });
2155
+
2156
+ // ../node_modules/viem/_esm/utils/encoding/fromBytes.js
2157
+ function bytesToBool(bytes_, opts = {}) {
2158
+ let bytes = bytes_;
2159
+ if (typeof opts.size !== "undefined") {
2160
+ assertSize(bytes, { size: opts.size });
2161
+ bytes = trim(bytes);
2162
+ }
2163
+ if (bytes.length > 1 || bytes[0] > 1)
2164
+ throw new InvalidBytesBooleanError(bytes);
2165
+ return Boolean(bytes[0]);
2166
+ }
2167
+ function bytesToNumber(bytes, opts = {}) {
2168
+ if (typeof opts.size !== "undefined")
2169
+ assertSize(bytes, { size: opts.size });
2170
+ if (!opts.signed && bytes.length > 0) {
2171
+ let i = 0;
2172
+ while (i < bytes.length && bytes[i] === 0)
2173
+ i++;
2174
+ if (bytes.length - i <= 6) {
2175
+ let value = 0;
2176
+ for (; i < bytes.length; i++)
2177
+ value = value * 256 + bytes[i];
2178
+ return value;
2179
+ }
2180
+ }
2181
+ const hex = bytesToHex(bytes);
2182
+ return hexToNumber(hex, opts);
2183
+ }
2184
+ var init_fromBytes = __esm({
2185
+ "../node_modules/viem/_esm/utils/encoding/fromBytes.js"() {
2186
+ init_encoding();
2187
+ init_trim();
2188
+ init_fromHex();
2189
+ init_toHex();
2190
+ }
2191
+ });
2192
+
2193
+ // ../node_modules/viem/_esm/utils/abi/decodeAbiParameters.js
2194
+ function decodeAbiParameters(params, data) {
2195
+ const bytes = typeof data === "string" ? hexToBytes(data) : data;
2196
+ const cursor = createCursor(bytes);
2197
+ if (size(bytes) === 0 && params.length > 0)
2198
+ throw new AbiDecodingZeroDataError();
2199
+ if (size(data) && size(data) < 32)
2200
+ throw new AbiDecodingDataSizeTooSmallError({
2201
+ data: typeof data === "string" ? data : bytesToHex(data),
2202
+ params,
2203
+ size: size(data)
2204
+ });
2205
+ const budget = { limit: bytes.length * 32, used: 0 };
2206
+ let consumed = 0;
2207
+ const values = [];
2208
+ for (let i = 0; i < params.length; ++i) {
2209
+ const param = compile2(params[i]);
2210
+ cursor.position = consumed;
2211
+ values.push(decodeParameter(cursor, param, budget, 0));
2212
+ consumed += lastSize;
2213
+ }
2214
+ return values;
2215
+ }
2216
+ function compile2(param) {
2217
+ const compiled = {
2218
+ dynamic: false,
2219
+ kind: "invalid",
2220
+ param,
2221
+ child: void 0,
2222
+ length: null,
2223
+ components: void 0,
2224
+ unnamed: false,
2225
+ size: 0,
2226
+ signed: false
2227
+ };
2228
+ if (typeof param !== "object" || param === null)
2229
+ return compiled;
2230
+ const { type } = param;
2231
+ if (typeof type !== "string")
2232
+ return compiled;
2233
+ const arrayComponents = getArrayComponents(type);
2234
+ if (arrayComponents) {
2235
+ const [length, innerType] = arrayComponents;
2236
+ compiled.kind = "array";
2237
+ compiled.length = length;
2238
+ compiled.child = compile2({ ...param, type: innerType });
2239
+ compiled.dynamic = length === null || compiled.child.dynamic;
2240
+ return compiled;
2241
+ }
2242
+ if (type === "tuple") {
2243
+ compiled.kind = "tuple";
2244
+ const { components } = param;
2245
+ if (!Array.isArray(components) || !components.every((component) => typeof component === "object"))
2246
+ return compiled;
2247
+ compiled.components = components.map(compile2);
2248
+ compiled.unnamed = components.length === 0 || components.some(({ name }) => !name);
2249
+ compiled.dynamic = compiled.components.some(({ dynamic }) => dynamic);
2250
+ return compiled;
2251
+ }
2252
+ if (type === "address")
2253
+ compiled.kind = "address";
2254
+ else if (type === "bool")
2255
+ compiled.kind = "bool";
2256
+ else if (type.startsWith("bytes")) {
2257
+ const [_, size2] = type.split("bytes");
2258
+ if (size2) {
2259
+ compiled.kind = "fixedBytes";
2260
+ compiled.size = Number.parseInt(size2, 10);
2261
+ } else {
2262
+ compiled.kind = "bytes";
2263
+ compiled.dynamic = type === "bytes";
2264
+ }
2265
+ } else if (type.startsWith("uint") || type.startsWith("int")) {
2266
+ compiled.kind = "number";
2267
+ compiled.signed = type.startsWith("int");
2268
+ compiled.size = Number.parseInt(type.split("int")[1] || "256", 10);
2269
+ } else if (type === "string") {
2270
+ compiled.kind = "string";
2271
+ compiled.dynamic = true;
2272
+ }
2273
+ return compiled;
2274
+ }
2275
+ function decodeParameter(cursor, param, budget, staticPosition) {
2276
+ lastSize = 32;
2277
+ switch (param.kind) {
2278
+ case "address":
2279
+ return decodeAddress(cursor);
2280
+ case "array":
2281
+ return decodeArray(cursor, param, budget, staticPosition);
2282
+ case "bool":
2283
+ return decodeBool(cursor);
2284
+ case "bytes":
2285
+ return decodeBytes(cursor, budget, staticPosition);
2286
+ case "fixedBytes":
2287
+ return bytesToHex(cursor.readBytes(param.size, 32));
2288
+ case "number":
2289
+ return decodeNumber(cursor, param);
2290
+ case "string":
2291
+ return decodeString(cursor, budget, staticPosition);
2292
+ case "tuple":
2293
+ return decodeTuple(cursor, param, budget, staticPosition);
2294
+ }
2295
+ const type = param.param.type;
2296
+ getArrayComponents(type);
2297
+ throw new InvalidAbiDecodingTypeError(type, {
2298
+ docsPath: "/docs/contract/decodeAbiParameters"
2299
+ });
2300
+ }
2301
+ function readNumber(cursor) {
2302
+ return wordToNumber(cursor.readBytes(32));
2303
+ }
2304
+ function wordToNumber(word2, signed) {
2305
+ let high = 0;
2306
+ for (let i = 0; i < 25; i++)
2307
+ high |= word2[i];
2308
+ if (high === 0 && word2[25] < 32)
2309
+ return (word2[25] << 16 | word2[26] << 8 | word2[27]) * 4294967296 + ((word2[28] << 24 | word2[29] << 16 | word2[30] << 8 | word2[31]) >>> 0);
2310
+ return bytesToNumber(word2, { signed });
2311
+ }
2312
+ function decodeAddress(cursor) {
2313
+ const value = cursor.readBytes(32);
2314
+ return checksumAddress(bytesToHex(value.subarray(12)));
2315
+ }
2316
+ function decodeArray(cursor, param, budget, staticPosition) {
2317
+ const child = param.child;
2318
+ if (param.length === null) {
2319
+ const offset = readNumber(cursor);
2320
+ const start = staticPosition + offset;
2321
+ const startOfData = start + 32;
2322
+ cursor.setPosition(start);
2323
+ const length = readNumber(cursor);
2324
+ let consumed2 = 0;
2325
+ const value2 = [];
2326
+ for (let i = 0; i < length; ++i) {
2327
+ cursor.setPosition(startOfData + (child.dynamic ? i * 32 : consumed2));
2328
+ value2.push(decodeParameter(cursor, child, budget, startOfData));
2329
+ consumed2 += lastSize;
2330
+ if (lastSize === 0) {
2331
+ cursor.assertReadLimit();
2332
+ cursor._touch();
2333
+ }
2334
+ }
2335
+ cursor.setPosition(staticPosition + 32);
2336
+ lastSize = 32;
2337
+ return value2;
2338
+ }
2339
+ if (child.dynamic) {
2340
+ const offset = readNumber(cursor);
2341
+ const start = staticPosition + offset;
2342
+ const value2 = [];
2343
+ for (let i = 0; i < param.length; ++i) {
2344
+ cursor.setPosition(start + i * 32);
2345
+ value2.push(decodeParameter(cursor, child, budget, start));
2346
+ }
2347
+ cursor.setPosition(staticPosition + 32);
2348
+ lastSize = 32;
2349
+ return value2;
2350
+ }
2351
+ let consumed = 0;
2352
+ const value = [];
2353
+ for (let i = 0; i < param.length; ++i) {
2354
+ value.push(decodeParameter(cursor, child, budget, staticPosition + consumed));
2355
+ consumed += lastSize;
2356
+ if (lastSize === 0) {
2357
+ cursor.assertReadLimit();
2358
+ cursor._touch();
2359
+ }
2360
+ }
2361
+ lastSize = consumed;
2362
+ return value;
2363
+ }
2364
+ function decodeBool(cursor) {
2365
+ const value = cursor.readBytes(32);
2366
+ let high = 0;
2367
+ for (let i = 0; i < 31; i++)
2368
+ high |= value[i];
2369
+ if (high === 0 && value[31] <= 1)
2370
+ return value[31] === 1;
2371
+ return bytesToBool(value, { size: 32 });
2372
+ }
2373
+ function decodeBytes(cursor, budget, staticPosition) {
2374
+ const offset = readNumber(cursor);
2375
+ cursor.setPosition(staticPosition + offset);
2376
+ const length = readNumber(cursor);
2377
+ if (length === 0) {
2378
+ cursor.setPosition(staticPosition + 32);
2379
+ return "0x";
2380
+ }
2381
+ const data = cursor.readBytes(length);
2382
+ budget.used += length;
2383
+ if (budget.used > budget.limit)
2384
+ throw new AbiDecodingSizeLimitExceededError({ limit: budget.limit });
2385
+ cursor.setPosition(staticPosition + 32);
2386
+ return bytesToHex(data);
2387
+ }
2388
+ function decodeNumber(cursor, param) {
2389
+ const { signed, size: size2 } = param;
2390
+ const position = cursor.position;
2391
+ const value = cursor.readBytes(32);
2392
+ if (!(size2 > 48))
2393
+ return wordToNumber(value, signed);
2394
+ const view = cursor.dataView;
2395
+ const result = view.getBigUint64(position) << 192n | view.getBigUint64(position + 8) << 128n | view.getBigUint64(position + 16) << 64n | view.getBigUint64(position + 24);
2396
+ if (signed && value[0] >= 128)
2397
+ return result - (1n << 256n);
2398
+ return result;
2399
+ }
2400
+ function decodeTuple(cursor, param, budget, staticPosition) {
2401
+ const { components, unnamed } = param;
2402
+ if (!components) {
2403
+ readComponents(param.param);
2404
+ throw new InvalidAbiDecodingTypeError(param.param.type, {
2405
+ docsPath: "/docs/contract/decodeAbiParameters"
2406
+ });
2407
+ }
2408
+ const value = unnamed ? [] : {};
2409
+ let consumed = 0;
2410
+ if (param.dynamic) {
2411
+ const offset = readNumber(cursor);
2412
+ const start = staticPosition + offset;
2413
+ for (let i = 0; i < components.length; ++i) {
2414
+ const component = components[i];
2415
+ cursor.setPosition(start + consumed);
2416
+ const data = decodeParameter(cursor, component, budget, start);
2417
+ consumed += lastSize;
2418
+ value[unnamed ? i : component.param.name] = data;
2419
+ }
2420
+ cursor.setPosition(staticPosition + 32);
2421
+ lastSize = 32;
2422
+ return value;
2423
+ }
2424
+ for (let i = 0; i < components.length; ++i) {
2425
+ const component = components[i];
2426
+ const data = decodeParameter(cursor, component, budget, staticPosition);
2427
+ value[unnamed ? i : component.param.name] = data;
2428
+ consumed += lastSize;
2429
+ }
2430
+ lastSize = consumed;
2431
+ return value;
2432
+ }
2433
+ function readComponents(param) {
2434
+ return param.components.length === 0 || param.components.some(({ name }) => !name);
2435
+ }
2436
+ function decodeString(cursor, budget, staticPosition) {
2437
+ const offset = readNumber(cursor);
2438
+ const start = staticPosition + offset;
2439
+ cursor.setPosition(start);
2440
+ const length = readNumber(cursor);
2441
+ if (length === 0) {
2442
+ cursor.setPosition(staticPosition + 32);
2443
+ return "";
2444
+ }
2445
+ const data = cursor.readBytes(length, 32);
2446
+ budget.used += length;
2447
+ if (budget.used > budget.limit)
2448
+ throw new AbiDecodingSizeLimitExceededError({ limit: budget.limit });
2449
+ const value = (decoder ??= new TextDecoder("utf-8", {
2450
+ ignoreBOM: true
2451
+ })).decode(data);
2452
+ cursor.setPosition(staticPosition + 32);
2453
+ return value;
2454
+ }
2455
+ var lastSize, decoder, AbiDecodingSizeLimitExceededError;
2456
+ var init_decodeAbiParameters = __esm({
2457
+ "../node_modules/viem/_esm/utils/abi/decodeAbiParameters.js"() {
2458
+ init_abi();
2459
+ init_base();
2460
+ init_getAddress();
2461
+ init_cursor2();
2462
+ init_size();
2463
+ init_fromBytes();
2464
+ init_toBytes();
2465
+ init_toHex();
2466
+ init_encodeAbiParameters();
2467
+ lastSize = 0;
2468
+ AbiDecodingSizeLimitExceededError = class extends BaseError {
2469
+ constructor({ limit }) {
2470
+ super(`Decoded \`bytes\` and \`string\` values exceed the size limit of ${limit} bytes.`, { name: "AbiDecodingSizeLimitExceededError" });
2471
+ }
2472
+ };
2473
+ }
2474
+ });
2475
+
2476
+ // ../node_modules/viem/_esm/utils/abi/decodeErrorResult.js
2477
+ function decodeErrorResult(parameters) {
2478
+ const { abi, data, cause } = parameters;
2479
+ const signature = slice(data, 0, 4);
2480
+ if (signature === "0x")
2481
+ throw new AbiDecodingZeroDataError({ cause });
2482
+ const abi_ = [...abi || [], solidityError, solidityPanic];
2483
+ const abiItem = abi_.find((x) => x.type === "error" && signature === toFunctionSelector(formatAbiItem2(x)));
2484
+ if (!abiItem)
2485
+ throw new AbiErrorSignatureNotFoundError(signature, {
2486
+ docsPath: "/docs/contract/decodeErrorResult",
2487
+ cause
2488
+ });
2489
+ return {
2490
+ abiItem,
2491
+ args: "inputs" in abiItem && abiItem.inputs && abiItem.inputs.length > 0 ? decodeAbiParameters(abiItem.inputs, slice(data, 4)) : void 0,
2492
+ errorName: abiItem.name
2493
+ };
2494
+ }
2495
+ var init_decodeErrorResult = __esm({
2496
+ "../node_modules/viem/_esm/utils/abi/decodeErrorResult.js"() {
2497
+ init_solidity();
2498
+ init_abi();
2499
+ init_slice();
2500
+ init_toFunctionSelector();
2501
+ init_decodeAbiParameters();
2502
+ init_formatAbiItem2();
2503
+ }
2504
+ });
2505
+
2506
+ // ../node_modules/viem/_esm/constants/number.js
2507
+ var maxInt8, maxInt16, maxInt24, maxInt32, maxInt40, maxInt48, maxInt56, maxInt64, maxInt72, maxInt80, maxInt88, maxInt96, maxInt104, maxInt112, maxInt120, maxInt128, maxInt136, maxInt144, maxInt152, maxInt160, maxInt168, maxInt176, maxInt184, maxInt192, maxInt200, maxInt208, maxInt216, maxInt224, maxInt232, maxInt240, maxInt248, maxInt256, minInt8, minInt16, minInt24, minInt32, minInt40, minInt48, minInt56, minInt64, minInt72, minInt80, minInt88, minInt96, minInt104, minInt112, minInt120, minInt128, minInt136, minInt144, minInt152, minInt160, minInt168, minInt176, minInt184, minInt192, minInt200, minInt208, minInt216, minInt224, minInt232, minInt240, minInt248, minInt256, maxUint8, maxUint16, maxUint24, maxUint32, maxUint40, maxUint48, maxUint56, maxUint64, maxUint72, maxUint80, maxUint88, maxUint96, maxUint104, maxUint112, maxUint120, maxUint128, maxUint136, maxUint144, maxUint152, maxUint160, maxUint168, maxUint176, maxUint184, maxUint192, maxUint200, maxUint208, maxUint216, maxUint224, maxUint232, maxUint240, maxUint248, maxUint256;
2508
+ var init_number = __esm({
2509
+ "../node_modules/viem/_esm/constants/number.js"() {
2510
+ maxInt8 = 2n ** (8n - 1n) - 1n;
2511
+ maxInt16 = 2n ** (16n - 1n) - 1n;
2512
+ maxInt24 = 2n ** (24n - 1n) - 1n;
2513
+ maxInt32 = 2n ** (32n - 1n) - 1n;
2514
+ maxInt40 = 2n ** (40n - 1n) - 1n;
2515
+ maxInt48 = 2n ** (48n - 1n) - 1n;
2516
+ maxInt56 = 2n ** (56n - 1n) - 1n;
2517
+ maxInt64 = 2n ** (64n - 1n) - 1n;
2518
+ maxInt72 = 2n ** (72n - 1n) - 1n;
2519
+ maxInt80 = 2n ** (80n - 1n) - 1n;
2520
+ maxInt88 = 2n ** (88n - 1n) - 1n;
2521
+ maxInt96 = 2n ** (96n - 1n) - 1n;
2522
+ maxInt104 = 2n ** (104n - 1n) - 1n;
2523
+ maxInt112 = 2n ** (112n - 1n) - 1n;
2524
+ maxInt120 = 2n ** (120n - 1n) - 1n;
2525
+ maxInt128 = 2n ** (128n - 1n) - 1n;
2526
+ maxInt136 = 2n ** (136n - 1n) - 1n;
2527
+ maxInt144 = 2n ** (144n - 1n) - 1n;
2528
+ maxInt152 = 2n ** (152n - 1n) - 1n;
2529
+ maxInt160 = 2n ** (160n - 1n) - 1n;
2530
+ maxInt168 = 2n ** (168n - 1n) - 1n;
2531
+ maxInt176 = 2n ** (176n - 1n) - 1n;
2532
+ maxInt184 = 2n ** (184n - 1n) - 1n;
2533
+ maxInt192 = 2n ** (192n - 1n) - 1n;
2534
+ maxInt200 = 2n ** (200n - 1n) - 1n;
2535
+ maxInt208 = 2n ** (208n - 1n) - 1n;
2536
+ maxInt216 = 2n ** (216n - 1n) - 1n;
2537
+ maxInt224 = 2n ** (224n - 1n) - 1n;
2538
+ maxInt232 = 2n ** (232n - 1n) - 1n;
2539
+ maxInt240 = 2n ** (240n - 1n) - 1n;
2540
+ maxInt248 = 2n ** (248n - 1n) - 1n;
2541
+ maxInt256 = 2n ** (256n - 1n) - 1n;
2542
+ minInt8 = -(2n ** (8n - 1n));
2543
+ minInt16 = -(2n ** (16n - 1n));
2544
+ minInt24 = -(2n ** (24n - 1n));
2545
+ minInt32 = -(2n ** (32n - 1n));
2546
+ minInt40 = -(2n ** (40n - 1n));
2547
+ minInt48 = -(2n ** (48n - 1n));
2548
+ minInt56 = -(2n ** (56n - 1n));
2549
+ minInt64 = -(2n ** (64n - 1n));
2550
+ minInt72 = -(2n ** (72n - 1n));
2551
+ minInt80 = -(2n ** (80n - 1n));
2552
+ minInt88 = -(2n ** (88n - 1n));
2553
+ minInt96 = -(2n ** (96n - 1n));
2554
+ minInt104 = -(2n ** (104n - 1n));
2555
+ minInt112 = -(2n ** (112n - 1n));
2556
+ minInt120 = -(2n ** (120n - 1n));
2557
+ minInt128 = -(2n ** (128n - 1n));
2558
+ minInt136 = -(2n ** (136n - 1n));
2559
+ minInt144 = -(2n ** (144n - 1n));
2560
+ minInt152 = -(2n ** (152n - 1n));
2561
+ minInt160 = -(2n ** (160n - 1n));
2562
+ minInt168 = -(2n ** (168n - 1n));
2563
+ minInt176 = -(2n ** (176n - 1n));
2564
+ minInt184 = -(2n ** (184n - 1n));
2565
+ minInt192 = -(2n ** (192n - 1n));
2566
+ minInt200 = -(2n ** (200n - 1n));
2567
+ minInt208 = -(2n ** (208n - 1n));
2568
+ minInt216 = -(2n ** (216n - 1n));
2569
+ minInt224 = -(2n ** (224n - 1n));
2570
+ minInt232 = -(2n ** (232n - 1n));
2571
+ minInt240 = -(2n ** (240n - 1n));
2572
+ minInt248 = -(2n ** (248n - 1n));
2573
+ minInt256 = -(2n ** (256n - 1n));
2574
+ maxUint8 = 2n ** 8n - 1n;
2575
+ maxUint16 = 2n ** 16n - 1n;
2576
+ maxUint24 = 2n ** 24n - 1n;
2577
+ maxUint32 = 2n ** 32n - 1n;
2578
+ maxUint40 = 2n ** 40n - 1n;
2579
+ maxUint48 = 2n ** 48n - 1n;
2580
+ maxUint56 = 2n ** 56n - 1n;
2581
+ maxUint64 = 2n ** 64n - 1n;
2582
+ maxUint72 = 2n ** 72n - 1n;
2583
+ maxUint80 = 2n ** 80n - 1n;
2584
+ maxUint88 = 2n ** 88n - 1n;
2585
+ maxUint96 = 2n ** 96n - 1n;
2586
+ maxUint104 = 2n ** 104n - 1n;
2587
+ maxUint112 = 2n ** 112n - 1n;
2588
+ maxUint120 = 2n ** 120n - 1n;
2589
+ maxUint128 = 2n ** 128n - 1n;
2590
+ maxUint136 = 2n ** 136n - 1n;
2591
+ maxUint144 = 2n ** 144n - 1n;
2592
+ maxUint152 = 2n ** 152n - 1n;
2593
+ maxUint160 = 2n ** 160n - 1n;
2594
+ maxUint168 = 2n ** 168n - 1n;
2595
+ maxUint176 = 2n ** 176n - 1n;
2596
+ maxUint184 = 2n ** 184n - 1n;
2597
+ maxUint192 = 2n ** 192n - 1n;
2598
+ maxUint200 = 2n ** 200n - 1n;
2599
+ maxUint208 = 2n ** 208n - 1n;
2600
+ maxUint216 = 2n ** 216n - 1n;
2601
+ maxUint224 = 2n ** 224n - 1n;
2602
+ maxUint232 = 2n ** 232n - 1n;
2603
+ maxUint240 = 2n ** 240n - 1n;
2604
+ maxUint248 = 2n ** 248n - 1n;
2605
+ maxUint256 = 2n ** 256n - 1n;
2606
+ }
2607
+ });
2608
+
2609
+ // ../node_modules/viem/_esm/constants/abis.js
2610
+ var universalResolverErrors, universalResolverResolveAbi, universalResolverReverseAbi, erc20Abi2;
2611
+ var init_abis = __esm({
2612
+ "../node_modules/viem/_esm/constants/abis.js"() {
2613
+ universalResolverErrors = [
2614
+ {
2615
+ inputs: [
2616
+ {
2617
+ name: "dns",
2618
+ type: "bytes"
2619
+ }
2620
+ ],
2621
+ name: "DNSDecodingFailed",
2622
+ type: "error"
2623
+ },
2624
+ {
2625
+ inputs: [
2626
+ {
2627
+ name: "ens",
2628
+ type: "string"
2629
+ }
2630
+ ],
2631
+ name: "DNSEncodingFailed",
2632
+ type: "error"
2633
+ },
2634
+ {
2635
+ inputs: [],
2636
+ name: "EmptyAddress",
2637
+ type: "error"
2638
+ },
2639
+ {
2640
+ inputs: [
2641
+ {
2642
+ name: "status",
2643
+ type: "uint16"
2644
+ },
2645
+ {
2646
+ name: "message",
2647
+ type: "string"
2648
+ }
2649
+ ],
2650
+ name: "HttpError",
2651
+ type: "error"
2652
+ },
2653
+ {
2654
+ inputs: [],
2655
+ name: "InvalidBatchGatewayResponse",
2656
+ type: "error"
2657
+ },
2658
+ {
2659
+ inputs: [
2660
+ {
2661
+ name: "errorData",
2662
+ type: "bytes"
2663
+ }
2664
+ ],
2665
+ name: "ResolverError",
2666
+ type: "error"
2667
+ },
2668
+ {
2669
+ inputs: [
2670
+ {
2671
+ name: "name",
2672
+ type: "bytes"
2673
+ },
2674
+ {
2675
+ name: "resolver",
2676
+ type: "address"
2677
+ }
2678
+ ],
2679
+ name: "ResolverNotContract",
2680
+ type: "error"
2681
+ },
2682
+ {
2683
+ inputs: [
2684
+ {
2685
+ name: "name",
2686
+ type: "bytes"
2687
+ }
2688
+ ],
2689
+ name: "ResolverNotFound",
2690
+ type: "error"
2691
+ },
2692
+ {
2693
+ inputs: [
2694
+ {
2695
+ name: "primary",
2696
+ type: "string"
2697
+ },
2698
+ {
2699
+ name: "primaryAddress",
2700
+ type: "bytes"
2701
+ }
2702
+ ],
2703
+ name: "ReverseAddressMismatch",
2704
+ type: "error"
2705
+ },
2706
+ {
2707
+ inputs: [
2708
+ {
2709
+ internalType: "bytes4",
2710
+ name: "selector",
2711
+ type: "bytes4"
2712
+ }
2713
+ ],
2714
+ name: "UnsupportedResolverProfile",
2715
+ type: "error"
2716
+ }
2717
+ ];
2718
+ universalResolverResolveAbi = [
2719
+ ...universalResolverErrors,
2720
+ {
2721
+ name: "resolveWithGateways",
2722
+ type: "function",
2723
+ stateMutability: "view",
2724
+ inputs: [
2725
+ { name: "name", type: "bytes" },
2726
+ { name: "data", type: "bytes" },
2727
+ { name: "gateways", type: "string[]" }
2728
+ ],
2729
+ outputs: [
2730
+ { name: "", type: "bytes" },
2731
+ { name: "address", type: "address" }
2732
+ ]
2733
+ }
2734
+ ];
2735
+ universalResolverReverseAbi = [
2736
+ ...universalResolverErrors,
2737
+ {
2738
+ name: "reverseWithGateways",
2739
+ type: "function",
2740
+ stateMutability: "view",
2741
+ inputs: [
2742
+ { type: "bytes", name: "reverseName" },
2743
+ { type: "uint256", name: "coinType" },
2744
+ { type: "string[]", name: "gateways" }
2745
+ ],
2746
+ outputs: [
2747
+ { type: "string", name: "resolvedName" },
2748
+ { type: "address", name: "resolver" },
2749
+ { type: "address", name: "reverseResolver" }
2750
+ ]
2751
+ }
2752
+ ];
2753
+ erc20Abi2 = [
2754
+ {
2755
+ type: "event",
2756
+ name: "Approval",
2757
+ inputs: [
2758
+ {
2759
+ indexed: true,
2760
+ name: "owner",
2761
+ type: "address"
2762
+ },
2763
+ {
2764
+ indexed: true,
2765
+ name: "spender",
2766
+ type: "address"
2767
+ },
2768
+ {
2769
+ indexed: false,
2770
+ name: "value",
2771
+ type: "uint256"
2772
+ }
2773
+ ]
2774
+ },
2775
+ {
2776
+ type: "event",
2777
+ name: "Transfer",
2778
+ inputs: [
2779
+ {
2780
+ indexed: true,
2781
+ name: "from",
2782
+ type: "address"
2783
+ },
2784
+ {
2785
+ indexed: true,
2786
+ name: "to",
2787
+ type: "address"
2788
+ },
2789
+ {
2790
+ indexed: false,
2791
+ name: "value",
2792
+ type: "uint256"
2793
+ }
2794
+ ]
2795
+ },
2796
+ {
2797
+ type: "function",
2798
+ name: "allowance",
2799
+ stateMutability: "view",
2800
+ inputs: [
2801
+ {
2802
+ name: "owner",
2803
+ type: "address"
2804
+ },
2805
+ {
2806
+ name: "spender",
2807
+ type: "address"
2808
+ }
2809
+ ],
2810
+ outputs: [
2811
+ {
2812
+ type: "uint256"
2813
+ }
2814
+ ]
2815
+ },
2816
+ {
2817
+ type: "function",
2818
+ name: "approve",
2819
+ stateMutability: "nonpayable",
2820
+ inputs: [
2821
+ {
2822
+ name: "spender",
2823
+ type: "address"
2824
+ },
2825
+ {
2826
+ name: "amount",
2827
+ type: "uint256"
2828
+ }
2829
+ ],
2830
+ outputs: [
2831
+ {
2832
+ type: "bool"
2833
+ }
2834
+ ]
2835
+ },
2836
+ {
2837
+ type: "function",
2838
+ name: "balanceOf",
2839
+ stateMutability: "view",
2840
+ inputs: [
2841
+ {
2842
+ name: "account",
2843
+ type: "address"
2844
+ }
2845
+ ],
2846
+ outputs: [
2847
+ {
2848
+ type: "uint256"
2849
+ }
2850
+ ]
2851
+ },
2852
+ {
2853
+ type: "function",
2854
+ name: "decimals",
2855
+ stateMutability: "view",
2856
+ inputs: [],
2857
+ outputs: [
2858
+ {
2859
+ type: "uint8"
2860
+ }
2861
+ ]
2862
+ },
2863
+ {
2864
+ type: "function",
2865
+ name: "name",
2866
+ stateMutability: "view",
2867
+ inputs: [],
2868
+ outputs: [
2869
+ {
2870
+ type: "string"
2871
+ }
2872
+ ]
2873
+ },
2874
+ {
2875
+ type: "function",
2876
+ name: "symbol",
2877
+ stateMutability: "view",
2878
+ inputs: [],
2879
+ outputs: [
2880
+ {
2881
+ type: "string"
2882
+ }
2883
+ ]
2884
+ },
2885
+ {
2886
+ type: "function",
2887
+ name: "totalSupply",
2888
+ stateMutability: "view",
2889
+ inputs: [],
2890
+ outputs: [
2891
+ {
2892
+ type: "uint256"
2893
+ }
2894
+ ]
2895
+ },
2896
+ {
2897
+ type: "function",
2898
+ name: "transfer",
2899
+ stateMutability: "nonpayable",
2900
+ inputs: [
2901
+ {
2902
+ name: "recipient",
2903
+ type: "address"
2904
+ },
2905
+ {
2906
+ name: "amount",
2907
+ type: "uint256"
2908
+ }
2909
+ ],
2910
+ outputs: [
2911
+ {
2912
+ type: "bool"
2913
+ }
2914
+ ]
2915
+ },
2916
+ {
2917
+ type: "function",
2918
+ name: "transferFrom",
2919
+ stateMutability: "nonpayable",
2920
+ inputs: [
2921
+ {
2922
+ name: "sender",
2923
+ type: "address"
2924
+ },
2925
+ {
2926
+ name: "recipient",
2927
+ type: "address"
2928
+ },
2929
+ {
2930
+ name: "amount",
2931
+ type: "uint256"
2932
+ }
2933
+ ],
2934
+ outputs: [
2935
+ {
2936
+ type: "bool"
2937
+ }
2938
+ ]
2939
+ }
2940
+ ];
2941
+ }
2942
+ });
2943
+
2944
+ // ../node_modules/viem/_esm/utils/abi/decodeFunctionData.js
2945
+ function decodeFunctionData(parameters) {
2946
+ const { abi, data } = parameters;
2947
+ const signature = slice(data, 0, 4);
2948
+ const description = abi.find((x) => x.type === "function" && signature === toFunctionSelector(formatAbiItem2(x)));
2949
+ if (!description)
2950
+ throw new AbiFunctionSignatureNotFoundError(signature, {
2951
+ docsPath: "/docs/contract/decodeFunctionData"
2952
+ });
2953
+ return {
2954
+ functionName: description.name,
2955
+ args: "inputs" in description && description.inputs && description.inputs.length > 0 ? decodeAbiParameters(description.inputs, slice(data, 4)) : void 0
2956
+ };
2957
+ }
2958
+ var init_decodeFunctionData = __esm({
2959
+ "../node_modules/viem/_esm/utils/abi/decodeFunctionData.js"() {
2960
+ init_abi();
2961
+ init_slice();
2962
+ init_toFunctionSelector();
2963
+ init_decodeAbiParameters();
2964
+ init_formatAbiItem2();
2965
+ }
2966
+ });
2967
+
2968
+ // src/abis.ts
2969
+ var abis_exports = {};
2970
+ __export(abis_exports, {
2971
+ accountAbi: () => accountAbi,
2972
+ acrossAbi: () => acrossAbi,
2973
+ adapterAbi: () => adapterAbi,
2974
+ automationAbi: () => automationAbi,
2975
+ dcaAbi: () => dcaAbi,
2976
+ entryPointAbi: () => entryPointAbi,
2977
+ erc20Abi: () => erc20Abi,
2978
+ erc4626Abi: () => erc4626Abi,
2979
+ factoryAbi: () => factoryAbi,
2980
+ familyTransferAbi: () => familyTransferAbi,
2981
+ flapAbi: () => flapAbi,
2982
+ gateAbi: () => gateAbi,
2983
+ morphoBlueAbi: () => morphoBlueAbi,
2984
+ ponsAbi: () => ponsAbi,
2985
+ rebalanceAbi: () => rebalanceAbi,
2986
+ rootValidatorAbi: () => rootValidatorAbi,
2987
+ routerAbi: () => routerAbi,
2988
+ safe7579Abi: () => safe7579Abi,
2989
+ signerAbi: () => signerAbi,
2990
+ subVaultsAbi: () => subVaultsAbi,
2991
+ timelockAbi: () => timelockAbi,
2992
+ transferAbi: () => transferAbi,
2993
+ uniswapV3Abi: () => uniswapV3Abi,
2994
+ uniswapV3LiquidityAbi: () => uniswapV3LiquidityAbi,
2995
+ uniswapV4Abi: () => uniswapV4Abi,
2996
+ uniswapV4LiquidityAbi: () => uniswapV4LiquidityAbi,
2997
+ wethAbi: () => wethAbi
2998
+ });
2999
+ var gateAbi = [{ "type": "function", "name": "ENTRY_POINT", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "PERMIT2", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "acceptChild", "inputs": [{ "name": "child", "type": "address", "internalType": "address" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "agentUntil", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }, { "name": "agent", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "uint64", "internalType": "uint64" }], "stateMutability": "view" }, { "type": "function", "name": "canUse", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }, { "name": "actor", "type": "address", "internalType": "address" }, { "name": "adapter", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], "stateMutability": "view" }, { "type": "function", "name": "cap", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }, { "name": "actor", "type": "address", "internalType": "address" }, { "name": "token", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "tuple", "internalType": "struct MortiseGate.Cap", "components": [{ "name": "limit", "type": "uint128", "internalType": "uint128" }, { "name": "used", "type": "uint128", "internalType": "uint128" }, { "name": "period", "type": "uint64", "internalType": "uint64" }, { "name": "windowStart", "type": "uint64", "internalType": "uint64" }] }], "stateMutability": "view" }, { "type": "function", "name": "childCount", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "epoch", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "execute", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }, { "name": "actions", "type": "tuple[]", "internalType": "struct Action[]", "components": [{ "name": "adapter", "type": "address", "internalType": "address" }, { "name": "data", "type": "bytes", "internalType": "bytes" }] }], "outputs": [{ "name": "results", "type": "bytes[][]", "internalType": "bytes[][]" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "hasOpenFloor", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }, { "name": "actor", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], "stateMutability": "view" }, { "type": "function", "name": "hasOpenMarkets", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }, { "name": "actor", "type": "address", "internalType": "address" }, { "name": "adapter", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], "stateMutability": "view" }, { "type": "function", "name": "installed", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], "stateMutability": "view" }, { "type": "function", "name": "isAgent", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }, { "name": "agent", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], "stateMutability": "view" }, { "type": "function", "name": "isFamily", "inputs": [{ "name": "a", "type": "address", "internalType": "address" }, { "name": "b", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], "stateMutability": "view" }, { "type": "function", "name": "isInitialized", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], "stateMutability": "view" }, { "type": "function", "name": "isMarket", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }, { "name": "adapter", "type": "address", "internalType": "address" }, { "name": "market", "type": "bytes32", "internalType": "bytes32" }], "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], "stateMutability": "view" }, { "type": "function", "name": "isModule", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }, { "name": "module", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], "stateMutability": "view" }, { "type": "function", "name": "isModuleType", "inputs": [{ "name": "moduleTypeId", "type": "uint256", "internalType": "uint256" }], "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], "stateMutability": "pure" }, { "type": "function", "name": "isPaused", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], "stateMutability": "view" }, { "type": "function", "name": "liveParent", "inputs": [{ "name": "child", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "minRate", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }, { "name": "tokenIn", "type": "address", "internalType": "address" }, { "name": "tokenOut", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "moduleState", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }, { "name": "module", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "bytes", "internalType": "bytes" }], "stateMutability": "view" }, { "type": "function", "name": "onInstall", "inputs": [{ "name": "", "type": "bytes", "internalType": "bytes" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "onUninstall", "inputs": [{ "name": "", "type": "bytes", "internalType": "bytes" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "parentEpoch", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "parentVault", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "pause", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "pauser", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "proposeParent", "inputs": [{ "name": "parent", "type": "address", "internalType": "address" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "proposedParent", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "setAdapterAccess", "inputs": [{ "name": "actor", "type": "address", "internalType": "address" }, { "name": "adapter", "type": "address", "internalType": "address" }, { "name": "allowed", "type": "bool", "internalType": "bool" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "setAgent", "inputs": [{ "name": "agent", "type": "address", "internalType": "address" }, { "name": "until", "type": "uint64", "internalType": "uint64" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "setCap", "inputs": [{ "name": "actor", "type": "address", "internalType": "address" }, { "name": "token", "type": "address", "internalType": "address" }, { "name": "limit", "type": "uint128", "internalType": "uint128" }, { "name": "period", "type": "uint64", "internalType": "uint64" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "setMarket", "inputs": [{ "name": "adapter", "type": "address", "internalType": "address" }, { "name": "market", "type": "bytes32", "internalType": "bytes32" }, { "name": "allowed", "type": "bool", "internalType": "bool" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "setMinRate", "inputs": [{ "name": "tokenIn", "type": "address", "internalType": "address" }, { "name": "tokenOut", "type": "address", "internalType": "address" }, { "name": "rate", "type": "uint256", "internalType": "uint256" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "setModule", "inputs": [{ "name": "module", "type": "address", "internalType": "address" }, { "name": "enabled", "type": "bool", "internalType": "bool" }, { "name": "initState", "type": "bytes", "internalType": "bytes" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "setOpenFloor", "inputs": [{ "name": "actor", "type": "address", "internalType": "address" }, { "name": "open", "type": "bool", "internalType": "bool" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "setOpenMarkets", "inputs": [{ "name": "actor", "type": "address", "internalType": "address" }, { "name": "adapter", "type": "address", "internalType": "address" }, { "name": "open", "type": "bool", "internalType": "bool" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "setPauser", "inputs": [{ "name": "newPauser", "type": "address", "internalType": "address" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "trigger", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }, { "name": "module", "type": "address", "internalType": "address" }], "outputs": [{ "name": "results", "type": "bytes[][]", "internalType": "bytes[][]" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "unlink", "inputs": [{ "name": "child", "type": "address", "internalType": "address" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "unpause", "inputs": [], "outputs": [], "stateMutability": "nonpayable" }, { "type": "event", "name": "ActionExecuted", "inputs": [{ "name": "vault", "type": "address", "indexed": true, "internalType": "address" }, { "name": "actor", "type": "address", "indexed": true, "internalType": "address" }, { "name": "adapter", "type": "address", "indexed": true, "internalType": "address" }, { "name": "market", "type": "bytes32", "indexed": false, "internalType": "bytes32" }], "anonymous": false }, { "type": "event", "name": "AdapterAccessSet", "inputs": [{ "name": "vault", "type": "address", "indexed": true, "internalType": "address" }, { "name": "actor", "type": "address", "indexed": true, "internalType": "address" }, { "name": "adapter", "type": "address", "indexed": true, "internalType": "address" }, { "name": "allowed", "type": "bool", "indexed": false, "internalType": "bool" }], "anonymous": false }, { "type": "event", "name": "AgentSet", "inputs": [{ "name": "vault", "type": "address", "indexed": true, "internalType": "address" }, { "name": "agent", "type": "address", "indexed": true, "internalType": "address" }, { "name": "until", "type": "uint64", "indexed": false, "internalType": "uint64" }], "anonymous": false }, { "type": "event", "name": "CapSet", "inputs": [{ "name": "vault", "type": "address", "indexed": true, "internalType": "address" }, { "name": "actor", "type": "address", "indexed": true, "internalType": "address" }, { "name": "token", "type": "address", "indexed": true, "internalType": "address" }, { "name": "limit", "type": "uint128", "indexed": false, "internalType": "uint128" }, { "name": "period", "type": "uint64", "indexed": false, "internalType": "uint64" }], "anonymous": false }, { "type": "event", "name": "FamilyLinked", "inputs": [{ "name": "child", "type": "address", "indexed": true, "internalType": "address" }, { "name": "parentVault", "type": "address", "indexed": true, "internalType": "address" }, { "name": "childCount", "type": "uint256", "indexed": false, "internalType": "uint256" }], "anonymous": false }, { "type": "event", "name": "FamilyUnlinked", "inputs": [{ "name": "child", "type": "address", "indexed": true, "internalType": "address" }, { "name": "parentVault", "type": "address", "indexed": true, "internalType": "address" }, { "name": "childCount", "type": "uint256", "indexed": false, "internalType": "uint256" }], "anonymous": false }, { "type": "event", "name": "Installed", "inputs": [{ "name": "vault", "type": "address", "indexed": true, "internalType": "address" }, { "name": "epoch", "type": "uint256", "indexed": false, "internalType": "uint256" }], "anonymous": false }, { "type": "event", "name": "MarketSet", "inputs": [{ "name": "vault", "type": "address", "indexed": true, "internalType": "address" }, { "name": "adapter", "type": "address", "indexed": true, "internalType": "address" }, { "name": "market", "type": "bytes32", "indexed": true, "internalType": "bytes32" }, { "name": "allowed", "type": "bool", "indexed": false, "internalType": "bool" }], "anonymous": false }, { "type": "event", "name": "MinRateSet", "inputs": [{ "name": "vault", "type": "address", "indexed": true, "internalType": "address" }, { "name": "tokenIn", "type": "address", "indexed": true, "internalType": "address" }, { "name": "tokenOut", "type": "address", "indexed": true, "internalType": "address" }, { "name": "rate", "type": "uint256", "indexed": false, "internalType": "uint256" }], "anonymous": false }, { "type": "event", "name": "ModuleSet", "inputs": [{ "name": "vault", "type": "address", "indexed": true, "internalType": "address" }, { "name": "module", "type": "address", "indexed": true, "internalType": "address" }, { "name": "enabled", "type": "bool", "indexed": false, "internalType": "bool" }], "anonymous": false }, { "type": "event", "name": "OpenFloorSet", "inputs": [{ "name": "vault", "type": "address", "indexed": true, "internalType": "address" }, { "name": "actor", "type": "address", "indexed": true, "internalType": "address" }, { "name": "open", "type": "bool", "indexed": false, "internalType": "bool" }], "anonymous": false }, { "type": "event", "name": "OpenMarketsSet", "inputs": [{ "name": "vault", "type": "address", "indexed": true, "internalType": "address" }, { "name": "actor", "type": "address", "indexed": true, "internalType": "address" }, { "name": "adapter", "type": "address", "indexed": true, "internalType": "address" }, { "name": "open", "type": "bool", "indexed": false, "internalType": "bool" }], "anonymous": false }, { "type": "event", "name": "Paused", "inputs": [{ "name": "vault", "type": "address", "indexed": true, "internalType": "address" }, { "name": "by", "type": "address", "indexed": true, "internalType": "address" }], "anonymous": false }, { "type": "event", "name": "PauserSet", "inputs": [{ "name": "vault", "type": "address", "indexed": true, "internalType": "address" }, { "name": "pauser", "type": "address", "indexed": true, "internalType": "address" }], "anonymous": false }, { "type": "event", "name": "ProposedParentSet", "inputs": [{ "name": "child", "type": "address", "indexed": true, "internalType": "address" }, { "name": "proposedParent", "type": "address", "indexed": true, "internalType": "address" }], "anonymous": false }, { "type": "event", "name": "Uninstalled", "inputs": [{ "name": "vault", "type": "address", "indexed": true, "internalType": "address" }], "anonymous": false }, { "type": "event", "name": "Unpaused", "inputs": [{ "name": "vault", "type": "address", "indexed": true, "internalType": "address" }], "anonymous": false }, { "type": "error", "name": "AdapterNotAllowed", "inputs": [{ "name": "adapter", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "AllowanceLeft", "inputs": [{ "name": "token", "type": "address", "internalType": "address" }, { "name": "spender", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "AlreadyInitialized", "inputs": [{ "name": "smartAccount", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "BalanceUnreadable", "inputs": [{ "name": "token", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "BelowMinRate", "inputs": [{ "name": "spent", "type": "uint256", "internalType": "uint256" }, { "name": "received", "type": "uint256", "internalType": "uint256" }] }, { "type": "error", "name": "CallNotAllowed", "inputs": [{ "name": "target", "type": "address", "internalType": "address" }, { "name": "selector", "type": "bytes4", "internalType": "bytes4" }] }, { "type": "error", "name": "CapExceeded", "inputs": [{ "name": "token", "type": "address", "internalType": "address" }, { "name": "used", "type": "uint256", "internalType": "uint256" }, { "name": "limit", "type": "uint256", "internalType": "uint256" }] }, { "type": "error", "name": "DuplicateToken", "inputs": [{ "name": "token", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "EmptyPlan", "inputs": [] }, { "type": "error", "name": "ForbiddenTarget", "inputs": [{ "name": "target", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "InvalidPeriod", "inputs": [] }, { "type": "error", "name": "MalformedCall", "inputs": [{ "name": "target", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "MarketNotAllowed", "inputs": [{ "name": "adapter", "type": "address", "internalType": "address" }, { "name": "market", "type": "bytes32", "internalType": "bytes32" }] }, { "type": "error", "name": "NoMinRate", "inputs": [{ "name": "tokenIn", "type": "address", "internalType": "address" }, { "name": "tokenOut", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "NotAgent", "inputs": [{ "name": "agent", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "NotInitialized", "inputs": [{ "name": "smartAccount", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "NotInstalled", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "NotLinked", "inputs": [{ "name": "child", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "NotModule", "inputs": [{ "name": "module", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "NotPauser", "inputs": [{ "name": "caller", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "NotProposedParent", "inputs": [{ "name": "child", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "Reentrancy", "inputs": [] }, { "type": "error", "name": "SwapNotSettled", "inputs": [] }, { "type": "error", "name": "UndeclaredEth", "inputs": [] }, { "type": "error", "name": "UndeclaredToken", "inputs": [{ "name": "token", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "VaultPaused", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }] }];
3000
+ var rootValidatorAbi = [{ "type": "function", "name": "MAX_GUARDIANS", "inputs": [], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "MAX_MEMBERS", "inputs": [], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "MAX_RECOVERY_DELAY", "inputs": [], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "MIN_RECOVERY_DELAY", "inputs": [], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "approveRecovery", "inputs": [{ "name": "account", "type": "address", "internalType": "address" }, { "name": "newRoot", "type": "bytes", "internalType": "bytes" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "cancelRecovery", "inputs": [], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "executeRecovery", "inputs": [{ "name": "account", "type": "address", "internalType": "address" }, { "name": "newRoot", "type": "bytes", "internalType": "bytes" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "guardiansOf", "inputs": [{ "name": "account", "type": "address", "internalType": "address" }], "outputs": [{ "name": "guardians", "type": "address[]", "internalType": "address[]" }, { "name": "threshold", "type": "uint256", "internalType": "uint256" }, { "name": "delay", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "isInitialized", "inputs": [{ "name": "account", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], "stateMutability": "view" }, { "type": "function", "name": "isModuleType", "inputs": [{ "name": "moduleTypeId", "type": "uint256", "internalType": "uint256" }], "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], "stateMutability": "pure" }, { "type": "function", "name": "isPaymasterOnly", "inputs": [{ "name": "account", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], "stateMutability": "view" }, { "type": "function", "name": "isRootSignature", "inputs": [{ "name": "account", "type": "address", "internalType": "address" }, { "name": "hash", "type": "bytes32", "internalType": "bytes32" }, { "name": "signature", "type": "bytes", "internalType": "bytes" }], "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], "stateMutability": "view" }, { "type": "function", "name": "isValidSignatureWithSender", "inputs": [{ "name": "", "type": "address", "internalType": "address" }, { "name": "", "type": "bytes32", "internalType": "bytes32" }, { "name": "", "type": "bytes", "internalType": "bytes" }], "outputs": [{ "name": "", "type": "bytes4", "internalType": "bytes4" }], "stateMutability": "pure" }, { "type": "function", "name": "onInstall", "inputs": [{ "name": "data", "type": "bytes", "internalType": "bytes" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "onUninstall", "inputs": [{ "name": "", "type": "bytes", "internalType": "bytes" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "recoveryNonce", "inputs": [{ "name": "account", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "recoveryOf", "inputs": [{ "name": "account", "type": "address", "internalType": "address" }, { "name": "rootHash", "type": "bytes32", "internalType": "bytes32" }], "outputs": [{ "name": "", "type": "tuple", "internalType": "struct MortiseRootValidator.Recovery", "components": [{ "name": "approvals", "type": "uint256", "internalType": "uint256" }, { "name": "readyAt", "type": "uint256", "internalType": "uint256" }] }], "stateMutability": "view" }, { "type": "function", "name": "rootOf", "inputs": [{ "name": "account", "type": "address", "internalType": "address" }], "outputs": [{ "name": "members", "type": "tuple[]", "internalType": "struct MortiseRootValidator.Member[]", "components": [{ "name": "keyType", "type": "uint8", "internalType": "enum MortiseRootValidator.KeyType" }, { "name": "signer", "type": "address", "internalType": "address" }, { "name": "x", "type": "bytes32", "internalType": "bytes32" }, { "name": "y", "type": "bytes32", "internalType": "bytes32" }] }, { "name": "threshold", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "setGuardians", "inputs": [{ "name": "guardians", "type": "address[]", "internalType": "address[]" }, { "name": "threshold", "type": "uint256", "internalType": "uint256" }, { "name": "delay", "type": "uint256", "internalType": "uint256" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "setPaymasterOnly", "inputs": [{ "name": "required", "type": "bool", "internalType": "bool" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "setRootKey", "inputs": [{ "name": "data", "type": "bytes", "internalType": "bytes" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "validateUserOp", "inputs": [{ "name": "userOp", "type": "tuple", "internalType": "struct PackedUserOperation", "components": [{ "name": "sender", "type": "address", "internalType": "address" }, { "name": "nonce", "type": "uint256", "internalType": "uint256" }, { "name": "initCode", "type": "bytes", "internalType": "bytes" }, { "name": "callData", "type": "bytes", "internalType": "bytes" }, { "name": "accountGasLimits", "type": "bytes32", "internalType": "bytes32" }, { "name": "preVerificationGas", "type": "uint256", "internalType": "uint256" }, { "name": "gasFees", "type": "bytes32", "internalType": "bytes32" }, { "name": "paymasterAndData", "type": "bytes", "internalType": "bytes" }, { "name": "signature", "type": "bytes", "internalType": "bytes" }] }, { "name": "userOpHash", "type": "bytes32", "internalType": "bytes32" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "event", "name": "GuardiansSet", "inputs": [{ "name": "account", "type": "address", "indexed": true, "internalType": "address" }, { "name": "guardians", "type": "address[]", "indexed": false, "internalType": "address[]" }, { "name": "threshold", "type": "uint256", "indexed": false, "internalType": "uint256" }, { "name": "delay", "type": "uint256", "indexed": false, "internalType": "uint256" }], "anonymous": false }, { "type": "event", "name": "PaymasterOnlySet", "inputs": [{ "name": "account", "type": "address", "indexed": true, "internalType": "address" }, { "name": "required", "type": "bool", "indexed": false, "internalType": "bool" }], "anonymous": false }, { "type": "event", "name": "RecoveryApproved", "inputs": [{ "name": "account", "type": "address", "indexed": true, "internalType": "address" }, { "name": "guardian", "type": "address", "indexed": true, "internalType": "address" }, { "name": "rootHash", "type": "bytes32", "indexed": true, "internalType": "bytes32" }, { "name": "approvals", "type": "uint256", "indexed": false, "internalType": "uint256" }], "anonymous": false }, { "type": "event", "name": "RecoveryCancelled", "inputs": [{ "name": "account", "type": "address", "indexed": true, "internalType": "address" }, { "name": "nonce", "type": "uint256", "indexed": false, "internalType": "uint256" }], "anonymous": false }, { "type": "event", "name": "RecoveryExecuted", "inputs": [{ "name": "account", "type": "address", "indexed": true, "internalType": "address" }, { "name": "rootHash", "type": "bytes32", "indexed": true, "internalType": "bytes32" }], "anonymous": false }, { "type": "event", "name": "RecoveryReady", "inputs": [{ "name": "account", "type": "address", "indexed": true, "internalType": "address" }, { "name": "rootHash", "type": "bytes32", "indexed": true, "internalType": "bytes32" }, { "name": "readyAt", "type": "uint256", "indexed": false, "internalType": "uint256" }, { "name": "newRoot", "type": "bytes", "indexed": false, "internalType": "bytes" }], "anonymous": false }, { "type": "event", "name": "RootCleared", "inputs": [{ "name": "account", "type": "address", "indexed": true, "internalType": "address" }], "anonymous": false }, { "type": "event", "name": "RootSet", "inputs": [{ "name": "account", "type": "address", "indexed": true, "internalType": "address" }, { "name": "members", "type": "tuple[]", "indexed": false, "internalType": "struct MortiseRootValidator.Member[]", "components": [{ "name": "keyType", "type": "uint8", "internalType": "enum MortiseRootValidator.KeyType" }, { "name": "signer", "type": "address", "internalType": "address" }, { "name": "x", "type": "bytes32", "internalType": "bytes32" }, { "name": "y", "type": "bytes32", "internalType": "bytes32" }] }, { "name": "threshold", "type": "uint256", "indexed": false, "internalType": "uint256" }], "anonymous": false }, { "type": "error", "name": "AlreadyInitialized", "inputs": [{ "name": "smartAccount", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "HookInstalled", "inputs": [] }, { "type": "error", "name": "InvalidGuardians", "inputs": [] }, { "type": "error", "name": "InvalidKey", "inputs": [] }, { "type": "error", "name": "InvalidRoot", "inputs": [] }, { "type": "error", "name": "InvalidTargetAddress", "inputs": [{ "name": "target", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "NotGuardian", "inputs": [{ "name": "caller", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "NotInitialized", "inputs": [{ "name": "smartAccount", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "RecoveryNotReady", "inputs": [{ "name": "rootHash", "type": "bytes32", "internalType": "bytes32" }] }];
3001
+ var factoryAbi = [{ "type": "constructor", "inputs": [{ "name": "setupContract", "type": "address", "internalType": "address" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "SEALED_OWNER", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "SETUP", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "createVault", "inputs": [{ "name": "rootKey", "type": "bytes", "internalType": "bytes" }, { "name": "salt", "type": "uint256", "internalType": "uint256" }], "outputs": [{ "name": "vault", "type": "address", "internalType": "address" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "isVault", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], "stateMutability": "view" }, { "type": "function", "name": "predictVault", "inputs": [{ "name": "rootKey", "type": "bytes", "internalType": "bytes" }, { "name": "salt", "type": "uint256", "internalType": "uint256" }], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "event", "name": "VaultCreated", "inputs": [{ "name": "vault", "type": "address", "indexed": true, "internalType": "address" }, { "name": "salt", "type": "uint256", "indexed": false, "internalType": "uint256" }], "anonymous": false }, { "type": "error", "name": "UnexpectedVault", "inputs": [{ "name": "created", "type": "address", "internalType": "address" }, { "name": "predicted", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "ZeroAddress", "inputs": [] }];
3002
+ var subVaultsAbi = [{ "type": "constructor", "inputs": [{ "name": "gate", "type": "address", "internalType": "address" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "CHILD_SETUP", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "GATE", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "SEALED_OWNER", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "createSubVault", "inputs": [{ "name": "parent", "type": "address", "internalType": "address" }, { "name": "salt", "type": "uint256", "internalType": "uint256" }], "outputs": [{ "name": "child", "type": "address", "internalType": "address" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "exec", "inputs": [{ "name": "child", "type": "address", "internalType": "address" }, { "name": "executionCalldata", "type": "bytes", "internalType": "bytes" }], "outputs": [{ "name": "results", "type": "bytes[]", "internalType": "bytes[]" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "isInitialized", "inputs": [{ "name": "account", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], "stateMutability": "view" }, { "type": "function", "name": "isModuleType", "inputs": [{ "name": "moduleTypeId", "type": "uint256", "internalType": "uint256" }], "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], "stateMutability": "pure" }, { "type": "function", "name": "isParent", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], "stateMutability": "view" }, { "type": "function", "name": "isSubVault", "inputs": [{ "name": "child", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], "stateMutability": "view" }, { "type": "function", "name": "onInstall", "inputs": [{ "name": "data", "type": "bytes", "internalType": "bytes" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "onUninstall", "inputs": [{ "name": "", "type": "bytes", "internalType": "bytes" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "parentOf", "inputs": [{ "name": "child", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "predictSubVault", "inputs": [{ "name": "parent", "type": "address", "internalType": "address" }, { "name": "salt", "type": "uint256", "internalType": "uint256" }], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "sweep", "inputs": [{ "name": "child", "type": "address", "internalType": "address" }, { "name": "tokens", "type": "address[]", "internalType": "address[]" }], "outputs": [{ "name": "amounts", "type": "uint256[]", "internalType": "uint256[]" }], "stateMutability": "nonpayable" }, { "type": "event", "name": "SubVaultCreated", "inputs": [{ "name": "parent", "type": "address", "indexed": true, "internalType": "address" }, { "name": "child", "type": "address", "indexed": true, "internalType": "address" }, { "name": "salt", "type": "uint256", "indexed": false, "internalType": "uint256" }], "anonymous": false }, { "type": "event", "name": "Swept", "inputs": [{ "name": "child", "type": "address", "indexed": true, "internalType": "address" }, { "name": "token", "type": "address", "indexed": true, "internalType": "address" }, { "name": "amount", "type": "uint256", "indexed": false, "internalType": "uint256" }], "anonymous": false }, { "type": "error", "name": "AlreadyInitialized", "inputs": [{ "name": "smartAccount", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "CallNotAllowed", "inputs": [{ "name": "target", "type": "address", "internalType": "address" }, { "name": "selector", "type": "bytes4", "internalType": "bytes4" }] }, { "type": "error", "name": "DuplicateToken", "inputs": [{ "name": "token", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "InvalidParent", "inputs": [{ "name": "parent", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "NotInitialized", "inputs": [{ "name": "smartAccount", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "NotParent", "inputs": [{ "name": "caller", "type": "address", "internalType": "address" }, { "name": "child", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "TransferFailed", "inputs": [{ "name": "token", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "UnexpectedVault", "inputs": [{ "name": "created", "type": "address", "internalType": "address" }, { "name": "predicted", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "ZeroAddress", "inputs": [] }];
3003
+ var timelockAbi = [{ "type": "constructor", "inputs": [{ "name": "gate", "type": "address", "internalType": "address" }, { "name": "rootValidator", "type": "address", "internalType": "address" }, { "name": "subVaults", "type": "address", "internalType": "address" }, { "name": "signer", "type": "address", "internalType": "address" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "ENTRY_POINT", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "GATE", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "GRACE", "inputs": [], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "MAX_DELAY", "inputs": [], "outputs": [{ "name": "", "type": "uint32", "internalType": "uint32" }], "stateMutability": "view" }, { "type": "function", "name": "MIN_DELAY", "inputs": [], "outputs": [{ "name": "", "type": "uint32", "internalType": "uint32" }], "stateMutability": "view" }, { "type": "function", "name": "ROOT_VALIDATOR", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "SIGNER", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "SUB_VAULTS", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "cancel", "inputs": [{ "name": "op", "type": "bytes32", "internalType": "bytes32" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "cancelAll", "inputs": [], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "delayOf", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "uint32", "internalType": "uint32" }], "stateMutability": "view" }, { "type": "function", "name": "epoch", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "installed", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], "stateMutability": "view" }, { "type": "function", "name": "isDestination", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }, { "name": "destination", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], "stateMutability": "view" }, { "type": "function", "name": "isInitialized", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], "stateMutability": "view" }, { "type": "function", "name": "isModuleType", "inputs": [{ "name": "moduleTypeId", "type": "uint256", "internalType": "uint256" }], "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], "stateMutability": "pure" }, { "type": "function", "name": "onInstall", "inputs": [{ "name": "data", "type": "bytes", "internalType": "bytes" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "onUninstall", "inputs": [{ "name": "", "type": "bytes", "internalType": "bytes" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "postCheck", "inputs": [{ "name": "", "type": "bytes", "internalType": "bytes" }], "outputs": [], "stateMutability": "pure" }, { "type": "function", "name": "preCheck", "inputs": [{ "name": "msgSender", "type": "address", "internalType": "address" }, { "name": "", "type": "uint256", "internalType": "uint256" }, { "name": "msgData", "type": "bytes", "internalType": "bytes" }], "outputs": [{ "name": "", "type": "bytes", "internalType": "bytes" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "readyAtOf", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }, { "name": "op", "type": "bytes32", "internalType": "bytes32" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "schedule", "inputs": [{ "name": "callData", "type": "bytes", "internalType": "bytes" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "setDelay", "inputs": [{ "name": "delay", "type": "uint32", "internalType": "uint32" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "setDestination", "inputs": [{ "name": "destination", "type": "address", "internalType": "address" }, { "name": "allowed", "type": "bool", "internalType": "bool" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "event", "name": "Cancelled", "inputs": [{ "name": "vault", "type": "address", "indexed": true, "internalType": "address" }, { "name": "op", "type": "bytes32", "indexed": true, "internalType": "bytes32" }], "anonymous": false }, { "type": "event", "name": "CancelledAll", "inputs": [{ "name": "vault", "type": "address", "indexed": true, "internalType": "address" }, { "name": "scheduleNonce", "type": "uint256", "indexed": false, "internalType": "uint256" }], "anonymous": false }, { "type": "event", "name": "DelaySet", "inputs": [{ "name": "vault", "type": "address", "indexed": true, "internalType": "address" }, { "name": "delay", "type": "uint32", "indexed": false, "internalType": "uint32" }], "anonymous": false }, { "type": "event", "name": "DestinationSet", "inputs": [{ "name": "vault", "type": "address", "indexed": true, "internalType": "address" }, { "name": "destination", "type": "address", "indexed": true, "internalType": "address" }, { "name": "allowed", "type": "bool", "indexed": false, "internalType": "bool" }], "anonymous": false }, { "type": "event", "name": "Executed", "inputs": [{ "name": "vault", "type": "address", "indexed": true, "internalType": "address" }, { "name": "op", "type": "bytes32", "indexed": true, "internalType": "bytes32" }], "anonymous": false }, { "type": "event", "name": "Installed", "inputs": [{ "name": "vault", "type": "address", "indexed": true, "internalType": "address" }, { "name": "epoch", "type": "uint256", "indexed": false, "internalType": "uint256" }], "anonymous": false }, { "type": "event", "name": "Scheduled", "inputs": [{ "name": "vault", "type": "address", "indexed": true, "internalType": "address" }, { "name": "op", "type": "bytes32", "indexed": true, "internalType": "bytes32" }, { "name": "readyAt", "type": "uint256", "indexed": false, "internalType": "uint256" }, { "name": "callData", "type": "bytes", "indexed": false, "internalType": "bytes" }], "anonymous": false }, { "type": "event", "name": "Uninstalled", "inputs": [{ "name": "vault", "type": "address", "indexed": true, "internalType": "address" }], "anonymous": false }, { "type": "error", "name": "AlreadyInitialized", "inputs": [{ "name": "smartAccount", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "AlreadyScheduled", "inputs": [{ "name": "op", "type": "bytes32", "internalType": "bytes32" }] }, { "type": "error", "name": "Expired", "inputs": [{ "name": "op", "type": "bytes32", "internalType": "bytes32" }] }, { "type": "error", "name": "InvalidDelay", "inputs": [{ "name": "delay", "type": "uint32", "internalType": "uint32" }] }, { "type": "error", "name": "InvalidDestination", "inputs": [{ "name": "destination", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "NotInitialized", "inputs": [{ "name": "smartAccount", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "NotInstalled", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "NotReady", "inputs": [{ "name": "op", "type": "bytes32", "internalType": "bytes32" }, { "name": "readyAt", "type": "uint256", "internalType": "uint256" }] }, { "type": "error", "name": "NotScheduled", "inputs": [{ "name": "op", "type": "bytes32", "internalType": "bytes32" }] }, { "type": "error", "name": "PaymasterRequired", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "ZeroAddress", "inputs": [] }];
3004
+ var signerAbi = [{ "type": "constructor", "inputs": [{ "name": "rootValidator", "type": "address", "internalType": "address" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "NAME", "inputs": [], "outputs": [{ "name": "", "type": "string", "internalType": "string" }], "stateMutability": "view" }, { "type": "function", "name": "ROOT_VALIDATOR", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "contract MortiseRootValidator" }], "stateMutability": "view" }, { "type": "function", "name": "VERSION", "inputs": [], "outputs": [{ "name": "", "type": "string", "internalType": "string" }], "stateMutability": "view" }, { "type": "function", "name": "digestOf", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }, { "name": "hash", "type": "bytes32", "internalType": "bytes32" }, { "name": "signature", "type": "bytes", "internalType": "bytes" }], "outputs": [{ "name": "ok", "type": "bool", "internalType": "bool" }, { "name": "digest", "type": "bytes32", "internalType": "bytes32" }], "stateMutability": "view" }, { "type": "function", "name": "eip712Domain", "inputs": [], "outputs": [{ "name": "fields", "type": "bytes1", "internalType": "bytes1" }, { "name": "name", "type": "string", "internalType": "string" }, { "name": "version", "type": "string", "internalType": "string" }, { "name": "chainId", "type": "uint256", "internalType": "uint256" }, { "name": "verifyingContract", "type": "address", "internalType": "address" }, { "name": "salt", "type": "bytes32", "internalType": "bytes32" }, { "name": "extensions", "type": "uint256[]", "internalType": "uint256[]" }], "stateMutability": "view" }, { "type": "function", "name": "isInitialized", "inputs": [{ "name": "account", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], "stateMutability": "view" }, { "type": "function", "name": "isModuleType", "inputs": [{ "name": "moduleTypeId", "type": "uint256", "internalType": "uint256" }], "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], "stateMutability": "pure" }, { "type": "function", "name": "isValidSignatureWithSender", "inputs": [{ "name": "", "type": "address", "internalType": "address" }, { "name": "hash", "type": "bytes32", "internalType": "bytes32" }, { "name": "signature", "type": "bytes", "internalType": "bytes" }], "outputs": [{ "name": "", "type": "bytes4", "internalType": "bytes4" }], "stateMutability": "view" }, { "type": "function", "name": "onInstall", "inputs": [{ "name": "", "type": "bytes", "internalType": "bytes" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "onUninstall", "inputs": [{ "name": "", "type": "bytes", "internalType": "bytes" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "validateUserOp", "inputs": [{ "name": "", "type": "tuple", "internalType": "struct PackedUserOperation", "components": [{ "name": "sender", "type": "address", "internalType": "address" }, { "name": "nonce", "type": "uint256", "internalType": "uint256" }, { "name": "initCode", "type": "bytes", "internalType": "bytes" }, { "name": "callData", "type": "bytes", "internalType": "bytes" }, { "name": "accountGasLimits", "type": "bytes32", "internalType": "bytes32" }, { "name": "preVerificationGas", "type": "uint256", "internalType": "uint256" }, { "name": "gasFees", "type": "bytes32", "internalType": "bytes32" }, { "name": "paymasterAndData", "type": "bytes", "internalType": "bytes" }, { "name": "signature", "type": "bytes", "internalType": "bytes" }] }, { "name": "", "type": "bytes32", "internalType": "bytes32" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "pure" }, { "type": "error", "name": "AlreadyInitialized", "inputs": [{ "name": "smartAccount", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "InvalidTargetAddress", "inputs": [{ "name": "target", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "NotInitialized", "inputs": [{ "name": "smartAccount", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "ZeroAddress", "inputs": [] }];
3005
+ var routerAbi = [{ "type": "constructor", "inputs": [{ "name": "gate", "type": "address", "internalType": "address" }, { "name": "owner_", "type": "address", "internalType": "address" }, { "name": "feeRecipient_", "type": "address", "internalType": "address" }, { "name": "feeBps_", "type": "uint256", "internalType": "uint256" }, { "name": "capUsd_", "type": "uint256", "internalType": "uint256" }, { "name": "feedTokens", "type": "address[]", "internalType": "address[]" }, { "name": "feeds", "type": "tuple[]", "internalType": "struct MortiseDepositRouter.Feed[]", "components": [{ "name": "feed", "type": "address", "internalType": "address" }, { "name": "maxAge", "type": "uint32", "internalType": "uint32" }, { "name": "stock", "type": "bool", "internalType": "bool" }] }], "stateMutability": "nonpayable" }, { "type": "function", "name": "FEE_APPLY_WINDOW", "inputs": [], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "FEE_RAISE_DELAY", "inputs": [], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "GATE", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "MAX_FEE_BPS", "inputs": [], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "WETH", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "acceptOwnership", "inputs": [], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "applyFee", "inputs": [], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "capUsd", "inputs": [], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "deposit", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }, { "name": "token", "type": "address", "internalType": "address" }, { "name": "amount", "type": "uint256", "internalType": "uint256" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "depositETH", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }], "outputs": [], "stateMutability": "payable" }, { "type": "function", "name": "depositedUsd", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "feeBps", "inputs": [], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "feeRecipient", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "feedOf", "inputs": [{ "name": "token", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "tuple", "internalType": "struct MortiseDepositRouter.Feed", "components": [{ "name": "feed", "type": "address", "internalType": "address" }, { "name": "maxAge", "type": "uint32", "internalType": "uint32" }, { "name": "stock", "type": "bool", "internalType": "bool" }] }], "stateMutability": "view" }, { "type": "function", "name": "owner", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "pendingFeeAt", "inputs": [], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "pendingFeeBps", "inputs": [], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "pendingOwner", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "removeFeed", "inputs": [{ "name": "token", "type": "address", "internalType": "address" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "setCap", "inputs": [{ "name": "newCapUsd", "type": "uint256", "internalType": "uint256" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "setFee", "inputs": [{ "name": "newFeeBps", "type": "uint256", "internalType": "uint256" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "setFeeRecipient", "inputs": [{ "name": "newRecipient", "type": "address", "internalType": "address" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "transferOwnership", "inputs": [{ "name": "newOwner", "type": "address", "internalType": "address" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "valueOf", "inputs": [{ "name": "token", "type": "address", "internalType": "address" }, { "name": "amount", "type": "uint256", "internalType": "uint256" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "event", "name": "CapSet", "inputs": [{ "name": "capUsd", "type": "uint256", "indexed": false, "internalType": "uint256" }], "anonymous": false }, { "type": "event", "name": "Deposited", "inputs": [{ "name": "vault", "type": "address", "indexed": true, "internalType": "address" }, { "name": "token", "type": "address", "indexed": true, "internalType": "address" }, { "name": "sender", "type": "address", "indexed": true, "internalType": "address" }, { "name": "amount", "type": "uint256", "indexed": false, "internalType": "uint256" }, { "name": "fee", "type": "uint256", "indexed": false, "internalType": "uint256" }, { "name": "usd", "type": "uint256", "indexed": false, "internalType": "uint256" }], "anonymous": false }, { "type": "event", "name": "FeeRaiseScheduled", "inputs": [{ "name": "feeBps", "type": "uint256", "indexed": false, "internalType": "uint256" }, { "name": "at", "type": "uint256", "indexed": false, "internalType": "uint256" }], "anonymous": false }, { "type": "event", "name": "FeeRecipientSet", "inputs": [{ "name": "feeRecipient", "type": "address", "indexed": false, "internalType": "address" }], "anonymous": false }, { "type": "event", "name": "FeeSet", "inputs": [{ "name": "feeBps", "type": "uint256", "indexed": false, "internalType": "uint256" }], "anonymous": false }, { "type": "event", "name": "FeedRemoved", "inputs": [{ "name": "token", "type": "address", "indexed": true, "internalType": "address" }], "anonymous": false }, { "type": "event", "name": "FeedSet", "inputs": [{ "name": "token", "type": "address", "indexed": true, "internalType": "address" }, { "name": "feed", "type": "address", "indexed": true, "internalType": "address" }, { "name": "maxAge", "type": "uint32", "indexed": false, "internalType": "uint32" }, { "name": "stock", "type": "bool", "indexed": false, "internalType": "bool" }], "anonymous": false }, { "type": "event", "name": "OwnershipTransferStarted", "inputs": [{ "name": "owner", "type": "address", "indexed": true, "internalType": "address" }, { "name": "pendingOwner", "type": "address", "indexed": true, "internalType": "address" }], "anonymous": false }, { "type": "event", "name": "OwnershipTransferred", "inputs": [{ "name": "previousOwner", "type": "address", "indexed": true, "internalType": "address" }, { "name": "newOwner", "type": "address", "indexed": true, "internalType": "address" }], "anonymous": false }, { "type": "error", "name": "BadFeedList", "inputs": [] }, { "type": "error", "name": "CapExceeded", "inputs": [{ "name": "deposited", "type": "uint256", "internalType": "uint256" }, { "name": "cap", "type": "uint256", "internalType": "uint256" }] }, { "type": "error", "name": "FeeNotReady", "inputs": [] }, { "type": "error", "name": "FeeRaiseLapsed", "inputs": [] }, { "type": "error", "name": "FeeTooHigh", "inputs": [] }, { "type": "error", "name": "NoPrice", "inputs": [{ "name": "token", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "NotOwner", "inputs": [] }, { "type": "error", "name": "NotVault", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "Reentrancy", "inputs": [] }, { "type": "error", "name": "ZeroAddress", "inputs": [] }, { "type": "error", "name": "ZeroAmount", "inputs": [] }];
3006
+ var adapterAbi = [{ "type": "function", "name": "plan", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }, { "name": "data", "type": "bytes", "internalType": "bytes" }], "outputs": [{ "name": "", "type": "tuple", "internalType": "struct Plan", "components": [{ "name": "market", "type": "bytes32", "internalType": "bytes32" }, { "name": "calls", "type": "tuple[]", "internalType": "struct Execution[]", "components": [{ "name": "target", "type": "address", "internalType": "address" }, { "name": "value", "type": "uint256", "internalType": "uint256" }, { "name": "callData", "type": "bytes", "internalType": "bytes" }] }, { "name": "tokens", "type": "address[]", "internalType": "address[]" }, { "name": "isSwap", "type": "bool", "internalType": "bool" }, { "name": "swapIn", "type": "address", "internalType": "address" }, { "name": "swapOut", "type": "address", "internalType": "address" }] }], "stateMutability": "view" }, { "type": "function", "name": "rules", "inputs": [], "outputs": [{ "name": "", "type": "tuple[]", "internalType": "struct CallRule[]", "components": [{ "name": "target", "type": "address", "internalType": "address" }, { "name": "selector", "type": "bytes4", "internalType": "bytes4" }] }], "stateMutability": "view" }];
3007
+ var uniswapV3Abi = [{ "type": "constructor", "inputs": [{ "name": "gate", "type": "address", "internalType": "address" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "FACTORY", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "GATE", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "PERMIT2", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "UNIVERSAL_ROUTER", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "WETH", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "plan", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }, { "name": "data", "type": "bytes", "internalType": "bytes" }], "outputs": [{ "name": "p", "type": "tuple", "internalType": "struct Plan", "components": [{ "name": "market", "type": "bytes32", "internalType": "bytes32" }, { "name": "calls", "type": "tuple[]", "internalType": "struct Execution[]", "components": [{ "name": "target", "type": "address", "internalType": "address" }, { "name": "value", "type": "uint256", "internalType": "uint256" }, { "name": "callData", "type": "bytes", "internalType": "bytes" }] }, { "name": "tokens", "type": "address[]", "internalType": "address[]" }, { "name": "isSwap", "type": "bool", "internalType": "bool" }, { "name": "swapIn", "type": "address", "internalType": "address" }, { "name": "swapOut", "type": "address", "internalType": "address" }] }], "stateMutability": "view" }, { "type": "function", "name": "rules", "inputs": [], "outputs": [{ "name": "r", "type": "tuple[]", "internalType": "struct CallRule[]", "components": [{ "name": "target", "type": "address", "internalType": "address" }, { "name": "selector", "type": "bytes4", "internalType": "bytes4" }] }], "stateMutability": "pure" }, { "type": "error", "name": "NoPool", "inputs": [] }, { "type": "error", "name": "SameToken", "inputs": [] }, { "type": "error", "name": "ZeroAddress", "inputs": [] }, { "type": "error", "name": "ZeroAmount", "inputs": [] }];
3008
+ var uniswapV3LiquidityAbi = [{ "type": "constructor", "inputs": [{ "name": "gate", "type": "address", "internalType": "address" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "FACTORY", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "GATE", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "POSITION_MANAGER", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "plan", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }, { "name": "data", "type": "bytes", "internalType": "bytes" }], "outputs": [{ "name": "p", "type": "tuple", "internalType": "struct Plan", "components": [{ "name": "market", "type": "bytes32", "internalType": "bytes32" }, { "name": "calls", "type": "tuple[]", "internalType": "struct Execution[]", "components": [{ "name": "target", "type": "address", "internalType": "address" }, { "name": "value", "type": "uint256", "internalType": "uint256" }, { "name": "callData", "type": "bytes", "internalType": "bytes" }] }, { "name": "tokens", "type": "address[]", "internalType": "address[]" }, { "name": "isSwap", "type": "bool", "internalType": "bool" }, { "name": "swapIn", "type": "address", "internalType": "address" }, { "name": "swapOut", "type": "address", "internalType": "address" }] }], "stateMutability": "view" }, { "type": "function", "name": "rules", "inputs": [], "outputs": [{ "name": "r", "type": "tuple[]", "internalType": "struct CallRule[]", "components": [{ "name": "target", "type": "address", "internalType": "address" }, { "name": "selector", "type": "bytes4", "internalType": "bytes4" }] }], "stateMutability": "pure" }, { "type": "error", "name": "NoPool", "inputs": [] }, { "type": "error", "name": "NoPriceBand", "inputs": [{ "name": "token0", "type": "address", "internalType": "address" }, { "name": "token1", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "NotVaultPosition", "inputs": [{ "name": "tokenId", "type": "uint256", "internalType": "uint256" }] }, { "type": "error", "name": "PriceOutOfBand", "inputs": [] }, { "type": "error", "name": "ZeroAddress", "inputs": [] }];
3009
+ var uniswapV4Abi = [{ "type": "constructor", "inputs": [{ "name": "gate", "type": "address", "internalType": "address" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "GATE", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "PERMIT2", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "UNIVERSAL_ROUTER", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "plan", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }, { "name": "data", "type": "bytes", "internalType": "bytes" }], "outputs": [{ "name": "p", "type": "tuple", "internalType": "struct Plan", "components": [{ "name": "market", "type": "bytes32", "internalType": "bytes32" }, { "name": "calls", "type": "tuple[]", "internalType": "struct Execution[]", "components": [{ "name": "target", "type": "address", "internalType": "address" }, { "name": "value", "type": "uint256", "internalType": "uint256" }, { "name": "callData", "type": "bytes", "internalType": "bytes" }] }, { "name": "tokens", "type": "address[]", "internalType": "address[]" }, { "name": "isSwap", "type": "bool", "internalType": "bool" }, { "name": "swapIn", "type": "address", "internalType": "address" }, { "name": "swapOut", "type": "address", "internalType": "address" }] }], "stateMutability": "view" }, { "type": "function", "name": "rules", "inputs": [], "outputs": [{ "name": "r", "type": "tuple[]", "internalType": "struct CallRule[]", "components": [{ "name": "target", "type": "address", "internalType": "address" }, { "name": "selector", "type": "bytes4", "internalType": "bytes4" }] }], "stateMutability": "pure" }, { "type": "error", "name": "ZeroAddress", "inputs": [] }, { "type": "error", "name": "ZeroAmount", "inputs": [] }];
3010
+ var uniswapV4LiquidityAbi = [{ "type": "constructor", "inputs": [{ "name": "gate", "type": "address", "internalType": "address" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "GATE", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "PERMIT2", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "POOL_MANAGER", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "POSITION_MANAGER", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "plan", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }, { "name": "data", "type": "bytes", "internalType": "bytes" }], "outputs": [{ "name": "p", "type": "tuple", "internalType": "struct Plan", "components": [{ "name": "market", "type": "bytes32", "internalType": "bytes32" }, { "name": "calls", "type": "tuple[]", "internalType": "struct Execution[]", "components": [{ "name": "target", "type": "address", "internalType": "address" }, { "name": "value", "type": "uint256", "internalType": "uint256" }, { "name": "callData", "type": "bytes", "internalType": "bytes" }] }, { "name": "tokens", "type": "address[]", "internalType": "address[]" }, { "name": "isSwap", "type": "bool", "internalType": "bool" }, { "name": "swapIn", "type": "address", "internalType": "address" }, { "name": "swapOut", "type": "address", "internalType": "address" }] }], "stateMutability": "view" }, { "type": "function", "name": "rules", "inputs": [], "outputs": [{ "name": "r", "type": "tuple[]", "internalType": "struct CallRule[]", "components": [{ "name": "target", "type": "address", "internalType": "address" }, { "name": "selector", "type": "bytes4", "internalType": "bytes4" }] }], "stateMutability": "pure" }, { "type": "error", "name": "NoPriceBand", "inputs": [{ "name": "token0", "type": "address", "internalType": "address" }, { "name": "token1", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "NotVaultPosition", "inputs": [{ "name": "tokenId", "type": "uint256", "internalType": "uint256" }] }, { "type": "error", "name": "PriceOutOfBand", "inputs": [] }, { "type": "error", "name": "ZeroAddress", "inputs": [] }];
3011
+ var ponsAbi = [{ "type": "constructor", "inputs": [{ "name": "gate", "type": "address", "internalType": "address" }, { "name": "trader", "type": "address", "internalType": "address" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "GATE", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "TRADER", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "plan", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }, { "name": "data", "type": "bytes", "internalType": "bytes" }], "outputs": [{ "name": "p", "type": "tuple", "internalType": "struct Plan", "components": [{ "name": "market", "type": "bytes32", "internalType": "bytes32" }, { "name": "calls", "type": "tuple[]", "internalType": "struct Execution[]", "components": [{ "name": "target", "type": "address", "internalType": "address" }, { "name": "value", "type": "uint256", "internalType": "uint256" }, { "name": "callData", "type": "bytes", "internalType": "bytes" }] }, { "name": "tokens", "type": "address[]", "internalType": "address[]" }, { "name": "isSwap", "type": "bool", "internalType": "bool" }, { "name": "swapIn", "type": "address", "internalType": "address" }, { "name": "swapOut", "type": "address", "internalType": "address" }] }], "stateMutability": "view" }, { "type": "function", "name": "rules", "inputs": [], "outputs": [{ "name": "r", "type": "tuple[]", "internalType": "struct CallRule[]", "components": [{ "name": "target", "type": "address", "internalType": "address" }, { "name": "selector", "type": "bytes4", "internalType": "bytes4" }] }], "stateMutability": "view" }, { "type": "error", "name": "NotLaunched", "inputs": [{ "name": "token", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "ZeroAddress", "inputs": [] }, { "type": "error", "name": "ZeroAmount", "inputs": [] }];
3012
+ var flapAbi = [{ "type": "constructor", "inputs": [{ "name": "gate", "type": "address", "internalType": "address" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "GATE", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "PORTAL", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "plan", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }, { "name": "data", "type": "bytes", "internalType": "bytes" }], "outputs": [{ "name": "p", "type": "tuple", "internalType": "struct Plan", "components": [{ "name": "market", "type": "bytes32", "internalType": "bytes32" }, { "name": "calls", "type": "tuple[]", "internalType": "struct Execution[]", "components": [{ "name": "target", "type": "address", "internalType": "address" }, { "name": "value", "type": "uint256", "internalType": "uint256" }, { "name": "callData", "type": "bytes", "internalType": "bytes" }] }, { "name": "tokens", "type": "address[]", "internalType": "address[]" }, { "name": "isSwap", "type": "bool", "internalType": "bool" }, { "name": "swapIn", "type": "address", "internalType": "address" }, { "name": "swapOut", "type": "address", "internalType": "address" }] }], "stateMutability": "view" }, { "type": "function", "name": "rules", "inputs": [], "outputs": [{ "name": "r", "type": "tuple[]", "internalType": "struct CallRule[]", "components": [{ "name": "target", "type": "address", "internalType": "address" }, { "name": "selector", "type": "bytes4", "internalType": "bytes4" }] }], "stateMutability": "pure" }, { "type": "error", "name": "SameToken", "inputs": [] }, { "type": "error", "name": "ZeroAddress", "inputs": [] }, { "type": "error", "name": "ZeroAmount", "inputs": [] }];
3013
+ var morphoBlueAbi = [{ "type": "function", "name": "MORPHO", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "plan", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }, { "name": "data", "type": "bytes", "internalType": "bytes" }], "outputs": [{ "name": "", "type": "tuple", "internalType": "struct Plan", "components": [{ "name": "market", "type": "bytes32", "internalType": "bytes32" }, { "name": "calls", "type": "tuple[]", "internalType": "struct Execution[]", "components": [{ "name": "target", "type": "address", "internalType": "address" }, { "name": "value", "type": "uint256", "internalType": "uint256" }, { "name": "callData", "type": "bytes", "internalType": "bytes" }] }, { "name": "tokens", "type": "address[]", "internalType": "address[]" }, { "name": "isSwap", "type": "bool", "internalType": "bool" }, { "name": "swapIn", "type": "address", "internalType": "address" }, { "name": "swapOut", "type": "address", "internalType": "address" }] }], "stateMutability": "pure" }, { "type": "function", "name": "rules", "inputs": [], "outputs": [{ "name": "r", "type": "tuple[]", "internalType": "struct CallRule[]", "components": [{ "name": "target", "type": "address", "internalType": "address" }, { "name": "selector", "type": "bytes4", "internalType": "bytes4" }] }], "stateMutability": "pure" }, { "type": "error", "name": "InvalidAmount", "inputs": [] }];
3014
+ var erc4626Abi = [{ "type": "constructor", "inputs": [{ "name": "gate", "type": "address", "internalType": "address" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "GATE", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "plan", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }, { "name": "data", "type": "bytes", "internalType": "bytes" }], "outputs": [{ "name": "p", "type": "tuple", "internalType": "struct Plan", "components": [{ "name": "market", "type": "bytes32", "internalType": "bytes32" }, { "name": "calls", "type": "tuple[]", "internalType": "struct Execution[]", "components": [{ "name": "target", "type": "address", "internalType": "address" }, { "name": "value", "type": "uint256", "internalType": "uint256" }, { "name": "callData", "type": "bytes", "internalType": "bytes" }] }, { "name": "tokens", "type": "address[]", "internalType": "address[]" }, { "name": "isSwap", "type": "bool", "internalType": "bool" }, { "name": "swapIn", "type": "address", "internalType": "address" }, { "name": "swapOut", "type": "address", "internalType": "address" }] }], "stateMutability": "view" }, { "type": "function", "name": "rules", "inputs": [], "outputs": [{ "name": "r", "type": "tuple[]", "internalType": "struct CallRule[]", "components": [{ "name": "target", "type": "address", "internalType": "address" }, { "name": "selector", "type": "bytes4", "internalType": "bytes4" }] }], "stateMutability": "pure" }, { "type": "error", "name": "NotListed", "inputs": [{ "name": "target", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "ZeroAddress", "inputs": [] }, { "type": "error", "name": "ZeroAmount", "inputs": [] }];
3015
+ var transferAbi = [{ "type": "constructor", "inputs": [{ "name": "gate", "type": "address", "internalType": "address" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "GATE", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "marketOf", "inputs": [{ "name": "token", "type": "address", "internalType": "address" }, { "name": "to", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "bytes32", "internalType": "bytes32" }], "stateMutability": "pure" }, { "type": "function", "name": "plan", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }, { "name": "data", "type": "bytes", "internalType": "bytes" }], "outputs": [{ "name": "p", "type": "tuple", "internalType": "struct Plan", "components": [{ "name": "market", "type": "bytes32", "internalType": "bytes32" }, { "name": "calls", "type": "tuple[]", "internalType": "struct Execution[]", "components": [{ "name": "target", "type": "address", "internalType": "address" }, { "name": "value", "type": "uint256", "internalType": "uint256" }, { "name": "callData", "type": "bytes", "internalType": "bytes" }] }, { "name": "tokens", "type": "address[]", "internalType": "address[]" }, { "name": "isSwap", "type": "bool", "internalType": "bool" }, { "name": "swapIn", "type": "address", "internalType": "address" }, { "name": "swapOut", "type": "address", "internalType": "address" }] }], "stateMutability": "view" }, { "type": "function", "name": "rules", "inputs": [], "outputs": [{ "name": "r", "type": "tuple[]", "internalType": "struct CallRule[]", "components": [{ "name": "target", "type": "address", "internalType": "address" }, { "name": "selector", "type": "bytes4", "internalType": "bytes4" }] }], "stateMutability": "pure" }, { "type": "error", "name": "NotListed", "inputs": [{ "name": "token", "type": "address", "internalType": "address" }, { "name": "to", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "ZeroAddress", "inputs": [] }, { "type": "error", "name": "ZeroAmount", "inputs": [] }];
3016
+ var wethAbi = [{ "type": "function", "name": "WETH", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "plan", "inputs": [{ "name": "", "type": "address", "internalType": "address" }, { "name": "data", "type": "bytes", "internalType": "bytes" }], "outputs": [{ "name": "p", "type": "tuple", "internalType": "struct Plan", "components": [{ "name": "market", "type": "bytes32", "internalType": "bytes32" }, { "name": "calls", "type": "tuple[]", "internalType": "struct Execution[]", "components": [{ "name": "target", "type": "address", "internalType": "address" }, { "name": "value", "type": "uint256", "internalType": "uint256" }, { "name": "callData", "type": "bytes", "internalType": "bytes" }] }, { "name": "tokens", "type": "address[]", "internalType": "address[]" }, { "name": "isSwap", "type": "bool", "internalType": "bool" }, { "name": "swapIn", "type": "address", "internalType": "address" }, { "name": "swapOut", "type": "address", "internalType": "address" }] }], "stateMutability": "pure" }, { "type": "function", "name": "rules", "inputs": [], "outputs": [{ "name": "r", "type": "tuple[]", "internalType": "struct CallRule[]", "components": [{ "name": "target", "type": "address", "internalType": "address" }, { "name": "selector", "type": "bytes4", "internalType": "bytes4" }] }], "stateMutability": "pure" }, { "type": "error", "name": "ZeroAmount", "inputs": [] }];
3017
+ var acrossAbi = [{ "type": "constructor", "inputs": [{ "name": "gate", "type": "address", "internalType": "address" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "GATE", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "SPOKE_POOL", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "plan", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }, { "name": "data", "type": "bytes", "internalType": "bytes" }], "outputs": [{ "name": "p", "type": "tuple", "internalType": "struct Plan", "components": [{ "name": "market", "type": "bytes32", "internalType": "bytes32" }, { "name": "calls", "type": "tuple[]", "internalType": "struct Execution[]", "components": [{ "name": "target", "type": "address", "internalType": "address" }, { "name": "value", "type": "uint256", "internalType": "uint256" }, { "name": "callData", "type": "bytes", "internalType": "bytes" }] }, { "name": "tokens", "type": "address[]", "internalType": "address[]" }, { "name": "isSwap", "type": "bool", "internalType": "bool" }, { "name": "swapIn", "type": "address", "internalType": "address" }, { "name": "swapOut", "type": "address", "internalType": "address" }] }], "stateMutability": "view" }, { "type": "function", "name": "routeOf", "inputs": [{ "name": "destinationChainId", "type": "uint256", "internalType": "uint256" }, { "name": "recipient", "type": "bytes32", "internalType": "bytes32" }, { "name": "inputToken", "type": "address", "internalType": "address" }, { "name": "outputToken", "type": "bytes32", "internalType": "bytes32" }, { "name": "minRate", "type": "uint256", "internalType": "uint256" }], "outputs": [{ "name": "", "type": "bytes32", "internalType": "bytes32" }], "stateMutability": "pure" }, { "type": "function", "name": "rules", "inputs": [], "outputs": [{ "name": "r", "type": "tuple[]", "internalType": "struct CallRule[]", "components": [{ "name": "target", "type": "address", "internalType": "address" }, { "name": "selector", "type": "bytes4", "internalType": "bytes4" }] }], "stateMutability": "pure" }, { "type": "error", "name": "NotListed", "inputs": [{ "name": "market", "type": "bytes32", "internalType": "bytes32" }] }, { "type": "error", "name": "OutputTooLow", "inputs": [{ "name": "outputAmount", "type": "uint256", "internalType": "uint256" }, { "name": "minimum", "type": "uint256", "internalType": "uint256" }] }, { "type": "error", "name": "ZeroAddress", "inputs": [] }, { "type": "error", "name": "ZeroAmount", "inputs": [] }];
3018
+ var familyTransferAbi = [{ "type": "constructor", "inputs": [{ "name": "gate", "type": "address", "internalType": "address" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "GATE", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "plan", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }, { "name": "data", "type": "bytes", "internalType": "bytes" }], "outputs": [{ "name": "", "type": "tuple", "internalType": "struct Plan", "components": [{ "name": "market", "type": "bytes32", "internalType": "bytes32" }, { "name": "calls", "type": "tuple[]", "internalType": "struct Execution[]", "components": [{ "name": "target", "type": "address", "internalType": "address" }, { "name": "value", "type": "uint256", "internalType": "uint256" }, { "name": "callData", "type": "bytes", "internalType": "bytes" }] }, { "name": "tokens", "type": "address[]", "internalType": "address[]" }, { "name": "isSwap", "type": "bool", "internalType": "bool" }, { "name": "swapIn", "type": "address", "internalType": "address" }, { "name": "swapOut", "type": "address", "internalType": "address" }] }], "stateMutability": "view" }, { "type": "function", "name": "rules", "inputs": [], "outputs": [{ "name": "r", "type": "tuple[]", "internalType": "struct CallRule[]", "components": [{ "name": "target", "type": "address", "internalType": "address" }, { "name": "selector", "type": "bytes4", "internalType": "bytes4" }] }], "stateMutability": "pure" }, { "type": "error", "name": "NotFamily", "inputs": [{ "name": "to", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "ZeroAddress", "inputs": [] }, { "type": "error", "name": "ZeroAmount", "inputs": [] }];
3019
+ var dcaAbi = [{ "type": "function", "name": "encodePlan", "inputs": [{ "name": "action", "type": "tuple", "internalType": "struct Action", "components": [{ "name": "adapter", "type": "address", "internalType": "address" }, { "name": "data", "type": "bytes", "internalType": "bytes" }] }, { "name": "keeper", "type": "address", "internalType": "address" }, { "name": "interval", "type": "uint64", "internalType": "uint64" }, { "name": "firstAt", "type": "uint64", "internalType": "uint64" }, { "name": "runs", "type": "uint32", "internalType": "uint32" }], "outputs": [{ "name": "", "type": "bytes", "internalType": "bytes" }], "stateMutability": "pure" }, { "type": "function", "name": "propose", "inputs": [{ "name": "", "type": "address", "internalType": "address" }, { "name": "caller", "type": "address", "internalType": "address" }, { "name": "state", "type": "bytes", "internalType": "bytes" }], "outputs": [{ "name": "actions", "type": "tuple[]", "internalType": "struct Action[]", "components": [{ "name": "adapter", "type": "address", "internalType": "address" }, { "name": "data", "type": "bytes", "internalType": "bytes" }] }, { "name": "nextState", "type": "bytes", "internalType": "bytes" }], "stateMutability": "view" }, { "type": "error", "name": "Finished", "inputs": [] }, { "type": "error", "name": "NotDue", "inputs": [{ "name": "nextAt", "type": "uint64", "internalType": "uint64" }] }, { "type": "error", "name": "NotKeeper", "inputs": [{ "name": "caller", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "ZeroInterval", "inputs": [] }, { "type": "error", "name": "ZeroKeeper", "inputs": [] }];
3020
+ var automationAbi = [{ "type": "constructor", "inputs": [{ "name": "gate", "type": "address", "internalType": "address" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "GATE", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "MAX_INTERVAL", "inputs": [], "outputs": [{ "name": "", "type": "uint64", "internalType": "uint64" }], "stateMutability": "view" }, { "type": "function", "name": "MAX_STEPS", "inputs": [], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "MAX_TASKS", "inputs": [], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "encodeTasks", "inputs": [{ "name": "tasks", "type": "tuple[]", "internalType": "struct AutomationModule.Task[]", "components": [{ "name": "keeper", "type": "address", "internalType": "address" }, { "name": "nextAt", "type": "uint64", "internalType": "uint64" }, { "name": "interval", "type": "uint64", "internalType": "uint64" }, { "name": "runsLeft", "type": "uint32", "internalType": "uint32" }, { "name": "group", "type": "uint32", "internalType": "uint32" }, { "name": "condition", "type": "tuple", "internalType": "struct AutomationModule.Condition", "components": [{ "name": "feed", "type": "tuple", "internalType": "struct Feed", "components": [{ "name": "feed", "type": "address", "internalType": "address" }, { "name": "maxAge", "type": "uint32", "internalType": "uint32" }, { "name": "stockToken", "type": "address", "internalType": "address" }] }, { "name": "above", "type": "bool", "internalType": "bool" }, { "name": "price", "type": "uint256", "internalType": "uint256" }] }, { "name": "steps", "type": "tuple[]", "internalType": "struct AutomationModule.Step[]", "components": [{ "name": "action", "type": "tuple", "internalType": "struct Action", "components": [{ "name": "adapter", "type": "address", "internalType": "address" }, { "name": "data", "type": "bytes", "internalType": "bytes" }] }, { "name": "token", "type": "address", "internalType": "address" }, { "name": "keep", "type": "uint256", "internalType": "uint256" }, { "name": "bps", "type": "uint16", "internalType": "uint16" }, { "name": "word", "type": "uint16", "internalType": "uint16" }, { "name": "amount", "type": "uint256", "internalType": "uint256" }] }] }], "outputs": [{ "name": "", "type": "bytes", "internalType": "bytes" }], "stateMutability": "pure" }, { "type": "function", "name": "propose", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }, { "name": "caller", "type": "address", "internalType": "address" }, { "name": "state", "type": "bytes", "internalType": "bytes" }], "outputs": [{ "name": "actions", "type": "tuple[]", "internalType": "struct Action[]", "components": [{ "name": "adapter", "type": "address", "internalType": "address" }, { "name": "data", "type": "bytes", "internalType": "bytes" }] }, { "name": "nextState", "type": "bytes", "internalType": "bytes" }], "stateMutability": "view" }, { "type": "error", "name": "BadTemplate", "inputs": [{ "name": "task", "type": "uint256", "internalType": "uint256" }, { "name": "step", "type": "uint256", "internalType": "uint256" }] }, { "type": "error", "name": "InvalidTasks", "inputs": [] }, { "type": "error", "name": "NothingToRun", "inputs": [] }, { "type": "error", "name": "ZeroAddress", "inputs": [] }];
3021
+ var rebalanceAbi = [{ "type": "constructor", "inputs": [{ "name": "gate", "type": "address", "internalType": "address" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "GATE", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "MAX_INTERVAL", "inputs": [], "outputs": [{ "name": "", "type": "uint64", "internalType": "uint64" }], "stateMutability": "view" }, { "type": "function", "name": "MAX_PAIRS", "inputs": [], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "encodePairs", "inputs": [{ "name": "pairs", "type": "tuple[]", "internalType": "struct RebalanceModule.Pair[]", "components": [{ "name": "keeper", "type": "address", "internalType": "address" }, { "name": "tokenA", "type": "address", "internalType": "address" }, { "name": "tokenB", "type": "address", "internalType": "address" }, { "name": "feedA", "type": "tuple", "internalType": "struct Feed", "components": [{ "name": "feed", "type": "address", "internalType": "address" }, { "name": "maxAge", "type": "uint32", "internalType": "uint32" }, { "name": "stockToken", "type": "address", "internalType": "address" }] }, { "name": "feedB", "type": "tuple", "internalType": "struct Feed", "components": [{ "name": "feed", "type": "address", "internalType": "address" }, { "name": "maxAge", "type": "uint32", "internalType": "uint32" }, { "name": "stockToken", "type": "address", "internalType": "address" }] }, { "name": "targetBpsA", "type": "uint16", "internalType": "uint16" }, { "name": "bandBps", "type": "uint16", "internalType": "uint16" }, { "name": "slippageBps", "type": "uint16", "internalType": "uint16" }, { "name": "interval", "type": "uint64", "internalType": "uint64" }, { "name": "nextAt", "type": "uint64", "internalType": "uint64" }, { "name": "minTradeUsd", "type": "uint256", "internalType": "uint256" }, { "name": "sellA", "type": "tuple", "internalType": "struct Action", "components": [{ "name": "adapter", "type": "address", "internalType": "address" }, { "name": "data", "type": "bytes", "internalType": "bytes" }] }, { "name": "wordA", "type": "uint16", "internalType": "uint16" }, { "name": "minOutWordA", "type": "uint16", "internalType": "uint16" }, { "name": "sellB", "type": "tuple", "internalType": "struct Action", "components": [{ "name": "adapter", "type": "address", "internalType": "address" }, { "name": "data", "type": "bytes", "internalType": "bytes" }] }, { "name": "wordB", "type": "uint16", "internalType": "uint16" }, { "name": "minOutWordB", "type": "uint16", "internalType": "uint16" }] }], "outputs": [{ "name": "", "type": "bytes", "internalType": "bytes" }], "stateMutability": "pure" }, { "type": "function", "name": "propose", "inputs": [{ "name": "vault", "type": "address", "internalType": "address" }, { "name": "caller", "type": "address", "internalType": "address" }, { "name": "state", "type": "bytes", "internalType": "bytes" }], "outputs": [{ "name": "actions", "type": "tuple[]", "internalType": "struct Action[]", "components": [{ "name": "adapter", "type": "address", "internalType": "address" }, { "name": "data", "type": "bytes", "internalType": "bytes" }] }, { "name": "nextState", "type": "bytes", "internalType": "bytes" }], "stateMutability": "view" }, { "type": "error", "name": "BadTemplate", "inputs": [{ "name": "pair", "type": "uint256", "internalType": "uint256" }] }, { "type": "error", "name": "InvalidPairs", "inputs": [] }, { "type": "error", "name": "NothingToRun", "inputs": [] }, { "type": "error", "name": "ZeroAddress", "inputs": [] }];
3022
+ var accountAbi = [{ "type": "function", "name": "accountId", "inputs": [], "outputs": [{ "name": "accountImplementationId", "type": "string", "internalType": "string" }], "stateMutability": "view" }, { "type": "function", "name": "execute", "inputs": [{ "name": "mode", "type": "bytes32", "internalType": "ModeCode" }, { "name": "executionCalldata", "type": "bytes", "internalType": "bytes" }], "outputs": [], "stateMutability": "payable" }, { "type": "function", "name": "executeFromExecutor", "inputs": [{ "name": "mode", "type": "bytes32", "internalType": "ModeCode" }, { "name": "executionCalldata", "type": "bytes", "internalType": "bytes" }], "outputs": [{ "name": "returnData", "type": "bytes[]", "internalType": "bytes[]" }], "stateMutability": "payable" }, { "type": "function", "name": "installModule", "inputs": [{ "name": "moduleTypeId", "type": "uint256", "internalType": "uint256" }, { "name": "module", "type": "address", "internalType": "address" }, { "name": "initData", "type": "bytes", "internalType": "bytes" }], "outputs": [], "stateMutability": "payable" }, { "type": "function", "name": "isModuleInstalled", "inputs": [{ "name": "moduleTypeId", "type": "uint256", "internalType": "uint256" }, { "name": "module", "type": "address", "internalType": "address" }, { "name": "additionalContext", "type": "bytes", "internalType": "bytes" }], "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], "stateMutability": "view" }, { "type": "function", "name": "isValidSignature", "inputs": [{ "name": "hash", "type": "bytes32", "internalType": "bytes32" }, { "name": "data", "type": "bytes", "internalType": "bytes" }], "outputs": [{ "name": "", "type": "bytes4", "internalType": "bytes4" }], "stateMutability": "view" }, { "type": "function", "name": "supportsExecutionMode", "inputs": [{ "name": "encodedMode", "type": "bytes32", "internalType": "ModeCode" }], "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], "stateMutability": "view" }, { "type": "function", "name": "supportsModule", "inputs": [{ "name": "moduleTypeId", "type": "uint256", "internalType": "uint256" }], "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], "stateMutability": "view" }, { "type": "function", "name": "uninstallModule", "inputs": [{ "name": "moduleTypeId", "type": "uint256", "internalType": "uint256" }, { "name": "module", "type": "address", "internalType": "address" }, { "name": "deInitData", "type": "bytes", "internalType": "bytes" }], "outputs": [], "stateMutability": "payable" }, { "type": "event", "name": "ModuleInstalled", "inputs": [{ "name": "moduleTypeId", "type": "uint256", "indexed": false, "internalType": "uint256" }, { "name": "module", "type": "address", "indexed": false, "internalType": "address" }], "anonymous": false }, { "type": "event", "name": "ModuleUninstalled", "inputs": [{ "name": "moduleTypeId", "type": "uint256", "indexed": false, "internalType": "uint256" }, { "name": "module", "type": "address", "indexed": false, "internalType": "address" }], "anonymous": false }];
3023
+ var entryPointAbi = [{ "type": "function", "name": "addStake", "inputs": [{ "name": "_unstakeDelaySec", "type": "uint32", "internalType": "uint32" }], "outputs": [], "stateMutability": "payable" }, { "type": "function", "name": "balanceOf", "inputs": [{ "name": "account", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "delegateAndRevert", "inputs": [{ "name": "target", "type": "address", "internalType": "address" }, { "name": "data", "type": "bytes", "internalType": "bytes" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "depositTo", "inputs": [{ "name": "account", "type": "address", "internalType": "address" }], "outputs": [], "stateMutability": "payable" }, { "type": "function", "name": "getDepositInfo", "inputs": [{ "name": "account", "type": "address", "internalType": "address" }], "outputs": [{ "name": "info", "type": "tuple", "internalType": "struct IStakeManager.DepositInfo", "components": [{ "name": "deposit", "type": "uint256", "internalType": "uint256" }, { "name": "staked", "type": "bool", "internalType": "bool" }, { "name": "stake", "type": "uint112", "internalType": "uint112" }, { "name": "unstakeDelaySec", "type": "uint32", "internalType": "uint32" }, { "name": "withdrawTime", "type": "uint48", "internalType": "uint48" }] }], "stateMutability": "view" }, { "type": "function", "name": "getNonce", "inputs": [{ "name": "sender", "type": "address", "internalType": "address" }, { "name": "key", "type": "uint192", "internalType": "uint192" }], "outputs": [{ "name": "nonce", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "getSenderAddress", "inputs": [{ "name": "initCode", "type": "bytes", "internalType": "bytes" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "getUserOpHash", "inputs": [{ "name": "userOp", "type": "tuple", "internalType": "struct PackedUserOperation", "components": [{ "name": "sender", "type": "address", "internalType": "address" }, { "name": "nonce", "type": "uint256", "internalType": "uint256" }, { "name": "initCode", "type": "bytes", "internalType": "bytes" }, { "name": "callData", "type": "bytes", "internalType": "bytes" }, { "name": "accountGasLimits", "type": "bytes32", "internalType": "bytes32" }, { "name": "preVerificationGas", "type": "uint256", "internalType": "uint256" }, { "name": "gasFees", "type": "bytes32", "internalType": "bytes32" }, { "name": "paymasterAndData", "type": "bytes", "internalType": "bytes" }, { "name": "signature", "type": "bytes", "internalType": "bytes" }] }], "outputs": [{ "name": "", "type": "bytes32", "internalType": "bytes32" }], "stateMutability": "view" }, { "type": "function", "name": "handleAggregatedOps", "inputs": [{ "name": "opsPerAggregator", "type": "tuple[]", "internalType": "struct IEntryPoint.UserOpsPerAggregator[]", "components": [{ "name": "userOps", "type": "tuple[]", "internalType": "struct PackedUserOperation[]", "components": [{ "name": "sender", "type": "address", "internalType": "address" }, { "name": "nonce", "type": "uint256", "internalType": "uint256" }, { "name": "initCode", "type": "bytes", "internalType": "bytes" }, { "name": "callData", "type": "bytes", "internalType": "bytes" }, { "name": "accountGasLimits", "type": "bytes32", "internalType": "bytes32" }, { "name": "preVerificationGas", "type": "uint256", "internalType": "uint256" }, { "name": "gasFees", "type": "bytes32", "internalType": "bytes32" }, { "name": "paymasterAndData", "type": "bytes", "internalType": "bytes" }, { "name": "signature", "type": "bytes", "internalType": "bytes" }] }, { "name": "aggregator", "type": "address", "internalType": "contract IAggregator" }, { "name": "signature", "type": "bytes", "internalType": "bytes" }] }, { "name": "beneficiary", "type": "address", "internalType": "address payable" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "handleOps", "inputs": [{ "name": "ops", "type": "tuple[]", "internalType": "struct PackedUserOperation[]", "components": [{ "name": "sender", "type": "address", "internalType": "address" }, { "name": "nonce", "type": "uint256", "internalType": "uint256" }, { "name": "initCode", "type": "bytes", "internalType": "bytes" }, { "name": "callData", "type": "bytes", "internalType": "bytes" }, { "name": "accountGasLimits", "type": "bytes32", "internalType": "bytes32" }, { "name": "preVerificationGas", "type": "uint256", "internalType": "uint256" }, { "name": "gasFees", "type": "bytes32", "internalType": "bytes32" }, { "name": "paymasterAndData", "type": "bytes", "internalType": "bytes" }, { "name": "signature", "type": "bytes", "internalType": "bytes" }] }, { "name": "beneficiary", "type": "address", "internalType": "address payable" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "incrementNonce", "inputs": [{ "name": "key", "type": "uint192", "internalType": "uint192" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "unlockStake", "inputs": [], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "withdrawStake", "inputs": [{ "name": "withdrawAddress", "type": "address", "internalType": "address payable" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "withdrawTo", "inputs": [{ "name": "withdrawAddress", "type": "address", "internalType": "address payable" }, { "name": "withdrawAmount", "type": "uint256", "internalType": "uint256" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "event", "name": "AccountDeployed", "inputs": [{ "name": "userOpHash", "type": "bytes32", "indexed": true, "internalType": "bytes32" }, { "name": "sender", "type": "address", "indexed": true, "internalType": "address" }, { "name": "factory", "type": "address", "indexed": false, "internalType": "address" }, { "name": "paymaster", "type": "address", "indexed": false, "internalType": "address" }], "anonymous": false }, { "type": "event", "name": "BeforeExecution", "inputs": [], "anonymous": false }, { "type": "event", "name": "Deposited", "inputs": [{ "name": "account", "type": "address", "indexed": true, "internalType": "address" }, { "name": "totalDeposit", "type": "uint256", "indexed": false, "internalType": "uint256" }], "anonymous": false }, { "type": "event", "name": "PostOpRevertReason", "inputs": [{ "name": "userOpHash", "type": "bytes32", "indexed": true, "internalType": "bytes32" }, { "name": "sender", "type": "address", "indexed": true, "internalType": "address" }, { "name": "nonce", "type": "uint256", "indexed": false, "internalType": "uint256" }, { "name": "revertReason", "type": "bytes", "indexed": false, "internalType": "bytes" }], "anonymous": false }, { "type": "event", "name": "SignatureAggregatorChanged", "inputs": [{ "name": "aggregator", "type": "address", "indexed": true, "internalType": "address" }], "anonymous": false }, { "type": "event", "name": "StakeLocked", "inputs": [{ "name": "account", "type": "address", "indexed": true, "internalType": "address" }, { "name": "totalStaked", "type": "uint256", "indexed": false, "internalType": "uint256" }, { "name": "unstakeDelaySec", "type": "uint256", "indexed": false, "internalType": "uint256" }], "anonymous": false }, { "type": "event", "name": "StakeUnlocked", "inputs": [{ "name": "account", "type": "address", "indexed": true, "internalType": "address" }, { "name": "withdrawTime", "type": "uint256", "indexed": false, "internalType": "uint256" }], "anonymous": false }, { "type": "event", "name": "StakeWithdrawn", "inputs": [{ "name": "account", "type": "address", "indexed": true, "internalType": "address" }, { "name": "withdrawAddress", "type": "address", "indexed": false, "internalType": "address" }, { "name": "amount", "type": "uint256", "indexed": false, "internalType": "uint256" }], "anonymous": false }, { "type": "event", "name": "UserOperationEvent", "inputs": [{ "name": "userOpHash", "type": "bytes32", "indexed": true, "internalType": "bytes32" }, { "name": "sender", "type": "address", "indexed": true, "internalType": "address" }, { "name": "paymaster", "type": "address", "indexed": true, "internalType": "address" }, { "name": "nonce", "type": "uint256", "indexed": false, "internalType": "uint256" }, { "name": "success", "type": "bool", "indexed": false, "internalType": "bool" }, { "name": "actualGasCost", "type": "uint256", "indexed": false, "internalType": "uint256" }, { "name": "actualGasUsed", "type": "uint256", "indexed": false, "internalType": "uint256" }], "anonymous": false }, { "type": "event", "name": "UserOperationPrefundTooLow", "inputs": [{ "name": "userOpHash", "type": "bytes32", "indexed": true, "internalType": "bytes32" }, { "name": "sender", "type": "address", "indexed": true, "internalType": "address" }, { "name": "nonce", "type": "uint256", "indexed": false, "internalType": "uint256" }], "anonymous": false }, { "type": "event", "name": "UserOperationRevertReason", "inputs": [{ "name": "userOpHash", "type": "bytes32", "indexed": true, "internalType": "bytes32" }, { "name": "sender", "type": "address", "indexed": true, "internalType": "address" }, { "name": "nonce", "type": "uint256", "indexed": false, "internalType": "uint256" }, { "name": "revertReason", "type": "bytes", "indexed": false, "internalType": "bytes" }], "anonymous": false }, { "type": "event", "name": "Withdrawn", "inputs": [{ "name": "account", "type": "address", "indexed": true, "internalType": "address" }, { "name": "withdrawAddress", "type": "address", "indexed": false, "internalType": "address" }, { "name": "amount", "type": "uint256", "indexed": false, "internalType": "uint256" }], "anonymous": false }, { "type": "error", "name": "DelegateAndRevert", "inputs": [{ "name": "success", "type": "bool", "internalType": "bool" }, { "name": "ret", "type": "bytes", "internalType": "bytes" }] }, { "type": "error", "name": "FailedOp", "inputs": [{ "name": "opIndex", "type": "uint256", "internalType": "uint256" }, { "name": "reason", "type": "string", "internalType": "string" }] }, { "type": "error", "name": "FailedOpWithRevert", "inputs": [{ "name": "opIndex", "type": "uint256", "internalType": "uint256" }, { "name": "reason", "type": "string", "internalType": "string" }, { "name": "inner", "type": "bytes", "internalType": "bytes" }] }, { "type": "error", "name": "PostOpReverted", "inputs": [{ "name": "returnData", "type": "bytes", "internalType": "bytes" }] }, { "type": "error", "name": "SenderAddressResult", "inputs": [{ "name": "sender", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "SignatureValidationFailed", "inputs": [{ "name": "aggregator", "type": "address", "internalType": "address" }] }];
3024
+ var erc20Abi = [{ "type": "function", "name": "allowance", "inputs": [{ "name": "owner", "type": "address", "internalType": "address" }, { "name": "spender", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "approve", "inputs": [{ "name": "spender", "type": "address", "internalType": "address" }, { "name": "amount", "type": "uint256", "internalType": "uint256" }], "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "balanceOf", "inputs": [{ "name": "account", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "decimals", "inputs": [], "outputs": [{ "name": "", "type": "uint8", "internalType": "uint8" }], "stateMutability": "view" }, { "type": "function", "name": "name", "inputs": [], "outputs": [{ "name": "", "type": "string", "internalType": "string" }], "stateMutability": "view" }, { "type": "function", "name": "symbol", "inputs": [], "outputs": [{ "name": "", "type": "string", "internalType": "string" }], "stateMutability": "view" }, { "type": "function", "name": "totalSupply", "inputs": [], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "transfer", "inputs": [{ "name": "to", "type": "address", "internalType": "address" }, { "name": "amount", "type": "uint256", "internalType": "uint256" }], "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "transferFrom", "inputs": [{ "name": "from", "type": "address", "internalType": "address" }, { "name": "to", "type": "address", "internalType": "address" }, { "name": "amount", "type": "uint256", "internalType": "uint256" }], "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], "stateMutability": "nonpayable" }, { "type": "event", "name": "Approval", "inputs": [{ "name": "owner", "type": "address", "indexed": true, "internalType": "address" }, { "name": "spender", "type": "address", "indexed": true, "internalType": "address" }, { "name": "value", "type": "uint256", "indexed": false, "internalType": "uint256" }], "anonymous": false }, { "type": "event", "name": "Transfer", "inputs": [{ "name": "from", "type": "address", "indexed": true, "internalType": "address" }, { "name": "to", "type": "address", "indexed": true, "internalType": "address" }, { "name": "value", "type": "uint256", "indexed": false, "internalType": "uint256" }], "anonymous": false }];
3025
+ var safe7579Abi = [{ "type": "fallback", "stateMutability": "payable" }, { "type": "receive", "stateMutability": "payable" }, { "type": "function", "name": "accountId", "inputs": [], "outputs": [{ "name": "accountImplementationId", "type": "string", "internalType": "string" }], "stateMutability": "pure" }, { "type": "function", "name": "domainSeparator", "inputs": [], "outputs": [{ "name": "", "type": "bytes32", "internalType": "bytes32" }], "stateMutability": "view" }, { "type": "function", "name": "emergencyUninstallHook", "inputs": [{ "name": "data", "type": "tuple", "internalType": "struct EmergencyUninstall", "components": [{ "name": "hook", "type": "address", "internalType": "address" }, { "name": "hookType", "type": "uint256", "internalType": "uint256" }, { "name": "deInitData", "type": "bytes", "internalType": "bytes" }, { "name": "nonce", "type": "uint256", "internalType": "uint256" }] }, { "name": "signature", "type": "bytes", "internalType": "bytes" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "entryPoint", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "execute", "inputs": [{ "name": "mode", "type": "bytes32", "internalType": "ModeCode" }, { "name": "executionCalldata", "type": "bytes", "internalType": "bytes" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "executeFromExecutor", "inputs": [{ "name": "mode", "type": "bytes32", "internalType": "ModeCode" }, { "name": "executionCalldata", "type": "bytes", "internalType": "bytes" }], "outputs": [{ "name": "returnDatas", "type": "bytes[]", "internalType": "bytes[]" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "getActiveHook", "inputs": [], "outputs": [{ "name": "hook", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "getExecutorsPaginated", "inputs": [{ "name": "cursor", "type": "address", "internalType": "address" }, { "name": "pageSize", "type": "uint256", "internalType": "uint256" }], "outputs": [{ "name": "array", "type": "address[]", "internalType": "address[]" }, { "name": "next", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "getFallbackHandlerBySelector", "inputs": [{ "name": "selector", "type": "bytes4", "internalType": "bytes4" }], "outputs": [{ "name": "", "type": "bytes1", "internalType": "CallType" }, { "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "getNonce", "inputs": [{ "name": "safe", "type": "address", "internalType": "address" }, { "name": "validator", "type": "address", "internalType": "address" }], "outputs": [{ "name": "nonce", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "getPrevalidationHook", "inputs": [{ "name": "moduleType", "type": "uint256", "internalType": "uint256" }], "outputs": [{ "name": "hook", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "getSafeOp", "inputs": [{ "name": "userOp", "type": "tuple", "internalType": "struct PackedUserOperation", "components": [{ "name": "sender", "type": "address", "internalType": "address" }, { "name": "nonce", "type": "uint256", "internalType": "uint256" }, { "name": "initCode", "type": "bytes", "internalType": "bytes" }, { "name": "callData", "type": "bytes", "internalType": "bytes" }, { "name": "accountGasLimits", "type": "bytes32", "internalType": "bytes32" }, { "name": "preVerificationGas", "type": "uint256", "internalType": "uint256" }, { "name": "gasFees", "type": "bytes32", "internalType": "bytes32" }, { "name": "paymasterAndData", "type": "bytes", "internalType": "bytes" }, { "name": "signature", "type": "bytes", "internalType": "bytes" }] }, { "name": "entryPoint", "type": "address", "internalType": "address" }], "outputs": [{ "name": "operationData", "type": "bytes", "internalType": "bytes" }, { "name": "validAfter", "type": "uint48", "internalType": "uint48" }, { "name": "validUntil", "type": "uint48", "internalType": "uint48" }, { "name": "signatures", "type": "bytes", "internalType": "bytes" }], "stateMutability": "view" }, { "type": "function", "name": "getValidatorsPaginated", "inputs": [{ "name": "cursor", "type": "address", "internalType": "address" }, { "name": "pageSize", "type": "uint256", "internalType": "uint256" }], "outputs": [{ "name": "array", "type": "address[]", "internalType": "address[]" }, { "name": "next", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "initializeAccount", "inputs": [{ "name": "modules", "type": "tuple[]", "internalType": "struct ModuleInit[]", "components": [{ "name": "module", "type": "address", "internalType": "address" }, { "name": "initData", "type": "bytes", "internalType": "bytes" }, { "name": "moduleType", "type": "uint256", "internalType": "uint256" }] }, { "name": "registryInit", "type": "tuple", "internalType": "struct RegistryInit", "components": [{ "name": "registry", "type": "address", "internalType": "contract IERC7484" }, { "name": "attesters", "type": "address[]", "internalType": "address[]" }, { "name": "threshold", "type": "uint8", "internalType": "uint8" }] }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "initializeAccountWithValidators", "inputs": [{ "name": "validators", "type": "tuple[]", "internalType": "struct ModuleInit[]", "components": [{ "name": "module", "type": "address", "internalType": "address" }, { "name": "initData", "type": "bytes", "internalType": "bytes" }, { "name": "moduleType", "type": "uint256", "internalType": "uint256" }] }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "installModule", "inputs": [{ "name": "moduleType", "type": "uint256", "internalType": "uint256" }, { "name": "module", "type": "address", "internalType": "address" }, { "name": "initData", "type": "bytes", "internalType": "bytes" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "isModuleInstalled", "inputs": [{ "name": "moduleType", "type": "uint256", "internalType": "uint256" }, { "name": "module", "type": "address", "internalType": "address" }, { "name": "additionalContext", "type": "bytes", "internalType": "bytes" }], "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], "stateMutability": "view" }, { "type": "function", "name": "isValidSignature", "inputs": [{ "name": "hash", "type": "bytes32", "internalType": "bytes32" }, { "name": "data", "type": "bytes", "internalType": "bytes" }], "outputs": [{ "name": "magicValue", "type": "bytes4", "internalType": "bytes4" }], "stateMutability": "view" }, { "type": "function", "name": "setRegistry", "inputs": [{ "name": "registry", "type": "address", "internalType": "contract IERC7484" }, { "name": "attesters", "type": "address[]", "internalType": "address[]" }, { "name": "threshold", "type": "uint8", "internalType": "uint8" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "supportsExecutionMode", "inputs": [{ "name": "encodedMode", "type": "bytes32", "internalType": "ModeCode" }], "outputs": [{ "name": "supported", "type": "bool", "internalType": "bool" }], "stateMutability": "pure" }, { "type": "function", "name": "supportsModule", "inputs": [{ "name": "moduleTypeId", "type": "uint256", "internalType": "uint256" }], "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], "stateMutability": "pure" }, { "type": "function", "name": "uninstallModule", "inputs": [{ "name": "moduleType", "type": "uint256", "internalType": "uint256" }, { "name": "module", "type": "address", "internalType": "address" }, { "name": "deInitData", "type": "bytes", "internalType": "bytes" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "validateUserOp", "inputs": [{ "name": "userOp", "type": "tuple", "internalType": "struct PackedUserOperation", "components": [{ "name": "sender", "type": "address", "internalType": "address" }, { "name": "nonce", "type": "uint256", "internalType": "uint256" }, { "name": "initCode", "type": "bytes", "internalType": "bytes" }, { "name": "callData", "type": "bytes", "internalType": "bytes" }, { "name": "accountGasLimits", "type": "bytes32", "internalType": "bytes32" }, { "name": "preVerificationGas", "type": "uint256", "internalType": "uint256" }, { "name": "gasFees", "type": "bytes32", "internalType": "bytes32" }, { "name": "paymasterAndData", "type": "bytes", "internalType": "bytes" }, { "name": "signature", "type": "bytes", "internalType": "bytes" }] }, { "name": "userOpHash", "type": "bytes32", "internalType": "bytes32" }, { "name": "missingAccountFunds", "type": "uint256", "internalType": "uint256" }], "outputs": [{ "name": "validSignature", "type": "uint256", "internalType": "uint256" }], "stateMutability": "nonpayable" }, { "type": "event", "name": "ERC7484RegistryConfigured", "inputs": [{ "name": "smartAccount", "type": "address", "indexed": true, "internalType": "address" }, { "name": "registry", "type": "address", "indexed": true, "internalType": "contract IERC7484" }], "anonymous": false }, { "type": "event", "name": "EmergencyHookUninstallRequest", "inputs": [{ "name": "hook", "type": "address", "indexed": false, "internalType": "address" }, { "name": "time", "type": "uint256", "indexed": false, "internalType": "uint256" }], "anonymous": false }, { "type": "event", "name": "EmergencyHookUninstallRequestReset", "inputs": [{ "name": "hook", "type": "address", "indexed": false, "internalType": "address" }, { "name": "time", "type": "uint256", "indexed": false, "internalType": "uint256" }], "anonymous": false }, { "type": "event", "name": "ModuleInstalled", "inputs": [{ "name": "moduleTypeId", "type": "uint256", "indexed": false, "internalType": "uint256" }, { "name": "module", "type": "address", "indexed": false, "internalType": "address" }], "anonymous": false }, { "type": "event", "name": "ModuleUninstalled", "inputs": [{ "name": "moduleTypeId", "type": "uint256", "indexed": false, "internalType": "uint256" }, { "name": "module", "type": "address", "indexed": false, "internalType": "address" }], "anonymous": false }, { "type": "event", "name": "Safe7579Initialized", "inputs": [{ "name": "safe", "type": "address", "indexed": true, "internalType": "address" }], "anonymous": false }, { "type": "event", "name": "TryExecutionFailed", "inputs": [{ "name": "safe", "type": "address", "indexed": false, "internalType": "contract ISafe" }, { "name": "numberInBatch", "type": "uint256", "indexed": false, "internalType": "uint256" }], "anonymous": false }, { "type": "event", "name": "TryExecutionsFailed", "inputs": [{ "name": "safe", "type": "address", "indexed": false, "internalType": "contract ISafe" }, { "name": "success", "type": "bool[]", "indexed": false, "internalType": "bool[]" }], "anonymous": false }, { "type": "error", "name": "AccountAccessUnauthorized", "inputs": [] }, { "type": "error", "name": "EmergencyTimeLockNotExpired", "inputs": [] }, { "type": "error", "name": "EmergencyUninstallSigError", "inputs": [] }, { "type": "error", "name": "ExecutionFailed", "inputs": [] }, { "type": "error", "name": "FallbackInstalled", "inputs": [{ "name": "msgSig", "type": "bytes4", "internalType": "bytes4" }] }, { "type": "error", "name": "HookAlreadyInstalled", "inputs": [{ "name": "currentHook", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "InvalidCallType", "inputs": [{ "name": "callType", "type": "bytes1", "internalType": "CallType" }] }, { "type": "error", "name": "InvalidFallbackHandler", "inputs": [{ "name": "msgSig", "type": "bytes4", "internalType": "bytes4" }] }, { "type": "error", "name": "InvalidHookType", "inputs": [] }, { "type": "error", "name": "InvalidInitData", "inputs": [{ "name": "safe", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "InvalidInput", "inputs": [] }, { "type": "error", "name": "InvalidModule", "inputs": [{ "name": "module", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "InvalidModuleType", "inputs": [{ "name": "module", "type": "address", "internalType": "address" }, { "name": "moduleType", "type": "uint256", "internalType": "uint256" }] }, { "type": "error", "name": "InvalidNonce", "inputs": [] }, { "type": "error", "name": "LinkedList_AlreadyInitialized", "inputs": [] }, { "type": "error", "name": "LinkedList_EntryAlreadyInList", "inputs": [{ "name": "entry", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "LinkedList_InvalidEntry", "inputs": [{ "name": "entry", "type": "address", "internalType": "address" }] }, { "type": "error", "name": "LinkedList_InvalidPage", "inputs": [] }, { "type": "error", "name": "ModuleNotInstalled", "inputs": [{ "name": "module", "type": "address", "internalType": "address" }, { "name": "moduleType", "type": "uint256", "internalType": "uint256" }] }, { "type": "error", "name": "NoFallbackHandler", "inputs": [{ "name": "msgSig", "type": "bytes4", "internalType": "bytes4" }] }, { "type": "error", "name": "PreValidationHookAlreadyInstalled", "inputs": [{ "name": "currentHook", "type": "address", "internalType": "address" }, { "name": "moduleType", "type": "uint256", "internalType": "uint256" }] }, { "type": "error", "name": "UnsupportedCallType", "inputs": [{ "name": "callType", "type": "bytes1", "internalType": "CallType" }] }, { "type": "error", "name": "UnsupportedExecType", "inputs": [{ "name": "execType", "type": "bytes1", "internalType": "ExecType" }] }, { "type": "error", "name": "UnsupportedModuleType", "inputs": [{ "name": "moduleTypeId", "type": "uint256", "internalType": "uint256" }] }];
3026
+
3027
+ // ../node_modules/viem/_esm/utils/abi/decodeEventLog.js
3028
+ init_abi();
3029
+ init_base();
3030
+ init_cursor();
3031
+ init_getAddress();
3032
+ init_size();
3033
+ init_toEventSelector();
3034
+ init_regex2();
3035
+ init_decodeAbiParameters();
3036
+ init_formatAbiItem2();
3037
+ var docsPath2 = "/docs/contract/decodeEventLog";
3038
+ function decodeEventLog(parameters) {
3039
+ const { abi, data, eventName, strict: strict_, topics } = parameters;
3040
+ const strict = strict_ ?? true;
3041
+ const events = abi.filter((item) => item.type === "event" && "name" in item);
3042
+ const signature = topics[0];
3043
+ const bySelector = signature ? events.find((item) => !item.anonymous && signature === toEventSelector(formatAbiItem2(item))) : void 0;
3044
+ const candidates = bySelector ? [bySelector] : anonymousCandidates(events, topics.length, eventName);
3045
+ if (candidates.length > 1)
3046
+ throw new AbiEventAmbiguityError(candidates.map((item) => item.name));
3047
+ const abiItem = candidates[0];
3048
+ if (!abiItem) {
3049
+ if (!signature)
3050
+ throw new AbiEventSignatureEmptyTopicsError({ docsPath: docsPath2 });
3051
+ throw new AbiEventSignatureNotFoundError(signature, { docsPath: docsPath2 });
3052
+ }
3053
+ return decodeMatchedEventLog({
3054
+ argTopics: abiItem.anonymous ? topics : topics.slice(1),
3055
+ data,
3056
+ plan: toEventPlan(abiItem),
3057
+ strict
3058
+ });
3059
+ }
3060
+ function toEventPlan(abiItem) {
3061
+ const { inputs } = abiItem;
3062
+ const isUnnamed = inputs?.some((x) => !("name" in x && x.name));
3063
+ return {
3064
+ abiItem,
3065
+ indexedInputs: inputs.map((x, i) => [x, i]).filter(([x]) => "indexed" in x && x.indexed).map(([x, i]) => [x, i, topicKind(x)]),
3066
+ isUnnamed,
3067
+ nonIndexedInputs: inputs.filter((x) => !("indexed" in x && x.indexed)),
3068
+ selector: void 0
3069
+ };
3070
+ }
3071
+ function anonymousCandidates(events, topicCount, eventName) {
3072
+ const requested = (() => {
3073
+ if (eventName)
3074
+ return events.filter((item) => item.name === eventName);
3075
+ if (events.every((item) => item.anonymous))
3076
+ return events;
3077
+ return [];
3078
+ })();
3079
+ return requested.filter((item) => item.anonymous && indexedCount(item) === topicCount);
3080
+ }
3081
+ function indexedCount(item) {
3082
+ return item.inputs?.filter((input) => input.indexed).length ?? 0;
3083
+ }
3084
+ function decodeMatchedEventLog({ argTopics, data, plan, strict }) {
3085
+ const { abiItem, indexedInputs, isUnnamed, nonIndexedInputs } = plan;
3086
+ const { name, inputs } = abiItem;
3087
+ const args = isUnnamed ? [] : {};
3088
+ const missingIndexedInputs = [];
3089
+ for (let i = 0; i < indexedInputs.length; i++) {
3090
+ const [param, argIndex, kind] = indexedInputs[i];
3091
+ const topic = argTopics[i];
3092
+ if (!topic) {
3093
+ if (strict)
3094
+ throw new DecodeLogTopicsMismatch({
3095
+ abiItem,
3096
+ param
3097
+ });
3098
+ missingIndexedInputs.push([param, argIndex]);
3099
+ continue;
3100
+ }
3101
+ args[isUnnamed ? argIndex : param.name || argIndex] = decodeTopic(param, kind, topic);
3102
+ }
3103
+ const inputsToDecode = strict ? nonIndexedInputs : [...missingIndexedInputs.map(([param]) => param), ...nonIndexedInputs];
3104
+ if (inputsToDecode.length > 0) {
3105
+ if (data && data !== "0x") {
3106
+ try {
3107
+ const decodedData = decodeAbiParameters(inputsToDecode, data);
3108
+ if (decodedData) {
3109
+ let dataIndex = 0;
3110
+ if (!strict) {
3111
+ for (const [param, argIndex] of missingIndexedInputs) {
3112
+ args[isUnnamed ? argIndex : param.name || argIndex] = decodedData[dataIndex++];
3113
+ }
3114
+ }
3115
+ if (isUnnamed) {
3116
+ for (let i = 0; i < inputs.length; i++)
3117
+ if (args[i] === void 0 && dataIndex < decodedData.length)
3118
+ args[i] = decodedData[dataIndex++];
3119
+ } else
3120
+ for (let i = 0; i < nonIndexedInputs.length; i++)
3121
+ args[nonIndexedInputs[i].name] = decodedData[dataIndex++];
3122
+ }
3123
+ } catch (err) {
3124
+ if (strict) {
3125
+ if (err instanceof AbiDecodingDataSizeTooSmallError || err instanceof PositionOutOfBoundsError)
3126
+ throw new DecodeLogDataMismatch({
3127
+ abiItem,
3128
+ data,
3129
+ params: inputsToDecode,
3130
+ size: size(data)
3131
+ });
3132
+ throw err;
3133
+ }
3134
+ }
3135
+ } else if (strict) {
3136
+ throw new DecodeLogDataMismatch({
3137
+ abiItem,
3138
+ data: "0x",
3139
+ params: inputsToDecode,
3140
+ size: 0
3141
+ });
3142
+ }
3143
+ }
3144
+ return {
3145
+ eventName: name,
3146
+ args: Object.values(args).length > 0 ? args : void 0
3147
+ };
3148
+ }
3149
+ function topicKind(param) {
3150
+ const { type } = param;
3151
+ if (typeof type !== "string")
3152
+ return "decode";
3153
+ if (type === "string" || type === "bytes" || type === "tuple" || type.match(/^(.*)\[(\d+)?\]$/))
3154
+ return "hashed";
3155
+ if (type === "address")
3156
+ return "address";
3157
+ if (bytesRegex.test(type))
3158
+ return "bytes";
3159
+ const integer = integerRegex.exec(type);
3160
+ if (integer?.[1] === "uint" && Number(integer[2] ?? 256) > 48)
3161
+ return "uint";
3162
+ return "decode";
3163
+ }
3164
+ var topicRegex = /^0x[0-9a-fA-F]{64}$/;
3165
+ function decodeTopic(param, kind, value) {
3166
+ if (kind !== "decode" && kind !== "hashed" && topicRegex.test(value)) {
3167
+ if (kind === "address")
3168
+ return checksumAddress(`0x${value.slice(26).toLowerCase()}`);
3169
+ if (kind === "uint")
3170
+ return BigInt(value);
3171
+ return value.slice(0, 2 + Number(param.type.slice(5)) * 2).toLowerCase();
3172
+ }
3173
+ if (param.type === "string" || param.type === "bytes" || param.type === "tuple" || param.type.match(/^(.*)\[(\d+)?\]$/))
3174
+ return value;
3175
+ const decodedArg = decodeAbiParameters([param], value) || [];
3176
+ return decodedArg[0];
3177
+ }
3178
+ var AbiEventAmbiguityError = class extends BaseError {
3179
+ constructor(eventNames) {
3180
+ const distinct = new Set(eventNames).size === eventNames.length;
3181
+ super("Ambiguous anonymous event log.", {
3182
+ docsPath: docsPath2,
3183
+ metaMessages: [
3184
+ `Matched ${eventNames.map((name) => `\`${name}\``).join(", ")}.`,
3185
+ "These events take the same number of indexed topics.",
3186
+ distinct ? "Pass `eventName` to choose one." : "Pass an `abi` that holds only the event to decode."
3187
+ ],
3188
+ name: "AbiEventAmbiguityError"
3189
+ });
3190
+ }
3191
+ };
3192
+
3193
+ // ../node_modules/viem/_esm/utils/chain/defineChain.js
3194
+ function defineChain(chain) {
3195
+ const chainInstance = {
3196
+ formatters: void 0,
3197
+ fees: void 0,
3198
+ serializers: void 0,
3199
+ ...chain
3200
+ };
3201
+ function extend(base) {
3202
+ return (fnOrExtended) => {
3203
+ const properties = typeof fnOrExtended === "function" ? fnOrExtended(base) : fnOrExtended;
3204
+ const combined = { ...base, ...properties };
3205
+ return Object.assign(combined, { extend: extend(combined) });
3206
+ };
3207
+ }
3208
+ return Object.assign(chainInstance, {
3209
+ extend: extend(chainInstance)
3210
+ });
3211
+ }
3212
+
3213
+ // ../node_modules/viem/_esm/constants/address.js
3214
+ var zeroAddress = "0x0000000000000000000000000000000000000000";
3215
+
3216
+ // ../node_modules/viem/_esm/index.js
3217
+ init_abis();
3218
+ init_number();
3219
+ init_decodeAbiParameters();
3220
+ init_decodeErrorResult();
3221
+ init_decodeFunctionData();
3222
+ init_encodeAbiParameters();
3223
+ init_encodeFunctionData();
3224
+ init_concat();
3225
+ init_pad();
3226
+ init_toHex();
3227
+ init_keccak256();
3228
+
3229
+ // src/addresses.ts
3230
+ var robinhood = defineChain({
3231
+ id: 4663,
3232
+ name: "Robinhood Chain",
3233
+ nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
3234
+ rpcUrls: { default: { http: ["https://rpc.mainnet.chain.robinhood.com"] } },
3235
+ blockExplorers: { default: { name: "Blockscout", url: "https://robinhoodchain.blockscout.com" } }
3236
+ });
3237
+ var mortise = {
3238
+ rootValidator: "0xD10b7D017C00f078F4b39c348Ba50Af9422FC6cC",
3239
+ gate: "0x5713DF62cFa2dACe935fc207543817dd6348b567",
3240
+ setup: "0x0085085ce5771B03Fb0E9f4DbA802189cb9F9Dc5",
3241
+ factory: "0xCbB00808600C62C008C9F6cd3b8A0b0a1374d3A8",
3242
+ subVaults: "0x7d42FD334B2e342234eb47c0Caf4b3012260F81b",
3243
+ signer: "0x4b26cb1c6f31d1749F741cC7dF5e25B4CbfF827a",
3244
+ timelock: "0x45d02022232D78AA78716B837DDD63fb57Af40Be",
3245
+ router: "0x34f6Da2b9EE2e97d77b0320B05A1584804f4D89d",
3246
+ uniswapV3: "0x61DCf90FeE816EbD025766663cDF0598AE916f79",
3247
+ uniswapV3Liquidity: "0x6581543E5b0b42E3dD066e1eF6AF4C6a60309aF2",
3248
+ uniswapV4: "0x0A2C90C1CF8a827515971d9913E988f716DF73f6",
3249
+ uniswapV4Liquidity: "0x0Af90790a50295D396408a71F9cCC7b49bF4ec19",
3250
+ ponsTrader: "0x86775d6Ce307aAc55a42eB86612FC2b3aB55677a",
3251
+ pons: "0x16Cb81C4C61FA7064D7325B8fA344E45833A391D",
3252
+ flap: "0x869bb75F26D03a4B23952f1A29960bE015eE2bDa",
3253
+ morphoBlue: "0xA972dF5d1196f5a0247de2d81fDAf801796C1D16",
3254
+ erc4626: "0xD4d2827b2a8580bd6DbF2F0Bdcce239F795aAa61",
3255
+ transfer: "0x9171159781C91133009EEfEb528397b256aEf347",
3256
+ weth: "0xcb7EE95d267676Cc875a64A293A353604d497F30",
3257
+ across: "0x3716d6CD2D06CEC9a1e9067eaEdD2D2F7467bD21",
3258
+ familyTransfer: "0x398f4003F11197d70744D14423114D81280B5042",
3259
+ dca: "0xC319309684725a0cF3F712F630A9e7c63ACE345a",
3260
+ automation: "0x2aFf436334EbcafA4233363fcAf95bFE63219d7d",
3261
+ rebalance: "0xe6e501a2A6422587E8c81813B805D52B4b4fFc57"
3262
+ };
3263
+ var deployBlock = 127492191n;
3264
+ var external = {
3265
+ entryPoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
3266
+ safe7579: "0x7579d6Dd6F1e9F57729a59049174ed6Fd7fC0003",
3267
+ weth: "0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",
3268
+ permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3"
3269
+ };
3270
+ var ETH = "0x0000000000000000000000000000000000000000";
3271
+
3272
+ // src/root.ts
3273
+ var ZERO32 = "0x0000000000000000000000000000000000000000000000000000000000000000";
3274
+ var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
3275
+ var memberTuple = {
3276
+ type: "tuple[]",
3277
+ components: [
3278
+ { name: "keyType", type: "uint8" },
3279
+ { name: "signer", type: "address" },
3280
+ { name: "x", type: "bytes32" },
3281
+ { name: "y", type: "bytes32" }
3282
+ ]
3283
+ };
3284
+ function toMember(m) {
3285
+ return m.type === "ecdsa" ? { keyType: 1, signer: m.signer, x: ZERO32, y: ZERO32 } : { keyType: 2, signer: ZERO_ADDRESS, x: m.x, y: m.y };
3286
+ }
3287
+ function encodeRoot(root2) {
3288
+ const n = root2.members.length;
3289
+ if (n < 1 || n > 10) throw new Error("a root has one to ten keys");
3290
+ if (!Number.isInteger(root2.threshold) || root2.threshold < 1 || root2.threshold > n) {
3291
+ throw new Error("the threshold must be between 1 and the number of keys");
3292
+ }
3293
+ return encodeAbiParameters([memberTuple, { type: "uint256" }], [root2.members.map(toMember), BigInt(root2.threshold)]);
3294
+ }
3295
+ function rootHash(root2) {
3296
+ return keccak256(encodeRoot(root2));
3297
+ }
3298
+ var P256_N = 0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551n;
3299
+ function encodePasskeySignature(a) {
3300
+ const json = new TextEncoder().encode(a.clientDataJSON);
3301
+ const challengeIndex = byteIndexOf(json, '"challenge":"');
3302
+ const typeIndex = byteIndexOf(json, '"type":"');
3303
+ if (challengeIndex < 0 || typeIndex < 0) throw new Error("clientDataJSON has no challenge or type");
3304
+ const s = a.s > P256_N / 2n ? P256_N - a.s : a.s;
3305
+ return encodeAbiParameters(
3306
+ [
3307
+ {
3308
+ type: "tuple",
3309
+ components: [
3310
+ { name: "authenticatorData", type: "bytes" },
3311
+ { name: "clientDataJSON", type: "string" },
3312
+ { name: "challengeIndex", type: "uint256" },
3313
+ { name: "typeIndex", type: "uint256" },
3314
+ { name: "r", type: "bytes32" },
3315
+ { name: "s", type: "bytes32" }
3316
+ ]
3317
+ }
3318
+ ],
3319
+ [
3320
+ {
3321
+ authenticatorData: a.authenticatorData,
3322
+ clientDataJSON: a.clientDataJSON,
3323
+ challengeIndex: BigInt(challengeIndex),
3324
+ typeIndex: BigInt(typeIndex),
3325
+ r: `0x${a.r.toString(16).padStart(64, "0")}`,
3326
+ s: `0x${s.toString(16).padStart(64, "0")}`
3327
+ }
3328
+ ]
3329
+ );
3330
+ }
3331
+ function byteIndexOf(haystack, needle) {
3332
+ const n = new TextEncoder().encode(needle);
3333
+ outer: for (let i = 0; i + n.length <= haystack.length; i++) {
3334
+ for (let j = 0; j < n.length; j++) if (haystack[i + j] !== n[j]) continue outer;
3335
+ return i;
3336
+ }
3337
+ return -1;
3338
+ }
3339
+ function singleKeyRoot(signer2) {
3340
+ return { members: [{ type: "ecdsa", signer: signer2 }], threshold: 1 };
3341
+ }
3342
+ function encodeRootSignature(root2, signatures) {
3343
+ if (root2.members.length === 1) {
3344
+ const only = signatures[0];
3345
+ if (signatures.length !== 1 || !only || only.index !== 0) throw new Error("a one-key root takes one signature");
3346
+ return only.signature;
3347
+ }
3348
+ const sorted = [...signatures].sort((a, b) => a.index - b.index);
3349
+ sorted.forEach((s, i) => {
3350
+ if (s.index < 0 || s.index >= root2.members.length) throw new Error(`no root member ${s.index}`);
3351
+ if (i > 0 && sorted[i - 1].index === s.index) throw new Error(`member ${s.index} signed twice`);
3352
+ });
3353
+ if (sorted.length < root2.threshold) throw new Error(`the root needs ${root2.threshold} signatures`);
3354
+ return encodeAbiParameters(
3355
+ [{ type: "tuple[]", components: [{ name: "index", type: "uint256" }, { name: "signature", type: "bytes" }] }],
3356
+ [sorted.map((s) => ({ index: BigInt(s.index), signature: s.signature }))]
3357
+ );
3358
+ }
3359
+
3360
+ // src/errors.ts
3361
+ var errorAbi = (() => {
3362
+ const seen = /* @__PURE__ */ new Set();
3363
+ const out = [];
3364
+ for (const abi of Object.values(abis_exports)) {
3365
+ for (const item of abi) {
3366
+ if (item.type !== "error") continue;
3367
+ const key = `${item.name}(${item.inputs.map((i) => i.type).join(",")})`;
3368
+ if (seen.has(key)) continue;
3369
+ seen.add(key);
3370
+ out.push(item);
3371
+ }
3372
+ }
3373
+ return out;
3374
+ })();
3375
+ function decodeMortiseError(data) {
3376
+ try {
3377
+ const r = decodeErrorResult({ abi: errorAbi, data });
3378
+ return { name: r.errorName, args: r.args ?? [] };
3379
+ } catch {
3380
+ return void 0;
3381
+ }
3382
+ }
3383
+ function revertData(err) {
3384
+ const hex = (v) => typeof v === "string" && v.startsWith("0x") && v.length >= 10 ? v : void 0;
3385
+ let found;
3386
+ let e = err;
3387
+ for (let depth = 0; e && typeof e === "object" && depth < 20; depth++) {
3388
+ const data = e.data;
3389
+ found = hex(data) ?? hex(e.raw) ?? (data && typeof data === "object" ? hex(data.data) : void 0);
3390
+ if (found) return found;
3391
+ e = e.cause;
3392
+ }
3393
+ return void 0;
3394
+ }
3395
+ function mortiseErrorName(err) {
3396
+ const data = revertData(err);
3397
+ return data ? decodeMortiseError(data)?.name : void 0;
3398
+ }
3399
+
3400
+ // src/userop.ts
3401
+ var MODULE_TYPE = { validator: 1n, executor: 2n, fallback: 3n, hook: 4n };
3402
+ var BATCH_MODE = pad("0x01", { dir: "right", size: 32 });
3403
+ var executionComponents = [
3404
+ { name: "target", type: "address" },
3405
+ { name: "value", type: "uint256" },
3406
+ { name: "callData", type: "bytes" }
3407
+ ];
3408
+ function encodeRootCall(c) {
3409
+ if (c.kind === "execute") {
3410
+ if (c.calls.length === 0) throw new Error("nothing to execute");
3411
+ const executions = encodeAbiParameters(
3412
+ [{ type: "tuple[]", components: executionComponents }],
3413
+ [c.calls.map((x) => ({ target: x.to, value: x.value ?? 0n, callData: x.data ?? "0x" }))]
3414
+ );
3415
+ return encodeFunctionData({ abi: accountAbi, functionName: "execute", args: [BATCH_MODE, executions] });
3416
+ }
3417
+ if (c.kind === "installModule") {
3418
+ return encodeFunctionData({ abi: accountAbi, functionName: "installModule", args: [c.moduleType, c.module, c.initData] });
3419
+ }
3420
+ if (c.moduleType === MODULE_TYPE.validator && c.module.toLowerCase() === mortise.rootValidator.toLowerCase()) {
3421
+ throw new Error("refusing to remove the root validator: the vault would have no way in");
3422
+ }
3423
+ return encodeFunctionData({ abi: accountAbi, functionName: "uninstallModule", args: [c.moduleType, c.module, c.deInitData] });
3424
+ }
3425
+ var u128 = (v) => pad(toHex(v), { size: 16 });
3426
+ function packUserOp(op) {
3427
+ return {
3428
+ sender: op.sender,
3429
+ nonce: op.nonce,
3430
+ initCode: op.factory ? concat([op.factory, op.factoryData ?? "0x"]) : "0x",
3431
+ callData: op.callData,
3432
+ accountGasLimits: concat([u128(op.verificationGasLimit), u128(op.callGasLimit)]),
3433
+ preVerificationGas: op.preVerificationGas,
3434
+ gasFees: concat([u128(op.maxPriorityFeePerGas), u128(op.maxFeePerGas)]),
3435
+ paymasterAndData: op.paymaster ? concat([
3436
+ op.paymaster,
3437
+ u128(op.paymasterVerificationGasLimit ?? 0n),
3438
+ u128(op.paymasterPostOpGasLimit ?? 0n),
3439
+ op.paymasterData ?? "0x"
3440
+ ]) : "0x",
3441
+ signature: op.signature
3442
+ };
3443
+ }
3444
+ async function rootNonce(client, vault) {
3445
+ return client.readContract({
3446
+ address: external.safe7579,
3447
+ abi: safe7579Abi,
3448
+ functionName: "getNonce",
3449
+ args: [vault, mortise.rootValidator]
3450
+ });
3451
+ }
3452
+ async function userOpHash(client, op) {
3453
+ return client.readContract({
3454
+ address: external.entryPoint,
3455
+ abi: entryPointAbi,
3456
+ functionName: "getUserOpHash",
3457
+ args: [packUserOp(op)]
3458
+ });
3459
+ }
3460
+ async function simulateRootCall(client, vault, callData) {
3461
+ try {
3462
+ await client.call({ account: external.entryPoint, to: vault, data: callData });
3463
+ } catch (err) {
3464
+ throw await explainRootFailure(client, vault, callData, err);
3465
+ }
3466
+ return client.estimateGas({ account: external.entryPoint, to: vault, data: callData });
3467
+ }
3468
+ var RootCallError = class extends Error {
3469
+ /** Where the failure came from: the vault's hook (such as the timelock), one call of the batch, or a module's install. */
3470
+ source;
3471
+ /** Index of the failing call in the batch, when source is "call". */
3472
+ callIndex;
3473
+ /** The revert data that carries the reason; decode it with decodeMortiseError. */
3474
+ data;
3475
+ constructor(message, source, data, cause, callIndex) {
3476
+ super(message, { cause });
3477
+ this.name = "RootCallError";
3478
+ this.source = source;
3479
+ this.data = data;
3480
+ this.callIndex = callIndex;
3481
+ }
3482
+ };
3483
+ async function explainRootFailure(client, vault, callData, err) {
3484
+ const data = revertData(err);
3485
+ if (!data || decodeMortiseError(data)?.name !== "ExecutionFailed") {
3486
+ return new RootCallError(`root call failed: ${describe(data)}`, "account", data, err);
3487
+ }
3488
+ const hook = await client.readContract({ address: vault, abi: safe7579Abi, functionName: "getActiveHook" });
3489
+ if (hook !== zeroAddress) {
3490
+ try {
3491
+ const preCheck = encodeFunctionData({ abi: hookAbi, functionName: "preCheck", args: [external.entryPoint, 0n, concat([callData, external.entryPoint])] });
3492
+ await client.call({ account: vault, to: hook, data: preCheck });
3493
+ } catch (hookErr) {
3494
+ const hookData = revertData(hookErr);
3495
+ return new RootCallError(`the vault's hook ${hook} refused the call: ${describe(hookData)}`, "hook", hookData, err);
3496
+ }
3497
+ }
3498
+ const decoded = decodeFunctionData({ abi: accountAbi, data: callData });
3499
+ if (decoded.functionName === "installModule") {
3500
+ const [moduleType, module, initData] = decoded.args;
3501
+ let moduleInitData;
3502
+ if (moduleType === MODULE_TYPE.validator || moduleType === MODULE_TYPE.executor || moduleType === MODULE_TYPE.hook) moduleInitData = initData;
3503
+ else if (moduleType === MODULE_TYPE.fallback) moduleInitData = decodeAbiParameters([{ type: "bytes4" }, { type: "bytes1" }, { type: "bytes" }], initData)[2];
3504
+ else if (moduleType === 8n || moduleType === 9n) moduleInitData = decodeAbiParameters([{ type: "uint256" }, { type: "bytes" }], initData)[1];
3505
+ if (moduleInitData !== void 0) {
3506
+ try {
3507
+ await client.call({ account: vault, to: module, data: encodeFunctionData({ abi: moduleAbi, functionName: "onInstall", args: [moduleInitData] }) });
3508
+ } catch (installErr) {
3509
+ const installData = revertData(installErr);
3510
+ return new RootCallError(`${module} refused to install: ${describe(installData)}`, "install", installData, err);
3511
+ }
3512
+ }
3513
+ }
3514
+ if (decoded.functionName === "execute") {
3515
+ const [executions] = decodeAbiParameters([{ type: "tuple[]", components: executionComponents }], decoded.args[1]);
3516
+ try {
3517
+ const [block] = await client.simulateBlocks({
3518
+ blocks: [{ calls: executions.map((e) => ({ account: vault, to: e.target, value: e.value, data: e.callData })) }]
3519
+ });
3520
+ const i = block?.calls.findIndex((c) => c.status === "failure") ?? -1;
3521
+ if (i >= 0) {
3522
+ const failed = block.calls[i];
3523
+ const callErr = failed.error;
3524
+ const callData_ = revertData(callErr) ?? (failed.data !== "0x" ? failed.data : void 0);
3525
+ return new RootCallError(`call ${i} to ${executions[i].target} failed: ${describe(callData_)}`, "call", callData_, err, i);
3526
+ }
3527
+ } catch {
3528
+ }
3529
+ }
3530
+ return new RootCallError("root call failed: ExecutionFailed (no reason recovered)", "account", data, err);
3531
+ }
3532
+ function describe(data) {
3533
+ if (!data) return "no revert data";
3534
+ const d = decodeMortiseError(data);
3535
+ if (!d) return `unknown error ${data.slice(0, 10)}`;
3536
+ return d.args.length ? `${d.name}(${d.args.map(String).join(", ")})` : d.name;
3537
+ }
3538
+ var moduleAbi = [
3539
+ { type: "function", name: "onInstall", inputs: [{ type: "bytes" }], outputs: [], stateMutability: "nonpayable" }
3540
+ ];
3541
+ var hookAbi = [
3542
+ {
3543
+ type: "function",
3544
+ name: "preCheck",
3545
+ inputs: [{ type: "address" }, { type: "uint256" }, { type: "bytes" }],
3546
+ outputs: [{ type: "bytes" }],
3547
+ stateMutability: "nonpayable"
3548
+ }
3549
+ ];
3550
+ function ecdsaRootSigner(index, account) {
3551
+ return { index, sign: (hash2) => account.signMessage({ message: { raw: hash2 } }) };
3552
+ }
3553
+ async function buildRootOp(client, vault, call2, o) {
3554
+ const callData = encodeRootCall(call2);
3555
+ const exists = (await client.getCode({ address: vault }))?.length ? true : false;
3556
+ let factory;
3557
+ let factoryData;
3558
+ if (!exists) {
3559
+ if (!o.create) throw new Error(`vault ${vault} does not exist; pass create to deploy it in this userOp`);
3560
+ factory = mortise.factory;
3561
+ factoryData = encodeFunctionData({ abi: factoryAbi, functionName: "createVault", args: [encodeRoot(o.root), o.create.salt] });
3562
+ }
3563
+ const callGas = o.gas?.callGasLimit ?? (exists ? await simulateRootCall(client, vault, callData) * 13n / 10n + 50000n : 3000000n);
3564
+ const block = await client.getBlock();
3565
+ const base = block.baseFeePerGas ?? await client.getGasPrice();
3566
+ const op = {
3567
+ sender: vault,
3568
+ nonce: await rootNonce(client, vault),
3569
+ factory,
3570
+ factoryData,
3571
+ callData,
3572
+ callGasLimit: callGas,
3573
+ verificationGasLimit: o.gas?.verificationGasLimit ?? (exists ? 800000n : 2500000n),
3574
+ preVerificationGas: o.gas?.preVerificationGas ?? 100000n,
3575
+ maxFeePerGas: o.gas?.maxFeePerGas ?? base * 2n + (o.gas?.maxPriorityFeePerGas ?? 0n),
3576
+ maxPriorityFeePerGas: o.gas?.maxPriorityFeePerGas ?? 0n,
3577
+ signature: "0x"
3578
+ };
3579
+ if (o.paymaster && o.bundlerUrl) Object.assign(op, await o.paymaster(op, { stub: true }));
3580
+ if (o.bundlerUrl) await applyBundlerGas(o.bundlerUrl, op, o.root, o.gas, o.signers.map((sg) => sg.index));
3581
+ if (o.paymaster) Object.assign(op, await o.paymaster(op, { stub: false }));
3582
+ const hash2 = await userOpHash(client, op);
3583
+ const sigs = await Promise.all(o.signers.map(async (s) => ({ index: s.index, signature: await s.sign(hash2) })));
3584
+ op.signature = encodeRootSignature(o.root, sigs);
3585
+ return op;
3586
+ }
3587
+ function dummyRootSignature(root2, signerIndices) {
3588
+ const ecdsa = concat([pad("0xff", { size: 32 }), pad("0xff", { size: 32 }), "0x1b"]);
3589
+ const passkey = encodePasskeySignature({
3590
+ authenticatorData: pad("0x", { size: 37 }),
3591
+ clientDataJSON: `{"type":"webauthn.get","challenge":"${"A".repeat(43)}","origin":"https://mortiseagentvault.xyz"}`,
3592
+ r: 1n,
3593
+ s: 1n
3594
+ });
3595
+ const sigs = signingIndices(root2, signerIndices).map((index) => ({ index, signature: root2.members[index].type === "ecdsa" ? ecdsa : passkey }));
3596
+ return encodeRootSignature(root2, sigs);
3597
+ }
3598
+ function signingIndices(root2, signerIndices) {
3599
+ const all = signerIndices?.length ? [...new Set(signerIndices)].sort((a, b) => a - b) : root2.members.map((_, i) => i);
3600
+ return all.slice(0, root2.threshold).filter((i) => i >= 0 && i < root2.members.length);
3601
+ }
3602
+ async function applyBundlerGas(url, op, root2, fixed, signerIndices) {
3603
+ const est = await bundlerRpc(url, "eth_estimateUserOperationGas", [
3604
+ // Rundler returns any limit the request already carries unchanged; 0 means "estimate it". So the limits
3605
+ // go out as 0 unless the caller fixed them.
3606
+ rpcUserOp({
3607
+ ...op,
3608
+ signature: dummyRootSignature(root2, signerIndices),
3609
+ verificationGasLimit: fixed?.verificationGasLimit ?? 0n,
3610
+ callGasLimit: fixed?.callGasLimit ?? 0n,
3611
+ preVerificationGas: fixed?.preVerificationGas ?? 0n
3612
+ }),
3613
+ external.entryPoint
3614
+ ]);
3615
+ const max = (a, b) => a > b ? a : b;
3616
+ if (fixed?.preVerificationGas === void 0) op.preVerificationGas = BigInt(est.preVerificationGas) * 12n / 10n;
3617
+ const signing = signingIndices(root2, signerIndices).map((i) => root2.members[i]);
3618
+ const allowance = signing.reduce((g, m, i) => g + (m.type === "ecdsa" ? i === 0 ? 5000n : 15000n : i === 0 ? 20000n : 40000n), 0n) + (op.paymaster ? 0n : 25000n);
3619
+ if (fixed?.verificationGasLimit === void 0) op.verificationGasLimit = BigInt(est.verificationGasLimit) * 11n / 10n + allowance;
3620
+ if (fixed?.callGasLimit === void 0) op.callGasLimit = BigInt(est.callGasLimit) * 11n / 10n;
3621
+ if (op.paymaster) {
3622
+ if (est.paymasterVerificationGasLimit) op.paymasterVerificationGasLimit = max(op.paymasterVerificationGasLimit ?? 0n, BigInt(est.paymasterVerificationGasLimit) * 13n / 10n);
3623
+ if (est.paymasterPostOpGasLimit) op.paymasterPostOpGasLimit = max(op.paymasterPostOpGasLimit ?? 0n, BigInt(est.paymasterPostOpGasLimit));
3624
+ }
3625
+ try {
3626
+ const tip = BigInt(await bundlerRpc(url, "rundler_maxPriorityFeePerGas", [])) * 105n / 100n + 1n;
3627
+ if (tip > op.maxPriorityFeePerGas) {
3628
+ op.maxFeePerGas += tip - op.maxPriorityFeePerGas;
3629
+ op.maxPriorityFeePerGas = tip;
3630
+ }
3631
+ } catch {
3632
+ }
3633
+ }
3634
+ function readResult(logs, hash2, tx) {
3635
+ let result;
3636
+ let revertReason;
3637
+ for (const log of logs) {
3638
+ if (log.address.toLowerCase() !== external.entryPoint.toLowerCase()) continue;
3639
+ try {
3640
+ const ev = decodeEventLog({ abi: entryPointAbi, data: log.data, topics: log.topics });
3641
+ if (ev.eventName === "UserOperationEvent" && ev.args.userOpHash === hash2) {
3642
+ result = { userOpHash: hash2, transactionHash: tx, success: ev.args.success, actualGasCost: ev.args.actualGasCost };
3643
+ } else if (ev.eventName === "UserOperationRevertReason" && ev.args.userOpHash === hash2) {
3644
+ revertReason = ev.args.revertReason;
3645
+ }
3646
+ } catch {
3647
+ }
3648
+ }
3649
+ if (!result) throw new Error(`no UserOperationEvent for ${hash2} in ${tx}`);
3650
+ return revertReason ? { ...result, revertReason } : result;
3651
+ }
3652
+ async function sendUserOpDirect(client, wallet, op) {
3653
+ const hash2 = await userOpHash(client, op);
3654
+ const tx = await wallet.writeContract({
3655
+ address: external.entryPoint,
3656
+ abi: entryPointAbi,
3657
+ functionName: "handleOps",
3658
+ args: [[packUserOp(op)], wallet.account.address]
3659
+ });
3660
+ const receipt = await client.waitForTransactionReceipt({ hash: tx });
3661
+ if (receipt.status !== "success") throw new Error(`handleOps reverted in ${tx}`);
3662
+ return readResult(receipt.logs, hash2, tx);
3663
+ }
3664
+ function rpcUserOp(op) {
3665
+ const q = (v) => numberToHex(v);
3666
+ return {
3667
+ sender: op.sender,
3668
+ nonce: q(op.nonce),
3669
+ ...op.factory ? { factory: op.factory, factoryData: op.factoryData ?? "0x" } : {},
3670
+ callData: op.callData,
3671
+ callGasLimit: q(op.callGasLimit),
3672
+ verificationGasLimit: q(op.verificationGasLimit),
3673
+ preVerificationGas: q(op.preVerificationGas),
3674
+ maxFeePerGas: q(op.maxFeePerGas),
3675
+ maxPriorityFeePerGas: q(op.maxPriorityFeePerGas),
3676
+ ...op.paymaster ? {
3677
+ paymaster: op.paymaster,
3678
+ paymasterVerificationGasLimit: q(op.paymasterVerificationGasLimit ?? 0n),
3679
+ paymasterPostOpGasLimit: q(op.paymasterPostOpGasLimit ?? 0n),
3680
+ paymasterData: op.paymasterData ?? "0x"
3681
+ } : {},
3682
+ signature: op.signature
3683
+ };
3684
+ }
3685
+ var BundlerError = class extends Error {
3686
+ code;
3687
+ constructor(method, code, message) {
3688
+ super(`${method}: ${message}`);
3689
+ this.name = "BundlerError";
3690
+ this.code = code;
3691
+ }
3692
+ };
3693
+ async function bundlerRpc(url, method, params) {
3694
+ const res = await fetch(url, {
3695
+ method: "POST",
3696
+ headers: { "content-type": "application/json" },
3697
+ body: JSON.stringify({ jsonrpc: "2.0", id: 1, method, params }),
3698
+ signal: AbortSignal.timeout(3e4)
3699
+ });
3700
+ if (res.status === 429 || res.status >= 500) throw new Error(`${method}: HTTP ${res.status} from the bundler`);
3701
+ const text = await res.text();
3702
+ let body;
3703
+ try {
3704
+ body = JSON.parse(text);
3705
+ } catch {
3706
+ throw new Error(`${method}: HTTP ${res.status} from the bundler`);
3707
+ }
3708
+ if (body.error) throw new BundlerError(method, body.error.code, body.error.message);
3709
+ if (!res.ok) throw new BundlerError(method, res.status, `HTTP ${res.status}`);
3710
+ return body.result;
3711
+ }
3712
+ async function sendUserOpToBundler(client, bundlerUrl, op, timeoutMs = 12e4) {
3713
+ const hash2 = await userOpHash(client, op);
3714
+ try {
3715
+ await bundlerRpc(bundlerUrl, "eth_sendUserOperation", [rpcUserOp(op), external.entryPoint]);
3716
+ } catch (err) {
3717
+ throw Object.assign(new Error(`${err instanceof Error ? err.message : String(err)} (userOp ${hash2})`, { cause: err }), { userOpHash: hash2 });
3718
+ }
3719
+ const deadline = Date.now() + timeoutMs;
3720
+ while (Date.now() < deadline) {
3721
+ const r = await bundlerRpc(bundlerUrl, "eth_getUserOperationReceipt", [hash2]).catch((e) => {
3722
+ if (e instanceof BundlerError) throw e;
3723
+ return null;
3724
+ });
3725
+ if (r?.receipt) {
3726
+ const receipt = await client.waitForTransactionReceipt({ hash: r.receipt.transactionHash, timeout: Math.max(deadline - Date.now(), 3e4) });
3727
+ return readResult(receipt.logs, hash2, r.receipt.transactionHash);
3728
+ }
3729
+ await new Promise((f) => setTimeout(f, 2e3));
3730
+ }
3731
+ throw new Error(`userOp ${hash2} not included within ${timeoutMs / 1e3} s`);
3732
+ }
3733
+
3734
+ // src/calls.ts
3735
+ var call = (to, data, value = 0n) => ({ to, data, value });
3736
+ var gate = {
3737
+ /** `until` is a unix time in seconds; 0 removes the agent, NEVER keeps it. */
3738
+ setAgent: (agent, until) => call(mortise.gate, encodeFunctionData({ abi: gateAbi, functionName: "setAgent", args: [agent, until] })),
3739
+ setAdapterAccess: (actor, adapter, allowed) => call(mortise.gate, encodeFunctionData({ abi: gateAbi, functionName: "setAdapterAccess", args: [actor, adapter, allowed] })),
3740
+ setMarket: (adapter, market, allowed) => call(mortise.gate, encodeFunctionData({ abi: gateAbi, functionName: "setMarket", args: [adapter, market, allowed] })),
3741
+ /** `limit` in raw units of `token` (address(0) is ETH), per `period` seconds. */
3742
+ setCap: (actor, token, limit, period) => call(mortise.gate, encodeFunctionData({ abi: gateAbi, functionName: "setCap", args: [actor, token, limit, period] })),
3743
+ setMinRate: (tokenIn, tokenOut, rate) => call(mortise.gate, encodeFunctionData({ abi: gateAbi, functionName: "setMinRate", args: [tokenIn, tokenOut, rate] })),
3744
+ setOpenMarkets: (actor, adapter, open) => call(mortise.gate, encodeFunctionData({ abi: gateAbi, functionName: "setOpenMarkets", args: [actor, adapter, open] })),
3745
+ setOpenFloor: (actor, open) => call(mortise.gate, encodeFunctionData({ abi: gateAbi, functionName: "setOpenFloor", args: [actor, open] })),
3746
+ setModule: (module, enabled, initState = "0x") => call(mortise.gate, encodeFunctionData({ abi: gateAbi, functionName: "setModule", args: [module, enabled, initState] })),
3747
+ setPauser: (pauser) => call(mortise.gate, encodeFunctionData({ abi: gateAbi, functionName: "setPauser", args: [pauser] })),
3748
+ pause: (vault) => call(mortise.gate, encodeFunctionData({ abi: gateAbi, functionName: "pause", args: [vault] })),
3749
+ unpause: () => call(mortise.gate, encodeFunctionData({ abi: gateAbi, functionName: "unpause" })),
3750
+ proposeParent: (parent) => call(mortise.gate, encodeFunctionData({ abi: gateAbi, functionName: "proposeParent", args: [parent] })),
3751
+ acceptChild: (child) => call(mortise.gate, encodeFunctionData({ abi: gateAbi, functionName: "acceptChild", args: [child] })),
3752
+ unlink: (child) => call(mortise.gate, encodeFunctionData({ abi: gateAbi, functionName: "unlink", args: [child] }))
3753
+ };
3754
+ var NEVER = maxUint64;
3755
+ function rateOf(amountIn, minAmountOut) {
3756
+ if (amountIn <= 0n) throw new Error("amountIn must be positive");
3757
+ return (minAmountOut * 10n ** 36n + amountIn - 1n) / amountIn;
3758
+ }
3759
+ var root = {
3760
+ setRootKey: (next) => call(mortise.rootValidator, encodeFunctionData({ abi: rootValidatorAbi, functionName: "setRootKey", args: [encodeRoot(next)] })),
3761
+ /** Guardians who can replace the root after `delay` seconds (7 to 90 days); an empty list removes recovery. */
3762
+ setGuardians: (guardians, threshold, delay) => call(mortise.rootValidator, encodeFunctionData({ abi: rootValidatorAbi, functionName: "setGuardians", args: [guardians, threshold, delay] })),
3763
+ cancelRecovery: () => call(mortise.rootValidator, encodeFunctionData({ abi: rootValidatorAbi, functionName: "cancelRecovery" })),
3764
+ setPaymasterOnly: (required) => call(mortise.rootValidator, encodeFunctionData({ abi: rootValidatorAbi, functionName: "setPaymasterOnly", args: [required] }))
3765
+ };
3766
+ var timelock = {
3767
+ /** Installs the hook. The root validator must already be in paymaster-only mode. */
3768
+ install: (delay, destinations) => ({
3769
+ kind: "installModule",
3770
+ moduleType: MODULE_TYPE.hook,
3771
+ module: mortise.timelock,
3772
+ initData: encodeAbiParameters([{ type: "uint32" }, { type: "address[]" }], [delay, destinations])
3773
+ }),
3774
+ /** Schedules a root call that the timelock would refuse now; it can run once, after the delay. */
3775
+ schedule: (later) => call(mortise.timelock, encodeFunctionData({ abi: timelockAbi, functionName: "schedule", args: [encodeRootCall(later)] })),
3776
+ cancel: (later) => call(mortise.timelock, encodeFunctionData({ abi: timelockAbi, functionName: "cancel", args: [opId(later)] })),
3777
+ cancelAll: () => call(mortise.timelock, encodeFunctionData({ abi: timelockAbi, functionName: "cancelAll" })),
3778
+ setDelay: (delay) => call(mortise.timelock, encodeFunctionData({ abi: timelockAbi, functionName: "setDelay", args: [delay] })),
3779
+ setDestination: (destination, allowed) => call(mortise.timelock, encodeFunctionData({ abi: timelockAbi, functionName: "setDestination", args: [destination, allowed] }))
3780
+ };
3781
+ function opId(c) {
3782
+ return keccak256(encodeRootCall(c));
3783
+ }
3784
+ var subVaults = {
3785
+ install: () => ({ kind: "installModule", moduleType: MODULE_TYPE.executor, module: mortise.subVaults, initData: "0x" }),
3786
+ create: (parent, salt) => call(mortise.subVaults, encodeFunctionData({ abi: subVaultsAbi, functionName: "createSubVault", args: [parent, salt] })),
3787
+ /** Runs `calls` as the sub-vault. */
3788
+ exec: (child, calls) => call(
3789
+ mortise.subVaults,
3790
+ encodeFunctionData({
3791
+ abi: subVaultsAbi,
3792
+ functionName: "exec",
3793
+ args: [
3794
+ child,
3795
+ encodeAbiParameters(
3796
+ [{ type: "tuple[]", components: [{ name: "target", type: "address" }, { name: "value", type: "uint256" }, { name: "callData", type: "bytes" }] }],
3797
+ [calls.map((c) => ({ target: c.to, value: c.value ?? 0n, callData: c.data ?? "0x" }))]
3798
+ )
3799
+ ]
3800
+ })
3801
+ ),
3802
+ /** Moves the sub-vault's whole balance of each token (address(0) is ETH) back to the parent. */
3803
+ sweep: (child, tokens) => call(mortise.subVaults, encodeFunctionData({ abi: subVaultsAbi, functionName: "sweep", args: [child, tokens] }))
3804
+ };
3805
+ var signer = {
3806
+ installValidator: () => ({ kind: "installModule", moduleType: MODULE_TYPE.validator, module: mortise.signer, initData: "0x" }),
3807
+ /** Safe7579 fallback init data: selector, call type static (0xfe), then the module's own init data. */
3808
+ installFallback: () => ({
3809
+ kind: "installModule",
3810
+ moduleType: MODULE_TYPE.fallback,
3811
+ module: mortise.signer,
3812
+ initData: encodeAbiParameters([{ type: "bytes4" }, { type: "bytes1" }, { type: "bytes" }], ["0x84b0196e", "0xfe", "0x"])
3813
+ })
3814
+ };
3815
+ var funds = {
3816
+ sendEth: (to, amount) => ({ to, value: amount, data: "0x" }),
3817
+ sendToken: (token, to, amount) => call(token, encodeFunctionData({ abi: erc20Abi, functionName: "transfer", args: [to, amount] }))
3818
+ };
3819
+
3820
+ // src/actions.ts
3821
+ var poolKeyType = {
3822
+ type: "tuple",
3823
+ components: [
3824
+ { name: "currency0", type: "address" },
3825
+ { name: "currency1", type: "address" },
3826
+ { name: "fee", type: "uint24" },
3827
+ { name: "tickSpacing", type: "int24" },
3828
+ { name: "hooks", type: "address" }
3829
+ ]
3830
+ };
3831
+ var marketParamsType = {
3832
+ type: "tuple",
3833
+ components: [
3834
+ { name: "loanToken", type: "address" },
3835
+ { name: "collateralToken", type: "address" },
3836
+ { name: "oracle", type: "address" },
3837
+ { name: "irm", type: "address" },
3838
+ { name: "lltv", type: "uint256" }
3839
+ ]
3840
+ };
3841
+ function poolId(key) {
3842
+ return keccak256(encodeAbiParameters([poolKeyType], [key]));
3843
+ }
3844
+ function morphoMarketId(m) {
3845
+ return keccak256(encodeAbiParameters([marketParamsType], [m]));
3846
+ }
3847
+ var actions = {
3848
+ /** Exact-input swap on one Uniswap v3 pool; address(0) is ETH. The minimum is raised to the vault's floor. */
3849
+ uniswapV3Swap: (a) => ({
3850
+ adapter: mortise.uniswapV3,
3851
+ data: encodeAbiParameters(
3852
+ [{ type: "tuple", components: [{ name: "tokenIn", type: "address" }, { name: "tokenOut", type: "address" }, { name: "fee", type: "uint24" }, { name: "amountIn", type: "uint128" }, { name: "amountOutMinimum", type: "uint128" }] }],
3853
+ [a]
3854
+ )
3855
+ }),
3856
+ /** Exact-input swap on one Uniswap v4 pool, hook included. */
3857
+ uniswapV4Swap: (a) => ({
3858
+ adapter: mortise.uniswapV4,
3859
+ data: encodeAbiParameters([poolKeyType, { type: "bool" }, { type: "uint128" }, { type: "uint128" }], [a.key, a.zeroForOne, a.amountIn, a.amountOutMinimum])
3860
+ }),
3861
+ /** Supply or withdraw a Morpho Blue market's loan token; give either assets or shares, the other 0. */
3862
+ morpho: (a) => ({
3863
+ adapter: mortise.morphoBlue,
3864
+ data: encodeAbiParameters([{ type: "uint8" }, marketParamsType, { type: "uint256" }, { type: "uint256" }], [a.op === "supply" ? 0 : 1, a.market, a.assets, a.shares])
3865
+ }),
3866
+ /** Buy or sell a Pons V2 token on its bonding curve; amounts in the launch's pair token (or ETH) and the token. */
3867
+ pons: (a) => ({
3868
+ adapter: mortise.pons,
3869
+ data: encodeAbiParameters([{ type: "bool" }, { type: "address" }, { type: "uint256" }, { type: "uint256" }], [a.side === "buy", a.token, a.amountIn, a.minOut])
3870
+ }),
3871
+ /** Buy or sell through the Flap Portal (bonding curve, or the DEX after graduation). */
3872
+ flap: (a) => ({
3873
+ adapter: mortise.flap,
3874
+ data: encodeAbiParameters([{ type: "address" }, { type: "address" }, { type: "uint256" }, { type: "uint256" }], [a.tokenIn, a.tokenOut, a.amountIn, a.minOut])
3875
+ }),
3876
+ /** Deposit assets into, withdraw assets from, or redeem shares of a listed ERC-4626 vault. */
3877
+ erc4626: (a) => ({
3878
+ adapter: mortise.erc4626,
3879
+ data: encodeAbiParameters([{ type: "uint8" }, { type: "address" }, { type: "uint256" }], [{ deposit: 0, withdraw: 1, redeem: 2 }[a.op], a.target, a.amount])
3880
+ }),
3881
+ /** Send an ERC-20 to a recipient the owner listed for it (market: transferMarket(token, to)). */
3882
+ transfer: (a) => ({
3883
+ adapter: mortise.transfer,
3884
+ data: encodeAbiParameters([{ type: "address" }, { type: "address" }, { type: "uint256" }], [a.token, a.to, a.amount])
3885
+ }),
3886
+ /** Move a token or ETH (address(0)) to another vault of the family. */
3887
+ familyTransfer: (a) => ({
3888
+ adapter: mortise.familyTransfer,
3889
+ data: encodeAbiParameters([{ type: "address" }, { type: "address" }, { type: "uint256" }], [a.token, a.to, a.amount])
3890
+ }),
3891
+ /** Wrap ETH into WETH or unwrap it. */
3892
+ weth: (a) => ({
3893
+ adapter: mortise.weth,
3894
+ data: encodeAbiParameters([{ type: "bool" }, { type: "uint256" }], [a.wrap, a.amount])
3895
+ }),
3896
+ /** Bridge an ERC-20 through Across on a listed route; recipient and outputToken are bytes32. */
3897
+ across: (b) => ({
3898
+ adapter: mortise.across,
3899
+ data: encodeAbiParameters(
3900
+ [
3901
+ {
3902
+ type: "tuple",
3903
+ components: [
3904
+ { name: "destinationChainId", type: "uint256" },
3905
+ { name: "recipient", type: "bytes32" },
3906
+ { name: "inputToken", type: "address" },
3907
+ { name: "outputToken", type: "bytes32" },
3908
+ { name: "minRate", type: "uint256" },
3909
+ { name: "inputAmount", type: "uint256" },
3910
+ { name: "outputAmount", type: "uint256" },
3911
+ { name: "quoteTimestamp", type: "uint32" },
3912
+ { name: "fillDeadline", type: "uint32" }
3913
+ ]
3914
+ }
3915
+ ],
3916
+ [b]
3917
+ )
3918
+ }),
3919
+ /** Uniswap v3 positions: Mint and Increase take up to amount0/amount1; Decrease takes `liquidity`. */
3920
+ uniswapV3Liquidity: (a) => {
3921
+ let op;
3922
+ let args;
3923
+ if (a.op === "mint") {
3924
+ op = 0;
3925
+ args = encodeAbiParameters(
3926
+ [{ type: "tuple", components: [{ name: "token0", type: "address" }, { name: "token1", type: "address" }, { name: "fee", type: "uint24" }, { name: "tickLower", type: "int24" }, { name: "tickUpper", type: "int24" }, { name: "amount0", type: "uint256" }, { name: "amount1", type: "uint256" }, { name: "amount0Min", type: "uint256" }, { name: "amount1Min", type: "uint256" }] }],
3927
+ [a]
3928
+ );
3929
+ } else if (a.op === "increase" || a.op === "decrease") {
3930
+ op = a.op === "increase" ? 1 : 2;
3931
+ args = encodeAbiParameters(
3932
+ [{ type: "tuple", components: [{ name: "tokenId", type: "uint256" }, { name: "liquidity", type: "uint128" }, { name: "amount0", type: "uint256" }, { name: "amount1", type: "uint256" }, { name: "amount0Min", type: "uint256" }, { name: "amount1Min", type: "uint256" }] }],
3933
+ [a]
3934
+ );
3935
+ } else {
3936
+ op = a.op === "collect" ? 3 : 4;
3937
+ args = encodeAbiParameters([{ type: "uint256" }], [a.tokenId]);
3938
+ }
3939
+ return { adapter: mortise.uniswapV3Liquidity, data: encodeAbiParameters([{ type: "uint8" }, { type: "bytes" }], [op, args]) };
3940
+ },
3941
+ /** Uniswap v4 positions: amounts are maximums for Mint and Increase, minimums for Decrease and Burn. */
3942
+ uniswapV4Liquidity: (a) => {
3943
+ let op;
3944
+ let args;
3945
+ if (a.op === "mint") {
3946
+ op = 0;
3947
+ args = encodeAbiParameters(
3948
+ [{ type: "tuple", components: [{ name: "key", type: "tuple", components: poolKeyType.components }, { name: "tickLower", type: "int24" }, { name: "tickUpper", type: "int24" }, { name: "liquidity", type: "uint256" }, { name: "amount0", type: "uint128" }, { name: "amount1", type: "uint128" }] }],
3949
+ [a]
3950
+ );
3951
+ } else if (a.op !== "burn") {
3952
+ op = a.op === "increase" ? 1 : 2;
3953
+ args = encodeAbiParameters(
3954
+ [{ type: "tuple", components: [{ name: "tokenId", type: "uint256" }, { name: "liquidity", type: "uint256" }, { name: "amount0", type: "uint128" }, { name: "amount1", type: "uint128" }] }],
3955
+ [a]
3956
+ );
3957
+ } else {
3958
+ op = 3;
3959
+ args = encodeAbiParameters([{ type: "uint256" }, { type: "uint128" }, { type: "uint128" }], [a.tokenId, a.amount0Min, a.amount1Min]);
3960
+ }
3961
+ return { adapter: mortise.uniswapV4Liquidity, data: encodeAbiParameters([{ type: "uint8" }, { type: "bytes" }], [op, args]) };
3962
+ }
3963
+ };
3964
+ var addressMarket = (a) => pad(a.toLowerCase(), { size: 32 });
3965
+ var pairHash = (a, b) => keccak256(encodeAbiParameters([{ type: "address" }, { type: "address" }], [a, b]));
3966
+ var markets = {
3967
+ /** The pool address from the official v3 factory (UniswapV3Adapter and UniswapV3LiquidityAdapter). */
3968
+ uniswapV3Pool: (pool) => addressMarket(pool),
3969
+ /** The PoolId (UniswapV4Adapter and UniswapV4LiquidityAdapter). */
3970
+ uniswapV4Pool: (key) => poolId(key),
3971
+ morpho: (m) => morphoMarketId(m),
3972
+ /** The token's bonding curve. */
3973
+ ponsCurve: (curve) => addressMarket(curve),
3974
+ /** The pair, lower address first. */
3975
+ flapPair: (a, b) => BigInt(a) < BigInt(b) ? pairHash(a, b) : pairHash(b, a),
3976
+ erc4626: (target) => addressMarket(target),
3977
+ /** Lets the transfer adapter send `token` to `to`. */
3978
+ transfer: (token, to) => pairHash(token, to),
3979
+ /** The token allowed to move inside the family. */
3980
+ familyTransfer: (token) => addressMarket(token),
3981
+ weth: () => addressMarket(external.weth),
3982
+ acrossRoute: (r) => keccak256(
3983
+ encodeAbiParameters(
3984
+ [{ type: "uint256" }, { type: "bytes32" }, { type: "address" }, { type: "bytes32" }, { type: "uint256" }],
3985
+ [r.destinationChainId, r.recipient, r.inputToken, r.outputToken, r.minRate]
3986
+ )
3987
+ )
3988
+ };
3989
+
3990
+ // src/agent.ts
3991
+ function planAction(client, vault, action) {
3992
+ return client.readContract({ address: action.adapter, abi: adapterAbi, functionName: "plan", args: [vault, action.data] });
3993
+ }
3994
+ async function simulateActions(client, agent, vault, actions2) {
3995
+ const { result } = await client.simulateContract({ account: agent, address: mortise.gate, abi: gateAbi, functionName: "execute", args: [vault, actions2] });
3996
+ return result;
3997
+ }
3998
+ var TransactionRevertedError = class extends Error {
3999
+ transactionHash;
4000
+ constructor(hash2) {
4001
+ super(`transaction ${hash2} reverted`);
4002
+ this.name = "TransactionRevertedError";
4003
+ this.transactionHash = hash2;
4004
+ }
4005
+ };
4006
+ async function sendActions(client, wallet, vault, actions2, o = {}) {
4007
+ const { request } = await client.simulateContract({ account: wallet.account, address: mortise.gate, abi: gateAbi, functionName: "execute", args: [vault, actions2] });
4008
+ return sendSigned(wallet, encodeFunctionData({ abi: gateAbi, functionName: "execute", args: request.args }), o);
4009
+ }
4010
+ async function executeActions(client, wallet, vault, actions2) {
4011
+ return actionReceipt(client, await sendActions(client, wallet, vault, actions2));
4012
+ }
4013
+ async function sendTrigger(client, wallet, vault, module, o = {}) {
4014
+ const { request } = await client.simulateContract({ account: wallet.account, address: mortise.gate, abi: gateAbi, functionName: "trigger", args: [vault, module] });
4015
+ return sendSigned(wallet, encodeFunctionData({ abi: gateAbi, functionName: "trigger", args: request.args }), o);
4016
+ }
4017
+ async function triggerModule(client, wallet, vault, module) {
4018
+ return actionReceipt(client, await sendTrigger(client, wallet, vault, module));
4019
+ }
4020
+ async function sendSigned(wallet, data, o) {
4021
+ if (wallet.account.type !== "local") return wallet.sendTransaction({ to: mortise.gate, data });
4022
+ const stopped = () => new Error("the send was stopped before the transaction went out");
4023
+ const prepared = await wallet.prepareTransactionRequest({ to: mortise.gate, data });
4024
+ if (o.shouldSend && !o.shouldSend()) throw stopped();
4025
+ const signed = await wallet.signTransaction(prepared);
4026
+ const hash2 = keccak256(signed);
4027
+ if (o.shouldSend && !o.shouldSend()) throw stopped();
4028
+ o.onSigned?.(hash2);
4029
+ await wallet.sendRawTransaction({ serializedTransaction: signed });
4030
+ return hash2;
4031
+ }
4032
+ async function actionReceipt(client, hash2, timeoutMs = 18e4) {
4033
+ const receipt = await client.waitForTransactionReceipt({ hash: hash2, timeout: timeoutMs });
4034
+ if (receipt.status !== "success") throw new TransactionRevertedError(hash2);
4035
+ const executed = [];
4036
+ for (const log of receipt.logs) {
4037
+ if (log.address.toLowerCase() !== mortise.gate.toLowerCase()) continue;
4038
+ try {
4039
+ const ev = decodeEventLog({ abi: gateAbi, data: log.data, topics: log.topics });
4040
+ if (ev.eventName === "ActionExecuted") executed.push({ adapter: ev.args.adapter, market: ev.args.market });
4041
+ } catch {
4042
+ }
4043
+ }
4044
+ return { transactionHash: hash2, gasUsed: receipt.gasUsed, executed };
4045
+ }
4046
+ async function permissions(client, vault, actor, q) {
4047
+ const g = { address: mortise.gate, abi: gateAbi };
4048
+ const [installed, live, until, paused, openFloor, block] = await Promise.all([
4049
+ client.readContract({ ...g, functionName: "installed", args: [vault] }),
4050
+ client.readContract({ ...g, functionName: "isAgent", args: [vault, actor] }),
4051
+ client.readContract({ ...g, functionName: "agentUntil", args: [vault, actor] }),
4052
+ client.readContract({ ...g, functionName: "isPaused", args: [vault] }),
4053
+ client.readContract({ ...g, functionName: "hasOpenFloor", args: [vault, actor] }),
4054
+ client.getBlock()
4055
+ ]);
4056
+ const adapters = await Promise.all(
4057
+ q.adapters.map(async (adapter) => ({
4058
+ adapter,
4059
+ canUse: await client.readContract({ ...g, functionName: "canUse", args: [vault, actor, adapter] }),
4060
+ openMarkets: await client.readContract({ ...g, functionName: "hasOpenMarkets", args: [vault, actor, adapter] })
4061
+ }))
4062
+ );
4063
+ const now = block.timestamp;
4064
+ const caps = await Promise.all(
4065
+ q.tokens.map(async (token) => {
4066
+ const c = await client.readContract({ ...g, functionName: "cap", args: [vault, actor, token] });
4067
+ const fresh = c.period === 0n || now >= c.windowStart + c.period;
4068
+ const used = fresh ? 0n : c.used;
4069
+ return { token, limit: c.limit, period: c.period, used, left: c.limit > used ? c.limit - used : 0n, resetsAt: fresh ? void 0 : c.windowStart + c.period };
4070
+ })
4071
+ );
4072
+ const markets2 = await Promise.all(
4073
+ (q.markets ?? []).map(async (m) => ({ ...m, allowed: await client.readContract({ ...g, functionName: "isMarket", args: [vault, m.adapter, m.market] }) }))
4074
+ );
4075
+ return { installed, live, until, paused, openFloor, adapters, caps, markets: markets2 };
4076
+ }
4077
+ function minRate(client, vault, tokenIn, tokenOut) {
4078
+ return client.readContract({ address: mortise.gate, abi: gateAbi, functionName: "minRate", args: [vault, tokenIn, tokenOut] });
4079
+ }
4080
+
4081
+ // src/vault.ts
4082
+ function predictVault(client, root2, salt) {
4083
+ return client.readContract({ address: mortise.factory, abi: factoryAbi, functionName: "predictVault", args: [encodeRoot(root2), salt] });
4084
+ }
4085
+ async function createVault(client, wallet, root2, salt) {
4086
+ const vault = await predictVault(client, root2, salt);
4087
+ const hash2 = await wallet.writeContract({ address: mortise.factory, abi: factoryAbi, functionName: "createVault", args: [encodeRoot(root2), salt] });
4088
+ const receipt = await client.waitForTransactionReceipt({ hash: hash2 });
4089
+ if (receipt.status !== "success") throw new Error(`createVault reverted in ${hash2}`);
4090
+ return vault;
4091
+ }
4092
+ async function deposit(client, wallet, vault, token, amount) {
4093
+ if (token === ETH) {
4094
+ const hash3 = await wallet.writeContract({ address: mortise.router, abi: routerAbi, functionName: "depositETH", args: [vault], value: amount });
4095
+ await mustSucceed(client, hash3);
4096
+ return hash3;
4097
+ }
4098
+ const approve = await wallet.writeContract({ address: token, abi: erc20Abi2, functionName: "approve", args: [mortise.router, amount] });
4099
+ await mustSucceed(client, approve);
4100
+ const hash2 = await wallet.writeContract({ address: mortise.router, abi: routerAbi, functionName: "deposit", args: [vault, token, amount] });
4101
+ await mustSucceed(client, hash2);
4102
+ return hash2;
4103
+ }
4104
+ async function mustSucceed(client, hash2) {
4105
+ const r = await client.waitForTransactionReceipt({ hash: hash2 });
4106
+ if (r.status !== "success") throw new Error(`transaction ${hash2} reverted`);
4107
+ }
4108
+ async function depositQuote(client, vault, token, amount) {
4109
+ const [feeBps, capUsd, received] = await Promise.all([
4110
+ client.readContract({ address: mortise.router, abi: routerAbi, functionName: "feeBps" }),
4111
+ client.readContract({ address: mortise.router, abi: routerAbi, functionName: "capUsd" }),
4112
+ client.readContract({ address: mortise.router, abi: routerAbi, functionName: "depositedUsd", args: [vault] })
4113
+ ]);
4114
+ const fee = amount * feeBps / 10000n;
4115
+ const net = amount - fee;
4116
+ const usdValue = capUsd === 0n ? 0n : await client.readContract({ address: mortise.router, abi: routerAbi, functionName: "valueOf", args: [token, net] });
4117
+ return { fee, net, usdValue, capUsd, receivedUsd: received, fitsCap: usdValue === 0n || received + usdValue <= capUsd };
4118
+ }
4119
+ async function approveRecovery(client, guardian, vault, next) {
4120
+ return send(client, guardian, "approveRecovery", [vault, encodeRoot(next)]);
4121
+ }
4122
+ async function executeRecovery(client, wallet, vault, next) {
4123
+ return send(client, wallet, "executeRecovery", [vault, encodeRoot(next)]);
4124
+ }
4125
+ async function send(client, wallet, functionName, args) {
4126
+ const { request } = await client.simulateContract({ account: wallet.account, address: mortise.rootValidator, abi: rootValidatorAbi, functionName, args });
4127
+ const hash2 = await wallet.writeContract(request);
4128
+ const receipt = await client.waitForTransactionReceipt({ hash: hash2 });
4129
+ if (receipt.status !== "success") throw new Error(`${functionName} reverted in ${hash2}`);
4130
+ return hash2;
4131
+ }
4132
+ async function vaultStatus(client, vault) {
4133
+ const code = await client.getCode({ address: vault });
4134
+ if (!code || code === "0x") return { exists: false, vault };
4135
+ const [rootOf, guardians, paymasterOnly, gateInstalled, paused, pauser, hook, timelockDelay, liveParent, childCount, subVaultParent] = await Promise.all([
4136
+ client.readContract({ address: mortise.rootValidator, abi: rootValidatorAbi, functionName: "rootOf", args: [vault] }),
4137
+ client.readContract({ address: mortise.rootValidator, abi: rootValidatorAbi, functionName: "guardiansOf", args: [vault] }),
4138
+ client.readContract({ address: mortise.rootValidator, abi: rootValidatorAbi, functionName: "isPaymasterOnly", args: [vault] }),
4139
+ client.readContract({ address: mortise.gate, abi: gateAbi, functionName: "installed", args: [vault] }),
4140
+ client.readContract({ address: mortise.gate, abi: gateAbi, functionName: "isPaused", args: [vault] }),
4141
+ client.readContract({ address: mortise.gate, abi: gateAbi, functionName: "pauser", args: [vault] }),
4142
+ client.readContract({ address: vault, abi: [{ type: "function", name: "getActiveHook", inputs: [], outputs: [{ type: "address" }], stateMutability: "view" }], functionName: "getActiveHook" }),
4143
+ client.readContract({ address: mortise.timelock, abi: timelockAbi, functionName: "delayOf", args: [vault] }),
4144
+ client.readContract({ address: mortise.gate, abi: gateAbi, functionName: "liveParent", args: [vault] }),
4145
+ client.readContract({ address: mortise.gate, abi: gateAbi, functionName: "childCount", args: [vault] }),
4146
+ client.readContract({ address: mortise.subVaults, abi: subVaultsAbi, functionName: "parentOf", args: [vault] })
4147
+ ]);
4148
+ const [members, threshold] = rootOf;
4149
+ const [guardianList, guardianThreshold, recoveryDelay] = guardians;
4150
+ const isInstalled = (type, module) => client.readContract({ address: vault, abi: accountAbi, functionName: "isModuleInstalled", args: [type, module, "0x"] });
4151
+ const [subVaults2, signer2] = await Promise.all([isInstalled(MODULE_TYPE.executor, mortise.subVaults), isInstalled(MODULE_TYPE.validator, mortise.signer)]);
4152
+ const rootMembers = members.map(
4153
+ (m) => m.keyType === 1 ? { type: "ecdsa", signer: m.signer } : { type: "passkey", x: m.x, y: m.y }
4154
+ );
4155
+ return {
4156
+ exists: true,
4157
+ vault,
4158
+ root: { members: rootMembers, threshold: Number(threshold) },
4159
+ recovery: { guardians: guardianList, threshold: guardianThreshold, delay: recoveryDelay },
4160
+ paymasterOnly,
4161
+ gate: { installed: gateInstalled, paused, pauser },
4162
+ hook,
4163
+ timelock: { installed: hook.toLowerCase() === mortise.timelock.toLowerCase(), delay: timelockDelay },
4164
+ // `parent` is the Gate's family link (family transfers); `controller` is the sub-vault parent whose root
4165
+ // runs this vault through MortiseSubVaults, set when the vault was created and kept after an unlink.
4166
+ family: { parent: liveParent === ETH ? void 0 : liveParent, controller: subVaultParent === ETH ? void 0 : subVaultParent, children: childCount },
4167
+ modules: { subVaults: subVaults2, signer: signer2 },
4168
+ ethBalance: await client.getBalance({ address: vault }),
4169
+ entryPointDeposit: await client.readContract({
4170
+ address: external.entryPoint,
4171
+ abi: [{ type: "function", name: "balanceOf", inputs: [{ type: "address" }], outputs: [{ type: "uint256" }], stateMutability: "view" }],
4172
+ functionName: "balanceOf",
4173
+ args: [vault]
4174
+ })
4175
+ };
4176
+ }
4177
+
4178
+ // src/modules.ts
4179
+ var moduleState = {
4180
+ /** The same action every `interval` seconds, `runs` times from `firstAt`; only `keeper` may trigger it. */
4181
+ dca: (client, a) => client.readContract({ address: mortise.dca, abi: dcaAbi, functionName: "encodePlan", args: [a.action, a.keeper, a.interval, a.firstAt, a.runs] }),
4182
+ /** Up to eight tasks: scheduled, recurring or price-triggered actions, each run by its own keeper. */
4183
+ automation: (client, tasks) => client.readContract({ address: mortise.automation, abi: automationAbi, functionName: "encodeTasks", args: [tasks] }),
4184
+ /** Token pairs kept near a target share of their Chainlink value. */
4185
+ rebalance: (client, pairs) => client.readContract({ address: mortise.rebalance, abi: rebalanceAbi, functionName: "encodePairs", args: [pairs] })
4186
+ };
4187
+ export {
4188
+ BundlerError,
4189
+ ETH,
4190
+ MODULE_TYPE,
4191
+ NEVER,
4192
+ RootCallError,
4193
+ TransactionRevertedError,
4194
+ accountAbi,
4195
+ acrossAbi,
4196
+ actionReceipt,
4197
+ actions,
4198
+ adapterAbi,
4199
+ approveRecovery,
4200
+ automationAbi,
4201
+ buildRootOp,
4202
+ createVault,
4203
+ dcaAbi,
4204
+ decodeMortiseError,
4205
+ deployBlock,
4206
+ deposit,
4207
+ depositQuote,
4208
+ dummyRootSignature,
4209
+ ecdsaRootSigner,
4210
+ encodePasskeySignature,
4211
+ encodeRoot,
4212
+ encodeRootCall,
4213
+ encodeRootSignature,
4214
+ entryPointAbi,
4215
+ erc20Abi,
4216
+ erc4626Abi,
4217
+ executeActions,
4218
+ executeRecovery,
4219
+ external,
4220
+ factoryAbi,
4221
+ familyTransferAbi,
4222
+ flapAbi,
4223
+ funds,
4224
+ gate,
4225
+ gateAbi,
4226
+ markets,
4227
+ minRate,
4228
+ moduleState,
4229
+ morphoBlueAbi,
4230
+ morphoMarketId,
4231
+ mortise,
4232
+ mortiseErrorName,
4233
+ opId,
4234
+ packUserOp,
4235
+ permissions,
4236
+ planAction,
4237
+ ponsAbi,
4238
+ poolId,
4239
+ predictVault,
4240
+ rateOf,
4241
+ rebalanceAbi,
4242
+ revertData,
4243
+ robinhood,
4244
+ root,
4245
+ rootHash,
4246
+ rootNonce,
4247
+ rootValidatorAbi,
4248
+ routerAbi,
4249
+ safe7579Abi,
4250
+ sendActions,
4251
+ sendTrigger,
4252
+ sendUserOpDirect,
4253
+ sendUserOpToBundler,
4254
+ signer,
4255
+ signerAbi,
4256
+ simulateActions,
4257
+ simulateRootCall,
4258
+ singleKeyRoot,
4259
+ subVaults,
4260
+ subVaultsAbi,
4261
+ timelock,
4262
+ timelockAbi,
4263
+ transferAbi,
4264
+ triggerModule,
4265
+ uniswapV3Abi,
4266
+ uniswapV3LiquidityAbi,
4267
+ uniswapV4Abi,
4268
+ uniswapV4LiquidityAbi,
4269
+ userOpHash,
4270
+ vaultStatus,
4271
+ wethAbi
4272
+ };