@matterlabs/zksync-js 0.0.24 → 0.0.26
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/index.cjs +250 -94
- package/dist/adapters/ethers/index.cjs.map +1 -1
- package/dist/adapters/ethers/index.js +2 -2
- package/dist/adapters/ethers/resources/deposits/services/fee.d.ts +1 -0
- package/dist/adapters/ethers/resources/deposits/services/gas.d.ts +23 -3
- package/dist/adapters/ethers/sdk.cjs +250 -94
- package/dist/adapters/ethers/sdk.cjs.map +1 -1
- package/dist/adapters/ethers/sdk.js +2 -2
- package/dist/adapters/viem/index.cjs +280 -133
- package/dist/adapters/viem/index.cjs.map +1 -1
- package/dist/adapters/viem/index.js +2 -2
- package/dist/adapters/viem/resources/deposits/services/fee.d.ts +1 -0
- package/dist/adapters/viem/resources/deposits/services/gas.d.ts +22 -2
- package/dist/adapters/viem/sdk.cjs +280 -133
- package/dist/adapters/viem/sdk.cjs.map +1 -1
- package/dist/adapters/viem/sdk.js +2 -2
- package/dist/{chunk-5S63J6DW.js → chunk-FMBQ7PVA.js} +58 -10
- package/dist/{chunk-QMMFUWRV.js → chunk-VVDJFIXV.js} +224 -130
- package/dist/{chunk-B6P24GL5.js → chunk-YWUBX7YE.js} +194 -88
- package/dist/core/resources/deposits/gas.d.ts +11 -1
- package/dist/core/resources/deposits/priority.d.ts +46 -0
- package/package.json +1 -1
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import type { Address } from '../../types/primitives';
|
|
2
2
|
import type { GasEstimator, CoreTransactionRequest } from '../../adapters/interfaces';
|
|
3
|
-
import type { TxOverrides } from '../../types/fees';
|
|
3
|
+
import type { TxGasOverrides, TxOverrides } from '../../types/fees';
|
|
4
4
|
import type { DepositRoute } from '../../types/flows/deposits';
|
|
5
5
|
export type AbiEncoder = (abi: unknown, functionName: string, args: unknown[]) => string;
|
|
6
|
+
export type L1Fees = {
|
|
7
|
+
maxFeePerGas: bigint;
|
|
8
|
+
maxPriorityFeePerGas: bigint;
|
|
9
|
+
};
|
|
6
10
|
export type GasQuote = {
|
|
7
11
|
gasLimit: bigint;
|
|
8
12
|
maxFeePerGas: bigint;
|
|
@@ -17,6 +21,11 @@ export declare function resolveCreateDepositL1GasLimit(input: {
|
|
|
17
21
|
preparedGasLimit?: bigint;
|
|
18
22
|
estimatedGasLimit?: bigint;
|
|
19
23
|
}): bigint | undefined;
|
|
24
|
+
export type QuoteL1FeesInput = {
|
|
25
|
+
estimator: GasEstimator;
|
|
26
|
+
overrides?: TxGasOverrides;
|
|
27
|
+
};
|
|
28
|
+
export declare function quoteL1Fees(input: QuoteL1FeesInput): Promise<L1Fees>;
|
|
20
29
|
export type QuoteL1GasInput = {
|
|
21
30
|
estimator: GasEstimator;
|
|
22
31
|
tx: CoreTransactionRequest;
|
|
@@ -41,5 +50,6 @@ export type QuoteL2BaseCostInput = {
|
|
|
41
50
|
chainIdL2: bigint;
|
|
42
51
|
l2GasLimit: bigint;
|
|
43
52
|
gasPerPubdata: bigint;
|
|
53
|
+
l1GasPrice: bigint;
|
|
44
54
|
};
|
|
45
55
|
export declare function quoteL2BaseCost(input: QuoteL2BaseCostInput): Promise<bigint>;
|
|
@@ -13,6 +13,39 @@ export type PriorityTxL2Leg = {
|
|
|
13
13
|
from: Address;
|
|
14
14
|
to: Address;
|
|
15
15
|
data: `0x${string}`;
|
|
16
|
+
value?: bigint;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Getters on a chain's L1 contract (era-contracts `Getters` facet) that decide how a base-token
|
|
20
|
+
* deposit's L2 gas limit is sized. Kept local: the public ABI registry feeds generated typechain.
|
|
21
|
+
*/
|
|
22
|
+
export declare const ZK_CHAIN_PRICING_GETTERS_ABI: readonly [{
|
|
23
|
+
readonly type: "function";
|
|
24
|
+
readonly name: "getZKsyncOS";
|
|
25
|
+
readonly stateMutability: "view";
|
|
26
|
+
readonly inputs: readonly [];
|
|
27
|
+
readonly outputs: readonly [{
|
|
28
|
+
readonly name: "";
|
|
29
|
+
readonly type: "bool";
|
|
30
|
+
}];
|
|
31
|
+
}, {
|
|
32
|
+
readonly type: "function";
|
|
33
|
+
readonly name: "getPubdataPricingMode";
|
|
34
|
+
readonly stateMutability: "view";
|
|
35
|
+
readonly inputs: readonly [];
|
|
36
|
+
readonly outputs: readonly [{
|
|
37
|
+
readonly name: "";
|
|
38
|
+
readonly type: "uint8";
|
|
39
|
+
}];
|
|
40
|
+
}];
|
|
41
|
+
/** `PubdataPricingMode.Rollup` in era-contracts `Config.sol`; `Validium` is 1. */
|
|
42
|
+
export declare const PUBDATA_PRICING_MODE_ROLLUP = 0;
|
|
43
|
+
/** How a chain prices a deposit, read once from its L1 contract. */
|
|
44
|
+
export type ChainPricing = {
|
|
45
|
+
/** Runs ZKsync OS. EraVM chains cannot simulate priority txs and are sized by the floor. */
|
|
46
|
+
zksyncOS: boolean;
|
|
47
|
+
/** Charges pubdata per byte (rollup), so a deposit creating accounts costs more. */
|
|
48
|
+
chargesPubdata: boolean;
|
|
16
49
|
};
|
|
17
50
|
export declare const DEFAULT_PRIORITY_BODY_GAS_ESTIMATE_MULTIPLIER = 7n;
|
|
18
51
|
export declare function applyL1ToL2Alias(address: Address): Address;
|
|
@@ -58,6 +91,19 @@ export declare function clampPriorityL2GasLimit(input: {
|
|
|
58
91
|
l2Calldata: `0x${string}`;
|
|
59
92
|
gasPerPubdata: bigint;
|
|
60
93
|
}): bigint;
|
|
94
|
+
/**
|
|
95
|
+
* `l2GasLimit` for a base-token deposit (`requestL2TransactionDirect`) on a ZKsync OS chain.
|
|
96
|
+
* The validator floor only covers L1-side validation. The L2 call and its pubdata, such as first
|
|
97
|
+
* writes for a fresh aliased sender, come from the node's priority-tx estimate. Without one, a
|
|
98
|
+
* chain that charges pubdata (rollup) gets the worst measured case of a deposit creating accounts;
|
|
99
|
+
* a validium charges a flat amount the floor already covers.
|
|
100
|
+
*/
|
|
101
|
+
export declare function resolveBaseTokenPriorityL2GasLimit(input: {
|
|
102
|
+
priorityFloorGasLimit: bigint;
|
|
103
|
+
gasPerPubdata: bigint;
|
|
104
|
+
chargesPubdata: boolean;
|
|
105
|
+
nodeEstimate?: bigint;
|
|
106
|
+
}): bigint;
|
|
61
107
|
/**
|
|
62
108
|
* `l2GasLimit` for finalizing a deposit of a token that already exists on L2.
|
|
63
109
|
* The validator floor only covers L1-side validation, so the real execution comes from the node's
|