@matterlabs/zksync-js 0.0.3 → 0.0.6
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/README.md +1 -3
- package/dist/adapters/ethers/client.js +1 -1
- package/dist/adapters/ethers/index.cjs +23 -1
- package/dist/adapters/ethers/index.cjs.map +1 -1
- package/dist/adapters/ethers/index.js +4 -4
- package/dist/adapters/ethers/resources/withdrawals/index.d.ts +11 -0
- package/dist/adapters/ethers/sdk.cjs +23 -1
- package/dist/adapters/ethers/sdk.cjs.map +1 -1
- package/dist/adapters/ethers/sdk.js +2 -2
- package/dist/adapters/viem/index.cjs +23 -1
- package/dist/adapters/viem/index.cjs.map +1 -1
- package/dist/adapters/viem/index.js +3 -3
- package/dist/adapters/viem/resources/withdrawals/index.d.ts +11 -0
- package/dist/adapters/viem/sdk.cjs +23 -1
- package/dist/adapters/viem/sdk.cjs.map +1 -1
- package/dist/adapters/viem/sdk.js +1 -1
- package/dist/{chunk-JXUFGIJG.js → chunk-2MDK3GLO.js} +23 -1
- package/dist/{chunk-5YWP4CZP.js → chunk-WU2LOG2A.js} +24 -2
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { buildDirectRequestStruct, createDepositsResource, createEthersSdk, createFinalizationServices, createTokensResource, createWithdrawalsResource, encodeNativeTokenVaultTransferData, encodeSecondBridgeArgs, encodeSecondBridgeDataV1, encodeSecondBridgeErc20Args, encodeSecondBridgeEthArgs } from '../../chunk-5YWP4CZP.js';
|
|
2
|
-
import '../../chunk-LL3WKCFJ.js';
|
|
3
|
-
import '../../chunk-NEC2ZKHI.js';
|
|
4
1
|
export { createEthersClient as createClient, createEthersClient } from '../../chunk-3MRGU4HV.js';
|
|
2
|
+
export { buildDirectRequestStruct, createDepositsResource, createEthersSdk, createFinalizationServices, createTokensResource, createWithdrawalsResource, encodeNativeTokenVaultTransferData, encodeSecondBridgeArgs, encodeSecondBridgeDataV1, encodeSecondBridgeErc20Args, encodeSecondBridgeEthArgs } from '../../chunk-WU2LOG2A.js';
|
|
5
3
|
export { classifyReadinessFromRevert, createErrorHandlers, decodeRevert, registerErrorAbi, toZKsyncError } from '../../chunk-XRE7H466.js';
|
|
6
|
-
import '../../chunk-
|
|
4
|
+
import '../../chunk-LL3WKCFJ.js';
|
|
5
|
+
import '../../chunk-NEC2ZKHI.js';
|
|
7
6
|
import '../../chunk-NCAIVYBR.js';
|
|
7
|
+
import '../../chunk-6K6VJQAL.js';
|
|
8
8
|
import '../../chunk-M5J2MM2U.js';
|
|
9
9
|
import '../../chunk-F2ENUV3A.js';
|
|
@@ -38,6 +38,17 @@ export interface WithdrawalsResource {
|
|
|
38
38
|
pollMs?: number;
|
|
39
39
|
timeoutMs?: number;
|
|
40
40
|
}): Promise<TransactionReceiptZKsyncOS | TransactionReceipt | null>;
|
|
41
|
+
tryWait(h: WithdrawalWaitable | Hex, opts: {
|
|
42
|
+
for: 'l2' | 'ready' | 'finalized';
|
|
43
|
+
pollMs?: number;
|
|
44
|
+
timeoutMs?: number;
|
|
45
|
+
}): Promise<{
|
|
46
|
+
ok: true;
|
|
47
|
+
value: TransactionReceiptZKsyncOS | TransactionReceipt;
|
|
48
|
+
} | {
|
|
49
|
+
ok: false;
|
|
50
|
+
error: unknown;
|
|
51
|
+
}>;
|
|
41
52
|
finalize(l2TxHash: Hex): Promise<{
|
|
42
53
|
status: WithdrawalStatus;
|
|
43
54
|
receipt?: TransactionReceipt;
|
|
@@ -6101,6 +6101,27 @@ function createWithdrawalsResource(client, tokens, contracts) {
|
|
|
6101
6101
|
message: "Internal error while attempting to tryFinalize withdrawal.",
|
|
6102
6102
|
ctx: { l2TxHash, where: "withdrawals.tryFinalize" }
|
|
6103
6103
|
});
|
|
6104
|
+
const tryWait = (h, opts) => toResult2(
|
|
6105
|
+
OP_WITHDRAWALS.tryWait,
|
|
6106
|
+
async () => {
|
|
6107
|
+
const v = await wait(h, opts);
|
|
6108
|
+
if (v) return v;
|
|
6109
|
+
throw createError("STATE", {
|
|
6110
|
+
resource: "withdrawals",
|
|
6111
|
+
operation: "withdrawals.tryWait",
|
|
6112
|
+
message: opts.for === "l2" ? "No L2 receipt yet; the withdrawal has not executed on L2." : "No L1 receipt yet; the withdrawal has not been included on L1.",
|
|
6113
|
+
context: {
|
|
6114
|
+
for: opts.for,
|
|
6115
|
+
l2TxHash: typeof h === "string" ? h : "l2TxHash" in h ? h.l2TxHash : void 0,
|
|
6116
|
+
where: "withdrawals.tryWait"
|
|
6117
|
+
}
|
|
6118
|
+
});
|
|
6119
|
+
},
|
|
6120
|
+
{
|
|
6121
|
+
message: "Internal error while waiting for withdrawal.",
|
|
6122
|
+
ctx: { input: h, for: opts?.for, where: "withdrawals.tryWait" }
|
|
6123
|
+
}
|
|
6124
|
+
);
|
|
6104
6125
|
return {
|
|
6105
6126
|
quote,
|
|
6106
6127
|
tryQuote,
|
|
@@ -6111,7 +6132,8 @@ function createWithdrawalsResource(client, tokens, contracts) {
|
|
|
6111
6132
|
status,
|
|
6112
6133
|
wait,
|
|
6113
6134
|
finalize,
|
|
6114
|
-
tryFinalize
|
|
6135
|
+
tryFinalize,
|
|
6136
|
+
tryWait
|
|
6115
6137
|
};
|
|
6116
6138
|
}
|
|
6117
6139
|
|