@matterlabs/zksync-js 0.0.12 → 0.0.14

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 (69) hide show
  1. package/dist/adapters/ethers/client.cjs +735 -8
  2. package/dist/adapters/ethers/client.cjs.map +1 -1
  3. package/dist/adapters/ethers/client.js +7 -6
  4. package/dist/adapters/ethers/index.cjs +1421 -441
  5. package/dist/adapters/ethers/index.cjs.map +1 -1
  6. package/dist/adapters/ethers/index.js +10 -9
  7. package/dist/adapters/ethers/resources/deposits/routes/priority.d.ts +12 -0
  8. package/dist/adapters/ethers/resources/deposits/services/gas.d.ts +4 -0
  9. package/dist/adapters/ethers/resources/interop/index.d.ts +14 -14
  10. package/dist/adapters/ethers/resources/interop/resolvers.d.ts +3 -8
  11. package/dist/adapters/ethers/resources/interop/routes/types.d.ts +2 -1
  12. package/dist/adapters/ethers/resources/interop/services/erc20.d.ts +10 -0
  13. package/dist/adapters/ethers/resources/interop/services/fee.d.ts +12 -0
  14. package/dist/adapters/ethers/resources/interop/services/finalization/index.d.ts +1 -1
  15. package/dist/adapters/ethers/resources/interop/services/finalization/polling.d.ts +1 -1
  16. package/dist/adapters/ethers/resources/interop/types.d.ts +6 -14
  17. package/dist/adapters/ethers/sdk.cjs +3068 -1685
  18. package/dist/adapters/ethers/sdk.cjs.map +1 -1
  19. package/dist/adapters/ethers/sdk.d.ts +6 -1
  20. package/dist/adapters/ethers/sdk.js +8 -7
  21. package/dist/adapters/viem/client.cjs +10 -8
  22. package/dist/adapters/viem/client.cjs.map +1 -1
  23. package/dist/adapters/viem/client.js +7 -6
  24. package/dist/adapters/viem/index.cjs +317 -77
  25. package/dist/adapters/viem/index.cjs.map +1 -1
  26. package/dist/adapters/viem/index.js +10 -9
  27. package/dist/adapters/viem/resources/deposits/routes/priority.d.ts +13 -0
  28. package/dist/adapters/viem/resources/deposits/services/gas.d.ts +4 -0
  29. package/dist/adapters/viem/sdk.cjs +307 -69
  30. package/dist/adapters/viem/sdk.cjs.map +1 -1
  31. package/dist/adapters/viem/sdk.js +7 -7
  32. package/dist/{chunk-E3KP7XCG.js → chunk-3HHUZXSV.js} +1 -1
  33. package/dist/{chunk-4PFO3J7W.js → chunk-5RRJDPAJ.js} +10 -2
  34. package/dist/{chunk-AUN5Y2A3.js → chunk-75IOOODG.js} +253 -53
  35. package/dist/{chunk-LWA7LC3N.js → chunk-7CAVFIMW.js} +5 -4
  36. package/dist/chunk-BWKWWLY4.js +9 -0
  37. package/dist/{chunk-NBQVHW2N.js → chunk-DYJKK5FW.js} +19 -19
  38. package/dist/{chunk-I5VQBVQ2.js → chunk-EOBXYHTZ.js} +35 -7
  39. package/dist/{chunk-GMNLOTNG.js → chunk-HP3EWKJL.js} +1 -1
  40. package/dist/{chunk-IUSH7YBZ.js → chunk-J47RI3G7.js} +1 -1
  41. package/dist/{chunk-6CLYCJMV.js → chunk-JY62QO3W.js} +759 -22
  42. package/dist/{chunk-QQ2OR434.js → chunk-MT4X5FEO.js} +18 -2
  43. package/dist/{chunk-BGUNJK2H.js → chunk-OTXPSNNC.js} +5 -4
  44. package/dist/{chunk-TE2YQHVI.js → chunk-XDRCN4FC.js} +2 -2
  45. package/dist/{chunk-6JM4PE62.js → chunk-XKRNLFET.js} +407 -210
  46. package/dist/core/abi.d.ts +2 -0
  47. package/dist/core/constants.cjs +17 -1
  48. package/dist/core/constants.cjs.map +1 -1
  49. package/dist/core/constants.d.ts +9 -1
  50. package/dist/core/constants.js +1 -1
  51. package/dist/core/index.cjs +768 -28
  52. package/dist/core/index.cjs.map +1 -1
  53. package/dist/core/index.js +6 -5
  54. package/dist/core/internal/abis/IERC7786Attributes.d.ts +21 -11
  55. package/dist/core/internal/abis/IInteropCenter.d.ts +4 -0
  56. package/dist/core/internal/abis/IInteropErrors.d.ts +197 -0
  57. package/dist/core/internal/abis/IL1ContractErrors.d.ts +1021 -0
  58. package/dist/core/resources/deposits/priority.d.ts +37 -0
  59. package/dist/core/resources/interop/attributes/bundle.d.ts +1 -0
  60. package/dist/core/resources/interop/attributes/resource.d.ts +1 -0
  61. package/dist/core/resources/interop/plan.d.ts +11 -3
  62. package/dist/core/rpc/types.d.ts +1 -1
  63. package/dist/core/rpc/zks.d.ts +5 -1
  64. package/dist/core/types/errors.d.ts +5 -0
  65. package/dist/core/types/flows/interop.d.ts +11 -18
  66. package/dist/index.cjs +785 -29
  67. package/dist/index.cjs.map +1 -1
  68. package/dist/index.js +6 -5
  69. package/package.json +1 -1
