@matterlabs/zksync-js 0.0.20 → 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.
- package/dist/adapters/ethers/client.cjs +31 -1
- package/dist/adapters/ethers/client.cjs.map +1 -1
- package/dist/adapters/ethers/client.d.ts +11 -0
- package/dist/adapters/ethers/client.js +6 -5
- package/dist/adapters/ethers/index.cjs +1057 -290
- package/dist/adapters/ethers/index.cjs.map +1 -1
- package/dist/adapters/ethers/index.d.ts +2 -1
- package/dist/adapters/ethers/index.js +10 -8
- package/dist/adapters/ethers/resources/withdrawals/context.d.ts +12 -1
- package/dist/adapters/ethers/resources/withdrawals/index.d.ts +17 -1
- package/dist/adapters/ethers/resources/withdrawals/routes/interop-bundle.d.ts +2 -0
- package/dist/adapters/ethers/resources/withdrawals/services/finalization.d.ts +35 -17
- package/dist/adapters/ethers/resources/withdrawals/services/protocol.d.ts +11 -0
- package/dist/adapters/ethers/sdk.cjs +1010 -274
- package/dist/adapters/ethers/sdk.cjs.map +1 -1
- package/dist/adapters/ethers/sdk.d.ts +3 -1
- package/dist/adapters/ethers/sdk.js +8 -7
- package/dist/adapters/viem/client.cjs +44 -0
- package/dist/adapters/viem/client.cjs.map +1 -1
- package/dist/adapters/viem/client.d.ts +11 -0
- package/dist/adapters/viem/client.js +6 -5
- package/dist/adapters/viem/index.cjs +1094 -296
- package/dist/adapters/viem/index.cjs.map +1 -1
- package/dist/adapters/viem/index.d.ts +2 -1
- package/dist/adapters/viem/index.js +10 -8
- package/dist/adapters/viem/resources/withdrawals/context.d.ts +12 -1
- package/dist/adapters/viem/resources/withdrawals/index.d.ts +17 -1
- package/dist/adapters/viem/resources/withdrawals/routes/interop-bundle.d.ts +2 -0
- package/dist/adapters/viem/resources/withdrawals/services/finalization.d.ts +36 -18
- package/dist/adapters/viem/resources/withdrawals/services/protocol.d.ts +11 -0
- package/dist/adapters/viem/sdk.cjs +1048 -295
- package/dist/adapters/viem/sdk.cjs.map +1 -1
- package/dist/adapters/viem/sdk.d.ts +3 -1
- package/dist/adapters/viem/sdk.js +8 -7
- package/dist/{chunk-SBGBYZJM.js → chunk-2D3FBCZC.js} +2 -2
- package/dist/{chunk-3HHUZXSV.js → chunk-32N6TI6K.js} +10 -2
- package/dist/{chunk-6LYAENO6.js → chunk-3SPDWWRD.js} +6 -4
- package/dist/{chunk-3T5V4HKS.js → chunk-4K4LOCQJ.js} +569 -259
- package/dist/{chunk-UEKFQAOS.js → chunk-AMRHBZIY.js} +304 -2
- package/dist/{chunk-E2XKJCI5.js → chunk-CP4SQ5PM.js} +537 -242
- package/dist/{chunk-NJK325XV.js → chunk-CPNHKNI4.js} +2 -2
- package/dist/{chunk-TYYUG5GA.js → chunk-CUBUD4J4.js} +1 -1
- package/dist/{chunk-CK5UFAZK.js → chunk-JXBLQQEN.js} +37 -3
- package/dist/{chunk-JSBMIT4S.js → chunk-KL6ZCPWJ.js} +1 -1
- package/dist/{chunk-MT4X5FEO.js → chunk-NQRYXL3K.js} +3 -1
- package/dist/{chunk-24TE2NNJ.js → chunk-PI4PF6WT.js} +24 -4
- package/dist/chunk-QUAPG3ZR.js +157 -0
- package/dist/chunk-UMPAKZCQ.js +19 -0
- package/dist/core/abi.d.ts +1 -0
- package/dist/core/constants.cjs +2 -0
- package/dist/core/constants.cjs.map +1 -1
- package/dist/core/constants.d.ts +9 -0
- package/dist/core/constants.js +1 -1
- package/dist/core/index.cjs +513 -0
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.ts +6 -1
- package/dist/core/index.js +6 -4
- package/dist/core/internal/abis/IERC7786Attributes.d.ts +10 -0
- package/dist/core/internal/abis/IL1NullifierV32.d.ts +221 -0
- package/dist/core/resources/interop/attributes/bundle.d.ts +1 -0
- package/dist/core/resources/interop/attributes/resource.d.ts +1 -0
- package/dist/core/resources/protocol/semver.d.ts +18 -0
- package/dist/core/resources/withdrawals/bundle.d.ts +80 -0
- package/dist/core/resources/withdrawals/finalization.d.ts +142 -0
- package/dist/core/resources/withdrawals/protocol.d.ts +55 -0
- package/dist/core/resources/withdrawals/status.d.ts +5 -0
- package/dist/core/types/flows/withdrawals.d.ts +32 -2
- package/dist/core/utils/events.d.ts +2 -0
- package/dist/index.cjs +313 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -4
- 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-
|
|
2
|
-
import '../../chunk-
|
|
3
|
-
import '../../chunk-
|
|
4
|
-
import '../../chunk-
|
|
5
|
-
import '../../chunk-
|
|
6
|
-
import '../../chunk-
|
|
7
|
-
import '../../chunk-
|
|
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-
|
|
2
|
-
import { IL1Nullifier_default, IERC20_default, L1NativeTokenVault_default, L2NativeTokenVault_default, Mailbox_default, IL1ContractErrors_default, IInteropErrors_default } from './chunk-
|
|
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-
|
|
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) {
|
|
@@ -40,6 +40,14 @@ function isL1MessageSentLog(log, opts) {
|
|
|
40
40
|
const preferAddr = extractPreferAddress(opts);
|
|
41
41
|
return log.address.toLowerCase() === preferAddr && (topic === TOPIC_L1_MESSAGE_SENT_LEG.toLowerCase() || topic === TOPIC_L1_MESSAGE_SENT_NEW.toLowerCase());
|
|
42
42
|
}
|
|
43
|
+
var SENDER_TOPIC = /^0x0{24}([0-9a-fA-F]{40})$/;
|
|
44
|
+
function l1MessageSentSender(log) {
|
|
45
|
+
const sender = SENDER_TOPIC.exec(log.topics?.[1] ?? "")?.[1];
|
|
46
|
+
if (!sender) {
|
|
47
|
+
throw new Error("L1MessageSent log has no valid sender topic.");
|
|
48
|
+
}
|
|
49
|
+
return `0x${sender.toLowerCase()}`;
|
|
50
|
+
}
|
|
43
51
|
|
|
44
52
|
// src/core/resources/withdrawals/logs.ts
|
|
45
53
|
function messengerLogIndex(raw, opts) {
|
|
@@ -53,4 +61,4 @@ function messengerLogIndex(raw, opts) {
|
|
|
53
61
|
return (hits[index] ?? hits[0]).i;
|
|
54
62
|
}
|
|
55
63
|
|
|
56
|
-
export { findL1MessageSentLog, isL1MessageSentLog, messengerLogIndex, pickWithdrawRoute };
|
|
64
|
+
export { findL1MessageSentLog, isL1MessageSentLog, l1MessageSentSender, messengerLogIndex, pickWithdrawRoute };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { isL1MessageSentLog } from './chunk-
|
|
2
|
-
import { IBridgehub_default, isHash66, isBigint, isHash, assertNever, createError, OP_INTEROP, isNumber, isAddress, isHash66Array } from './chunk-
|
|
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-
|
|
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]);
|
|
@@ -284,10 +284,12 @@ function createBundleAttributes(codec) {
|
|
|
284
284
|
const executionAddress = (executor) => codec.encode("executionAddress", [executor]);
|
|
285
285
|
const unbundlerAddress = (addr) => codec.encode("unbundlerAddress", [addr]);
|
|
286
286
|
const useFixedFee = (enabled) => codec.encode("useFixedFee", [enabled]);
|
|
287
|
+
const interopBundleSalt = (salt) => codec.encode("interopBundleSalt", [salt]);
|
|
287
288
|
return {
|
|
288
289
|
executionAddress,
|
|
289
290
|
unbundlerAddress,
|
|
290
|
-
useFixedFee
|
|
291
|
+
useFixedFee,
|
|
292
|
+
interopBundleSalt
|
|
291
293
|
};
|
|
292
294
|
}
|
|
293
295
|
|