@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.
@@ -1,4 +1,4 @@
1
- export { createViemSdk } from '../../chunk-JXUFGIJG.js';
1
+ export { createViemSdk } from '../../chunk-2MDK3GLO.js';
2
2
  import '../../chunk-LL3WKCFJ.js';
3
3
  import '../../chunk-NEC2ZKHI.js';
4
4
  import '../../chunk-NCAIVYBR.js';
@@ -2723,6 +2723,27 @@ function createWithdrawalsResource(client, tokens, contracts) {
2723
2723
  message: "Internal error while attempting to tryFinalize withdrawal.",
2724
2724
  ctx: { l2TxHash, where: "withdrawals.tryFinalize" }
2725
2725
  });
2726
+ const tryWait = (h, opts) => toResult2(
2727
+ OP_WITHDRAWALS.tryWait,
2728
+ async () => {
2729
+ const v = await wait(h, opts);
2730
+ if (v) return v;
2731
+ throw createError("STATE", {
2732
+ resource: "withdrawals",
2733
+ operation: "withdrawals.tryWait",
2734
+ 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.",
2735
+ context: {
2736
+ for: opts.for,
2737
+ l2TxHash: typeof h === "string" ? h : "l2TxHash" in h ? h.l2TxHash : void 0,
2738
+ where: "withdrawals.tryWait"
2739
+ }
2740
+ });
2741
+ },
2742
+ {
2743
+ message: "Internal error while waiting for withdrawal.",
2744
+ ctx: { input: h, for: opts?.for, where: "withdrawals.tryWait" }
2745
+ }
2746
+ );
2726
2747
  return {
2727
2748
  quote,
2728
2749
  tryQuote,
@@ -2733,7 +2754,8 @@ function createWithdrawalsResource(client, tokens, contracts) {
2733
2754
  status,
2734
2755
  wait,
2735
2756
  finalize,
2736
- tryFinalize
2757
+ tryFinalize,
2758
+ tryWait
2737
2759
  };
2738
2760
  }
2739
2761
 
@@ -1,6 +1,6 @@
1
+ import { createErrorHandlers, toZKsyncError, classifyReadinessFromRevert } from './chunk-XRE7H466.js';
1
2
  import { createNTVCodec, buildFeeBreakdown, quoteL2Gas, quoteL2BaseCost, quoteL1Gas, quoteL2Gas2 } from './chunk-LL3WKCFJ.js';
2
3
  import { findL1MessageSentLog, messengerLogIndex, normalizeL1Token, isAddressEq, hexEq, isHash66, isETH, normalizeAddrEq, pickWithdrawRoute } from './chunk-NEC2ZKHI.js';
3
- import { createErrorHandlers, toZKsyncError, classifyReadinessFromRevert } from './chunk-XRE7H466.js';
4
4
  import { OP_WITHDRAWALS, IL1Nullifier_default, createError, OP_DEPOSITS, IERC20_default, isZKsyncError, isReceiptNotFound } from './chunk-M5J2MM2U.js';
5
5
  import { ETH_ADDRESS, L1_MESSENGER_ADDRESS, L2_ASSET_ROUTER_ADDRESS, L2_BASE_TOKEN_ADDRESS, L2_NATIVE_TOKEN_VAULT_ADDRESS, TOPIC_CANONICAL_ASSIGNED, TOPIC_CANONICAL_SUCCESS, SAFE_L1_BRIDGE_GAS } from './chunk-F2ENUV3A.js';
6
6
  import { Interface, AbiCoder, ethers, Contract, NonceManager } from 'ethers';
@@ -2172,6 +2172,27 @@ function createWithdrawalsResource(client, tokens, contracts) {
2172
2172
  message: "Internal error while attempting to tryFinalize withdrawal.",
2173
2173
  ctx: { l2TxHash, where: "withdrawals.tryFinalize" }
2174
2174
  });
2175
+ const tryWait = (h, opts) => toResult2(
2176
+ OP_WITHDRAWALS.tryWait,
2177
+ async () => {
2178
+ const v = await wait(h, opts);
2179
+ if (v) return v;
2180
+ throw createError("STATE", {
2181
+ resource: "withdrawals",
2182
+ operation: "withdrawals.tryWait",
2183
+ 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.",
2184
+ context: {
2185
+ for: opts.for,
2186
+ l2TxHash: typeof h === "string" ? h : "l2TxHash" in h ? h.l2TxHash : void 0,
2187
+ where: "withdrawals.tryWait"
2188
+ }
2189
+ });
2190
+ },
2191
+ {
2192
+ message: "Internal error while waiting for withdrawal.",
2193
+ ctx: { input: h, for: opts?.for, where: "withdrawals.tryWait" }
2194
+ }
2195
+ );
2175
2196
  return {
2176
2197
  quote,
2177
2198
  tryQuote,
@@ -2182,7 +2203,8 @@ function createWithdrawalsResource(client, tokens, contracts) {
2182
2203
  status,
2183
2204
  wait,
2184
2205
  finalize,
2185
- tryFinalize
2206
+ tryFinalize,
2207
+ tryWait
2186
2208
  };
2187
2209
  }
2188
2210
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@matterlabs/zksync-js",
3
- "version": "0.0.3",
3
+ "version": "0.0.6",
4
4
  "main": "./dist/index.cjs",
5
5
  "module": "./dist/index.js",
6
6
  "devDependencies": {