@matterlabs/zksync-js 0.0.1 → 0.0.2
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/README.md +12 -12
- package/dist/adapters/ethers/client.cjs +642 -1
- package/dist/adapters/ethers/client.cjs.map +1 -1
- package/dist/adapters/ethers/client.js +6 -5
- package/dist/adapters/ethers/estimator.d.ts +4 -0
- package/dist/adapters/ethers/index.cjs +934 -801
- package/dist/adapters/ethers/index.cjs.map +1 -1
- package/dist/adapters/ethers/index.js +9 -8
- package/dist/adapters/ethers/resources/deposits/context.d.ts +5 -5
- package/dist/adapters/ethers/resources/deposits/routes/types.d.ts +2 -6
- package/dist/adapters/ethers/resources/deposits/services/fee.d.ts +6 -0
- package/dist/adapters/ethers/resources/deposits/services/gas.d.ts +40 -0
- package/dist/adapters/ethers/resources/utils.d.ts +4 -15
- package/dist/adapters/ethers/resources/withdrawals/context.d.ts +4 -4
- package/dist/adapters/ethers/resources/withdrawals/routes/types.d.ts +2 -2
- package/dist/adapters/ethers/resources/withdrawals/services/fees.d.ts +14 -0
- package/dist/adapters/ethers/resources/withdrawals/services/gas.d.ts +12 -0
- package/dist/adapters/ethers/sdk.cjs +947 -1292
- package/dist/adapters/ethers/sdk.cjs.map +1 -1
- package/dist/adapters/ethers/sdk.js +7 -6
- package/dist/adapters/viem/client.cjs.map +1 -1
- package/dist/adapters/viem/client.d.ts +1 -1
- package/dist/adapters/viem/client.js +4 -5
- package/dist/adapters/viem/estimator.d.ts +4 -0
- package/dist/adapters/viem/index.cjs +944 -662
- package/dist/adapters/viem/index.cjs.map +1 -1
- package/dist/adapters/viem/index.js +8 -8
- package/dist/adapters/viem/resources/deposits/context.d.ts +5 -5
- package/dist/adapters/viem/resources/deposits/routes/types.d.ts +2 -6
- package/dist/adapters/viem/resources/deposits/services/fee.d.ts +6 -0
- package/dist/adapters/viem/resources/deposits/services/gas.d.ts +36 -0
- package/dist/adapters/viem/resources/utils.d.ts +3 -16
- package/dist/adapters/viem/resources/withdrawals/context.d.ts +3 -6
- package/dist/adapters/viem/resources/withdrawals/routes/types.d.ts +12 -2
- package/dist/adapters/viem/resources/withdrawals/services/fee.d.ts +17 -0
- package/dist/adapters/viem/resources/withdrawals/services/gas.d.ts +12 -0
- package/dist/adapters/viem/sdk.cjs +877 -563
- package/dist/adapters/viem/sdk.cjs.map +1 -1
- package/dist/adapters/viem/sdk.d.ts +1 -1
- package/dist/adapters/viem/sdk.js +6 -6
- package/dist/{chunk-3LALBFFE.js → chunk-3MRGU4HV.js} +9 -5
- package/dist/{chunk-4HLJJKIY.js → chunk-6K6VJQAL.js} +2 -2
- package/dist/{chunk-CGO27P7F.js → chunk-BCCKWWOX.js} +540 -741
- package/dist/{chunk-6GCT6TLS.js → chunk-F2ENUV3A.js} +13 -1
- package/dist/{chunk-DI2CJDPZ.js → chunk-HLUANWGN.js} +2 -2
- package/dist/{chunk-Y75OMFK6.js → chunk-M5J2MM2U.js} +351 -1
- package/dist/{chunk-263G6636.js → chunk-NCAIVYBR.js} +1 -14
- package/dist/{chunk-7M4V3FMT.js → chunk-OC6ZVLSP.js} +669 -559
- package/dist/chunk-QJS6ETEE.js +217 -0
- package/dist/chunk-XRE7H466.js +157 -0
- package/dist/{chunk-BD2LUO5T.js → chunk-YUK547UF.js} +3 -3
- package/dist/core/abi.d.ts +9 -0
- package/dist/core/adapters/interfaces.d.ts +25 -0
- package/dist/core/constants.cjs +12 -0
- package/dist/core/constants.cjs.map +1 -1
- package/dist/core/constants.d.ts +6 -0
- package/dist/core/constants.js +1 -1
- package/dist/core/index.cjs +4504 -1
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +4 -4
- package/dist/core/resources/deposits/fee.d.ts +15 -0
- package/dist/core/resources/deposits/gas.d.ts +38 -0
- package/dist/core/resources/withdrawals/gas.d.ts +14 -0
- package/dist/core/types/errors.d.ts +1 -1
- package/dist/core/types/fees.d.ts +40 -0
- package/dist/core/types/flows/base.d.ts +0 -10
- package/dist/core/types/flows/deposits.d.ts +20 -6
- package/dist/core/types/flows/route.d.ts +2 -3
- package/dist/core/types/flows/withdrawals.d.ts +12 -6
- package/dist/index.cjs +4516 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4 -4
- package/package.json +5 -1
- package/dist/adapters/ethers/resources/withdrawals/routes/eth-nonbase.d.ts +0 -2
- package/dist/adapters/viem/resources/withdrawals/routes/eth-nonbase.d.ts +0 -2
- package/dist/chunk-B77GWPO5.js +0 -339
- package/dist/core/internal/abi-registry.d.ts +0 -9
- package/dist/core/utils/gas.d.ts +0 -13
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
export { createEthersClient as createClient, createEthersClient } from '../../chunk-
|
|
2
|
-
export { buildDirectRequestStruct,
|
|
3
|
-
|
|
4
|
-
import '../../chunk-
|
|
5
|
-
import '../../chunk-
|
|
6
|
-
import '../../chunk-
|
|
7
|
-
import '../../chunk-
|
|
8
|
-
import '../../chunk-
|
|
1
|
+
export { createEthersClient as createClient, createEthersClient } from '../../chunk-3MRGU4HV.js';
|
|
2
|
+
export { buildDirectRequestStruct, createDepositsResource, createEthersSdk, createFinalizationServices, createWithdrawalsResource, encodeNTVAssetId, encodeNTVTransferData, encodeNativeTokenVaultAssetId, encodeNativeTokenVaultTransferData, encodeSecondBridgeArgs, encodeSecondBridgeDataV1, encodeSecondBridgeErc20Args, encodeSecondBridgeEthArgs } from '../../chunk-BCCKWWOX.js';
|
|
3
|
+
export { classifyReadinessFromRevert, createErrorHandlers, decodeRevert, registerErrorAbi, toZKsyncError } from '../../chunk-XRE7H466.js';
|
|
4
|
+
import '../../chunk-QJS6ETEE.js';
|
|
5
|
+
import '../../chunk-HLUANWGN.js';
|
|
6
|
+
import '../../chunk-NCAIVYBR.js';
|
|
7
|
+
import '../../chunk-6K6VJQAL.js';
|
|
8
|
+
import '../../chunk-M5J2MM2U.js';
|
|
9
|
+
import '../../chunk-F2ENUV3A.js';
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { EthersClient } from '../../client';
|
|
2
2
|
import type { Address } from '../../../../core/types/primitives';
|
|
3
|
-
import { type ResolvedFeeOverrides } from '../utils';
|
|
4
3
|
import type { DepositParams, DepositRoute } from '../../../../core/types/flows/deposits';
|
|
5
4
|
import type { CommonCtx } from '../../../../core/types/flows/base';
|
|
5
|
+
import type { TxOverrides } from '../../../../core/types/fees';
|
|
6
6
|
export interface BuildCtx extends CommonCtx {
|
|
7
7
|
client: EthersClient;
|
|
8
8
|
l1AssetRouter: Address;
|
|
9
|
-
|
|
10
|
-
l2GasLimit
|
|
9
|
+
gasOverrides?: TxOverrides;
|
|
10
|
+
l2GasLimit?: bigint;
|
|
11
11
|
gasPerPubdata: bigint;
|
|
12
12
|
operatorTip: bigint;
|
|
13
13
|
refundRecipient: Address;
|
|
@@ -19,8 +19,8 @@ export declare function commonCtx(p: DepositParams, client: EthersClient): Promi
|
|
|
19
19
|
bridgehub: `0x${string}`;
|
|
20
20
|
chainIdL2: bigint;
|
|
21
21
|
sender: `0x${string}`;
|
|
22
|
-
|
|
23
|
-
l2GasLimit: bigint;
|
|
22
|
+
gasOverrides: TxOverrides | undefined;
|
|
23
|
+
l2GasLimit: bigint | undefined;
|
|
24
24
|
gasPerPubdata: bigint;
|
|
25
25
|
operatorTip: bigint;
|
|
26
26
|
refundRecipient: `0x${string}`;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import type { TransactionRequest } from 'ethers';
|
|
2
2
|
import type { DepositParams } from '../../../../../core/types/flows/deposits';
|
|
3
|
+
import type { DepositFeeBreakdown } from '../../../../../core/types/fees';
|
|
3
4
|
import type { RouteStrategy } from '../../../../../core/types/flows/route';
|
|
4
5
|
import type { BuildCtx as DepositBuildCtx } from '../context';
|
|
5
|
-
export type
|
|
6
|
-
baseCost: bigint;
|
|
7
|
-
mintValue: bigint;
|
|
8
|
-
l1GasLimit?: bigint;
|
|
9
|
-
};
|
|
10
|
-
export type DepositRouteStrategy = RouteStrategy<DepositParams, TransactionRequest, DepositQuoteExtras, DepositBuildCtx>;
|
|
6
|
+
export type DepositRouteStrategy = RouteStrategy<DepositParams, TransactionRequest, DepositFeeBreakdown, DepositBuildCtx>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { TransactionRequest } from 'ethers';
|
|
2
|
+
import type { BuildCtx } from '../context';
|
|
3
|
+
import type { DepositRoute } from '../../../../../core/types/flows/deposits';
|
|
4
|
+
import type { TxOverrides } from '../../../../../core/types/fees';
|
|
5
|
+
import { type GasQuote } from '../../../../../core/resources/deposits/gas';
|
|
6
|
+
export type { GasQuote };
|
|
7
|
+
export type QuoteL1GasInput = {
|
|
8
|
+
ctx: BuildCtx;
|
|
9
|
+
tx: TransactionRequest;
|
|
10
|
+
overrides?: TxOverrides;
|
|
11
|
+
fallbackGasLimit?: bigint;
|
|
12
|
+
};
|
|
13
|
+
export type QuoteL2GasInput = {
|
|
14
|
+
ctx: BuildCtx;
|
|
15
|
+
route: DepositRoute;
|
|
16
|
+
l2TxForModeling?: TransactionRequest;
|
|
17
|
+
overrideGasLimit?: bigint;
|
|
18
|
+
stateOverrides?: Record<string, unknown>;
|
|
19
|
+
};
|
|
20
|
+
export type ResolveErc20L2GasLimitInput = {
|
|
21
|
+
ctx: BuildCtx;
|
|
22
|
+
l1Token: string;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Quote L1 gas for a deposit transaction.
|
|
26
|
+
*/
|
|
27
|
+
export declare function quoteL1Gas(input: QuoteL1GasInput): Promise<GasQuote | undefined>;
|
|
28
|
+
/**
|
|
29
|
+
* Quote L2 gas for an L2 transaction.
|
|
30
|
+
*/
|
|
31
|
+
export declare function quoteL2Gas(input: QuoteL2GasInput): Promise<GasQuote | undefined>;
|
|
32
|
+
/**
|
|
33
|
+
* Resolve a safe L2 gas limit for ERC20 deposits based on whether the
|
|
34
|
+
* L2 token contract is already deployed.
|
|
35
|
+
*/
|
|
36
|
+
export declare function determineErc20L2Gas(input: {
|
|
37
|
+
ctx: BuildCtx;
|
|
38
|
+
l1Token: string;
|
|
39
|
+
modelTx?: TransactionRequest;
|
|
40
|
+
}): Promise<GasQuote | undefined>;
|
|
@@ -1,20 +1,12 @@
|
|
|
1
|
-
import { ethers } from 'ethers';
|
|
2
1
|
import type { Address } from '../../../core/types';
|
|
3
|
-
import type { EthersClient } from '../client';
|
|
4
|
-
import type { Eip1559GasOverrides, ResolvedEip1559Fees } from '../../../core/types/flows/base';
|
|
5
2
|
export declare function encodeNativeTokenVaultAssetId(chainId: bigint, address: string): string;
|
|
6
3
|
export declare function encodeNativeTokenVaultTransferData(amount: bigint, receiver: Address, token: Address): string;
|
|
7
4
|
export declare function encodeSecondBridgeDataV1(assetId: string, transferData: string): string;
|
|
8
5
|
export declare function encodeNTVAssetId(chainId: bigint, address: string): string;
|
|
9
|
-
export declare
|
|
10
|
-
export declare function
|
|
11
|
-
export declare function
|
|
12
|
-
export
|
|
13
|
-
gasPriceForBaseCost: bigint;
|
|
14
|
-
};
|
|
15
|
-
export declare function getFeeOverrides(client: EthersClient, overrides?: Eip1559GasOverrides): Promise<ResolvedFeeOverrides>;
|
|
16
|
-
export declare function getL2FeeOverrides(client: EthersClient, overrides?: Eip1559GasOverrides): Promise<ResolvedEip1559Fees>;
|
|
17
|
-
export declare function getGasPriceWei(client: EthersClient): Promise<bigint>;
|
|
6
|
+
export declare const encodeNTVTransferData: typeof encodeNativeTokenVaultTransferData;
|
|
7
|
+
export declare function encodeSecondBridgeArgs(token: Address, amount: bigint, l2Receiver: Address): `0x${string}`;
|
|
8
|
+
export declare function encodeSecondBridgeErc20Args(token: Address, amount: bigint, l2Receiver: Address): `0x${string}`;
|
|
9
|
+
export declare function encodeSecondBridgeEthArgs(amount: bigint, l2Receiver: Address, ethToken?: Address): `0x${string}`;
|
|
18
10
|
export declare function buildDirectRequestStruct(args: {
|
|
19
11
|
chainId: bigint;
|
|
20
12
|
mintValue: bigint;
|
|
@@ -34,6 +26,3 @@ export declare function buildDirectRequestStruct(args: {
|
|
|
34
26
|
factoryDeps: `0x${string}`[];
|
|
35
27
|
refundRecipient: `0x${string}`;
|
|
36
28
|
};
|
|
37
|
-
export declare function encodeSecondBridgeArgs(token: Address, amount: bigint, l2Receiver: Address): `0x${string}`;
|
|
38
|
-
export declare function encodeSecondBridgeErc20Args(token: Address, amount: bigint, l2Receiver: Address): `0x${string}`;
|
|
39
|
-
export declare function encodeSecondBridgeEthArgs(amount: bigint, l2Receiver: Address, ethToken?: Address): `0x${string}`;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import type { EthersClient } from '../../client';
|
|
2
2
|
import type { Address } from '../../../../core/types/primitives';
|
|
3
3
|
import type { WithdrawParams, WithdrawRoute } from '../../../../core/types/flows/withdrawals';
|
|
4
|
-
import type { CommonCtx
|
|
4
|
+
import type { CommonCtx } from '../../../../core/types/flows/base';
|
|
5
|
+
import type { TxOverrides } from '../../../../core/types/fees';
|
|
5
6
|
export interface BuildCtx extends CommonCtx {
|
|
6
7
|
client: EthersClient;
|
|
8
|
+
bridgehub: Address;
|
|
7
9
|
l1AssetRouter: Address;
|
|
8
10
|
l1Nullifier: Address;
|
|
9
11
|
l2AssetRouter: Address;
|
|
10
12
|
l2NativeTokenVault: Address;
|
|
11
13
|
l2BaseTokenSystem: Address;
|
|
12
14
|
baseIsEth: boolean;
|
|
13
|
-
|
|
14
|
-
gasBufferPct: number;
|
|
15
|
-
fee: ResolvedEip1559Fees;
|
|
15
|
+
gasOverrides?: TxOverrides;
|
|
16
16
|
}
|
|
17
17
|
export declare function commonCtx(p: WithdrawParams, client: EthersClient): Promise<BuildCtx & {
|
|
18
18
|
route: WithdrawRoute;
|
|
@@ -3,8 +3,8 @@ import type { WithdrawParams } from '../../../../../core/types/flows/withdrawals
|
|
|
3
3
|
import type { RouteStrategy } from '../../../../../core/types/flows/route';
|
|
4
4
|
import type { BuildCtx as WithdrawBuildCtx } from '../context';
|
|
5
5
|
import type { Address, Hex } from '../../../../../core/types';
|
|
6
|
-
|
|
7
|
-
export type WithdrawRouteStrategy = RouteStrategy<WithdrawParams, TransactionRequest,
|
|
6
|
+
import type { WithdrawalFeeBreakdown } from '../../../../../core/types/fees';
|
|
7
|
+
export type WithdrawRouteStrategy = RouteStrategy<WithdrawParams, TransactionRequest, WithdrawalFeeBreakdown, WithdrawBuildCtx>;
|
|
8
8
|
export interface L2ToL1Log {
|
|
9
9
|
l2ShardId?: number;
|
|
10
10
|
isService?: boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Address } from '../../../../../core/types/primitives';
|
|
2
|
+
import type { WithdrawalFeeBreakdown } from '../../../../../core/types/fees';
|
|
3
|
+
import type { GasQuote } from './gas';
|
|
4
|
+
export type BuildWithdrawFeeBreakdownInput = {
|
|
5
|
+
feeToken: Address;
|
|
6
|
+
l2Gas?: GasQuote;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Builds FeeBreakdown for withdrawals.
|
|
10
|
+
*
|
|
11
|
+
* Withdrawals represent a single L2 transaction:
|
|
12
|
+
* - fees.l2 = cost of the withdraw tx on L2
|
|
13
|
+
*/
|
|
14
|
+
export declare function buildFeeBreakdown(p: BuildWithdrawFeeBreakdownInput): WithdrawalFeeBreakdown;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { TransactionRequest } from 'ethers';
|
|
2
|
+
import type { BuildCtx } from '../context';
|
|
3
|
+
import { type GasQuote } from '../../../../../core/resources/withdrawals/gas';
|
|
4
|
+
export type { GasQuote };
|
|
5
|
+
export type QuoteWithdrawL2GasInput = {
|
|
6
|
+
ctx: BuildCtx;
|
|
7
|
+
tx: TransactionRequest;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Quotes L2 gas for a withdrawal tx.
|
|
11
|
+
*/
|
|
12
|
+
export declare function quoteL2Gas(input: QuoteWithdrawL2GasInput): Promise<GasQuote | undefined>;
|