@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,8 +1,8 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { buildDirectRequestStruct, classifyReadinessFromRevert, createContractsResource, createDepositsResource, createErrorHandlers, createFinalizationServices, createTokensResource, createViemSdk, createWithdrawalsResource, decodeRevert, encodeNativeTokenVaultTransferData, encodeSecondBridgeArgs, encodeSecondBridgeDataV1, encodeSecondBridgeErc20Args, encodeSecondBridgeEthArgs, registerErrorAbi, toZKsyncError } from '../../chunk-JXUFGIJG.js';
|
|
1
|
+
export { buildDirectRequestStruct, classifyReadinessFromRevert, createContractsResource, createDepositsResource, createErrorHandlers, createFinalizationServices, createTokensResource, createViemSdk, createWithdrawalsResource, decodeRevert, encodeNativeTokenVaultTransferData, encodeSecondBridgeArgs, encodeSecondBridgeDataV1, encodeSecondBridgeErc20Args, encodeSecondBridgeEthArgs, registerErrorAbi, toZKsyncError } from '../../chunk-2MDK3GLO.js';
|
|
3
2
|
import '../../chunk-LL3WKCFJ.js';
|
|
4
3
|
import '../../chunk-NEC2ZKHI.js';
|
|
5
|
-
import '../../chunk-6K6VJQAL.js';
|
|
6
4
|
import '../../chunk-NCAIVYBR.js';
|
|
5
|
+
export { createViemClient as createClient, createViemClient } from '../../chunk-YUK547UF.js';
|
|
6
|
+
import '../../chunk-6K6VJQAL.js';
|
|
7
7
|
import '../../chunk-M5J2MM2U.js';
|
|
8
8
|
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;
|
|
@@ -6976,6 +6976,27 @@ function createWithdrawalsResource(client, tokens, contracts) {
|
|
|
6976
6976
|
message: "Internal error while attempting to tryFinalize withdrawal.",
|
|
6977
6977
|
ctx: { l2TxHash, where: "withdrawals.tryFinalize" }
|
|
6978
6978
|
});
|
|
6979
|
+
const tryWait = (h, opts) => toResult2(
|
|
6980
|
+
OP_WITHDRAWALS.tryWait,
|
|
6981
|
+
async () => {
|
|
6982
|
+
const v = await wait(h, opts);
|
|
6983
|
+
if (v) return v;
|
|
6984
|
+
throw createError("STATE", {
|
|
6985
|
+
resource: "withdrawals",
|
|
6986
|
+
operation: "withdrawals.tryWait",
|
|
6987
|
+
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.",
|
|
6988
|
+
context: {
|
|
6989
|
+
for: opts.for,
|
|
6990
|
+
l2TxHash: typeof h === "string" ? h : "l2TxHash" in h ? h.l2TxHash : void 0,
|
|
6991
|
+
where: "withdrawals.tryWait"
|
|
6992
|
+
}
|
|
6993
|
+
});
|
|
6994
|
+
},
|
|
6995
|
+
{
|
|
6996
|
+
message: "Internal error while waiting for withdrawal.",
|
|
6997
|
+
ctx: { input: h, for: opts?.for, where: "withdrawals.tryWait" }
|
|
6998
|
+
}
|
|
6999
|
+
);
|
|
6979
7000
|
return {
|
|
6980
7001
|
quote,
|
|
6981
7002
|
tryQuote,
|
|
@@ -6986,7 +7007,8 @@ function createWithdrawalsResource(client, tokens, contracts) {
|
|
|
6986
7007
|
status,
|
|
6987
7008
|
wait,
|
|
6988
7009
|
finalize,
|
|
6989
|
-
tryFinalize
|
|
7010
|
+
tryFinalize,
|
|
7011
|
+
tryWait
|
|
6990
7012
|
};
|
|
6991
7013
|
}
|
|
6992
7014
|
|