@matterlabs/zksync-js 0.0.7 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/ethers/client.cjs +1705 -259
- package/dist/adapters/ethers/client.cjs.map +1 -1
- package/dist/adapters/ethers/client.d.ts +11 -0
- package/dist/adapters/ethers/client.js +6 -6
- package/dist/adapters/ethers/index.cjs +5254 -2335
- package/dist/adapters/ethers/index.cjs.map +1 -1
- package/dist/adapters/ethers/index.d.ts +4 -0
- package/dist/adapters/ethers/index.js +9 -9
- package/dist/adapters/ethers/resources/contracts/types.d.ts +15 -0
- package/dist/adapters/ethers/resources/deposits/context.d.ts +3 -3
- package/dist/adapters/ethers/resources/deposits/services/gas.d.ts +2 -2
- package/dist/adapters/ethers/resources/deposits/services/verification.d.ts +1 -1
- package/dist/adapters/ethers/resources/interop/address.d.ts +18 -0
- package/dist/adapters/ethers/resources/interop/attributes/resource.d.ts +9 -0
- package/dist/adapters/ethers/resources/interop/context.d.ts +36 -0
- package/dist/adapters/ethers/resources/interop/index.d.ts +63 -0
- package/dist/adapters/ethers/resources/interop/resolvers.d.ts +9 -0
- package/dist/adapters/ethers/resources/interop/routes/direct.d.ts +2 -0
- package/dist/adapters/ethers/resources/interop/routes/indirect.d.ts +2 -0
- package/dist/adapters/ethers/resources/interop/routes/types.d.ts +13 -0
- package/dist/adapters/ethers/resources/interop/services/erc20.d.ts +15 -0
- package/dist/adapters/ethers/resources/interop/services/finalization/bundle.d.ts +15 -0
- package/dist/adapters/ethers/resources/interop/services/finalization/data-fetchers.d.ts +17 -0
- package/dist/adapters/ethers/resources/interop/services/finalization/decoders.d.ts +12 -0
- package/dist/adapters/ethers/resources/interop/services/finalization/index.d.ts +13 -0
- package/dist/adapters/ethers/resources/interop/services/finalization/polling.d.ts +7 -0
- package/dist/adapters/ethers/resources/interop/services/finalization/status.d.ts +5 -0
- package/dist/adapters/ethers/resources/interop/services/finalization/topics.d.ts +6 -0
- package/dist/adapters/ethers/resources/interop/services/starter-data.d.ts +6 -0
- package/dist/adapters/ethers/resources/interop/types.d.ts +16 -0
- package/dist/adapters/ethers/resources/withdrawals/context.d.ts +2 -2
- package/dist/adapters/ethers/sdk.cjs +3384 -931
- package/dist/adapters/ethers/sdk.cjs.map +1 -1
- package/dist/adapters/ethers/sdk.d.ts +10 -8
- package/dist/adapters/ethers/sdk.js +7 -7
- package/dist/adapters/viem/client.cjs +760 -64
- package/dist/adapters/viem/client.cjs.map +1 -1
- package/dist/adapters/viem/client.js +6 -4
- package/dist/adapters/viem/index.cjs +404 -276
- package/dist/adapters/viem/index.cjs.map +1 -1
- package/dist/adapters/viem/index.d.ts +1 -0
- package/dist/adapters/viem/index.js +9 -8
- package/dist/adapters/viem/resources/deposits/context.d.ts +3 -3
- package/dist/adapters/viem/resources/deposits/services/gas.d.ts +2 -2
- package/dist/adapters/viem/resources/deposits/services/verification.d.ts +1 -1
- package/dist/adapters/viem/resources/withdrawals/context.d.ts +2 -2
- package/dist/adapters/viem/sdk.cjs +84 -92
- package/dist/adapters/viem/sdk.cjs.map +1 -1
- package/dist/adapters/viem/sdk.js +6 -6
- package/dist/{chunk-KRIRXY74.js → chunk-5AG6B7UX.js} +38 -63
- package/dist/{chunk-NNFWIAVG.js → chunk-AIFHAPJC.js} +9 -3
- package/dist/{chunk-NCR42O6O.js → chunk-C3AGOEHR.js} +11 -1
- package/dist/{chunk-GIXLOHLK.js → chunk-FBKBF7YM.js} +1534 -12
- package/dist/{chunk-VRL6Y4YJ.js → chunk-IYEDEUXG.js} +1 -1
- package/dist/chunk-JNWHQJU3.js +209 -0
- package/dist/{chunk-7VP6742W.js → chunk-KLNFDFLA.js} +43 -32
- package/dist/{chunk-GNERKUWO.js → chunk-QDJOEVGJ.js} +2 -2
- package/dist/{chunk-EWLA4NUE.js → chunk-RRKVUW3G.js} +1377 -78
- package/dist/{chunk-KAMEGD6I.js → chunk-SRPKTXIF.js} +1 -1
- package/dist/{chunk-WY36Z6YB.js → chunk-UIXU35ZU.js} +57 -19
- package/dist/{chunk-P5PIWVEO.js → chunk-ZVHFVUDE.js} +14 -26
- package/dist/core/abi.d.ts +5 -0
- package/dist/core/constants.cjs +10 -0
- package/dist/core/constants.cjs.map +1 -1
- package/dist/core/constants.d.ts +10 -0
- package/dist/core/constants.js +1 -1
- package/dist/core/index.cjs +1676 -186
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.ts +2 -1
- package/dist/core/index.js +5 -5
- package/dist/core/internal/abis/IERC7786Attributes.d.ts +42 -0
- package/dist/core/internal/abis/IInteropCenter.d.ts +211 -0
- package/dist/core/internal/abis/IInteropHandler.d.ts +166 -0
- package/dist/core/internal/abis/InteropCenter.d.ts +578 -0
- package/dist/core/internal/abis/InteropRootStorage.d.ts +20 -0
- package/dist/core/internal/abis/L2MessageVerification.d.ts +277 -0
- package/dist/core/resources/interop/attributes/bundle.d.ts +6 -0
- package/dist/core/resources/interop/attributes/call.d.ts +6 -0
- package/dist/core/resources/interop/attributes/index.d.ts +4 -0
- package/dist/core/resources/interop/attributes/resource.d.ts +12 -0
- package/dist/core/resources/interop/attributes/types.d.ts +4 -0
- package/dist/core/resources/interop/events.d.ts +7 -0
- package/dist/core/resources/interop/finalization.d.ts +60 -0
- package/dist/core/resources/interop/plan.d.ts +39 -0
- package/dist/core/resources/interop/route.d.ts +15 -0
- package/dist/core/rpc/types.d.ts +9 -0
- package/dist/core/types/errors.d.ts +56 -5
- package/dist/core/types/fees.d.ts +9 -0
- package/dist/core/types/flows/base.d.ts +1 -1
- package/dist/core/types/flows/interop.d.ts +207 -0
- package/dist/core/types/flows/withdrawals.d.ts +0 -8
- package/dist/core/types/primitives.d.ts +1 -0
- package/dist/core/types/transactions.d.ts +10 -0
- package/dist/core/utils/addr.d.ts +2 -2
- package/dist/core/utils/events.d.ts +12 -0
- package/dist/core/utils/hash.d.ts +5 -0
- package/dist/core/utils/index.d.ts +5 -0
- package/dist/core/utils/number.d.ts +2 -0
- package/dist/index.cjs +1686 -186
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +5 -5
- package/package.json +6 -2
- package/dist/chunk-NGXRO2ZX.js +0 -142
- package/dist/core/resources/withdrawals/events.d.ts +0 -9
|
@@ -11,6 +11,20 @@ function makeTransportFromEthers(provider) {
|
|
|
11
11
|
return (m, p = []) => provider.send(m, p);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
// src/core/utils/number.ts
|
|
15
|
+
var isNumber = (x) => typeof x === "number" && Number.isFinite(x);
|
|
16
|
+
var isBigint = (x) => typeof x === "bigint";
|
|
17
|
+
var k256hex = (s) => `0x${utils.bytesToHex(sha3.keccak_256(utils.utf8ToBytes(s)))}`.toLowerCase();
|
|
18
|
+
var FORMAL_ETH_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
19
|
+
var L2_ASSET_ROUTER_ADDRESS = "0x0000000000000000000000000000000000010003";
|
|
20
|
+
var L2_NATIVE_TOKEN_VAULT_ADDRESS = "0x0000000000000000000000000000000000010004";
|
|
21
|
+
var L2_BASE_TOKEN_ADDRESS = "0x000000000000000000000000000000000000800A";
|
|
22
|
+
var L2_INTEROP_CENTER_ADDRESS = "0x000000000000000000000000000000000001000d";
|
|
23
|
+
var L2_INTEROP_HANDLER_ADDRESS = "0x000000000000000000000000000000000001000e";
|
|
24
|
+
var L2_MESSAGE_VERIFICATION_ADDRESS = "0x0000000000000000000000000000000000010009";
|
|
25
|
+
k256hex("L1MessageSent(uint256,bytes32,bytes)");
|
|
26
|
+
k256hex("L1MessageSent(address,bytes32,bytes)");
|
|
27
|
+
|
|
14
28
|
// src/core/errors/formatter.ts
|
|
15
29
|
function elideMiddle(s, max = 96) {
|
|
16
30
|
if (s.length <= max) return s;
|
|
@@ -21,7 +35,7 @@ function shortJSON(v, max = 240) {
|
|
|
21
35
|
try {
|
|
22
36
|
const s = JSON.stringify(
|
|
23
37
|
v,
|
|
24
|
-
(_k, val) =>
|
|
38
|
+
(_k, val) => isBigint(val) ? `${val.toString()}n` : val
|
|
25
39
|
);
|
|
26
40
|
return s.length > max ? elideMiddle(s, max) : s;
|
|
27
41
|
} catch {
|
|
@@ -41,7 +55,7 @@ function formatContextLine(ctx) {
|
|
|
41
55
|
if (txHash !== void 0)
|
|
42
56
|
parts.push(`txHash=${typeof txHash === "string" ? txHash : shortJSON(txHash, 96)}`);
|
|
43
57
|
if (nonce !== void 0) {
|
|
44
|
-
const nonceStr = typeof nonce === "string" ||
|
|
58
|
+
const nonceStr = typeof nonce === "string" || isNumber(nonce) || isBigint(nonce) ? String(nonce) : shortJSON(nonce, 48);
|
|
45
59
|
parts.push(`nonce=${nonceStr}`);
|
|
46
60
|
}
|
|
47
61
|
return parts.length ? ` ${kv("Context", parts.join(" \u2022 "))}` : void 0;
|
|
@@ -71,17 +85,17 @@ function formatCause(c) {
|
|
|
71
85
|
const head = [];
|
|
72
86
|
if (obj.name !== void 0) {
|
|
73
87
|
const nameVal = obj.name;
|
|
74
|
-
const nameStr = typeof nameVal === "string" ||
|
|
88
|
+
const nameStr = typeof nameVal === "string" || isNumber(nameVal) || isBigint(nameVal) || typeof nameVal === "boolean" ? String(nameVal) : shortJSON(nameVal, 120);
|
|
75
89
|
head.push(`name=${nameStr}`);
|
|
76
90
|
}
|
|
77
91
|
if (obj.code !== void 0) {
|
|
78
92
|
const codeVal = obj.code;
|
|
79
|
-
const codeStr = typeof codeVal === "string" ||
|
|
93
|
+
const codeStr = typeof codeVal === "string" || isNumber(codeVal) || isBigint(codeVal) || typeof codeVal === "boolean" ? String(codeVal) : shortJSON(codeVal, 120);
|
|
80
94
|
head.push(`code=${codeStr}`);
|
|
81
95
|
}
|
|
82
96
|
if (head.length) out.push(` ${kv("Cause", head.join(" "))}`);
|
|
83
97
|
if (obj.message) {
|
|
84
|
-
const messageStr = typeof obj.message === "string" ||
|
|
98
|
+
const messageStr = typeof obj.message === "string" || isNumber(obj.message) || isBigint(obj.message) || typeof obj.message === "boolean" ? String(obj.message) : shortJSON(obj.message, 600);
|
|
85
99
|
out.push(` message=${elideMiddle(messageStr, 600)}`);
|
|
86
100
|
}
|
|
87
101
|
if (obj.data) {
|
|
@@ -144,13 +158,18 @@ if (kInspect) {
|
|
|
144
158
|
enumerable: false
|
|
145
159
|
});
|
|
146
160
|
}
|
|
147
|
-
function isZKsyncError(e) {
|
|
161
|
+
function isZKsyncError(e, opts) {
|
|
148
162
|
if (!e || typeof e !== "object") return false;
|
|
149
163
|
const maybe = e;
|
|
150
164
|
if (!("envelope" in maybe)) return false;
|
|
151
165
|
const envelope = maybe.envelope;
|
|
152
|
-
|
|
166
|
+
if (typeof envelope?.type !== "string" || typeof envelope?.message !== "string") return false;
|
|
167
|
+
return true;
|
|
153
168
|
}
|
|
169
|
+
var OP_CLIENT = {
|
|
170
|
+
ensureAddresses: "client.ensureAddresses",
|
|
171
|
+
getSemverProtocolVersion: "client.getSemverProtocolVersion"
|
|
172
|
+
};
|
|
154
173
|
var OP_DEPOSITS = {
|
|
155
174
|
base: {
|
|
156
175
|
baseToken: "deposits.erc20-base:baseToken"}};
|
|
@@ -160,20 +179,20 @@ function createError(type, input) {
|
|
|
160
179
|
return new ZKsyncError({ ...input, type });
|
|
161
180
|
}
|
|
162
181
|
function shapeCause(err) {
|
|
163
|
-
const
|
|
182
|
+
const isRecord2 = (x) => x !== null && typeof x === "object";
|
|
164
183
|
let data = void 0;
|
|
165
|
-
if (
|
|
184
|
+
if (isRecord2(err)) {
|
|
166
185
|
const r2 = err;
|
|
167
186
|
const d = r2.data;
|
|
168
|
-
if (
|
|
187
|
+
if (isRecord2(d) && "data" in d) {
|
|
169
188
|
data = d.data;
|
|
170
|
-
} else if ("error" in r2 &&
|
|
189
|
+
} else if ("error" in r2 && isRecord2(r2.error) && "data" in r2.error) {
|
|
171
190
|
data = r2.error.data;
|
|
172
191
|
} else if ("data" in r2) {
|
|
173
192
|
data = r2.data;
|
|
174
193
|
}
|
|
175
194
|
}
|
|
176
|
-
const r =
|
|
195
|
+
const r = isRecord2(err) ? err : void 0;
|
|
177
196
|
const name = r && typeof r.name === "string" ? r.name : void 0;
|
|
178
197
|
const message = r && typeof r.message === "string" ? r.message : r && typeof r.shortMessage === "string" ? r.shortMessage : void 0;
|
|
179
198
|
const code = r && "code" in r ? r.code : void 0;
|
|
@@ -227,7 +246,7 @@ function normalizeProof(p) {
|
|
|
227
246
|
context: { keys: Object.keys(raw ?? {}) }
|
|
228
247
|
});
|
|
229
248
|
}
|
|
230
|
-
const toBig = (x) =>
|
|
249
|
+
const toBig = (x) => isBigint(x) ? x : isNumber(x) ? BigInt(x) : typeof x === "string" ? BigInt(x) : (() => {
|
|
231
250
|
throw createError("RPC", {
|
|
232
251
|
resource: "zksrpc",
|
|
233
252
|
operation: "zksrpc.normalizeProof",
|
|
@@ -238,7 +257,8 @@ function normalizeProof(p) {
|
|
|
238
257
|
return {
|
|
239
258
|
id: toBig(idRaw),
|
|
240
259
|
batchNumber: toBig(bnRaw),
|
|
241
|
-
proof: toHexArray(raw?.proof)
|
|
260
|
+
proof: toHexArray(raw?.proof),
|
|
261
|
+
root: raw.root
|
|
242
262
|
};
|
|
243
263
|
} catch (e) {
|
|
244
264
|
if (isZKsyncError(e)) throw e;
|
|
@@ -263,8 +283,8 @@ function ensureHex(value, field, context) {
|
|
|
263
283
|
function ensureNumber(value, field, opts) {
|
|
264
284
|
const operation = opts?.operation ?? "zksrpc.normalizeGenesis";
|
|
265
285
|
const messagePrefix = opts?.messagePrefix ?? "Malformed genesis response";
|
|
266
|
-
if (
|
|
267
|
-
if (
|
|
286
|
+
if (isNumber(value)) return value;
|
|
287
|
+
if (isBigint(value)) return Number(value);
|
|
268
288
|
if (typeof value === "string" && value.trim() !== "") {
|
|
269
289
|
const parsed = Number(value);
|
|
270
290
|
if (Number.isFinite(parsed)) return parsed;
|
|
@@ -279,8 +299,8 @@ function ensureNumber(value, field, opts) {
|
|
|
279
299
|
function ensureBigInt(value, field, opts) {
|
|
280
300
|
const operation = opts?.operation ?? "zksrpc.normalizeBlockMetadata";
|
|
281
301
|
const messagePrefix = opts?.messagePrefix ?? "Malformed block metadata response";
|
|
282
|
-
if (
|
|
283
|
-
if (
|
|
302
|
+
if (isBigint(value)) return value;
|
|
303
|
+
if (isNumber(value)) {
|
|
284
304
|
if (!Number.isInteger(value)) {
|
|
285
305
|
throw createError("RPC", {
|
|
286
306
|
resource: "zksrpc",
|
|
@@ -304,6 +324,9 @@ function ensureBigInt(value, field, opts) {
|
|
|
304
324
|
context: { field, valueType: typeof value }
|
|
305
325
|
});
|
|
306
326
|
}
|
|
327
|
+
function isRecord(x) {
|
|
328
|
+
return !!x && typeof x === "object" && !Array.isArray(x);
|
|
329
|
+
}
|
|
307
330
|
function normalizeContractTuple(tuple, index) {
|
|
308
331
|
if (!Array.isArray(tuple) || tuple.length < 2) {
|
|
309
332
|
throw createError("RPC", {
|
|
@@ -319,7 +342,7 @@ function normalizeContractTuple(tuple, index) {
|
|
|
319
342
|
bytecode: ensureHex(bytecodeRaw, "initial_contracts.bytecode", { index })
|
|
320
343
|
};
|
|
321
344
|
}
|
|
322
|
-
function
|
|
345
|
+
function normalizeRawStorageTuple(tuple, index) {
|
|
323
346
|
if (!Array.isArray(tuple) || tuple.length < 2) {
|
|
324
347
|
throw createError("RPC", {
|
|
325
348
|
resource: "zksrpc",
|
|
@@ -330,10 +353,53 @@ function normalizeStorageTuple(tuple, index) {
|
|
|
330
353
|
}
|
|
331
354
|
const [keyRaw, valueRaw] = tuple;
|
|
332
355
|
return {
|
|
356
|
+
format: "raw",
|
|
333
357
|
key: ensureHex(keyRaw, "additional_storage.key", { index }),
|
|
334
358
|
value: ensureHex(valueRaw, "additional_storage.value", { index })
|
|
335
359
|
};
|
|
336
360
|
}
|
|
361
|
+
function normalizeAdditionalStorage(value, record) {
|
|
362
|
+
const effective = value ?? record["additional_storage_raw"];
|
|
363
|
+
if (Array.isArray(effective)) {
|
|
364
|
+
return effective.map((entry, index) => {
|
|
365
|
+
const kv2 = normalizeRawStorageTuple(entry, index);
|
|
366
|
+
return { format: "raw", key: kv2.key, value: kv2.value };
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
if (isRecord(effective)) {
|
|
370
|
+
const out = [];
|
|
371
|
+
for (const [addrRaw, slotsRaw] of Object.entries(effective)) {
|
|
372
|
+
const address = ensureHex(addrRaw, "additional_storage.address", {});
|
|
373
|
+
if (!isRecord(slotsRaw)) {
|
|
374
|
+
throw createError("RPC", {
|
|
375
|
+
resource: "zksrpc",
|
|
376
|
+
operation: "zksrpc.normalizeGenesis",
|
|
377
|
+
message: "Malformed genesis response: additional_storage[address] must be an object map.",
|
|
378
|
+
context: { address, valueType: typeof slotsRaw }
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
for (const [slotRaw, valRaw] of Object.entries(slotsRaw)) {
|
|
382
|
+
out.push({
|
|
383
|
+
format: "pretty",
|
|
384
|
+
address,
|
|
385
|
+
key: ensureHex(slotRaw, "additional_storage.key", { address }),
|
|
386
|
+
value: ensureHex(valRaw, "additional_storage.value", { address, key: slotRaw })
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
return out;
|
|
391
|
+
}
|
|
392
|
+
throw createError("RPC", {
|
|
393
|
+
resource: "zksrpc",
|
|
394
|
+
operation: "zksrpc.normalizeGenesis",
|
|
395
|
+
message: "Malformed genesis response: additional_storage must be an array (raw) or an object map (pretty).",
|
|
396
|
+
context: {
|
|
397
|
+
valueType: typeof effective,
|
|
398
|
+
hasAdditionalStorage: "additional_storage" in record,
|
|
399
|
+
hasAdditionalStorageRaw: "additional_storage_raw" in record
|
|
400
|
+
}
|
|
401
|
+
});
|
|
402
|
+
}
|
|
337
403
|
function normalizeGenesis(raw) {
|
|
338
404
|
try {
|
|
339
405
|
if (!raw || typeof raw !== "object") {
|
|
@@ -354,21 +420,12 @@ function normalizeGenesis(raw) {
|
|
|
354
420
|
context: { valueType: typeof contractsRaw }
|
|
355
421
|
});
|
|
356
422
|
}
|
|
357
|
-
const storageRaw = record["additional_storage"];
|
|
358
|
-
if (!Array.isArray(storageRaw)) {
|
|
359
|
-
throw createError("RPC", {
|
|
360
|
-
resource: "zksrpc",
|
|
361
|
-
operation: "zksrpc.normalizeGenesis",
|
|
362
|
-
message: "Malformed genesis response: additional_storage must be an array.",
|
|
363
|
-
context: { valueType: typeof storageRaw }
|
|
364
|
-
});
|
|
365
|
-
}
|
|
366
423
|
const executionVersion = ensureNumber(record["execution_version"], "execution_version");
|
|
367
424
|
const genesisRoot = ensureHex(record["genesis_root"], "genesis_root", {});
|
|
368
425
|
const initialContracts = contractsRaw.map(
|
|
369
426
|
(entry, index) => normalizeContractTuple(entry, index)
|
|
370
427
|
);
|
|
371
|
-
const additionalStorage =
|
|
428
|
+
const additionalStorage = normalizeAdditionalStorage(record["additional_storage"], record);
|
|
372
429
|
return {
|
|
373
430
|
initialContracts,
|
|
374
431
|
additionalStorage,
|
|
@@ -553,12 +610,6 @@ function zksRpcFromEthers(l2Provider) {
|
|
|
553
610
|
}
|
|
554
611
|
return createZksRpc(makeTransportFromEthers(maybe));
|
|
555
612
|
}
|
|
556
|
-
var k256hex = (s) => `0x${utils.bytesToHex(sha3.keccak_256(utils.utf8ToBytes(s)))}`.toLowerCase();
|
|
557
|
-
var L2_ASSET_ROUTER_ADDRESS = "0x0000000000000000000000000000000000010003";
|
|
558
|
-
var L2_NATIVE_TOKEN_VAULT_ADDRESS = "0x0000000000000000000000000000000000010004";
|
|
559
|
-
var L2_BASE_TOKEN_ADDRESS = "0x000000000000000000000000000000000000800A";
|
|
560
|
-
k256hex("L1MessageSent(uint256,bytes32,bytes)");
|
|
561
|
-
k256hex("L1MessageSent(address,bytes32,bytes)");
|
|
562
613
|
|
|
563
614
|
// src/core/internal/abis/IBridgehub.ts
|
|
564
615
|
var IBridgehubABI = [
|
|
@@ -5048,232 +5099,1581 @@ var MailboxABI = [
|
|
|
5048
5099
|
];
|
|
5049
5100
|
var Mailbox_default = MailboxABI;
|
|
5050
5101
|
|
|
5051
|
-
// src/core/
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
|
|
5057
|
-
|
|
5058
|
-
|
|
5059
|
-
const revert = decodeRevert2 ? decodeRevert2(err) : void 0;
|
|
5060
|
-
return createError(type, { ...base, ...revert ? { revert } : {}, cause: shapeCause(err) });
|
|
5061
|
-
}
|
|
5062
|
-
function createErrorHandlers2(resource) {
|
|
5063
|
-
async function run(kind, operation, fn, opts) {
|
|
5064
|
-
try {
|
|
5065
|
-
return await fn();
|
|
5066
|
-
} catch (e) {
|
|
5067
|
-
if (isZKsyncError(e)) throw e;
|
|
5068
|
-
const message = resolveMessage(operation, opts?.message);
|
|
5069
|
-
throw toZKsyncError2(kind, { resource, operation, context: opts?.ctx ?? {}, message }, e);
|
|
5102
|
+
// src/core/internal/abis/InteropCenter.ts
|
|
5103
|
+
var InteropCenterABI = [
|
|
5104
|
+
{
|
|
5105
|
+
inputs: [
|
|
5106
|
+
{
|
|
5107
|
+
internalType: "bytes4",
|
|
5108
|
+
name: "selector",
|
|
5109
|
+
type: "bytes4"
|
|
5070
5110
|
}
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
resource,
|
|
5087
|
-
operation,
|
|
5088
|
-
context: opts?.ctx ?? {},
|
|
5089
|
-
message: resolveMessage(operation, opts?.message)
|
|
5090
|
-
},
|
|
5091
|
-
e
|
|
5092
|
-
);
|
|
5093
|
-
return { ok: false, error: shaped };
|
|
5111
|
+
],
|
|
5112
|
+
name: "AttributeAlreadySet",
|
|
5113
|
+
type: "error"
|
|
5114
|
+
},
|
|
5115
|
+
{
|
|
5116
|
+
inputs: [
|
|
5117
|
+
{
|
|
5118
|
+
internalType: "bytes4",
|
|
5119
|
+
name: "selector",
|
|
5120
|
+
type: "bytes4"
|
|
5121
|
+
},
|
|
5122
|
+
{
|
|
5123
|
+
internalType: "uint256",
|
|
5124
|
+
name: "restriction",
|
|
5125
|
+
type: "uint256"
|
|
5094
5126
|
}
|
|
5095
|
-
|
|
5096
|
-
|
|
5097
|
-
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
}
|
|
5111
|
-
try {
|
|
5112
|
-
ERROR_IFACES.push({ name: "IERC20", iface: new ethers.Interface(IERC20_default) });
|
|
5113
|
-
} catch {
|
|
5114
|
-
}
|
|
5115
|
-
try {
|
|
5116
|
-
ERROR_IFACES.push({
|
|
5117
|
-
name: "IL1NativeTokenVault",
|
|
5118
|
-
iface: new ethers.Interface(L1NativeTokenVault_default)
|
|
5119
|
-
});
|
|
5120
|
-
} catch {
|
|
5121
|
-
}
|
|
5122
|
-
try {
|
|
5123
|
-
ERROR_IFACES.push({
|
|
5124
|
-
name: "IL2NativeTokenVault",
|
|
5125
|
-
iface: new ethers.Interface(L2NativeTokenVault_default)
|
|
5126
|
-
});
|
|
5127
|
-
} catch {
|
|
5128
|
-
}
|
|
5129
|
-
try {
|
|
5130
|
-
ERROR_IFACES.push({ name: "Mailbox", iface: new ethers.Interface(Mailbox_default) });
|
|
5131
|
-
} catch {
|
|
5132
|
-
}
|
|
5133
|
-
})();
|
|
5134
|
-
function extractRevertData(e) {
|
|
5135
|
-
const maybe = (
|
|
5136
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
5137
|
-
e?.data?.data ?? e?.error?.data ?? e?.data ?? e?.error?.error?.data ?? e?.info?.error?.data
|
|
5138
|
-
);
|
|
5139
|
-
if (typeof maybe === "string" && maybe.startsWith("0x") && maybe.length >= 10) {
|
|
5140
|
-
return maybe;
|
|
5141
|
-
}
|
|
5142
|
-
return void 0;
|
|
5143
|
-
}
|
|
5144
|
-
function decodeRevert(e) {
|
|
5145
|
-
const data = extractRevertData(e);
|
|
5146
|
-
if (!data) return;
|
|
5147
|
-
const selector = `0x${data.slice(2, 10)}`;
|
|
5148
|
-
try {
|
|
5149
|
-
const parsed = IFACE_ERROR_STRING.parseError(data);
|
|
5150
|
-
if (parsed?.name === "Error") {
|
|
5151
|
-
const args = parsed.args ? Array.from(parsed.args) : void 0;
|
|
5152
|
-
return { selector, name: "Error", args };
|
|
5153
|
-
}
|
|
5154
|
-
} catch {
|
|
5155
|
-
}
|
|
5156
|
-
try {
|
|
5157
|
-
const parsed = IFACE_PANIC.parseError(data);
|
|
5158
|
-
if (parsed?.name === "Panic") {
|
|
5159
|
-
const args = parsed.args ? Array.from(parsed.args) : void 0;
|
|
5160
|
-
return { selector, name: "Panic", args };
|
|
5161
|
-
}
|
|
5162
|
-
} catch {
|
|
5163
|
-
}
|
|
5164
|
-
for (const { name, iface } of ERROR_IFACES) {
|
|
5165
|
-
try {
|
|
5166
|
-
const parsed = iface.parseError(data);
|
|
5167
|
-
if (parsed) {
|
|
5168
|
-
const args = parsed.args ? Array.from(parsed.args) : void 0;
|
|
5169
|
-
return {
|
|
5170
|
-
selector,
|
|
5171
|
-
name: parsed.name,
|
|
5172
|
-
args,
|
|
5173
|
-
contract: name
|
|
5174
|
-
};
|
|
5127
|
+
],
|
|
5128
|
+
name: "AttributeViolatesRestriction",
|
|
5129
|
+
type: "error"
|
|
5130
|
+
},
|
|
5131
|
+
{
|
|
5132
|
+
inputs: [
|
|
5133
|
+
{
|
|
5134
|
+
internalType: "uint256",
|
|
5135
|
+
name: "expected",
|
|
5136
|
+
type: "uint256"
|
|
5137
|
+
},
|
|
5138
|
+
{
|
|
5139
|
+
internalType: "uint256",
|
|
5140
|
+
name: "actual",
|
|
5141
|
+
type: "uint256"
|
|
5175
5142
|
}
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
var { wrapAs } = createErrorHandlers("client");
|
|
5187
|
-
function createEthersClient(args) {
|
|
5188
|
-
const { l1, l2, signer } = args;
|
|
5189
|
-
let boundSigner = signer;
|
|
5190
|
-
const signerProvider = signer.provider;
|
|
5191
|
-
const isBrowserProvider = signerProvider instanceof ethers.BrowserProvider;
|
|
5192
|
-
if (!isBrowserProvider && (!boundSigner.provider || boundSigner.provider !== l1)) {
|
|
5193
|
-
boundSigner = signer.connect(l1);
|
|
5194
|
-
} else if (isBrowserProvider && signerProvider) {
|
|
5195
|
-
void (async () => {
|
|
5196
|
-
try {
|
|
5197
|
-
const [signerNet, l1Net] = await Promise.all([
|
|
5198
|
-
signerProvider.getNetwork(),
|
|
5199
|
-
l1.getNetwork()
|
|
5200
|
-
]);
|
|
5201
|
-
if (signerNet.chainId !== l1Net.chainId) {
|
|
5202
|
-
const warning = createError("STATE", {
|
|
5203
|
-
message: `BrowserProvider signer chainId (${signerNet.chainId}) != L1 provider chainId (${l1Net.chainId}). Ensure the wallet is connected to the correct network.`,
|
|
5204
|
-
resource: "helpers",
|
|
5205
|
-
operation: "client.browserProvider.networkMismatch",
|
|
5206
|
-
context: {
|
|
5207
|
-
signerChainId: signerNet.chainId,
|
|
5208
|
-
l1ChainId: l1Net.chainId
|
|
5209
|
-
}
|
|
5210
|
-
});
|
|
5211
|
-
console.debug("[zksync-sdk] non-fatal warning:", warning);
|
|
5212
|
-
}
|
|
5213
|
-
} catch (e) {
|
|
5143
|
+
],
|
|
5144
|
+
name: "IndirectCallValueMismatch",
|
|
5145
|
+
type: "error"
|
|
5146
|
+
},
|
|
5147
|
+
{
|
|
5148
|
+
inputs: [
|
|
5149
|
+
{
|
|
5150
|
+
internalType: "bytes",
|
|
5151
|
+
name: "interoperableAddress",
|
|
5152
|
+
type: "bytes"
|
|
5214
5153
|
}
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
-
|
|
5231
|
-
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
|
|
5236
|
-
|
|
5237
|
-
|
|
5238
|
-
|
|
5239
|
-
|
|
5240
|
-
|
|
5241
|
-
|
|
5242
|
-
|
|
5243
|
-
|
|
5244
|
-
|
|
5245
|
-
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
|
|
5260
|
-
|
|
5261
|
-
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
|
|
5265
|
-
|
|
5266
|
-
|
|
5267
|
-
|
|
5268
|
-
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
|
|
5154
|
+
],
|
|
5155
|
+
name: "InteroperableAddressChainReferenceNotEmpty",
|
|
5156
|
+
type: "error"
|
|
5157
|
+
},
|
|
5158
|
+
{
|
|
5159
|
+
inputs: [
|
|
5160
|
+
{
|
|
5161
|
+
internalType: "bytes",
|
|
5162
|
+
name: "interoperableAddress",
|
|
5163
|
+
type: "bytes"
|
|
5164
|
+
}
|
|
5165
|
+
],
|
|
5166
|
+
name: "InteroperableAddressNotEmpty",
|
|
5167
|
+
type: "error"
|
|
5168
|
+
},
|
|
5169
|
+
{
|
|
5170
|
+
inputs: [
|
|
5171
|
+
{
|
|
5172
|
+
internalType: "bytes",
|
|
5173
|
+
name: "",
|
|
5174
|
+
type: "bytes"
|
|
5175
|
+
}
|
|
5176
|
+
],
|
|
5177
|
+
name: "InteroperableAddressParsingError",
|
|
5178
|
+
type: "error"
|
|
5179
|
+
},
|
|
5180
|
+
{
|
|
5181
|
+
inputs: [
|
|
5182
|
+
{
|
|
5183
|
+
internalType: "uint256",
|
|
5184
|
+
name: "expectedMsgValue",
|
|
5185
|
+
type: "uint256"
|
|
5186
|
+
},
|
|
5187
|
+
{
|
|
5188
|
+
internalType: "uint256",
|
|
5189
|
+
name: "providedMsgValue",
|
|
5190
|
+
type: "uint256"
|
|
5191
|
+
}
|
|
5192
|
+
],
|
|
5193
|
+
name: "MsgValueMismatch",
|
|
5194
|
+
type: "error"
|
|
5195
|
+
},
|
|
5196
|
+
{
|
|
5197
|
+
inputs: [],
|
|
5198
|
+
name: "NotInGatewayMode",
|
|
5199
|
+
type: "error"
|
|
5200
|
+
},
|
|
5201
|
+
{
|
|
5202
|
+
inputs: [
|
|
5203
|
+
{
|
|
5204
|
+
internalType: "uint256",
|
|
5205
|
+
name: "sourceChainId",
|
|
5206
|
+
type: "uint256"
|
|
5207
|
+
},
|
|
5208
|
+
{
|
|
5209
|
+
internalType: "uint256",
|
|
5210
|
+
name: "destinationChainId",
|
|
5211
|
+
type: "uint256"
|
|
5212
|
+
}
|
|
5213
|
+
],
|
|
5214
|
+
name: "NotL2ToL2",
|
|
5215
|
+
type: "error"
|
|
5216
|
+
},
|
|
5217
|
+
{
|
|
5218
|
+
inputs: [],
|
|
5219
|
+
name: "SlotOccupied",
|
|
5220
|
+
type: "error"
|
|
5221
|
+
},
|
|
5222
|
+
{
|
|
5223
|
+
inputs: [
|
|
5224
|
+
{
|
|
5225
|
+
internalType: "address",
|
|
5226
|
+
name: "caller",
|
|
5227
|
+
type: "address"
|
|
5228
|
+
}
|
|
5229
|
+
],
|
|
5230
|
+
name: "Unauthorized",
|
|
5231
|
+
type: "error"
|
|
5232
|
+
},
|
|
5233
|
+
{
|
|
5234
|
+
inputs: [
|
|
5235
|
+
{
|
|
5236
|
+
internalType: "bytes4",
|
|
5237
|
+
name: "selector",
|
|
5238
|
+
type: "bytes4"
|
|
5239
|
+
}
|
|
5240
|
+
],
|
|
5241
|
+
name: "UnsupportedAttribute",
|
|
5242
|
+
type: "error"
|
|
5243
|
+
},
|
|
5244
|
+
{
|
|
5245
|
+
anonymous: false,
|
|
5246
|
+
inputs: [
|
|
5247
|
+
{
|
|
5248
|
+
indexed: false,
|
|
5249
|
+
internalType: "uint8",
|
|
5250
|
+
name: "version",
|
|
5251
|
+
type: "uint8"
|
|
5252
|
+
}
|
|
5253
|
+
],
|
|
5254
|
+
name: "Initialized",
|
|
5255
|
+
type: "event"
|
|
5256
|
+
},
|
|
5257
|
+
{
|
|
5258
|
+
anonymous: false,
|
|
5259
|
+
inputs: [
|
|
5260
|
+
{
|
|
5261
|
+
indexed: false,
|
|
5262
|
+
internalType: "bytes32",
|
|
5263
|
+
name: "l2l1MsgHash",
|
|
5264
|
+
type: "bytes32"
|
|
5265
|
+
},
|
|
5266
|
+
{
|
|
5267
|
+
indexed: false,
|
|
5268
|
+
internalType: "bytes32",
|
|
5269
|
+
name: "interopBundleHash",
|
|
5270
|
+
type: "bytes32"
|
|
5271
|
+
},
|
|
5272
|
+
{
|
|
5273
|
+
components: [
|
|
5274
|
+
{
|
|
5275
|
+
internalType: "bytes1",
|
|
5276
|
+
name: "version",
|
|
5277
|
+
type: "bytes1"
|
|
5278
|
+
},
|
|
5279
|
+
{
|
|
5280
|
+
internalType: "uint256",
|
|
5281
|
+
name: "sourceChainId",
|
|
5282
|
+
type: "uint256"
|
|
5283
|
+
},
|
|
5284
|
+
{
|
|
5285
|
+
internalType: "uint256",
|
|
5286
|
+
name: "destinationChainId",
|
|
5287
|
+
type: "uint256"
|
|
5288
|
+
},
|
|
5289
|
+
{
|
|
5290
|
+
internalType: "bytes32",
|
|
5291
|
+
name: "interopBundleSalt",
|
|
5292
|
+
type: "bytes32"
|
|
5293
|
+
},
|
|
5294
|
+
{
|
|
5295
|
+
components: [
|
|
5296
|
+
{
|
|
5297
|
+
internalType: "bytes1",
|
|
5298
|
+
name: "version",
|
|
5299
|
+
type: "bytes1"
|
|
5300
|
+
},
|
|
5301
|
+
{
|
|
5302
|
+
internalType: "bool",
|
|
5303
|
+
name: "shadowAccount",
|
|
5304
|
+
type: "bool"
|
|
5305
|
+
},
|
|
5306
|
+
{
|
|
5307
|
+
internalType: "address",
|
|
5308
|
+
name: "to",
|
|
5309
|
+
type: "address"
|
|
5310
|
+
},
|
|
5311
|
+
{
|
|
5312
|
+
internalType: "address",
|
|
5313
|
+
name: "from",
|
|
5314
|
+
type: "address"
|
|
5315
|
+
},
|
|
5316
|
+
{
|
|
5317
|
+
internalType: "uint256",
|
|
5318
|
+
name: "value",
|
|
5319
|
+
type: "uint256"
|
|
5320
|
+
},
|
|
5321
|
+
{
|
|
5322
|
+
internalType: "bytes",
|
|
5323
|
+
name: "data",
|
|
5324
|
+
type: "bytes"
|
|
5325
|
+
}
|
|
5326
|
+
],
|
|
5327
|
+
internalType: "struct InteropCall[]",
|
|
5328
|
+
name: "calls",
|
|
5329
|
+
type: "tuple[]"
|
|
5330
|
+
},
|
|
5331
|
+
{
|
|
5332
|
+
components: [
|
|
5333
|
+
{
|
|
5334
|
+
internalType: "bytes",
|
|
5335
|
+
name: "executionAddress",
|
|
5336
|
+
type: "bytes"
|
|
5337
|
+
},
|
|
5338
|
+
{
|
|
5339
|
+
internalType: "bytes",
|
|
5340
|
+
name: "unbundlerAddress",
|
|
5341
|
+
type: "bytes"
|
|
5342
|
+
}
|
|
5343
|
+
],
|
|
5344
|
+
internalType: "struct BundleAttributes",
|
|
5345
|
+
name: "bundleAttributes",
|
|
5346
|
+
type: "tuple"
|
|
5347
|
+
}
|
|
5348
|
+
],
|
|
5349
|
+
indexed: false,
|
|
5350
|
+
internalType: "struct InteropBundle",
|
|
5351
|
+
name: "interopBundle",
|
|
5352
|
+
type: "tuple"
|
|
5353
|
+
}
|
|
5354
|
+
],
|
|
5355
|
+
name: "InteropBundleSent",
|
|
5356
|
+
type: "event"
|
|
5357
|
+
},
|
|
5358
|
+
{
|
|
5359
|
+
anonymous: false,
|
|
5360
|
+
inputs: [
|
|
5361
|
+
{
|
|
5362
|
+
indexed: true,
|
|
5363
|
+
internalType: "bytes32",
|
|
5364
|
+
name: "sendId",
|
|
5365
|
+
type: "bytes32"
|
|
5366
|
+
},
|
|
5367
|
+
{
|
|
5368
|
+
indexed: false,
|
|
5369
|
+
internalType: "bytes",
|
|
5370
|
+
name: "sender",
|
|
5371
|
+
type: "bytes"
|
|
5372
|
+
},
|
|
5373
|
+
{
|
|
5374
|
+
indexed: false,
|
|
5375
|
+
internalType: "bytes",
|
|
5376
|
+
name: "recipient",
|
|
5377
|
+
type: "bytes"
|
|
5378
|
+
},
|
|
5379
|
+
{
|
|
5380
|
+
indexed: false,
|
|
5381
|
+
internalType: "bytes",
|
|
5382
|
+
name: "payload",
|
|
5383
|
+
type: "bytes"
|
|
5384
|
+
},
|
|
5385
|
+
{
|
|
5386
|
+
indexed: false,
|
|
5387
|
+
internalType: "uint256",
|
|
5388
|
+
name: "value",
|
|
5389
|
+
type: "uint256"
|
|
5390
|
+
},
|
|
5391
|
+
{
|
|
5392
|
+
indexed: false,
|
|
5393
|
+
internalType: "bytes[]",
|
|
5394
|
+
name: "attributes",
|
|
5395
|
+
type: "bytes[]"
|
|
5396
|
+
}
|
|
5397
|
+
],
|
|
5398
|
+
name: "MessageSent",
|
|
5399
|
+
type: "event"
|
|
5400
|
+
},
|
|
5401
|
+
{
|
|
5402
|
+
anonymous: false,
|
|
5403
|
+
inputs: [
|
|
5404
|
+
{
|
|
5405
|
+
indexed: true,
|
|
5406
|
+
internalType: "address",
|
|
5407
|
+
name: "oldAssetRouter",
|
|
5408
|
+
type: "address"
|
|
5409
|
+
},
|
|
5410
|
+
{
|
|
5411
|
+
indexed: true,
|
|
5412
|
+
internalType: "address",
|
|
5413
|
+
name: "newAssetRouter",
|
|
5414
|
+
type: "address"
|
|
5415
|
+
}
|
|
5416
|
+
],
|
|
5417
|
+
name: "NewAssetRouter",
|
|
5418
|
+
type: "event"
|
|
5419
|
+
},
|
|
5420
|
+
{
|
|
5421
|
+
anonymous: false,
|
|
5422
|
+
inputs: [
|
|
5423
|
+
{
|
|
5424
|
+
indexed: true,
|
|
5425
|
+
internalType: "address",
|
|
5426
|
+
name: "oldAssetTracker",
|
|
5427
|
+
type: "address"
|
|
5428
|
+
},
|
|
5429
|
+
{
|
|
5430
|
+
indexed: true,
|
|
5431
|
+
internalType: "address",
|
|
5432
|
+
name: "newAssetTracker",
|
|
5433
|
+
type: "address"
|
|
5434
|
+
}
|
|
5435
|
+
],
|
|
5436
|
+
name: "NewAssetTracker",
|
|
5437
|
+
type: "event"
|
|
5438
|
+
},
|
|
5439
|
+
{
|
|
5440
|
+
anonymous: false,
|
|
5441
|
+
inputs: [
|
|
5442
|
+
{
|
|
5443
|
+
indexed: true,
|
|
5444
|
+
internalType: "address",
|
|
5445
|
+
name: "previousOwner",
|
|
5446
|
+
type: "address"
|
|
5447
|
+
},
|
|
5448
|
+
{
|
|
5449
|
+
indexed: true,
|
|
5450
|
+
internalType: "address",
|
|
5451
|
+
name: "newOwner",
|
|
5452
|
+
type: "address"
|
|
5453
|
+
}
|
|
5454
|
+
],
|
|
5455
|
+
name: "OwnershipTransferStarted",
|
|
5456
|
+
type: "event"
|
|
5457
|
+
},
|
|
5458
|
+
{
|
|
5459
|
+
anonymous: false,
|
|
5460
|
+
inputs: [
|
|
5461
|
+
{
|
|
5462
|
+
indexed: true,
|
|
5463
|
+
internalType: "address",
|
|
5464
|
+
name: "previousOwner",
|
|
5465
|
+
type: "address"
|
|
5466
|
+
},
|
|
5467
|
+
{
|
|
5468
|
+
indexed: true,
|
|
5469
|
+
internalType: "address",
|
|
5470
|
+
name: "newOwner",
|
|
5471
|
+
type: "address"
|
|
5472
|
+
}
|
|
5473
|
+
],
|
|
5474
|
+
name: "OwnershipTransferred",
|
|
5475
|
+
type: "event"
|
|
5476
|
+
},
|
|
5477
|
+
{
|
|
5478
|
+
anonymous: false,
|
|
5479
|
+
inputs: [
|
|
5480
|
+
{
|
|
5481
|
+
indexed: false,
|
|
5482
|
+
internalType: "address",
|
|
5483
|
+
name: "account",
|
|
5484
|
+
type: "address"
|
|
5485
|
+
}
|
|
5486
|
+
],
|
|
5487
|
+
name: "Paused",
|
|
5488
|
+
type: "event"
|
|
5489
|
+
},
|
|
5490
|
+
{
|
|
5491
|
+
anonymous: false,
|
|
5492
|
+
inputs: [
|
|
5493
|
+
{
|
|
5494
|
+
indexed: false,
|
|
5495
|
+
internalType: "address",
|
|
5496
|
+
name: "account",
|
|
5497
|
+
type: "address"
|
|
5498
|
+
}
|
|
5499
|
+
],
|
|
5500
|
+
name: "Unpaused",
|
|
5501
|
+
type: "event"
|
|
5502
|
+
},
|
|
5503
|
+
{
|
|
5504
|
+
inputs: [],
|
|
5505
|
+
name: "L1_CHAIN_ID",
|
|
5506
|
+
outputs: [
|
|
5507
|
+
{
|
|
5508
|
+
internalType: "uint256",
|
|
5509
|
+
name: "",
|
|
5510
|
+
type: "uint256"
|
|
5511
|
+
}
|
|
5512
|
+
],
|
|
5513
|
+
stateMutability: "view",
|
|
5514
|
+
type: "function"
|
|
5515
|
+
},
|
|
5516
|
+
{
|
|
5517
|
+
inputs: [],
|
|
5518
|
+
name: "acceptOwnership",
|
|
5519
|
+
outputs: [],
|
|
5520
|
+
stateMutability: "nonpayable",
|
|
5521
|
+
type: "function"
|
|
5522
|
+
},
|
|
5523
|
+
{
|
|
5524
|
+
inputs: [
|
|
5525
|
+
{
|
|
5526
|
+
internalType: "uint256",
|
|
5527
|
+
name: "_chainId",
|
|
5528
|
+
type: "uint256"
|
|
5529
|
+
},
|
|
5530
|
+
{
|
|
5531
|
+
internalType: "bytes32",
|
|
5532
|
+
name: "_canonicalTxHash",
|
|
5533
|
+
type: "bytes32"
|
|
5534
|
+
},
|
|
5535
|
+
{
|
|
5536
|
+
internalType: "uint64",
|
|
5537
|
+
name: "_expirationTimestamp",
|
|
5538
|
+
type: "uint64"
|
|
5539
|
+
},
|
|
5540
|
+
{
|
|
5541
|
+
components: [
|
|
5542
|
+
{
|
|
5543
|
+
internalType: "bytes1",
|
|
5544
|
+
name: "version",
|
|
5545
|
+
type: "bytes1"
|
|
5546
|
+
},
|
|
5547
|
+
{
|
|
5548
|
+
internalType: "address",
|
|
5549
|
+
name: "originToken",
|
|
5550
|
+
type: "address"
|
|
5551
|
+
},
|
|
5552
|
+
{
|
|
5553
|
+
internalType: "bytes32",
|
|
5554
|
+
name: "baseTokenAssetId",
|
|
5555
|
+
type: "bytes32"
|
|
5556
|
+
},
|
|
5557
|
+
{
|
|
5558
|
+
internalType: "uint256",
|
|
5559
|
+
name: "baseTokenAmount",
|
|
5560
|
+
type: "uint256"
|
|
5561
|
+
},
|
|
5562
|
+
{
|
|
5563
|
+
internalType: "bytes32",
|
|
5564
|
+
name: "assetId",
|
|
5565
|
+
type: "bytes32"
|
|
5566
|
+
},
|
|
5567
|
+
{
|
|
5568
|
+
internalType: "uint256",
|
|
5569
|
+
name: "amount",
|
|
5570
|
+
type: "uint256"
|
|
5571
|
+
},
|
|
5572
|
+
{
|
|
5573
|
+
internalType: "uint256",
|
|
5574
|
+
name: "tokenOriginChainId",
|
|
5575
|
+
type: "uint256"
|
|
5576
|
+
}
|
|
5577
|
+
],
|
|
5578
|
+
internalType: "struct BalanceChange",
|
|
5579
|
+
name: "_balanceChange",
|
|
5580
|
+
type: "tuple"
|
|
5581
|
+
}
|
|
5582
|
+
],
|
|
5583
|
+
name: "forwardTransactionOnGatewayWithBalanceChange",
|
|
5584
|
+
outputs: [],
|
|
5585
|
+
stateMutability: "nonpayable",
|
|
5586
|
+
type: "function"
|
|
5587
|
+
},
|
|
5588
|
+
{
|
|
5589
|
+
inputs: [
|
|
5590
|
+
{
|
|
5591
|
+
internalType: "uint256",
|
|
5592
|
+
name: "_l1ChainId",
|
|
5593
|
+
type: "uint256"
|
|
5594
|
+
},
|
|
5595
|
+
{
|
|
5596
|
+
internalType: "address",
|
|
5597
|
+
name: "_owner",
|
|
5598
|
+
type: "address"
|
|
5599
|
+
}
|
|
5600
|
+
],
|
|
5601
|
+
name: "initL2",
|
|
5602
|
+
outputs: [],
|
|
5603
|
+
stateMutability: "nonpayable",
|
|
5604
|
+
type: "function"
|
|
5605
|
+
},
|
|
5606
|
+
{
|
|
5607
|
+
inputs: [
|
|
5608
|
+
{
|
|
5609
|
+
internalType: "address",
|
|
5610
|
+
name: "sender",
|
|
5611
|
+
type: "address"
|
|
5612
|
+
}
|
|
5613
|
+
],
|
|
5614
|
+
name: "interopBundleNonce",
|
|
5615
|
+
outputs: [
|
|
5616
|
+
{
|
|
5617
|
+
internalType: "uint256",
|
|
5618
|
+
name: "numberOfBundlesSent",
|
|
5619
|
+
type: "uint256"
|
|
5620
|
+
}
|
|
5621
|
+
],
|
|
5622
|
+
stateMutability: "view",
|
|
5623
|
+
type: "function"
|
|
5624
|
+
},
|
|
5625
|
+
{
|
|
5626
|
+
inputs: [],
|
|
5627
|
+
name: "owner",
|
|
5628
|
+
outputs: [
|
|
5629
|
+
{
|
|
5630
|
+
internalType: "address",
|
|
5631
|
+
name: "",
|
|
5632
|
+
type: "address"
|
|
5633
|
+
}
|
|
5634
|
+
],
|
|
5635
|
+
stateMutability: "view",
|
|
5636
|
+
type: "function"
|
|
5637
|
+
},
|
|
5638
|
+
{
|
|
5639
|
+
inputs: [
|
|
5640
|
+
{
|
|
5641
|
+
internalType: "bytes[]",
|
|
5642
|
+
name: "_attributes",
|
|
5643
|
+
type: "bytes[]"
|
|
5644
|
+
},
|
|
5645
|
+
{
|
|
5646
|
+
internalType: "enum IInteropCenter.AttributeParsingRestrictions",
|
|
5647
|
+
name: "_restriction",
|
|
5648
|
+
type: "uint8"
|
|
5649
|
+
}
|
|
5650
|
+
],
|
|
5651
|
+
name: "parseAttributes",
|
|
5652
|
+
outputs: [
|
|
5653
|
+
{
|
|
5654
|
+
components: [
|
|
5655
|
+
{
|
|
5656
|
+
internalType: "uint256",
|
|
5657
|
+
name: "interopCallValue",
|
|
5658
|
+
type: "uint256"
|
|
5659
|
+
},
|
|
5660
|
+
{
|
|
5661
|
+
internalType: "bool",
|
|
5662
|
+
name: "indirectCall",
|
|
5663
|
+
type: "bool"
|
|
5664
|
+
},
|
|
5665
|
+
{
|
|
5666
|
+
internalType: "uint256",
|
|
5667
|
+
name: "indirectCallMessageValue",
|
|
5668
|
+
type: "uint256"
|
|
5669
|
+
}
|
|
5670
|
+
],
|
|
5671
|
+
internalType: "struct CallAttributes",
|
|
5672
|
+
name: "callAttributes",
|
|
5673
|
+
type: "tuple"
|
|
5674
|
+
},
|
|
5675
|
+
{
|
|
5676
|
+
components: [
|
|
5677
|
+
{
|
|
5678
|
+
internalType: "bytes",
|
|
5679
|
+
name: "executionAddress",
|
|
5680
|
+
type: "bytes"
|
|
5681
|
+
},
|
|
5682
|
+
{
|
|
5683
|
+
internalType: "bytes",
|
|
5684
|
+
name: "unbundlerAddress",
|
|
5685
|
+
type: "bytes"
|
|
5686
|
+
}
|
|
5687
|
+
],
|
|
5688
|
+
internalType: "struct BundleAttributes",
|
|
5689
|
+
name: "bundleAttributes",
|
|
5690
|
+
type: "tuple"
|
|
5691
|
+
}
|
|
5692
|
+
],
|
|
5693
|
+
stateMutability: "pure",
|
|
5694
|
+
type: "function"
|
|
5695
|
+
},
|
|
5696
|
+
{
|
|
5697
|
+
inputs: [],
|
|
5698
|
+
name: "pause",
|
|
5699
|
+
outputs: [],
|
|
5700
|
+
stateMutability: "nonpayable",
|
|
5701
|
+
type: "function"
|
|
5702
|
+
},
|
|
5703
|
+
{
|
|
5704
|
+
inputs: [],
|
|
5705
|
+
name: "paused",
|
|
5706
|
+
outputs: [
|
|
5707
|
+
{
|
|
5708
|
+
internalType: "bool",
|
|
5709
|
+
name: "",
|
|
5710
|
+
type: "bool"
|
|
5711
|
+
}
|
|
5712
|
+
],
|
|
5713
|
+
stateMutability: "view",
|
|
5714
|
+
type: "function"
|
|
5715
|
+
},
|
|
5716
|
+
{
|
|
5717
|
+
inputs: [],
|
|
5718
|
+
name: "pendingOwner",
|
|
5719
|
+
outputs: [
|
|
5720
|
+
{
|
|
5721
|
+
internalType: "address",
|
|
5722
|
+
name: "",
|
|
5723
|
+
type: "address"
|
|
5724
|
+
}
|
|
5725
|
+
],
|
|
5726
|
+
stateMutability: "view",
|
|
5727
|
+
type: "function"
|
|
5728
|
+
},
|
|
5729
|
+
{
|
|
5730
|
+
inputs: [],
|
|
5731
|
+
name: "renounceOwnership",
|
|
5732
|
+
outputs: [],
|
|
5733
|
+
stateMutability: "nonpayable",
|
|
5734
|
+
type: "function"
|
|
5735
|
+
},
|
|
5736
|
+
{
|
|
5737
|
+
inputs: [
|
|
5738
|
+
{
|
|
5739
|
+
internalType: "bytes",
|
|
5740
|
+
name: "_destinationChainId",
|
|
5741
|
+
type: "bytes"
|
|
5742
|
+
},
|
|
5743
|
+
{
|
|
5744
|
+
components: [
|
|
5745
|
+
{
|
|
5746
|
+
internalType: "bytes",
|
|
5747
|
+
name: "to",
|
|
5748
|
+
type: "bytes"
|
|
5749
|
+
},
|
|
5750
|
+
{
|
|
5751
|
+
internalType: "bytes",
|
|
5752
|
+
name: "data",
|
|
5753
|
+
type: "bytes"
|
|
5754
|
+
},
|
|
5755
|
+
{
|
|
5756
|
+
internalType: "bytes[]",
|
|
5757
|
+
name: "callAttributes",
|
|
5758
|
+
type: "bytes[]"
|
|
5759
|
+
}
|
|
5760
|
+
],
|
|
5761
|
+
internalType: "struct InteropCallStarter[]",
|
|
5762
|
+
name: "_callStarters",
|
|
5763
|
+
type: "tuple[]"
|
|
5764
|
+
},
|
|
5765
|
+
{
|
|
5766
|
+
internalType: "bytes[]",
|
|
5767
|
+
name: "_bundleAttributes",
|
|
5768
|
+
type: "bytes[]"
|
|
5769
|
+
}
|
|
5770
|
+
],
|
|
5771
|
+
name: "sendBundle",
|
|
5772
|
+
outputs: [
|
|
5773
|
+
{
|
|
5774
|
+
internalType: "bytes32",
|
|
5775
|
+
name: "bundleHash",
|
|
5776
|
+
type: "bytes32"
|
|
5777
|
+
}
|
|
5778
|
+
],
|
|
5779
|
+
stateMutability: "payable",
|
|
5780
|
+
type: "function"
|
|
5781
|
+
},
|
|
5782
|
+
{
|
|
5783
|
+
inputs: [
|
|
5784
|
+
{
|
|
5785
|
+
internalType: "bytes",
|
|
5786
|
+
name: "recipient",
|
|
5787
|
+
type: "bytes"
|
|
5788
|
+
},
|
|
5789
|
+
{
|
|
5790
|
+
internalType: "bytes",
|
|
5791
|
+
name: "payload",
|
|
5792
|
+
type: "bytes"
|
|
5793
|
+
},
|
|
5794
|
+
{
|
|
5795
|
+
internalType: "bytes[]",
|
|
5796
|
+
name: "attributes",
|
|
5797
|
+
type: "bytes[]"
|
|
5798
|
+
}
|
|
5799
|
+
],
|
|
5800
|
+
name: "sendMessage",
|
|
5801
|
+
outputs: [
|
|
5802
|
+
{
|
|
5803
|
+
internalType: "bytes32",
|
|
5804
|
+
name: "sendId",
|
|
5805
|
+
type: "bytes32"
|
|
5806
|
+
}
|
|
5807
|
+
],
|
|
5808
|
+
stateMutability: "payable",
|
|
5809
|
+
type: "function"
|
|
5810
|
+
},
|
|
5811
|
+
{
|
|
5812
|
+
inputs: [
|
|
5813
|
+
{
|
|
5814
|
+
internalType: "bytes4",
|
|
5815
|
+
name: "_attributeSelector",
|
|
5816
|
+
type: "bytes4"
|
|
5817
|
+
}
|
|
5818
|
+
],
|
|
5819
|
+
name: "supportsAttribute",
|
|
5820
|
+
outputs: [
|
|
5821
|
+
{
|
|
5822
|
+
internalType: "bool",
|
|
5823
|
+
name: "",
|
|
5824
|
+
type: "bool"
|
|
5825
|
+
}
|
|
5826
|
+
],
|
|
5827
|
+
stateMutability: "pure",
|
|
5828
|
+
type: "function"
|
|
5829
|
+
},
|
|
5830
|
+
{
|
|
5831
|
+
inputs: [
|
|
5832
|
+
{
|
|
5833
|
+
internalType: "address",
|
|
5834
|
+
name: "newOwner",
|
|
5835
|
+
type: "address"
|
|
5836
|
+
}
|
|
5837
|
+
],
|
|
5838
|
+
name: "transferOwnership",
|
|
5839
|
+
outputs: [],
|
|
5840
|
+
stateMutability: "nonpayable",
|
|
5841
|
+
type: "function"
|
|
5842
|
+
},
|
|
5843
|
+
{
|
|
5844
|
+
inputs: [],
|
|
5845
|
+
name: "unpause",
|
|
5846
|
+
outputs: [],
|
|
5847
|
+
stateMutability: "nonpayable",
|
|
5848
|
+
type: "function"
|
|
5849
|
+
}
|
|
5850
|
+
];
|
|
5851
|
+
var InteropCenter_default = InteropCenterABI;
|
|
5852
|
+
|
|
5853
|
+
// src/core/internal/abis/IInteropHandler.ts
|
|
5854
|
+
var IInteropHandlerABI = [
|
|
5855
|
+
{
|
|
5856
|
+
anonymous: false,
|
|
5857
|
+
inputs: [
|
|
5858
|
+
{
|
|
5859
|
+
indexed: true,
|
|
5860
|
+
internalType: "bytes32",
|
|
5861
|
+
name: "bundleHash",
|
|
5862
|
+
type: "bytes32"
|
|
5863
|
+
}
|
|
5864
|
+
],
|
|
5865
|
+
name: "BundleExecuted",
|
|
5866
|
+
type: "event"
|
|
5867
|
+
},
|
|
5868
|
+
{
|
|
5869
|
+
anonymous: false,
|
|
5870
|
+
inputs: [
|
|
5871
|
+
{
|
|
5872
|
+
indexed: true,
|
|
5873
|
+
internalType: "bytes32",
|
|
5874
|
+
name: "bundleHash",
|
|
5875
|
+
type: "bytes32"
|
|
5876
|
+
}
|
|
5877
|
+
],
|
|
5878
|
+
name: "BundleUnbundled",
|
|
5879
|
+
type: "event"
|
|
5880
|
+
},
|
|
5881
|
+
{
|
|
5882
|
+
anonymous: false,
|
|
5883
|
+
inputs: [
|
|
5884
|
+
{
|
|
5885
|
+
indexed: true,
|
|
5886
|
+
internalType: "bytes32",
|
|
5887
|
+
name: "bundleHash",
|
|
5888
|
+
type: "bytes32"
|
|
5889
|
+
}
|
|
5890
|
+
],
|
|
5891
|
+
name: "BundleVerified",
|
|
5892
|
+
type: "event"
|
|
5893
|
+
},
|
|
5894
|
+
{
|
|
5895
|
+
anonymous: false,
|
|
5896
|
+
inputs: [
|
|
5897
|
+
{
|
|
5898
|
+
indexed: true,
|
|
5899
|
+
internalType: "bytes32",
|
|
5900
|
+
name: "bundleHash",
|
|
5901
|
+
type: "bytes32"
|
|
5902
|
+
},
|
|
5903
|
+
{
|
|
5904
|
+
indexed: true,
|
|
5905
|
+
internalType: "uint256",
|
|
5906
|
+
name: "callIndex",
|
|
5907
|
+
type: "uint256"
|
|
5908
|
+
},
|
|
5909
|
+
{
|
|
5910
|
+
indexed: false,
|
|
5911
|
+
internalType: "enum CallStatus",
|
|
5912
|
+
name: "status",
|
|
5913
|
+
type: "uint8"
|
|
5914
|
+
}
|
|
5915
|
+
],
|
|
5916
|
+
name: "CallProcessed",
|
|
5917
|
+
type: "event"
|
|
5918
|
+
},
|
|
5919
|
+
{
|
|
5920
|
+
inputs: [
|
|
5921
|
+
{
|
|
5922
|
+
internalType: "bytes",
|
|
5923
|
+
name: "_bundle",
|
|
5924
|
+
type: "bytes"
|
|
5925
|
+
},
|
|
5926
|
+
{
|
|
5927
|
+
components: [
|
|
5928
|
+
{
|
|
5929
|
+
internalType: "uint256",
|
|
5930
|
+
name: "chainId",
|
|
5931
|
+
type: "uint256"
|
|
5932
|
+
},
|
|
5933
|
+
{
|
|
5934
|
+
internalType: "uint256",
|
|
5935
|
+
name: "l1BatchNumber",
|
|
5936
|
+
type: "uint256"
|
|
5937
|
+
},
|
|
5938
|
+
{
|
|
5939
|
+
internalType: "uint256",
|
|
5940
|
+
name: "l2MessageIndex",
|
|
5941
|
+
type: "uint256"
|
|
5942
|
+
},
|
|
5943
|
+
{
|
|
5944
|
+
components: [
|
|
5945
|
+
{
|
|
5946
|
+
internalType: "uint16",
|
|
5947
|
+
name: "txNumberInBatch",
|
|
5948
|
+
type: "uint16"
|
|
5949
|
+
},
|
|
5950
|
+
{
|
|
5951
|
+
internalType: "address",
|
|
5952
|
+
name: "sender",
|
|
5953
|
+
type: "address"
|
|
5954
|
+
},
|
|
5955
|
+
{
|
|
5956
|
+
internalType: "bytes",
|
|
5957
|
+
name: "data",
|
|
5958
|
+
type: "bytes"
|
|
5959
|
+
}
|
|
5960
|
+
],
|
|
5961
|
+
internalType: "struct L2Message",
|
|
5962
|
+
name: "message",
|
|
5963
|
+
type: "tuple"
|
|
5964
|
+
},
|
|
5965
|
+
{
|
|
5966
|
+
internalType: "bytes32[]",
|
|
5967
|
+
name: "proof",
|
|
5968
|
+
type: "bytes32[]"
|
|
5969
|
+
}
|
|
5970
|
+
],
|
|
5971
|
+
internalType: "struct MessageInclusionProof",
|
|
5972
|
+
name: "_proof",
|
|
5973
|
+
type: "tuple"
|
|
5974
|
+
}
|
|
5975
|
+
],
|
|
5976
|
+
name: "executeBundle",
|
|
5977
|
+
outputs: [],
|
|
5978
|
+
stateMutability: "nonpayable",
|
|
5979
|
+
type: "function"
|
|
5980
|
+
},
|
|
5981
|
+
{
|
|
5982
|
+
inputs: [
|
|
5983
|
+
{
|
|
5984
|
+
internalType: "uint256",
|
|
5985
|
+
name: "_sourceChainId",
|
|
5986
|
+
type: "uint256"
|
|
5987
|
+
},
|
|
5988
|
+
{
|
|
5989
|
+
internalType: "bytes",
|
|
5990
|
+
name: "_bundle",
|
|
5991
|
+
type: "bytes"
|
|
5992
|
+
},
|
|
5993
|
+
{
|
|
5994
|
+
internalType: "enum CallStatus[]",
|
|
5995
|
+
name: "_callStatus",
|
|
5996
|
+
type: "uint8[]"
|
|
5997
|
+
}
|
|
5998
|
+
],
|
|
5999
|
+
name: "unbundleBundle",
|
|
6000
|
+
outputs: [],
|
|
6001
|
+
stateMutability: "nonpayable",
|
|
6002
|
+
type: "function"
|
|
6003
|
+
},
|
|
6004
|
+
{
|
|
6005
|
+
inputs: [
|
|
6006
|
+
{
|
|
6007
|
+
internalType: "bytes",
|
|
6008
|
+
name: "_bundle",
|
|
6009
|
+
type: "bytes"
|
|
6010
|
+
},
|
|
6011
|
+
{
|
|
6012
|
+
components: [
|
|
6013
|
+
{
|
|
6014
|
+
internalType: "uint256",
|
|
6015
|
+
name: "chainId",
|
|
6016
|
+
type: "uint256"
|
|
6017
|
+
},
|
|
6018
|
+
{
|
|
6019
|
+
internalType: "uint256",
|
|
6020
|
+
name: "l1BatchNumber",
|
|
6021
|
+
type: "uint256"
|
|
6022
|
+
},
|
|
6023
|
+
{
|
|
6024
|
+
internalType: "uint256",
|
|
6025
|
+
name: "l2MessageIndex",
|
|
6026
|
+
type: "uint256"
|
|
6027
|
+
},
|
|
6028
|
+
{
|
|
6029
|
+
components: [
|
|
6030
|
+
{
|
|
6031
|
+
internalType: "uint16",
|
|
6032
|
+
name: "txNumberInBatch",
|
|
6033
|
+
type: "uint16"
|
|
6034
|
+
},
|
|
6035
|
+
{
|
|
6036
|
+
internalType: "address",
|
|
6037
|
+
name: "sender",
|
|
6038
|
+
type: "address"
|
|
6039
|
+
},
|
|
6040
|
+
{
|
|
6041
|
+
internalType: "bytes",
|
|
6042
|
+
name: "data",
|
|
6043
|
+
type: "bytes"
|
|
6044
|
+
}
|
|
6045
|
+
],
|
|
6046
|
+
internalType: "struct L2Message",
|
|
6047
|
+
name: "message",
|
|
6048
|
+
type: "tuple"
|
|
6049
|
+
},
|
|
6050
|
+
{
|
|
6051
|
+
internalType: "bytes32[]",
|
|
6052
|
+
name: "proof",
|
|
6053
|
+
type: "bytes32[]"
|
|
6054
|
+
}
|
|
6055
|
+
],
|
|
6056
|
+
internalType: "struct MessageInclusionProof",
|
|
6057
|
+
name: "_proof",
|
|
6058
|
+
type: "tuple"
|
|
6059
|
+
}
|
|
6060
|
+
],
|
|
6061
|
+
name: "verifyBundle",
|
|
6062
|
+
outputs: [],
|
|
6063
|
+
stateMutability: "nonpayable",
|
|
6064
|
+
type: "function"
|
|
6065
|
+
}
|
|
6066
|
+
];
|
|
6067
|
+
var IInteropHandler_default = IInteropHandlerABI;
|
|
6068
|
+
|
|
6069
|
+
// src/core/internal/abis/L2MessageVerification.ts
|
|
6070
|
+
var L2MessageVerificationABI = [
|
|
6071
|
+
{
|
|
6072
|
+
inputs: [],
|
|
6073
|
+
name: "DepthMoreThanOneForRecursiveMerkleProof",
|
|
6074
|
+
type: "error"
|
|
6075
|
+
},
|
|
6076
|
+
{
|
|
6077
|
+
inputs: [],
|
|
6078
|
+
name: "HashedLogIsDefault",
|
|
6079
|
+
type: "error"
|
|
6080
|
+
},
|
|
6081
|
+
{
|
|
6082
|
+
inputs: [],
|
|
6083
|
+
name: "InvalidProofLengthForFinalNode",
|
|
6084
|
+
type: "error"
|
|
6085
|
+
},
|
|
6086
|
+
{
|
|
6087
|
+
inputs: [],
|
|
6088
|
+
name: "MerkleIndexOutOfBounds",
|
|
6089
|
+
type: "error"
|
|
6090
|
+
},
|
|
6091
|
+
{
|
|
6092
|
+
inputs: [],
|
|
6093
|
+
name: "MerklePathEmpty",
|
|
6094
|
+
type: "error"
|
|
6095
|
+
},
|
|
6096
|
+
{
|
|
6097
|
+
inputs: [],
|
|
6098
|
+
name: "MerklePathOutOfBounds",
|
|
6099
|
+
type: "error"
|
|
6100
|
+
},
|
|
6101
|
+
{
|
|
6102
|
+
inputs: [
|
|
6103
|
+
{
|
|
6104
|
+
internalType: "uint256",
|
|
6105
|
+
name: "metadataVersion",
|
|
6106
|
+
type: "uint256"
|
|
6107
|
+
}
|
|
6108
|
+
],
|
|
6109
|
+
name: "UnsupportedProofMetadataVersion",
|
|
6110
|
+
type: "error"
|
|
6111
|
+
},
|
|
6112
|
+
{
|
|
6113
|
+
inputs: [
|
|
6114
|
+
{
|
|
6115
|
+
components: [
|
|
6116
|
+
{
|
|
6117
|
+
internalType: "uint256",
|
|
6118
|
+
name: "chainId",
|
|
6119
|
+
type: "uint256"
|
|
6120
|
+
},
|
|
6121
|
+
{
|
|
6122
|
+
internalType: "uint256",
|
|
6123
|
+
name: "l2BatchNumber",
|
|
6124
|
+
type: "uint256"
|
|
6125
|
+
},
|
|
6126
|
+
{
|
|
6127
|
+
internalType: "uint256",
|
|
6128
|
+
name: "l2MessageIndex",
|
|
6129
|
+
type: "uint256"
|
|
6130
|
+
},
|
|
6131
|
+
{
|
|
6132
|
+
internalType: "address",
|
|
6133
|
+
name: "l2Sender",
|
|
6134
|
+
type: "address"
|
|
6135
|
+
},
|
|
6136
|
+
{
|
|
6137
|
+
internalType: "uint16",
|
|
6138
|
+
name: "l2TxNumberInBatch",
|
|
6139
|
+
type: "uint16"
|
|
6140
|
+
},
|
|
6141
|
+
{
|
|
6142
|
+
internalType: "bytes",
|
|
6143
|
+
name: "message",
|
|
6144
|
+
type: "bytes"
|
|
6145
|
+
},
|
|
6146
|
+
{
|
|
6147
|
+
internalType: "bytes32[]",
|
|
6148
|
+
name: "merkleProof",
|
|
6149
|
+
type: "bytes32[]"
|
|
6150
|
+
}
|
|
6151
|
+
],
|
|
6152
|
+
internalType: "struct FinalizeL1DepositParams",
|
|
6153
|
+
name: "_finalizeWithdrawalParams",
|
|
6154
|
+
type: "tuple"
|
|
6155
|
+
}
|
|
6156
|
+
],
|
|
6157
|
+
name: "proveL1DepositParamsInclusion",
|
|
6158
|
+
outputs: [
|
|
6159
|
+
{
|
|
6160
|
+
internalType: "bool",
|
|
6161
|
+
name: "success",
|
|
6162
|
+
type: "bool"
|
|
6163
|
+
}
|
|
6164
|
+
],
|
|
6165
|
+
stateMutability: "view",
|
|
6166
|
+
type: "function"
|
|
6167
|
+
},
|
|
6168
|
+
{
|
|
6169
|
+
inputs: [
|
|
6170
|
+
{
|
|
6171
|
+
internalType: "uint256",
|
|
6172
|
+
name: "_chainId",
|
|
6173
|
+
type: "uint256"
|
|
6174
|
+
},
|
|
6175
|
+
{
|
|
6176
|
+
internalType: "bytes32",
|
|
6177
|
+
name: "_l2TxHash",
|
|
6178
|
+
type: "bytes32"
|
|
6179
|
+
},
|
|
6180
|
+
{
|
|
6181
|
+
internalType: "uint256",
|
|
6182
|
+
name: "_l2BatchNumber",
|
|
6183
|
+
type: "uint256"
|
|
6184
|
+
},
|
|
6185
|
+
{
|
|
6186
|
+
internalType: "uint256",
|
|
6187
|
+
name: "_l2MessageIndex",
|
|
6188
|
+
type: "uint256"
|
|
6189
|
+
},
|
|
6190
|
+
{
|
|
6191
|
+
internalType: "uint16",
|
|
6192
|
+
name: "_l2TxNumberInBatch",
|
|
6193
|
+
type: "uint16"
|
|
6194
|
+
},
|
|
6195
|
+
{
|
|
6196
|
+
internalType: "bytes32[]",
|
|
6197
|
+
name: "_merkleProof",
|
|
6198
|
+
type: "bytes32[]"
|
|
6199
|
+
},
|
|
6200
|
+
{
|
|
6201
|
+
internalType: "enum TxStatus",
|
|
6202
|
+
name: "_status",
|
|
6203
|
+
type: "uint8"
|
|
6204
|
+
}
|
|
6205
|
+
],
|
|
6206
|
+
name: "proveL1ToL2TransactionStatusShared",
|
|
6207
|
+
outputs: [
|
|
6208
|
+
{
|
|
6209
|
+
internalType: "bool",
|
|
6210
|
+
name: "",
|
|
6211
|
+
type: "bool"
|
|
6212
|
+
}
|
|
6213
|
+
],
|
|
6214
|
+
stateMutability: "view",
|
|
6215
|
+
type: "function"
|
|
6216
|
+
},
|
|
6217
|
+
{
|
|
6218
|
+
inputs: [
|
|
6219
|
+
{
|
|
6220
|
+
internalType: "uint256",
|
|
6221
|
+
name: "_chainId",
|
|
6222
|
+
type: "uint256"
|
|
6223
|
+
},
|
|
6224
|
+
{
|
|
6225
|
+
internalType: "uint256",
|
|
6226
|
+
name: "_blockOrBatchNumber",
|
|
6227
|
+
type: "uint256"
|
|
6228
|
+
},
|
|
6229
|
+
{
|
|
6230
|
+
internalType: "uint256",
|
|
6231
|
+
name: "_leafProofMask",
|
|
6232
|
+
type: "uint256"
|
|
6233
|
+
},
|
|
6234
|
+
{
|
|
6235
|
+
internalType: "bytes32",
|
|
6236
|
+
name: "_leaf",
|
|
6237
|
+
type: "bytes32"
|
|
6238
|
+
},
|
|
6239
|
+
{
|
|
6240
|
+
internalType: "bytes32[]",
|
|
6241
|
+
name: "_proof",
|
|
6242
|
+
type: "bytes32[]"
|
|
6243
|
+
}
|
|
6244
|
+
],
|
|
6245
|
+
name: "proveL2LeafInclusionShared",
|
|
6246
|
+
outputs: [
|
|
6247
|
+
{
|
|
6248
|
+
internalType: "bool",
|
|
6249
|
+
name: "",
|
|
6250
|
+
type: "bool"
|
|
6251
|
+
}
|
|
6252
|
+
],
|
|
6253
|
+
stateMutability: "view",
|
|
6254
|
+
type: "function"
|
|
6255
|
+
},
|
|
6256
|
+
{
|
|
6257
|
+
inputs: [
|
|
6258
|
+
{
|
|
6259
|
+
internalType: "uint256",
|
|
6260
|
+
name: "_chainId",
|
|
6261
|
+
type: "uint256"
|
|
6262
|
+
},
|
|
6263
|
+
{
|
|
6264
|
+
internalType: "uint256",
|
|
6265
|
+
name: "_blockOrBatchNumber",
|
|
6266
|
+
type: "uint256"
|
|
6267
|
+
},
|
|
6268
|
+
{
|
|
6269
|
+
internalType: "uint256",
|
|
6270
|
+
name: "_leafProofMask",
|
|
6271
|
+
type: "uint256"
|
|
6272
|
+
},
|
|
6273
|
+
{
|
|
6274
|
+
internalType: "bytes32",
|
|
6275
|
+
name: "_leaf",
|
|
6276
|
+
type: "bytes32"
|
|
6277
|
+
},
|
|
6278
|
+
{
|
|
6279
|
+
internalType: "bytes32[]",
|
|
6280
|
+
name: "_proof",
|
|
6281
|
+
type: "bytes32[]"
|
|
6282
|
+
},
|
|
6283
|
+
{
|
|
6284
|
+
internalType: "uint256",
|
|
6285
|
+
name: "_depth",
|
|
6286
|
+
type: "uint256"
|
|
6287
|
+
}
|
|
6288
|
+
],
|
|
6289
|
+
name: "proveL2LeafInclusionSharedRecursive",
|
|
6290
|
+
outputs: [
|
|
6291
|
+
{
|
|
6292
|
+
internalType: "bool",
|
|
6293
|
+
name: "",
|
|
6294
|
+
type: "bool"
|
|
6295
|
+
}
|
|
6296
|
+
],
|
|
6297
|
+
stateMutability: "view",
|
|
6298
|
+
type: "function"
|
|
6299
|
+
},
|
|
6300
|
+
{
|
|
6301
|
+
inputs: [
|
|
6302
|
+
{
|
|
6303
|
+
internalType: "uint256",
|
|
6304
|
+
name: "_chainId",
|
|
6305
|
+
type: "uint256"
|
|
6306
|
+
},
|
|
6307
|
+
{
|
|
6308
|
+
internalType: "uint256",
|
|
6309
|
+
name: "_blockOrBatchNumber",
|
|
6310
|
+
type: "uint256"
|
|
6311
|
+
},
|
|
6312
|
+
{
|
|
6313
|
+
internalType: "uint256",
|
|
6314
|
+
name: "_index",
|
|
6315
|
+
type: "uint256"
|
|
6316
|
+
},
|
|
6317
|
+
{
|
|
6318
|
+
components: [
|
|
6319
|
+
{
|
|
6320
|
+
internalType: "uint8",
|
|
6321
|
+
name: "l2ShardId",
|
|
6322
|
+
type: "uint8"
|
|
6323
|
+
},
|
|
6324
|
+
{
|
|
6325
|
+
internalType: "bool",
|
|
6326
|
+
name: "isService",
|
|
6327
|
+
type: "bool"
|
|
6328
|
+
},
|
|
6329
|
+
{
|
|
6330
|
+
internalType: "uint16",
|
|
6331
|
+
name: "txNumberInBatch",
|
|
6332
|
+
type: "uint16"
|
|
6333
|
+
},
|
|
6334
|
+
{
|
|
6335
|
+
internalType: "address",
|
|
6336
|
+
name: "sender",
|
|
6337
|
+
type: "address"
|
|
6338
|
+
},
|
|
6339
|
+
{
|
|
6340
|
+
internalType: "bytes32",
|
|
6341
|
+
name: "key",
|
|
6342
|
+
type: "bytes32"
|
|
6343
|
+
},
|
|
6344
|
+
{
|
|
6345
|
+
internalType: "bytes32",
|
|
6346
|
+
name: "value",
|
|
6347
|
+
type: "bytes32"
|
|
6348
|
+
}
|
|
6349
|
+
],
|
|
6350
|
+
internalType: "struct L2Log",
|
|
6351
|
+
name: "_log",
|
|
6352
|
+
type: "tuple"
|
|
6353
|
+
},
|
|
6354
|
+
{
|
|
6355
|
+
internalType: "bytes32[]",
|
|
6356
|
+
name: "_proof",
|
|
6357
|
+
type: "bytes32[]"
|
|
6358
|
+
}
|
|
6359
|
+
],
|
|
6360
|
+
name: "proveL2LogInclusionShared",
|
|
6361
|
+
outputs: [
|
|
6362
|
+
{
|
|
6363
|
+
internalType: "bool",
|
|
6364
|
+
name: "",
|
|
6365
|
+
type: "bool"
|
|
6366
|
+
}
|
|
6367
|
+
],
|
|
6368
|
+
stateMutability: "view",
|
|
6369
|
+
type: "function"
|
|
6370
|
+
},
|
|
6371
|
+
{
|
|
6372
|
+
inputs: [
|
|
6373
|
+
{
|
|
6374
|
+
internalType: "uint256",
|
|
6375
|
+
name: "_chainId",
|
|
6376
|
+
type: "uint256"
|
|
6377
|
+
},
|
|
6378
|
+
{
|
|
6379
|
+
internalType: "uint256",
|
|
6380
|
+
name: "_blockOrBatchNumber",
|
|
6381
|
+
type: "uint256"
|
|
6382
|
+
},
|
|
6383
|
+
{
|
|
6384
|
+
internalType: "uint256",
|
|
6385
|
+
name: "_index",
|
|
6386
|
+
type: "uint256"
|
|
6387
|
+
},
|
|
6388
|
+
{
|
|
6389
|
+
components: [
|
|
6390
|
+
{
|
|
6391
|
+
internalType: "uint16",
|
|
6392
|
+
name: "txNumberInBatch",
|
|
6393
|
+
type: "uint16"
|
|
6394
|
+
},
|
|
6395
|
+
{
|
|
6396
|
+
internalType: "address",
|
|
6397
|
+
name: "sender",
|
|
6398
|
+
type: "address"
|
|
6399
|
+
},
|
|
6400
|
+
{
|
|
6401
|
+
internalType: "bytes",
|
|
6402
|
+
name: "data",
|
|
6403
|
+
type: "bytes"
|
|
6404
|
+
}
|
|
6405
|
+
],
|
|
6406
|
+
internalType: "struct L2Message",
|
|
6407
|
+
name: "_message",
|
|
6408
|
+
type: "tuple"
|
|
6409
|
+
},
|
|
6410
|
+
{
|
|
6411
|
+
internalType: "bytes32[]",
|
|
6412
|
+
name: "_proof",
|
|
6413
|
+
type: "bytes32[]"
|
|
6414
|
+
}
|
|
6415
|
+
],
|
|
6416
|
+
name: "proveL2MessageInclusionShared",
|
|
6417
|
+
outputs: [
|
|
6418
|
+
{
|
|
6419
|
+
internalType: "bool",
|
|
6420
|
+
name: "",
|
|
6421
|
+
type: "bool"
|
|
6422
|
+
}
|
|
6423
|
+
],
|
|
6424
|
+
stateMutability: "view",
|
|
6425
|
+
type: "function"
|
|
6426
|
+
}
|
|
6427
|
+
];
|
|
6428
|
+
var L2MessageVerification_default = L2MessageVerificationABI;
|
|
6429
|
+
|
|
6430
|
+
// src/core/errors/error-ops.ts
|
|
6431
|
+
function resolveMessage(op, msg) {
|
|
6432
|
+
if (!msg) return `Error during ${op}.`;
|
|
6433
|
+
return typeof msg === "function" ? msg() : msg;
|
|
6434
|
+
}
|
|
6435
|
+
function createErrorOps(decodeRevert2) {
|
|
6436
|
+
function toZKsyncError2(type, base, err) {
|
|
6437
|
+
if (isZKsyncError(err)) return err;
|
|
6438
|
+
const revert = decodeRevert2 ? decodeRevert2(err) : void 0;
|
|
6439
|
+
return createError(type, { ...base, ...revert ? { revert } : {}, cause: shapeCause(err) });
|
|
6440
|
+
}
|
|
6441
|
+
function createErrorHandlers2(resource) {
|
|
6442
|
+
async function run(kind, operation, fn, opts) {
|
|
6443
|
+
try {
|
|
6444
|
+
return await fn();
|
|
6445
|
+
} catch (e) {
|
|
6446
|
+
if (isZKsyncError(e)) throw e;
|
|
6447
|
+
const message = resolveMessage(operation, opts?.message);
|
|
6448
|
+
throw toZKsyncError2(kind, { resource, operation, context: opts?.ctx ?? {}, message }, e);
|
|
6449
|
+
}
|
|
6450
|
+
}
|
|
6451
|
+
function wrap2(operation, fn, opts) {
|
|
6452
|
+
return run("INTERNAL", operation, fn, opts);
|
|
6453
|
+
}
|
|
6454
|
+
function wrapAs2(kind, operation, fn, opts) {
|
|
6455
|
+
return run(kind, operation, fn, opts);
|
|
6456
|
+
}
|
|
6457
|
+
async function toResult(operation, fn, opts) {
|
|
6458
|
+
try {
|
|
6459
|
+
const value = await wrap2(operation, fn, opts);
|
|
6460
|
+
return { ok: true, value };
|
|
6461
|
+
} catch (e) {
|
|
6462
|
+
const shaped = isZKsyncError(e) ? e : toZKsyncError2(
|
|
6463
|
+
"INTERNAL",
|
|
6464
|
+
{
|
|
6465
|
+
resource,
|
|
6466
|
+
operation,
|
|
6467
|
+
context: opts?.ctx ?? {},
|
|
6468
|
+
message: resolveMessage(operation, opts?.message)
|
|
6469
|
+
},
|
|
6470
|
+
e
|
|
6471
|
+
);
|
|
6472
|
+
return { ok: false, error: shaped };
|
|
6473
|
+
}
|
|
6474
|
+
}
|
|
6475
|
+
return { wrap: wrap2, wrapAs: wrapAs2, toResult };
|
|
6476
|
+
}
|
|
6477
|
+
return { toZKsyncError: toZKsyncError2, createErrorHandlers: createErrorHandlers2 };
|
|
6478
|
+
}
|
|
6479
|
+
var ERROR_IFACES = [];
|
|
6480
|
+
var IFACE_ERROR_STRING = new ethers.Interface(["error Error(string)"]);
|
|
6481
|
+
var IFACE_PANIC = new ethers.Interface(["error Panic(uint256)"]);
|
|
6482
|
+
(function bootstrapDefaultIfaces() {
|
|
6483
|
+
try {
|
|
6484
|
+
ERROR_IFACES.push({
|
|
6485
|
+
name: "IL1Nullifier",
|
|
6486
|
+
iface: new ethers.Interface(IL1Nullifier_default)
|
|
6487
|
+
});
|
|
6488
|
+
} catch {
|
|
6489
|
+
}
|
|
6490
|
+
try {
|
|
6491
|
+
ERROR_IFACES.push({ name: "IERC20", iface: new ethers.Interface(IERC20_default) });
|
|
6492
|
+
} catch {
|
|
6493
|
+
}
|
|
6494
|
+
try {
|
|
6495
|
+
ERROR_IFACES.push({
|
|
6496
|
+
name: "IL1NativeTokenVault",
|
|
6497
|
+
iface: new ethers.Interface(L1NativeTokenVault_default)
|
|
6498
|
+
});
|
|
6499
|
+
} catch {
|
|
6500
|
+
}
|
|
6501
|
+
try {
|
|
6502
|
+
ERROR_IFACES.push({
|
|
6503
|
+
name: "IL2NativeTokenVault",
|
|
6504
|
+
iface: new ethers.Interface(L2NativeTokenVault_default)
|
|
6505
|
+
});
|
|
6506
|
+
} catch {
|
|
6507
|
+
}
|
|
6508
|
+
try {
|
|
6509
|
+
ERROR_IFACES.push({ name: "Mailbox", iface: new ethers.Interface(Mailbox_default) });
|
|
6510
|
+
} catch {
|
|
6511
|
+
}
|
|
6512
|
+
})();
|
|
6513
|
+
function extractRevertData(e) {
|
|
6514
|
+
const maybe = (
|
|
6515
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
6516
|
+
e?.data?.data ?? e?.error?.data ?? e?.data ?? e?.error?.error?.data ?? e?.info?.error?.data
|
|
6517
|
+
);
|
|
6518
|
+
if (typeof maybe === "string" && maybe.startsWith("0x") && maybe.length >= 10) {
|
|
6519
|
+
return maybe;
|
|
6520
|
+
}
|
|
6521
|
+
return void 0;
|
|
6522
|
+
}
|
|
6523
|
+
function decodeRevert(e) {
|
|
6524
|
+
const data = extractRevertData(e);
|
|
6525
|
+
if (!data) return;
|
|
6526
|
+
const selector = `0x${data.slice(2, 10)}`;
|
|
6527
|
+
try {
|
|
6528
|
+
const parsed = IFACE_ERROR_STRING.parseError(data);
|
|
6529
|
+
if (parsed?.name === "Error") {
|
|
6530
|
+
const args = parsed.args ? Array.from(parsed.args) : void 0;
|
|
6531
|
+
return { selector, name: "Error", args };
|
|
6532
|
+
}
|
|
6533
|
+
} catch {
|
|
6534
|
+
}
|
|
6535
|
+
try {
|
|
6536
|
+
const parsed = IFACE_PANIC.parseError(data);
|
|
6537
|
+
if (parsed?.name === "Panic") {
|
|
6538
|
+
const args = parsed.args ? Array.from(parsed.args) : void 0;
|
|
6539
|
+
return { selector, name: "Panic", args };
|
|
6540
|
+
}
|
|
6541
|
+
} catch {
|
|
6542
|
+
}
|
|
6543
|
+
for (const { name, iface } of ERROR_IFACES) {
|
|
6544
|
+
try {
|
|
6545
|
+
const parsed = iface.parseError(data);
|
|
6546
|
+
if (parsed) {
|
|
6547
|
+
const args = parsed.args ? Array.from(parsed.args) : void 0;
|
|
6548
|
+
return {
|
|
6549
|
+
selector,
|
|
6550
|
+
name: parsed.name,
|
|
6551
|
+
args,
|
|
6552
|
+
contract: name
|
|
6553
|
+
};
|
|
6554
|
+
}
|
|
6555
|
+
} catch {
|
|
6556
|
+
}
|
|
6557
|
+
}
|
|
6558
|
+
return { selector };
|
|
6559
|
+
}
|
|
6560
|
+
|
|
6561
|
+
// src/adapters/ethers/errors/error-ops.ts
|
|
6562
|
+
var { createErrorHandlers } = createErrorOps(decodeRevert);
|
|
6563
|
+
|
|
6564
|
+
// src/adapters/ethers/client.ts
|
|
6565
|
+
var { wrapAs, wrap } = createErrorHandlers("client");
|
|
6566
|
+
var ChainTypeManagerABI = [
|
|
6567
|
+
"function getSemverProtocolVersion() view returns (uint32,uint32,uint32)"
|
|
6568
|
+
];
|
|
6569
|
+
function createEthersClient(args) {
|
|
6570
|
+
const { l1, l2, signer } = args;
|
|
6571
|
+
let boundSigner = signer;
|
|
6572
|
+
const signerProvider = signer.provider;
|
|
6573
|
+
const isBrowserProvider = signerProvider instanceof ethers.BrowserProvider;
|
|
6574
|
+
if (!isBrowserProvider && (!boundSigner.provider || boundSigner.provider !== l1)) {
|
|
6575
|
+
boundSigner = signer.connect(l1);
|
|
6576
|
+
} else if (isBrowserProvider && signerProvider) {
|
|
6577
|
+
void (async () => {
|
|
6578
|
+
try {
|
|
6579
|
+
const [signerNet, l1Net] = await Promise.all([
|
|
6580
|
+
signerProvider.getNetwork(),
|
|
6581
|
+
l1.getNetwork()
|
|
6582
|
+
]);
|
|
6583
|
+
if (signerNet.chainId !== l1Net.chainId) {
|
|
6584
|
+
const warning = createError("STATE", {
|
|
6585
|
+
message: `BrowserProvider signer chainId (${signerNet.chainId}) != L1 provider chainId (${l1Net.chainId}). Ensure the wallet is connected to the correct network.`,
|
|
6586
|
+
resource: "helpers",
|
|
6587
|
+
operation: "client.browserProvider.networkMismatch",
|
|
6588
|
+
context: {
|
|
6589
|
+
signerChainId: signerNet.chainId,
|
|
6590
|
+
l1ChainId: l1Net.chainId
|
|
6591
|
+
}
|
|
6592
|
+
});
|
|
6593
|
+
console.debug("[zksync-sdk] non-fatal warning:", warning);
|
|
6594
|
+
}
|
|
6595
|
+
} catch (e) {
|
|
6596
|
+
}
|
|
6597
|
+
})();
|
|
6598
|
+
}
|
|
6599
|
+
const zks = zksRpcFromEthers(l2);
|
|
6600
|
+
let addrCache;
|
|
6601
|
+
let cCache;
|
|
6602
|
+
async function ensureAddresses() {
|
|
6603
|
+
if (addrCache) return addrCache;
|
|
6604
|
+
return await wrap(
|
|
6605
|
+
OP_CLIENT.ensureAddresses,
|
|
6606
|
+
async () => {
|
|
6607
|
+
const bridgehub = args.overrides?.bridgehub ?? await zks.getBridgehubAddress();
|
|
6608
|
+
const IBridgehub = new ethers.Interface(IBridgehub_default);
|
|
6609
|
+
const bh = new ethers.Contract(bridgehub, IBridgehub, l1);
|
|
6610
|
+
const l1AssetRouter = args.overrides?.l1AssetRouter ?? await bh.assetRouter();
|
|
6611
|
+
const IL1AssetRouter = new ethers.Interface(IL1AssetRouter_default);
|
|
6612
|
+
const ar = new ethers.Contract(l1AssetRouter, IL1AssetRouter, l1);
|
|
6613
|
+
const l1Nullifier = args.overrides?.l1Nullifier ?? await ar.L1_NULLIFIER();
|
|
6614
|
+
const IL1Nullifier = new ethers.Interface(IL1Nullifier_default);
|
|
6615
|
+
const nf = new ethers.Contract(l1Nullifier, IL1Nullifier, l1);
|
|
6616
|
+
const l1NativeTokenVault = args.overrides?.l1NativeTokenVault ?? await nf.l1NativeTokenVault();
|
|
6617
|
+
const l2AssetRouter = args.overrides?.l2AssetRouter ?? L2_ASSET_ROUTER_ADDRESS;
|
|
6618
|
+
const l2NativeTokenVault = args.overrides?.l2NativeTokenVault ?? L2_NATIVE_TOKEN_VAULT_ADDRESS;
|
|
6619
|
+
const l2BaseTokenSystem = args.overrides?.l2BaseTokenSystem ?? L2_BASE_TOKEN_ADDRESS;
|
|
6620
|
+
const interopCenter = args.overrides?.interopCenter ?? L2_INTEROP_CENTER_ADDRESS;
|
|
6621
|
+
const interopHandler = args.overrides?.interopHandler ?? L2_INTEROP_HANDLER_ADDRESS;
|
|
6622
|
+
const l2MessageVerification = args.overrides?.l2MessageVerification ?? L2_MESSAGE_VERIFICATION_ADDRESS;
|
|
6623
|
+
addrCache = {
|
|
6624
|
+
bridgehub,
|
|
6625
|
+
l1AssetRouter,
|
|
6626
|
+
l1Nullifier,
|
|
6627
|
+
l1NativeTokenVault,
|
|
6628
|
+
l2AssetRouter,
|
|
6629
|
+
l2NativeTokenVault,
|
|
6630
|
+
l2BaseTokenSystem,
|
|
6631
|
+
interopCenter,
|
|
6632
|
+
interopHandler,
|
|
6633
|
+
l2MessageVerification
|
|
6634
|
+
};
|
|
6635
|
+
return addrCache;
|
|
6636
|
+
},
|
|
6637
|
+
{
|
|
6638
|
+
ctx: { where: "ensureAddresses" },
|
|
6639
|
+
message: "Failed to ensure contract addresses."
|
|
6640
|
+
}
|
|
6641
|
+
);
|
|
6642
|
+
}
|
|
6643
|
+
async function contracts() {
|
|
6644
|
+
if (cCache) return cCache;
|
|
6645
|
+
const a = await ensureAddresses();
|
|
6646
|
+
cCache = {
|
|
6647
|
+
bridgehub: new ethers.Contract(a.bridgehub, IBridgehub_default, l1),
|
|
6648
|
+
l1AssetRouter: new ethers.Contract(a.l1AssetRouter, IL1AssetRouter_default, l1),
|
|
6649
|
+
l1Nullifier: new ethers.Contract(a.l1Nullifier, IL1Nullifier_default, l1),
|
|
6650
|
+
l1NativeTokenVault: new ethers.Contract(a.l1NativeTokenVault, L1NativeTokenVault_default, l1),
|
|
6651
|
+
l2AssetRouter: new ethers.Contract(a.l2AssetRouter, IL2AssetRouter_default, l2),
|
|
6652
|
+
l2NativeTokenVault: new ethers.Contract(a.l2NativeTokenVault, L2NativeTokenVault_default, l2),
|
|
6653
|
+
l2BaseTokenSystem: new ethers.Contract(a.l2BaseTokenSystem, IBaseToken_default, l2),
|
|
6654
|
+
interopCenter: new ethers.Contract(a.interopCenter, InteropCenter_default, l2),
|
|
6655
|
+
interopHandler: new ethers.Contract(a.interopHandler, IInteropHandler_default, l2),
|
|
6656
|
+
l2MessageVerification: new ethers.Contract(a.l2MessageVerification, L2MessageVerification_default, l2)
|
|
6657
|
+
};
|
|
6658
|
+
return cCache;
|
|
6659
|
+
}
|
|
6660
|
+
function refresh() {
|
|
6661
|
+
addrCache = void 0;
|
|
6662
|
+
cCache = void 0;
|
|
6663
|
+
}
|
|
6664
|
+
function resolveSignerFor(provider) {
|
|
6665
|
+
const signerProvider2 = boundSigner.provider;
|
|
6666
|
+
if (signerProvider2 === provider) {
|
|
6667
|
+
return boundSigner;
|
|
6668
|
+
}
|
|
6669
|
+
if (!isBrowserProvider && typeof boundSigner.connect === "function") {
|
|
6670
|
+
return boundSigner.connect(provider);
|
|
6671
|
+
}
|
|
6672
|
+
if (!signerProvider2) {
|
|
6673
|
+
throw createError("STATE", {
|
|
6674
|
+
resource: "helpers",
|
|
6675
|
+
message: "Signer has no associated provider; cannot resolve requested signer.",
|
|
6676
|
+
operation: "client.resolveSignerFor"
|
|
5277
6677
|
});
|
|
5278
6678
|
}
|
|
5279
6679
|
return boundSigner;
|
|
@@ -5282,10 +6682,54 @@ function createEthersClient(args) {
|
|
|
5282
6682
|
const { bridgehub } = await ensureAddresses();
|
|
5283
6683
|
const bh = new ethers.Contract(bridgehub, IBridgehub_default, l1);
|
|
5284
6684
|
return await wrapAs("CONTRACT", OP_DEPOSITS.base.baseToken, () => bh.baseToken(chainId), {
|
|
5285
|
-
ctx: { where: "bridgehub.baseToken",
|
|
6685
|
+
ctx: { where: "bridgehub.baseToken", chainId },
|
|
5286
6686
|
message: "Failed to read base token."
|
|
5287
6687
|
});
|
|
5288
6688
|
}
|
|
6689
|
+
async function getProtocolVersion(chainId) {
|
|
6690
|
+
const targetChainId = chainId ?? (await l2.getNetwork()).chainId;
|
|
6691
|
+
const { bridgehub } = await ensureAddresses();
|
|
6692
|
+
const bh = new ethers.Contract(bridgehub, IBridgehub_default, l1);
|
|
6693
|
+
const chainTypeManager = await wrapAs(
|
|
6694
|
+
"CONTRACT",
|
|
6695
|
+
OP_CLIENT.getSemverProtocolVersion,
|
|
6696
|
+
() => bh.chainTypeManager(targetChainId),
|
|
6697
|
+
{
|
|
6698
|
+
ctx: { where: "bridgehub.chainTypeManager", bridgehub, chainId: targetChainId },
|
|
6699
|
+
message: "Failed to read chain type manager."
|
|
6700
|
+
}
|
|
6701
|
+
);
|
|
6702
|
+
if (chainTypeManager.toLowerCase() === FORMAL_ETH_ADDRESS) {
|
|
6703
|
+
throw createError("STATE", {
|
|
6704
|
+
resource: "client",
|
|
6705
|
+
operation: OP_CLIENT.getSemverProtocolVersion,
|
|
6706
|
+
message: "No registered chain type manager for the chain.",
|
|
6707
|
+
context: { chainId }
|
|
6708
|
+
});
|
|
6709
|
+
}
|
|
6710
|
+
const ctm = new ethers.Contract(chainTypeManager, ChainTypeManagerABI, l1);
|
|
6711
|
+
const semver = await wrapAs(
|
|
6712
|
+
"CONTRACT",
|
|
6713
|
+
OP_CLIENT.getSemverProtocolVersion,
|
|
6714
|
+
() => ctm.getSemverProtocolVersion(),
|
|
6715
|
+
{
|
|
6716
|
+
ctx: {
|
|
6717
|
+
where: "chainTypeManager.getSemverProtocolVersion",
|
|
6718
|
+
chainId: targetChainId,
|
|
6719
|
+
chainTypeManager
|
|
6720
|
+
},
|
|
6721
|
+
message: "Failed to read semver protocol version."
|
|
6722
|
+
}
|
|
6723
|
+
);
|
|
6724
|
+
return semver;
|
|
6725
|
+
}
|
|
6726
|
+
function signerFor(target) {
|
|
6727
|
+
if (target === "l1") {
|
|
6728
|
+
return boundSigner.provider === l1 ? boundSigner : boundSigner.connect(l1);
|
|
6729
|
+
}
|
|
6730
|
+
const provider = target ?? l2;
|
|
6731
|
+
return boundSigner.provider === provider ? boundSigner : boundSigner.connect(provider);
|
|
6732
|
+
}
|
|
5289
6733
|
const client = {
|
|
5290
6734
|
kind: "ethers",
|
|
5291
6735
|
l1,
|
|
@@ -5301,7 +6745,9 @@ function createEthersClient(args) {
|
|
|
5301
6745
|
ensureAddresses,
|
|
5302
6746
|
contracts,
|
|
5303
6747
|
refresh,
|
|
5304
|
-
baseToken
|
|
6748
|
+
baseToken,
|
|
6749
|
+
getProtocolVersion,
|
|
6750
|
+
signerFor
|
|
5305
6751
|
};
|
|
5306
6752
|
return client;
|
|
5307
6753
|
}
|