@matterlabs/zksync-js 0.0.21 → 0.0.22

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.
Files changed (70) hide show
  1. package/dist/adapters/ethers/client.cjs +31 -1
  2. package/dist/adapters/ethers/client.cjs.map +1 -1
  3. package/dist/adapters/ethers/client.d.ts +11 -0
  4. package/dist/adapters/ethers/client.js +6 -5
  5. package/dist/adapters/ethers/index.cjs +1009 -274
  6. package/dist/adapters/ethers/index.cjs.map +1 -1
  7. package/dist/adapters/ethers/index.d.ts +2 -1
  8. package/dist/adapters/ethers/index.js +10 -8
  9. package/dist/adapters/ethers/resources/withdrawals/context.d.ts +12 -1
  10. package/dist/adapters/ethers/resources/withdrawals/index.d.ts +17 -1
  11. package/dist/adapters/ethers/resources/withdrawals/routes/interop-bundle.d.ts +2 -0
  12. package/dist/adapters/ethers/resources/withdrawals/services/finalization.d.ts +35 -17
  13. package/dist/adapters/ethers/resources/withdrawals/services/protocol.d.ts +11 -0
  14. package/dist/adapters/ethers/sdk.cjs +976 -272
  15. package/dist/adapters/ethers/sdk.cjs.map +1 -1
  16. package/dist/adapters/ethers/sdk.d.ts +3 -1
  17. package/dist/adapters/ethers/sdk.js +8 -7
  18. package/dist/adapters/viem/client.cjs +44 -0
  19. package/dist/adapters/viem/client.cjs.map +1 -1
  20. package/dist/adapters/viem/client.d.ts +11 -0
  21. package/dist/adapters/viem/client.js +6 -5
  22. package/dist/adapters/viem/index.cjs +1060 -294
  23. package/dist/adapters/viem/index.cjs.map +1 -1
  24. package/dist/adapters/viem/index.d.ts +2 -1
  25. package/dist/adapters/viem/index.js +10 -8
  26. package/dist/adapters/viem/resources/withdrawals/context.d.ts +12 -1
  27. package/dist/adapters/viem/resources/withdrawals/index.d.ts +17 -1
  28. package/dist/adapters/viem/resources/withdrawals/routes/interop-bundle.d.ts +2 -0
  29. package/dist/adapters/viem/resources/withdrawals/services/finalization.d.ts +36 -18
  30. package/dist/adapters/viem/resources/withdrawals/services/protocol.d.ts +11 -0
  31. package/dist/adapters/viem/sdk.cjs +1014 -293
  32. package/dist/adapters/viem/sdk.cjs.map +1 -1
  33. package/dist/adapters/viem/sdk.d.ts +3 -1
  34. package/dist/adapters/viem/sdk.js +8 -7
  35. package/dist/{chunk-SBGBYZJM.js → chunk-2D3FBCZC.js} +2 -2
  36. package/dist/{chunk-LGTYM5XP.js → chunk-32N6TI6K.js} +1 -1
  37. package/dist/{chunk-IDXSGCGF.js → chunk-3SPDWWRD.js} +7 -22
  38. package/dist/{chunk-7GZDTLHX.js → chunk-4K4LOCQJ.js} +559 -256
  39. package/dist/{chunk-UEKFQAOS.js → chunk-AMRHBZIY.js} +304 -2
  40. package/dist/{chunk-2CGBLD5H.js → chunk-CP4SQ5PM.js} +527 -239
  41. package/dist/{chunk-NJK325XV.js → chunk-CPNHKNI4.js} +2 -2
  42. package/dist/{chunk-TYYUG5GA.js → chunk-CUBUD4J4.js} +1 -1
  43. package/dist/{chunk-CK5UFAZK.js → chunk-JXBLQQEN.js} +37 -3
  44. package/dist/{chunk-JSBMIT4S.js → chunk-KL6ZCPWJ.js} +1 -1
  45. package/dist/{chunk-MT4X5FEO.js → chunk-NQRYXL3K.js} +3 -1
  46. package/dist/{chunk-24TE2NNJ.js → chunk-PI4PF6WT.js} +24 -4
  47. package/dist/chunk-QUAPG3ZR.js +157 -0
  48. package/dist/chunk-UMPAKZCQ.js +19 -0
  49. package/dist/core/abi.d.ts +1 -0
  50. package/dist/core/constants.cjs +2 -0
  51. package/dist/core/constants.cjs.map +1 -1
  52. package/dist/core/constants.d.ts +9 -0
  53. package/dist/core/constants.js +1 -1
  54. package/dist/core/index.cjs +504 -0
  55. package/dist/core/index.cjs.map +1 -1
  56. package/dist/core/index.d.ts +6 -1
  57. package/dist/core/index.js +6 -4
  58. package/dist/core/internal/abis/IERC7786Attributes.d.ts +10 -0
  59. package/dist/core/internal/abis/IL1NullifierV32.d.ts +221 -0
  60. package/dist/core/resources/interop/attributes/bundle.d.ts +1 -0
  61. package/dist/core/resources/interop/attributes/resource.d.ts +1 -0
  62. package/dist/core/resources/protocol/semver.d.ts +18 -0
  63. package/dist/core/resources/withdrawals/bundle.d.ts +80 -0
  64. package/dist/core/resources/withdrawals/finalization.d.ts +142 -0
  65. package/dist/core/resources/withdrawals/protocol.d.ts +55 -0
  66. package/dist/core/types/flows/withdrawals.d.ts +30 -0
  67. package/dist/index.cjs +304 -0
  68. package/dist/index.cjs.map +1 -1
  69. package/dist/index.js +4 -4
  70. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import type { ViemClient } from './client';
