@matterlabs/zksync-js 0.0.12 → 0.0.13

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 (38) hide show
  1. package/dist/adapters/ethers/client.cjs +722 -4
  2. package/dist/adapters/ethers/client.cjs.map +1 -1
  3. package/dist/adapters/ethers/client.js +5 -5
  4. package/dist/adapters/ethers/index.cjs +735 -14
  5. package/dist/adapters/ethers/index.cjs.map +1 -1
  6. package/dist/adapters/ethers/index.js +7 -7
  7. package/dist/adapters/ethers/sdk.cjs +733 -10
  8. package/dist/adapters/ethers/sdk.cjs.map +1 -1
  9. package/dist/adapters/ethers/sdk.js +5 -5
  10. package/dist/adapters/viem/client.cjs +2 -4
  11. package/dist/adapters/viem/client.cjs.map +1 -1
  12. package/dist/adapters/viem/client.js +5 -5
  13. package/dist/adapters/viem/index.cjs +2 -4
  14. package/dist/adapters/viem/index.cjs.map +1 -1
  15. package/dist/adapters/viem/index.js +7 -7
  16. package/dist/adapters/viem/sdk.js +5 -5
  17. package/dist/{chunk-BGUNJK2H.js → chunk-2RIARDXZ.js} +3 -3
  18. package/dist/{chunk-NBQVHW2N.js → chunk-4S4XDA4N.js} +3 -5
  19. package/dist/{chunk-GMNLOTNG.js → chunk-53MC5BR2.js} +1 -1
  20. package/dist/{chunk-I5VQBVQ2.js → chunk-5L6EYUJB.js} +1 -1
  21. package/dist/{chunk-TE2YQHVI.js → chunk-5R7L5NM5.js} +2 -2
  22. package/dist/{chunk-AUN5Y2A3.js → chunk-EDWBCPO3.js} +3 -3
  23. package/dist/{chunk-IUSH7YBZ.js → chunk-HI64OOAR.js} +1 -1
  24. package/dist/{chunk-6JM4PE62.js → chunk-JHO2UQ5F.js} +16 -13
  25. package/dist/{chunk-LWA7LC3N.js → chunk-R5WRFPK2.js} +3 -3
  26. package/dist/{chunk-6CLYCJMV.js → chunk-RI73VJSH.js} +715 -1
  27. package/dist/{chunk-4PFO3J7W.js → chunk-UDBRUBEK.js} +10 -2
  28. package/dist/core/abi.d.ts +2 -0
  29. package/dist/core/index.cjs +716 -4
  30. package/dist/core/index.cjs.map +1 -1
  31. package/dist/core/index.js +3 -3
  32. package/dist/core/internal/abis/IInteropErrors.d.ts +197 -0
  33. package/dist/core/internal/abis/IL1ContractErrors.d.ts +1021 -0
  34. package/dist/core/rpc/types.d.ts +0 -1
  35. package/dist/index.cjs +716 -4
  36. package/dist/index.cjs.map +1 -1
  37. package/dist/index.js +3 -3
  38. package/package.json +1 -1
@@ -1,9 +1,9 @@
1
- export { buildDirectRequestStruct, createContractsResource, createDepositsResource, createFinalizationServices, createTokensResource, createViemSdk, createWithdrawalsResource, encodeNativeTokenVaultTransferData, encodeSecondBridgeArgs, encodeSecondBridgeDataV1, encodeSecondBridgeErc20Args, encodeSecondBridgeEthArgs, getL2TransactionHashFromLogs } from '../../chunk-AUN5Y2A3.js';
2
- import '../../chunk-I5VQBVQ2.js';
1
+ export { buildDirectRequestStruct, createContractsResource, createDepositsResource, createFinalizationServices, createTokensResource, createViemSdk, createWithdrawalsResource, encodeNativeTokenVaultTransferData, encodeSecondBridgeArgs, encodeSecondBridgeDataV1, encodeSecondBridgeErc20Args, encodeSecondBridgeEthArgs, getL2TransactionHashFromLogs } from '../../chunk-EDWBCPO3.js';
2
+ import '../../chunk-5L6EYUJB.js';
3
3
  import '../../chunk-E3KP7XCG.js';
4
- export { createViemClient as createClient, createViemClient } from '../../chunk-BGUNJK2H.js';
5
- export { classifyReadinessFromRevert, createErrorHandlers, decodeRevert, registerErrorAbi, toZKsyncError } from '../../chunk-TE2YQHVI.js';
6
- import '../../chunk-NBQVHW2N.js';
7
- import '../../chunk-GMNLOTNG.js';
8
- import '../../chunk-6CLYCJMV.js';
4
+ export { createViemClient as createClient, createViemClient } from '../../chunk-2RIARDXZ.js';
5
+ export { classifyReadinessFromRevert, createErrorHandlers, decodeRevert, registerErrorAbi, toZKsyncError } from '../../chunk-5R7L5NM5.js';
6
+ import '../../chunk-4S4XDA4N.js';
7
+ import '../../chunk-53MC5BR2.js';
8
+ import '../../chunk-RI73VJSH.js';
9
9
  import '../../chunk-QQ2OR434.js';