@@ -4,6 +4,11 @@ import { type WithdrawalsResource } from './resources/withdrawals/index';
4
4
  import { type InteropResource } from './resources/interop/index';
5
5
  import type { TokensResource } from '../../core/types/flows/token';
6
6
  import type { ContractsResource } from './resources/contracts/index';
7
+ import type { InteropConfig } from './resources/interop/types';
8
+ export interface EthersSdkOptions {
9
+ /** Configuration required for interop operations. */
10
+ interop?: InteropConfig;
11
+ }
7
12
  export interface EthersSdk {
8
13
  deposits: DepositsResource;
9
14
  withdrawals: WithdrawalsResource;
@@ -11,4 +16,4 @@ export interface EthersSdk {
11
16
  contracts: ContractsResource;
12
17
  interop: InteropResource;
13
18
  }
14
- export declare function createEthersSdk(client: EthersClient): EthersSdk;
19
+ export declare function createEthersSdk(client: EthersClient, options?: EthersSdkOptions): EthersSdk;
@@ -1,7 +1,8 @@
1
- export { createEthersSdk } from '../../chunk-6JM4PE62.js';
2
- import '../../chunk-4PFO3J7W.js';
3
- import '../../chunk-I5VQBVQ2.js';
4
- import '../../chunk-E3KP7XCG.js';
5
- import '../../chunk-GMNLOTNG.js';
6
- import '../../chunk-6CLYCJMV.js';
7
- import '../../chunk-QQ2OR434.js';
1
+ export { createEthersSdk } from '../../chunk-XKRNLFET.js';
2
+ import '../../chunk-5RRJDPAJ.js';
3
+ import '../../chunk-EOBXYHTZ.js';
4
+ import '../../chunk-3HHUZXSV.js';
5
+ import '../../chunk-HP3EWKJL.js';
6
+ import '../../chunk-DYJKK5FW.js';
7
+ import '../../chunk-JY62QO3W.js';
8
+ import '../../chunk-MT4X5FEO.js';
@@ -224,6 +224,7 @@ function normalizeProof(p) {
224
224
  const raw = p ?? {};
225
225
  const idRaw = raw?.id ?? raw?.index;
226
226
  const bnRaw = raw?.batch_number ?? raw?.batchNumber;
227
+ const gwBlockNumberRaw = raw?.gatewayBlockNumber;
227
228
  if (idRaw == null || bnRaw == null) {
228
229
  throw createError("RPC", {
229
230
  resource: "zksrpc",
@@ -244,7 +245,8 @@ function normalizeProof(p) {
244
245
  id: toBig(idRaw),
245
246
  batchNumber: toBig(bnRaw),
246
247
  proof: toHexArray(raw?.proof),
247
- root: raw.root
248
+ root: raw.root,
249
+ gatewayBlockNumber: gwBlockNumberRaw != null ? toBig(gwBlockNumberRaw) : void 0
248
250
  };
249
251
  } catch (e) {
250
252
  if (isZKsyncError(e)) throw e;
@@ -267,8 +269,8 @@ function ensureHex(value, field, context) {
267
269
  });
268
270
  }
269
271
  function ensureNumber(value, field, opts) {
270
- const operation = opts?.operation ?? "zksrpc.normalizeGenesis";
271
- const messagePrefix = opts?.messagePrefix ?? "Malformed genesis response";
272
+ const operation = opts?.operation;
273
+ const messagePrefix = opts?.messagePrefix;
272
274
  if (isNumber(value)) return value;
273
275
  if (isBigint(value)) return Number(value);
274
276
  if (typeof value === "string" && value.trim() !== "") {
@@ -406,7 +408,6 @@ function normalizeGenesis(raw) {
406
408
  context: { valueType: typeof contractsRaw }
407
409
  });
408
410
  }
409
- const executionVersion = ensureNumber(record["execution_version"], "execution_version");
410
411
  const genesisRoot = ensureHex(record["genesis_root"], "genesis_root", {});
411
412
  const initialContracts = contractsRaw.map(
412
413
  (entry, index) => normalizeContractTuple(entry, index)
@@ -415,7 +416,6 @@ function normalizeGenesis(raw) {
415
416
  return {
416
417
  initialContracts,
417
418
  additionalStorage,
418
- executionVersion,
419
419
  genesisRoot
420
420
  };
421
421
  } catch (e) {
@@ -523,13 +523,15 @@ function createZksRpc(transport) {
523
523
  );
524
524
  },
525
525
  // Fetches a proof for an L2→L1 log emitted in the given transaction.
526
- async getL2ToL1LogProof(txHash, index) {
526
+ async getL2ToL1LogProof(txHash, index, proofTarget) {
527
527
  return withRpcOp(
528
528
  "zksrpc.getL2ToL1LogProof",
529
529
  "Failed to fetch L2\u2192L1 log proof.",
530
- { txHash, index },
530
+ { txHash, index, proofTarget },
531
531
  async () => {
532
- const proof = await transport(METHODS.getL2ToL1LogProof, [txHash, index]);
532
+ const params = [txHash, index];
533
+ if (proofTarget != void 0) params.push(proofTarget);
534
+ const proof = await transport(METHODS.getL2ToL1LogProof, params);
533
535
  if (!proof) {
534
536
  throw createError("STATE", {
535
537
  resource: "zksrpc",