@matterlabs/zksync-js 0.0.19 → 0.0.21
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/index.cjs +38 -6
- package/dist/adapters/ethers/index.cjs.map +1 -1
- package/dist/adapters/ethers/index.js +3 -3
- package/dist/adapters/ethers/sdk.cjs +38 -6
- package/dist/adapters/ethers/sdk.cjs.map +1 -1
- package/dist/adapters/ethers/sdk.js +3 -3
- package/dist/adapters/viem/index.cjs +36 -4
- package/dist/adapters/viem/index.cjs.map +1 -1
- package/dist/adapters/viem/index.js +3 -3
- package/dist/adapters/viem/sdk.cjs +36 -4
- package/dist/adapters/viem/sdk.cjs.map +1 -1
- package/dist/adapters/viem/sdk.js +3 -3
- package/dist/{chunk-5H3VTIYD.js → chunk-2CGBLD5H.js} +15 -8
- package/dist/{chunk-3T5V4HKS.js → chunk-7GZDTLHX.js} +13 -6
- package/dist/{chunk-6LYAENO6.js → chunk-IDXSGCGF.js} +20 -3
- package/dist/{chunk-3HHUZXSV.js → chunk-LGTYM5XP.js} +9 -1
- package/dist/core/index.cjs +9 -0
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.js +1 -1
- package/dist/core/resources/withdrawals/status.d.ts +5 -0
- package/dist/core/types/flows/withdrawals.d.ts +2 -2
- package/dist/core/utils/events.d.ts +2 -0
- package/dist/index.cjs +9 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { createEthersSdk } from '../../chunk-
|
|
1
|
+
export { createEthersSdk } from '../../chunk-2CGBLD5H.js';
|
|
2
2
|
import '../../chunk-NJK325XV.js';
|
|
3
|
-
import '../../chunk-
|
|
4
|
-
import '../../chunk-
|
|
3
|
+
import '../../chunk-IDXSGCGF.js';
|
|
4
|
+
import '../../chunk-LGTYM5XP.js';
|
|
5
5
|
import '../../chunk-JSBMIT4S.js';
|
|
6
6
|
import '../../chunk-UEKFQAOS.js';
|
|
7
7
|
import '../../chunk-MT4X5FEO.js';
|
|
@@ -10060,6 +10060,14 @@ function isL1MessageSentLog(log, opts) {
|
|
|
10060
10060
|
const preferAddr = extractPreferAddress(opts);
|
|
10061
10061
|
return log.address.toLowerCase() === preferAddr && (topic === TOPIC_L1_MESSAGE_SENT_LEG.toLowerCase() || topic === TOPIC_L1_MESSAGE_SENT_NEW.toLowerCase());
|
|
10062
10062
|
}
|
|
10063
|
+
var SENDER_TOPIC = /^0x0{24}([0-9a-fA-F]{40})$/;
|
|
10064
|
+
function l1MessageSentSender(log) {
|
|
10065
|
+
const sender = SENDER_TOPIC.exec(log.topics?.[1] ?? "")?.[1];
|
|
10066
|
+
if (!sender) {
|
|
10067
|
+
throw new Error("L1MessageSent log has no valid sender topic.");
|
|
10068
|
+
}
|
|
10069
|
+
return `0x${sender.toLowerCase()}`;
|
|
10070
|
+
}
|
|
10063
10071
|
|
|
10064
10072
|
// src/core/resources/withdrawals/logs.ts
|
|
10065
10073
|
function messengerLogIndex(raw, opts) {
|
|
@@ -10174,7 +10182,7 @@ function createFinalizationServices(client) {
|
|
|
10174
10182
|
chainId: BigInt(chainId),
|
|
10175
10183
|
l2BatchNumber: proof.batchNumber,
|
|
10176
10184
|
l2MessageIndex: proof.id,
|
|
10177
|
-
l2Sender:
|
|
10185
|
+
l2Sender: l1MessageSentSender(ev),
|
|
10178
10186
|
l2TxNumberInBatch: txIndex,
|
|
10179
10187
|
message,
|
|
10180
10188
|
merkleProof: proof.proof
|
|
@@ -10349,6 +10357,23 @@ function createFinalizationServices(client) {
|
|
|
10349
10357
|
};
|
|
10350
10358
|
}
|
|
10351
10359
|
|
|
10360
|
+
// src/core/resources/withdrawals/status.ts
|
|
10361
|
+
function phaseFromReadiness(r) {
|
|
10362
|
+
switch (r.kind) {
|
|
10363
|
+
case "FINALIZED":
|
|
10364
|
+
return { phase: "FINALIZED" };
|
|
10365
|
+
case "READY":
|
|
10366
|
+
return { phase: "READY_TO_FINALIZE" };
|
|
10367
|
+
case "NOT_READY":
|
|
10368
|
+
return { phase: "PENDING", reason: formatReason(r.reason, r.detail) };
|
|
10369
|
+
case "UNFINALIZABLE":
|
|
10370
|
+
return { phase: "UNFINALIZABLE", reason: formatReason(r.reason, r.detail) };
|
|
10371
|
+
default:
|
|
10372
|
+
return assertNever(r);
|
|
10373
|
+
}
|
|
10374
|
+
}
|
|
10375
|
+
var formatReason = (reason, detail) => detail ? `${reason}: ${detail}` : reason;
|
|
10376
|
+
|
|
10352
10377
|
// src/adapters/viem/resources/withdrawals/index.ts
|
|
10353
10378
|
var ROUTES2 = {
|
|
10354
10379
|
base: routeEthBase(),
|
|
@@ -10546,9 +10571,8 @@ function createWithdrawalsResource(client, tokens, contracts) {
|
|
|
10546
10571
|
} catch {
|
|
10547
10572
|
}
|
|
10548
10573
|
const readiness = await svc.simulateFinalizeReadiness(pack.params);
|
|
10549
|
-
|
|
10550
|
-
|
|
10551
|
-
return { phase: "PENDING", l2TxHash, key };
|
|
10574
|
+
const { phase, reason } = phaseFromReadiness(readiness);
|
|
10575
|
+
return { phase, reason, l2TxHash, key };
|
|
10552
10576
|
},
|
|
10553
10577
|
{
|
|
10554
10578
|
message: "Internal error while checking withdrawal status.",
|
|
@@ -10596,6 +10620,14 @@ function createWithdrawalsResource(client, tokens, contracts) {
|
|
|
10596
10620
|
const deadline = opts.timeoutMs ? Date.now() + opts.timeoutMs : void 0;
|
|
10597
10621
|
while (true) {
|
|
10598
10622
|
const s = await status(l2Hash);
|
|
10623
|
+
if (s.phase === "UNFINALIZABLE") {
|
|
10624
|
+
throw createError("STATE", {
|
|
10625
|
+
resource: "withdrawals",
|
|
10626
|
+
operation: OP_WITHDRAWALS.wait,
|
|
10627
|
+
message: "Withdrawal can never be finalized.",
|
|
10628
|
+
context: { l2TxHash: l2Hash, reason: s.reason }
|
|
10629
|
+
});
|
|
10630
|
+
}
|
|
10599
10631
|
if (opts.for === "ready") {
|
|
10600
10632
|
if (s.phase === "READY_TO_FINALIZE" || s.phase === "FINALIZED") return null;
|
|
10601
10633
|
} else {
|