@@ -1,7 +1,7 @@
1
- export { createViemSdk } from '../../chunk-AUN5Y2A3.js';
2
- import '../../chunk-I5VQBVQ2.js';
1
+ export { createViemSdk } from '../../chunk-EDWBCPO3.js';
2
+ import '../../chunk-5L6EYUJB.js';
3
3
  import '../../chunk-E3KP7XCG.js';
4
- import '../../chunk-TE2YQHVI.js';
5
- import '../../chunk-GMNLOTNG.js';
6
- import '../../chunk-6CLYCJMV.js';
4
+ import '../../chunk-5R7L5NM5.js';
5
+ import '../../chunk-53MC5BR2.js';
6
+ import '../../chunk-RI73VJSH.js';
7
7
  import '../../chunk-QQ2OR434.js';
@@ -1,6 +1,6 @@
1
- import { createErrorHandlers } from './chunk-TE2YQHVI.js';
2
- import { createZksRpc, makeTransportFromViem } from './chunk-NBQVHW2N.js';
3
- import { OP_CLIENT, IBridgehub_default, IL1AssetRouter_default, IL1Nullifier_default, IBaseToken_default, L2NativeTokenVault_default, IL2AssetRouter_default, L1NativeTokenVault_default } from './chunk-6CLYCJMV.js';
1
+ import { createErrorHandlers } from './chunk-5R7L5NM5.js';
2
+ import { createZksRpc, makeTransportFromViem } from './chunk-4S4XDA4N.js';
3
+ import { OP_CLIENT, IBridgehub_default, IL1AssetRouter_default, IL1Nullifier_default, IBaseToken_default, L2NativeTokenVault_default, IL2AssetRouter_default, L1NativeTokenVault_default } from './chunk-RI73VJSH.js';
4
4
  import { L2_ASSET_ROUTER_ADDRESS, L2_NATIVE_TOKEN_VAULT_ADDRESS, L2_BASE_TOKEN_ADDRESS } from './chunk-QQ2OR434.js';
5
5
  import { getContract, createWalletClient } from 'viem';
6
6
 
@@ -1,4 +1,4 @@
1
- import { createError, isBigint, isNumber, isZKsyncError, shapeCause } from './chunk-6CLYCJMV.js';
1
+ import { createError, isBigint, isNumber, isZKsyncError, shapeCause } from './chunk-RI73VJSH.js';
2
2
  import { __export } from './chunk-QQ2OR434.js';
3
3
 
4
4
  // src/core/rpc/zks.ts
@@ -87,8 +87,8 @@ function ensureHex(value, field, context) {
87
87
  });
88
88
  }
89
89
  function ensureNumber(value, field, opts) {
90
- const operation = opts?.operation ?? "zksrpc.normalizeGenesis";
91
- const messagePrefix = opts?.messagePrefix ?? "Malformed genesis response";
90
+ const operation = opts?.operation;
91
+ const messagePrefix = opts?.messagePrefix;
92
92
  if (isNumber(value)) return value;
93
93
  if (isBigint(value)) return Number(value);
94
94
  if (typeof value === "string" && value.trim() !== "") {
@@ -226,7 +226,6 @@ function normalizeGenesis(raw) {
226
226
  context: { valueType: typeof contractsRaw }
227
227
  });
228
228
  }
229
- const executionVersion = ensureNumber(record["execution_version"], "execution_version");
230
229
  const genesisRoot = ensureHex(record["genesis_root"], "genesis_root", {});