2
2
  import { type DepositsResource as DepositsResourceType } from './resources/deposits/index';
3
- import { type WithdrawalsResource as WithdrawalsResourceType } from './resources/withdrawals/index';
3
+ import { type WithdrawalsResource as WithdrawalsResourceType, type WithdrawalsResourceOptions } from './resources/withdrawals/index';
4
4
  import type { TokensResource as TokensResourceType } from '../../core/types/flows/token';
5
5
  import type { ContractsResource as ContractsResourceType } from './resources/contracts';
6
6
  import { type InteropResource } from './resources/interop/index';
@@ -8,6 +8,8 @@ import type { InteropConfig } from './resources/interop/types';
8
8
  export interface ViemSdkOptions {
9
9
  /** Configuration required for interop operations. */
10
10
  interop?: InteropConfig;
11
+ /** Options for the withdrawals resource, e.g. forcing the withdrawal protocol. */
12
+ withdrawals?: WithdrawalsResourceOptions;
11
13
  }
12
14
  export interface ViemSdk {
13
15
  deposits: DepositsResourceType;
@@ -1,7 +1,8 @@
1
- export { createViemSdk } from '../../chunk-7GZDTLHX.js';
2
- import '../../chunk-IDXSGCGF.js';
3
- import '../../chunk-LGTYM5XP.js';
4
- import '../../chunk-SBGBYZJM.js';
5
- import '../../chunk-JSBMIT4S.js';
6
- import '../../chunk-UEKFQAOS.js';
7
- import '../../chunk-MT4X5FEO.js';
1
+ export { createViemSdk } from '../../chunk-4K4LOCQJ.js';
2
+ import '../../chunk-3SPDWWRD.js';
3
+ import '../../chunk-QUAPG3ZR.js';
4
+ import '../../chunk-32N6TI6K.js';
5
+ import '../../chunk-2D3FBCZC.js';
6
+ import '../../chunk-KL6ZCPWJ.js';
7
+ import '../../chunk-AMRHBZIY.js';
8
+ import '../../chunk-NQRYXL3K.js';
@@ -1,5 +1,5 @@
1
- import { createErrorOps, REVERT_TO_READINESS } from './chunk-JSBMIT4S.js';
2
- import { IL1Nullifier_default, IERC20_default, L1NativeTokenVault_default, L2NativeTokenVault_default, Mailbox_default, IL1ContractErrors_default, IInteropErrors_default } from './chunk-UEKFQAOS.js';
1
+ import { createErrorOps, REVERT_TO_READINESS } from './chunk-KL6ZCPWJ.js';
2
+ import { IL1Nullifier_default, IERC20_default, L1NativeTokenVault_default, L2NativeTokenVault_default, Mailbox_default, IL1ContractErrors_default, IInteropErrors_default } from './chunk-AMRHBZIY.js';
3
3
  import { decodeErrorResult } from 'viem';
4
4
 
5
5
  var ERROR_ABIS = [];
@@ -1,4 +1,4 @@
1
- import { L2_BASE_TOKEN_ADDRESS, TOPIC_L1_MESSAGE_SENT_NEW, TOPIC_L1_MESSAGE_SENT_LEG, L1_MESSENGER_ADDRESS, ETH_ADDRESS, L2_ASSET_ROUTER_ADDRESS } from './chunk-MT4X5FEO.js';
1
+ import { L2_BASE_TOKEN_ADDRESS, TOPIC_L1_MESSAGE_SENT_NEW, TOPIC_L1_MESSAGE_SENT_LEG, L1_MESSENGER_ADDRESS, ETH_ADDRESS, L2_ASSET_ROUTER_ADDRESS } from './chunk-NQRYXL3K.js';
2
2
 
3
3
  // src/core/resources/withdrawals/route.ts
4
4
  function normalizeTokenForRouting(token) {
@@ -1,6 +1,6 @@
1
- import { isL1MessageSentLog } from './chunk-LGTYM5XP.js';
2
- import { IBridgehub_default, assertNever, isHash66, isBigint, isHash, createError, OP_INTEROP, isNumber, isAddress, isHash66Array } from './chunk-UEKFQAOS.js';
3
- import { BUFFER, DEFAULT_ABI_BYTES, DEFAULT_PUBDATA_BYTES, TX_MEMORY_OVERHEAD_GAS, TX_OVERHEAD_GAS, L1_TX_MIN_L2_GAS_BASE, L1_TX_INTRINSIC_L2_GAS, L1_TX_DELTA_544_ENCODING_BYTES, L1_TX_DELTA_FACTORY_DEPS_L2_GAS, L1_TX_INTRINSIC_PUBDATA, L1_TX_DELTA_FACTORY_DEPS_PUBDATA, TX_SLOT_OVERHEAD_L2_GAS, PRIORITY_TX_MAX_GAS_LIMIT, L2_INTEROP_CENTER_ADDRESS, BUNDLE_IDENTIFIER } from './chunk-MT4X5FEO.js';
1
+ import { isL1MessageSentLog } from './chunk-32N6TI6K.js';
2
+ import { IBridgehub_default, isHash66, isBigint, isHash, assertNever, createError, OP_INTEROP, isNumber, isAddress, isHash66Array } from './chunk-AMRHBZIY.js';
3
+ import { BUFFER, DEFAULT_ABI_BYTES, DEFAULT_PUBDATA_BYTES, TX_MEMORY_OVERHEAD_GAS, TX_OVERHEAD_GAS, L1_TX_MIN_L2_GAS_BASE, L1_TX_INTRINSIC_L2_GAS, L1_TX_DELTA_544_ENCODING_BYTES, L1_TX_DELTA_FACTORY_DEPS_L2_GAS, L1_TX_INTRINSIC_PUBDATA, L1_TX_DELTA_FACTORY_DEPS_PUBDATA, TX_SLOT_OVERHEAD_L2_GAS, PRIORITY_TX_MAX_GAS_LIMIT, L2_INTEROP_CENTER_ADDRESS, BUNDLE_IDENTIFIER } from './chunk-NQRYXL3K.js';
4
4
 
5
5
  // src/core/resources/deposits/chains.ts
6
6
  var ERAVM_CHAIN_IDS = /* @__PURE__ */ new Set([324n, 2741n, 11124n, 300n]);
@@ -164,23 +164,6 @@ function createNTVCodec(deps) {
164
164
  };
165
165
  }
166
166
 
167
- // src/core/resources/withdrawals/status.ts
168
- function phaseFromReadiness(r) {
169
- switch (r.kind) {
170
- case "FINALIZED":
171
- return { phase: "FINALIZED" };
172
- case "READY":
173
- return { phase: "READY_TO_FINALIZE" };
174
- case "NOT_READY":
175
- return { phase: "PENDING", reason: formatReason(r.reason, r.detail) };
176
- case "UNFINALIZABLE":
177
- return { phase: "UNFINALIZABLE", reason: formatReason(r.reason, r.detail) };
178
- default:
179
- return assertNever(r);
180
- }
181
- }
182
- var formatReason = (reason, detail) => detail ? `${reason}: ${detail}` : reason;
183
-
184
167
  // src/core/types/flows/interop.ts
185
168
  function isInteropMessageProof(obj) {
186
169
  if (typeof obj !== "object" || obj === null) return false;
@@ -301,10 +284,12 @@ function createBundleAttributes(codec) {
301
284
  const executionAddress = (executor) => codec.encode("executionAddress", [executor]);
302
285
  const unbundlerAddress = (addr) => codec.encode("unbundlerAddress", [addr]);
303
286
  const useFixedFee = (enabled) => codec.encode("useFixedFee", [enabled]);
287
+ const interopBundleSalt = (salt) => codec.encode("interopBundleSalt", [salt]);
304
288
  return {
305
289
  executionAddress,
306
290
  unbundlerAddress,
307
- useFixedFee
291
+ useFixedFee,
292
+ interopBundleSalt
308
293
  };
309
294
  }
310
295
 
@@ -669,4 +654,4 @@ async function quoteL2Gas2(input) {
669
654
  }
670
655
  }
671
656
 
672
- export { DEFAULT_POLL_MS, DEFAULT_TIMEOUT_MS, ZERO_HASH, applyPriorityL2GasLimitBuffer, assertProtocolVersion, buildDirectBundle, buildFeeBreakdown, buildFinalizationInfo, buildIndirectBundle, createAttributesResource, createNTVCodec, derivePriorityBodyGasEstimateCap, derivePriorityTxGasBreakdown, isInteropFinalizationInfo, parseBundleReceiptInfo, parseBundleSentFromReceipt, phaseFromReadiness, pickInteropRoute, preflightDirect, preflightIndirect, quoteL1Gas, quoteL2BaseCost, quoteL2Gas, quoteL2Gas2, resolveCreateDepositL1GasLimit, resolveIdsFromWaitable, toGasOverrides };
657
+ export { DEFAULT_POLL_MS, DEFAULT_TIMEOUT_MS, ZERO_HASH, applyPriorityL2GasLimitBuffer, assertProtocolVersion, buildDirectBundle, buildFeeBreakdown, buildFinalizationInfo, buildIndirectBundle, createAttributesResource, createNTVCodec, derivePriorityBodyGasEstimateCap, derivePriorityTxGasBreakdown, isInteropFinalizationInfo, parseBundleReceiptInfo, parseBundleSentFromReceipt, pickInteropRoute, preflightDirect, preflightIndirect, quoteL1Gas, quoteL2BaseCost, quoteL2Gas, quoteL2Gas2, resolveCreateDepositL1GasLimit, resolveIdsFromWaitable, toGasOverrides };