@matterlabs/zksync-js 0.0.22 → 0.0.24
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 +0 -7
- package/dist/adapters/ethers/client.cjs.map +1 -1
- package/dist/adapters/ethers/client.js +5 -5
- package/dist/adapters/ethers/index.cjs +202 -93
- package/dist/adapters/ethers/index.cjs.map +1 -1
- package/dist/adapters/ethers/index.js +9 -9
- package/dist/adapters/ethers/resources/deposits/context.d.ts +2 -0
- package/dist/adapters/ethers/resources/deposits/services/gas.d.ts +3 -0
- package/dist/adapters/ethers/sdk.cjs +202 -105
- package/dist/adapters/ethers/sdk.cjs.map +1 -1
- package/dist/adapters/ethers/sdk.js +8 -8
- package/dist/adapters/viem/client.cjs +0 -7
- package/dist/adapters/viem/client.cjs.map +1 -1
- package/dist/adapters/viem/client.js +5 -5
- package/dist/adapters/viem/index.cjs +194 -92
- package/dist/adapters/viem/index.cjs.map +1 -1
- package/dist/adapters/viem/index.js +9 -9
- package/dist/adapters/viem/resources/deposits/context.d.ts +2 -0
- package/dist/adapters/viem/resources/deposits/services/gas.d.ts +3 -0
- package/dist/adapters/viem/sdk.cjs +194 -108
- package/dist/adapters/viem/sdk.cjs.map +1 -1
- package/dist/adapters/viem/sdk.js +8 -8
- package/dist/{chunk-NQRYXL3K.js → chunk-3IPSDGHO.js} +17 -1
- package/dist/{chunk-KL6ZCPWJ.js → chunk-4ZANKNIK.js} +1 -1
- package/dist/{chunk-3SPDWWRD.js → chunk-5S63J6DW.js} +60 -32
- package/dist/{chunk-CP4SQ5PM.js → chunk-B6P24GL5.js} +137 -57
- package/dist/{chunk-QUAPG3ZR.js → chunk-BQ2YCWV2.js} +2 -2
- package/dist/{chunk-2D3FBCZC.js → chunk-H5A6GU3D.js} +2 -2
- package/dist/{chunk-AMRHBZIY.js → chunk-JNS4XZE2.js} +2 -9
- package/dist/{chunk-32N6TI6K.js → chunk-OEUDZFXH.js} +1 -1
- package/dist/{chunk-PI4PF6WT.js → chunk-PNTR5FTL.js} +3 -3
- package/dist/{chunk-4K4LOCQJ.js → chunk-QMMFUWRV.js} +129 -56
- package/dist/{chunk-CPNHKNI4.js → chunk-RZH7HBH3.js} +2 -2
- package/dist/{chunk-JXBLQQEN.js → chunk-YEA74D2L.js} +3 -3
- package/dist/{chunk-CUBUD4J4.js → chunk-YGXEIOK6.js} +1 -1
- package/dist/core/adapters/interfaces.d.ts +2 -0
- package/dist/core/constants.cjs +16 -0
- package/dist/core/constants.cjs.map +1 -1
- package/dist/core/constants.d.ts +8 -0
- package/dist/core/constants.js +1 -1
- package/dist/core/index.cjs +0 -7
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.js +5 -5
- package/dist/core/internal/abis/IL2AssetRouter.d.ts +0 -14
- package/dist/core/resources/deposits/priority.d.ts +30 -0
- package/dist/core/types/errors.d.ts +1 -1
- package/dist/index.cjs +16 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -4
- package/package.json +1 -1
package/dist/core/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { pickDepositRoute } from '../chunk-
|
|
2
|
-
export { BundleStatus, CallStatus, MIN_INTEROP_WITHDRAWAL_MINOR, buildWithdrawalBundle, buildWithdrawalFinalization, classifyWithdrawalOutcome, detectWithdrawalProtocol, isBundleFinalized, keccakHex, parseBundleHashFromLogs, phaseFromReadiness, protocolFromVersion, stripBundleIdentifier, withdrawalBundleSalt } from '../chunk-
|
|
3
|
-
export { findL1MessageSentLog, isL1MessageSentLog, l1MessageSentSender, messengerLogIndex, pickWithdrawRoute } from '../chunk-
|
|
1
|
+
export { pickDepositRoute } from '../chunk-YGXEIOK6.js';
|
|
2
|
+
export { BundleStatus, CallStatus, MIN_INTEROP_WITHDRAWAL_MINOR, buildWithdrawalBundle, buildWithdrawalFinalization, classifyWithdrawalOutcome, detectWithdrawalProtocol, isBundleFinalized, keccakHex, parseBundleHashFromLogs, phaseFromReadiness, protocolFromVersion, stripBundleIdentifier, withdrawalBundleSalt } from '../chunk-BQ2YCWV2.js';
|
|
3
|
+
export { findL1MessageSentLog, isL1MessageSentLog, l1MessageSentSender, messengerLogIndex, pickWithdrawRoute } from '../chunk-OEUDZFXH.js';
|
|
4
4
|
export { SEMVER_MAJOR_OFFSET, SEMVER_MINOR_OFFSET, formatProtocolVersion, packSemver, unpackSemver } from '../chunk-UMPAKZCQ.js';
|
|
5
5
|
export { makeTransportFromEthers, makeTransportFromViem } from '../chunk-BWKWWLY4.js';
|
|
6
|
-
export { abi_exports as abi, factory_exports as errors, formatEnvelopePretty, hexEq, isAddress, isAddressEq, isETH, isHash, isHash66, isHash66Array, isHashArray, normalizeAddrEq, normalizeL1Token, zks_exports as zksRpc } from '../chunk-
|
|
7
|
-
export { ETH_ADDRESS, FORMAL_ETH_ADDRESS, L1_MESSENGER_ADDRESS, L1_SOPH_TOKEN_ADDRESS, L2_ASSET_ROUTER_ADDRESS, L2_BASE_TOKEN_ADDRESS, L2_INTEROP_ATTRIBUTE_PARSER_ADDRESS, L2_NATIVE_TOKEN_VAULT_ADDRESS } from '../chunk-
|
|
6
|
+
export { abi_exports as abi, factory_exports as errors, formatEnvelopePretty, hexEq, isAddress, isAddressEq, isETH, isHash, isHash66, isHash66Array, isHashArray, normalizeAddrEq, normalizeL1Token, zks_exports as zksRpc } from '../chunk-JNS4XZE2.js';
|
|
7
|
+
export { ETH_ADDRESS, FORMAL_ETH_ADDRESS, L1_MESSENGER_ADDRESS, L1_SOPH_TOKEN_ADDRESS, L2_ASSET_ROUTER_ADDRESS, L2_BASE_TOKEN_ADDRESS, L2_INTEROP_ATTRIBUTE_PARSER_ADDRESS, L2_NATIVE_TOKEN_VAULT_ADDRESS } from '../chunk-3IPSDGHO.js';
|
|
@@ -202,20 +202,6 @@ declare const IL2AssetRouterABI: readonly [{
|
|
|
202
202
|
readonly internalType: "address";
|
|
203
203
|
}];
|
|
204
204
|
readonly stateMutability: "view";
|
|
205
|
-
}, {
|
|
206
|
-
readonly type: "function";
|
|
207
|
-
readonly name: "l1TokenAddress";
|
|
208
|
-
readonly inputs: readonly [{
|
|
209
|
-
readonly name: "_l2Token";
|
|
210
|
-
readonly type: "address";
|
|
211
|
-
readonly internalType: "address";
|
|
212
|
-
}];
|
|
213
|
-
readonly outputs: readonly [{
|
|
214
|
-
readonly name: "";
|
|
215
|
-
readonly type: "address";
|
|
216
|
-
readonly internalType: "address";
|
|
217
|
-
}];
|
|
218
|
-
readonly stateMutability: "view";
|
|
219
205
|
}, {
|
|
220
206
|
readonly type: "function";
|
|
221
207
|
readonly name: "l2TokenAddress";
|
|
@@ -8,6 +8,12 @@ export type PriorityTxGasBreakdown = {
|
|
|
8
8
|
priorityTxMaxGasLimit: bigint;
|
|
9
9
|
priorityTxMaxGasLimitExceeded: boolean;
|
|
10
10
|
};
|
|
11
|
+
/** The L2 call a priority tx performs, as seen from L2 (aliased L1 sender). */
|
|
12
|
+
export type PriorityTxL2Leg = {
|
|
13
|
+
from: Address;
|
|
14
|
+
to: Address;
|
|
15
|
+
data: `0x${string}`;
|
|
16
|
+
};
|
|
11
17
|
export declare const DEFAULT_PRIORITY_BODY_GAS_ESTIMATE_MULTIPLIER = 7n;
|
|
12
18
|
export declare function applyL1ToL2Alias(address: Address): Address;
|
|
13
19
|
/**
|
|
@@ -39,3 +45,27 @@ export declare function applyPriorityL2GasLimitBuffer(input: {
|
|
|
39
45
|
chainIdL2: bigint;
|
|
40
46
|
gasLimit: bigint;
|
|
41
47
|
}): bigint;
|
|
48
|
+
/**
|
|
49
|
+
* Minimum `l2GasLimit` the L1 Mailbox accepts for a priority tx on ZKsync OS (protocol v33+).
|
|
50
|
+
* Below it `requestL2TransactionDirect` reverts with `ValidateTxnNotEnoughGas()`.
|
|
51
|
+
*/
|
|
52
|
+
export declare function minimalPriorityTxL2Gas(input: {
|
|
53
|
+
calldataLength: bigint;
|
|
54
|
+
gasPerPubdata: bigint;
|
|
55
|
+
}): bigint;
|
|
56
|
+
export declare function clampPriorityL2GasLimit(input: {
|
|
57
|
+
gasLimit: bigint;
|
|
58
|
+
l2Calldata: `0x${string}`;
|
|
59
|
+
gasPerPubdata: bigint;
|
|
60
|
+
}): bigint;
|
|
61
|
+
/**
|
|
62
|
+
* `l2GasLimit` for finalizing a deposit of a token that already exists on L2.
|
|
63
|
+
* The validator floor only covers L1-side validation, so the real execution comes from the node's
|
|
64
|
+
* priority-tx estimate, or from the measured bridge-mint model when the node cannot provide one.
|
|
65
|
+
*/
|
|
66
|
+
export declare function resolveRegisteredTokenPriorityL2GasLimit(input: {
|
|
67
|
+
chainIdL2: bigint;
|
|
68
|
+
priorityFloorGasLimit: bigint;
|
|
69
|
+
gasPerPubdata: bigint;
|
|
70
|
+
nodeEstimate?: bigint;
|
|
71
|
+
}): bigint;
|
|
@@ -125,7 +125,7 @@ export declare const OP_DEPOSITS: {
|
|
|
125
125
|
readonly baseCost: "deposits.eth-nonbase:l2TransactionBaseCost";
|
|
126
126
|
readonly allowanceBase: "deposits.eth-nonbase:allowanceBaseToken";
|
|
127
127
|
readonly ethBalance: "deposits.eth-nonbase:getEthBalance";
|
|
128
|
-
readonly encodeCalldata: "deposits.eth-nonbase:
|
|
128
|
+
readonly encodeCalldata: "deposits.eth-nonbase:encodeSecondBridgeEthDepositCalldata";
|
|
129
129
|
readonly estGas: "deposits.eth-nonbase:estimateGas";
|
|
130
130
|
readonly assertEthAsset: "deposits.eth-nonbase:assertEthAsset";
|
|
131
131
|
readonly assertNonEthBase: "deposits.eth-nonbase:assertNonEthBase";
|
package/dist/index.cjs
CHANGED
|
@@ -22,12 +22,16 @@ __export(constants_exports, {
|
|
|
22
22
|
L1_FEE_ESTIMATION_COEF_NUMERATOR: () => L1_FEE_ESTIMATION_COEF_NUMERATOR,
|
|
23
23
|
L1_MESSENGER_ADDRESS: () => L1_MESSENGER_ADDRESS,
|
|
24
24
|
L1_SOPH_TOKEN_ADDRESS: () => L1_SOPH_TOKEN_ADDRESS,
|
|
25
|
+
L1_TX_CALLDATA_FLOOR_PRICE_L2_GAS_ZKSYNC_OS: () => L1_TX_CALLDATA_FLOOR_PRICE_L2_GAS_ZKSYNC_OS,
|
|
25
26
|
L1_TX_DELTA_544_ENCODING_BYTES: () => L1_TX_DELTA_544_ENCODING_BYTES,
|
|
26
27
|
L1_TX_DELTA_FACTORY_DEPS_L2_GAS: () => L1_TX_DELTA_FACTORY_DEPS_L2_GAS,
|
|
27
28
|
L1_TX_DELTA_FACTORY_DEPS_PUBDATA: () => L1_TX_DELTA_FACTORY_DEPS_PUBDATA,
|
|
28
29
|
L1_TX_INTRINSIC_L2_GAS: () => L1_TX_INTRINSIC_L2_GAS,
|
|
30
|
+
L1_TX_INTRINSIC_L2_GAS_ZKSYNC_OS: () => L1_TX_INTRINSIC_L2_GAS_ZKSYNC_OS,
|
|
29
31
|
L1_TX_INTRINSIC_PUBDATA: () => L1_TX_INTRINSIC_PUBDATA,
|
|
32
|
+
L1_TX_INTRINSIC_PUBDATA_ZKSYNC_OS: () => L1_TX_INTRINSIC_PUBDATA_ZKSYNC_OS,
|
|
30
33
|
L1_TX_MIN_L2_GAS_BASE: () => L1_TX_MIN_L2_GAS_BASE,
|
|
34
|
+
L1_TX_NATIVE_PER_GAS: () => L1_TX_NATIVE_PER_GAS,
|
|
31
35
|
L2_ASSET_ROUTER_ADDRESS: () => L2_ASSET_ROUTER_ADDRESS,
|
|
32
36
|
L2_BASE_TOKEN_ADDRESS: () => L2_BASE_TOKEN_ADDRESS,
|
|
33
37
|
L2_INTEROP_ATTRIBUTE_PARSER_ADDRESS: () => L2_INTEROP_ATTRIBUTE_PARSER_ADDRESS,
|
|
@@ -36,7 +40,10 @@ __export(constants_exports, {
|
|
|
36
40
|
L2_INTEROP_ROOT_STORAGE_ADDRESS: () => L2_INTEROP_ROOT_STORAGE_ADDRESS,
|
|
37
41
|
L2_MESSAGE_VERIFICATION_ADDRESS: () => L2_MESSAGE_VERIFICATION_ADDRESS,
|
|
38
42
|
L2_NATIVE_TOKEN_VAULT_ADDRESS: () => L2_NATIVE_TOKEN_VAULT_ADDRESS,
|
|
43
|
+
MAX_NATIVE_COMPUTATIONAL_ZKSYNC_OS: () => MAX_NATIVE_COMPUTATIONAL_ZKSYNC_OS,
|
|
39
44
|
PRIORITY_TX_MAX_GAS_LIMIT: () => PRIORITY_TX_MAX_GAS_LIMIT,
|
|
45
|
+
REGISTERED_TOKEN_BRIDGE_MINT_EXECUTION_GAS: () => REGISTERED_TOKEN_BRIDGE_MINT_EXECUTION_GAS,
|
|
46
|
+
REGISTERED_TOKEN_BRIDGE_MINT_PUBDATA_BYTES: () => REGISTERED_TOKEN_BRIDGE_MINT_PUBDATA_BYTES,
|
|
40
47
|
SAFE_L1_BRIDGE_GAS: () => SAFE_L1_BRIDGE_GAS,
|
|
41
48
|
TOPIC_CANONICAL_ASSIGNED: () => TOPIC_CANONICAL_ASSIGNED,
|
|
42
49
|
TOPIC_CANONICAL_SUCCESS: () => TOPIC_CANONICAL_SUCCESS,
|
|
@@ -46,6 +53,7 @@ __export(constants_exports, {
|
|
|
46
53
|
TX_MEMORY_OVERHEAD_GAS: () => TX_MEMORY_OVERHEAD_GAS,
|
|
47
54
|
TX_OVERHEAD_GAS: () => TX_OVERHEAD_GAS,
|
|
48
55
|
TX_SLOT_OVERHEAD_L2_GAS: () => TX_SLOT_OVERHEAD_L2_GAS,
|
|
56
|
+
ZKSYNC_OS_PRIORITY_TX_TYPE: () => ZKSYNC_OS_PRIORITY_TX_TYPE,
|
|
49
57
|
k256hex: () => k256hex
|
|
50
58
|
});
|
|
51
59
|
var k256hex = (s) => `0x${utils.bytesToHex(sha3.keccak_256(utils.utf8ToBytes(s)))}`.toLowerCase();
|
|
@@ -81,6 +89,14 @@ var L1_TX_DELTA_FACTORY_DEPS_L2_GAS = 2473n;
|
|
|
81
89
|
var L1_TX_DELTA_FACTORY_DEPS_PUBDATA = 64n;
|
|
82
90
|
var TX_SLOT_OVERHEAD_L2_GAS = 10000n;
|
|
83
91
|
var PRIORITY_TX_MAX_GAS_LIMIT = 72000000n;
|
|
92
|
+
var L1_TX_INTRINSIC_L2_GAS_ZKSYNC_OS = 21000n;
|
|
93
|
+
var L1_TX_CALLDATA_FLOOR_PRICE_L2_GAS_ZKSYNC_OS = 40n;
|
|
94
|
+
var L1_TX_INTRINSIC_PUBDATA_ZKSYNC_OS = 351n;
|
|
95
|
+
var MAX_NATIVE_COMPUTATIONAL_ZKSYNC_OS = 1n << 35n;
|
|
96
|
+
var L1_TX_NATIVE_PER_GAS = 100000000n;
|
|
97
|
+
var ZKSYNC_OS_PRIORITY_TX_TYPE = "0x7f";
|
|
98
|
+
var REGISTERED_TOKEN_BRIDGE_MINT_EXECUTION_GAS = 140000n;
|
|
99
|
+
var REGISTERED_TOKEN_BRIDGE_MINT_PUBDATA_BYTES = 300n;
|
|
84
100
|
var L1_FEE_ESTIMATION_COEF_NUMERATOR = 12;
|
|
85
101
|
var L1_FEE_ESTIMATION_COEF_DENOMINATOR = 10;
|
|
86
102
|
|
|
@@ -3137,13 +3153,6 @@ var IL2AssetRouterABI = [
|
|
|
3137
3153
|
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
3138
3154
|
stateMutability: "view"
|
|
3139
3155
|
},
|
|
3140
|
-
{
|
|
3141
|
-
type: "function",
|
|
3142
|
-
name: "l1TokenAddress",
|
|
3143
|
-
inputs: [{ name: "_l2Token", type: "address", internalType: "address" }],
|
|
3144
|
-
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
3145
|
-
stateMutability: "view"
|
|
3146
|
-
},
|
|
3147
3156
|
{
|
|
3148
3157
|
type: "function",
|
|
3149
3158
|
name: "l2TokenAddress",
|