231
230
  const initialContracts = contractsRaw.map(
232
231
  (entry, index) => normalizeContractTuple(entry, index)
@@ -235,7 +234,6 @@ function normalizeGenesis(raw) {
235
234
  return {
236
235
  initialContracts,
237
236
  additionalStorage,
238
- executionVersion,
239
237
  genesisRoot
240
238
  };
241
239
  } catch (e) {
@@ -1,4 +1,4 @@
1
- import { isZKsyncError, createError, shapeCause } from './chunk-6CLYCJMV.js';
1
+ import { isZKsyncError, createError, shapeCause } from './chunk-RI73VJSH.js';
2
2
 
3
3
  // src/core/errors/error-ops.ts
4
4
  function resolveMessage(op, msg) {
@@ -1,4 +1,4 @@
1
- import { IBridgehub_default } from './chunk-6CLYCJMV.js';
1
+ import { IBridgehub_default } from './chunk-RI73VJSH.js';
2
2
  import { BUFFER, DEFAULT_ABI_BYTES, DEFAULT_PUBDATA_BYTES, TX_MEMORY_OVERHEAD_GAS, TX_OVERHEAD_GAS } from './chunk-QQ2OR434.js';
3
3
 
4
4
  // src/core/codec/ntv.ts
@@ -1,5 +1,5 @@
1
- import { createErrorOps, REVERT_TO_READINESS } from './chunk-GMNLOTNG.js';
2
- import { IL1Nullifier_default, IERC20_default, L1NativeTokenVault_default, L2NativeTokenVault_default, Mailbox_default } from './chunk-6CLYCJMV.js';
1
+ import { createErrorOps, REVERT_TO_READINESS } from './chunk-53MC5BR2.js';
2
+ import { IL1Nullifier_default, IERC20_default, L1NativeTokenVault_default, L2NativeTokenVault_default, Mailbox_default } from './chunk-RI73VJSH.js';
3
3
  import { decodeErrorResult } from 'viem';
4
4
 
5
5
  var ERROR_ABIS = [];
@@ -1,7 +1,7 @@
1
- import { createNTVCodec, toGasOverrides, buildFeeBreakdown, quoteL2Gas, quoteL1Gas, quoteL2Gas2 } from './chunk-I5VQBVQ2.js';
1
+ import { createNTVCodec, toGasOverrides, buildFeeBreakdown, quoteL2Gas, quoteL1Gas, quoteL2Gas2 } from './chunk-5L6EYUJB.js';
2
2
  import { findL1MessageSentLog, messengerLogIndex, pickWithdrawRoute } from './chunk-E3KP7XCG.js';
3
- import { createErrorHandlers, toZKsyncError, classifyReadinessFromRevert } from './chunk-TE2YQHVI.js';
4
- import { isHash66, IL1Nullifier_default, OP_WITHDRAWALS, createError, normalizeL1Token, isAddressEq, hexEq, OP_DEPOSITS, IERC20_default, isZKsyncError, isReceiptNotFound, IBridgehub_default, isETH, normalizeAddrEq, L2NativeTokenVault_default, IL2AssetRouter_default, IBaseToken_default } from './chunk-6CLYCJMV.js';
3
+ import { createErrorHandlers, toZKsyncError, classifyReadinessFromRevert } from './chunk-5R7L5NM5.js';
4
+ import { isHash66, IL1Nullifier_default, OP_WITHDRAWALS, createError, normalizeL1Token, isAddressEq, hexEq, OP_DEPOSITS, IERC20_default, isZKsyncError, isReceiptNotFound, IBridgehub_default, isETH, normalizeAddrEq, L2NativeTokenVault_default, IL2AssetRouter_default, IBaseToken_default } from './chunk-RI73VJSH.js';
5
5
  import { ETH_ADDRESS, TOPIC_CANONICAL_ASSIGNED, TOPIC_CANONICAL_SUCCESS, L1_MESSENGER_ADDRESS, L2_BASE_TOKEN_ADDRESS, L2_NATIVE_TOKEN_VAULT_ADDRESS, SAFE_L1_BRIDGE_GAS, FORMAL_ETH_ADDRESS } from './chunk-QQ2OR434.js';
6
6
  import { keccak256, encodeAbiParameters, concat, decodeEventLog, decodeAbiParameters, encodeFunctionData, zeroAddress } from 'viem';
7
7
 
@@ -1,4 +1,4 @@
1
- import { isETH, normalizeAddrEq } from './chunk-6CLYCJMV.js';
1
+ import { isETH, normalizeAddrEq } from './chunk-RI73VJSH.js';
2
2
 
3
3
  // src/core/resources/deposits/route.ts
4
4
  async function pickDepositRoute(client, chainIdL2, token) {
@@ -1,7 +1,7 @@
1
- import { createErrorHandlers, toZKsyncError, classifyReadinessFromRevert } from './chunk-4PFO3J7W.js';
2
- import { createNTVCodec, toGasOverrides, buildFeeBreakdown, quoteL2Gas, quoteL2BaseCost, quoteL1Gas, quoteL2Gas2 } from './chunk-I5VQBVQ2.js';
1
+ import { createErrorHandlers, toZKsyncError, classifyReadinessFromRevert } from './chunk-UDBRUBEK.js';
2
+ import { createNTVCodec, toGasOverrides, buildFeeBreakdown, quoteL2Gas, quoteL2BaseCost, quoteL1Gas, quoteL2Gas2 } from './chunk-5L6EYUJB.js';
3
3
  import { findL1MessageSentLog, messengerLogIndex, isL1MessageSentLog, pickWithdrawRoute } from './chunk-E3KP7XCG.js';
4
- import { isHash66, IL1Nullifier_default, OP_WITHDRAWALS, createError, normalizeL1Token, isAddressEq, hexEq, OP_DEPOSITS, IERC20_default, isZKsyncError, isReceiptNotFound, OP_INTEROP, IInteropHandler_default, IERC7786Attributes_default, isBigint, isHash, IInteropCenter_default, sleep, isETH, normalizeAddrEq, isNumber, isAddress, isHash66Array, IInteropRootStorage_default, L2NativeTokenVault_default, assertNever } from './chunk-6CLYCJMV.js';
4
+ import { isHash66, IL1Nullifier_default, OP_WITHDRAWALS, createError, normalizeL1Token, isAddressEq, hexEq, OP_DEPOSITS, IERC20_default, isZKsyncError, isReceiptNotFound, OP_INTEROP, IInteropHandler_default, IERC7786Attributes_default, isBigint, isHash, IInteropCenter_default, sleep, isETH, normalizeAddrEq, isNumber, isAddress, isHash66Array, IInteropRootStorage_default, L2NativeTokenVault_default, assertNever } from './chunk-RI73VJSH.js';
5
5
  import { ETH_ADDRESS, TOPIC_CANONICAL_ASSIGNED, TOPIC_CANONICAL_SUCCESS, L1_MESSENGER_ADDRESS, L2_BASE_TOKEN_ADDRESS, L2_NATIVE_TOKEN_VAULT_ADDRESS, L2_INTEROP_CENTER_ADDRESS, BUNDLE_IDENTIFIER, L2_INTEROP_ROOT_STORAGE_ADDRESS, SAFE_L1_BRIDGE_GAS, FORMAL_ETH_ADDRESS } from './chunk-QQ2OR434.js';
6
6
  import { Interface, AbiCoder, ethers, getBytes, Contract, NonceManager, JsonRpcProvider, isError, getAddress, concat, hexlify, toBeArray, toBeHex } from 'ethers';
7
7
 
@@ -3423,17 +3423,20 @@ function createInteropResource(client, tokens, contracts, attributes) {
3423
3423
  }
3424
3424
  } catch (e) {
3425
3425
  if (isZKsyncError(e)) throw e;
3426
- throw createError("EXECUTION", {
3427
- resource: "interop",
3428
- operation: "interop.create.sendTransaction",
3429
- message: "Failed to send or confirm an interop transaction step.",
3430
- context: {
3431
- step: step.key,
3432
- txHash: hash,
3433
- nonce: Number(step.tx.nonce ?? -1)
3426
+ throw toZKsyncError(
3427
+ "EXECUTION",
3428
+ {
3429
+ resource: "interop",
3430
+ operation: "interop.create.sendTransaction",
3431
+ message: "Failed to send or confirm an interop transaction step.",
3432
+ context: {
3433
+ step: step.key,
3434
+ txHash: hash,
3435
+ nonce: Number(step.tx.nonce ?? -1)
3436
+ }
3434
3437
  },
3435
- cause: e
3436
- });
3438
+ e
3439
+ );
3437
3440
  }
3438
3441
  }
3439
3442
  const last = Object.values(stepHashes).pop();
@@ -1,6 +1,6 @@
1
- import { createErrorHandlers } from './chunk-4PFO3J7W.js';
2
- import { createZksRpc, makeTransportFromEthers } from './chunk-NBQVHW2N.js';
3
- import { createError, OP_CLIENT, IBridgehub_default, IL1AssetRouter_default, IL1Nullifier_default, L2MessageVerification_default, IInteropHandler_default, IInteropCenter_default, IBaseToken_default, L2NativeTokenVault_default, IL2AssetRouter_default, L1NativeTokenVault_default, OP_DEPOSITS } from './chunk-6CLYCJMV.js';
1
+ import { createErrorHandlers } from './chunk-UDBRUBEK.js';
2
+ import { createZksRpc, makeTransportFromEthers } from './chunk-4S4XDA4N.js';
3
+ import { createError, OP_CLIENT, IBridgehub_default, IL1AssetRouter_default, IL1Nullifier_default, L2MessageVerification_default, IInteropHandler_default, IInteropCenter_default, IBaseToken_default, L2NativeTokenVault_default, IL2AssetRouter_default, L1NativeTokenVault_default, OP_DEPOSITS } from './chunk-RI73VJSH.js';
4
4
  import { L2_ASSET_ROUTER_ADDRESS, L2_NATIVE_TOKEN_VAULT_ADDRESS, L2_BASE_TOKEN_ADDRESS, L2_INTEROP_CENTER_ADDRESS, L2_INTEROP_HANDLER_ADDRESS, L2_MESSAGE_VERIFICATION_ADDRESS, FORMAL_ETH_ADDRESS } from './chunk-QQ2OR434.js';
5
5
  import { BrowserProvider, Interface, Contract } from 'ethers';
6
6