@matterlabs/zksync-js 0.0.13 → 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.
- package/dist/adapters/ethers/client.cjs +13 -4
- package/dist/adapters/ethers/client.cjs.map +1 -1
- package/dist/adapters/ethers/client.js +7 -6
- package/dist/adapters/ethers/index.cjs +501 -242
- package/dist/adapters/ethers/index.cjs.map +1 -1
- package/dist/adapters/ethers/index.js +10 -9
- package/dist/adapters/ethers/resources/deposits/routes/priority.d.ts +12 -0
- package/dist/adapters/ethers/resources/deposits/services/gas.d.ts +4 -0
- package/dist/adapters/ethers/resources/interop/index.d.ts +14 -14
- package/dist/adapters/ethers/resources/interop/resolvers.d.ts +3 -8
- package/dist/adapters/ethers/resources/interop/routes/types.d.ts +2 -1
- package/dist/adapters/ethers/resources/interop/services/erc20.d.ts +10 -0
- package/dist/adapters/ethers/resources/interop/services/fee.d.ts +12 -0
- package/dist/adapters/ethers/resources/interop/services/finalization/index.d.ts +1 -1
- package/dist/adapters/ethers/resources/interop/services/finalization/polling.d.ts +1 -1
- package/dist/adapters/ethers/resources/interop/types.d.ts +6 -14
- package/dist/adapters/ethers/sdk.cjs +912 -252
- package/dist/adapters/ethers/sdk.cjs.map +1 -1
- package/dist/adapters/ethers/sdk.d.ts +6 -1
- package/dist/adapters/ethers/sdk.js +8 -7
- package/dist/adapters/viem/client.cjs +8 -4
- package/dist/adapters/viem/client.cjs.map +1 -1
- package/dist/adapters/viem/client.js +7 -6
- package/dist/adapters/viem/index.cjs +315 -73
- package/dist/adapters/viem/index.cjs.map +1 -1
- package/dist/adapters/viem/index.js +10 -9
- package/dist/adapters/viem/resources/deposits/routes/priority.d.ts +13 -0
- package/dist/adapters/viem/resources/deposits/services/gas.d.ts +4 -0
- package/dist/adapters/viem/sdk.cjs +307 -69
- package/dist/adapters/viem/sdk.cjs.map +1 -1
- package/dist/adapters/viem/sdk.js +7 -7
- package/dist/{chunk-E3KP7XCG.js → chunk-3HHUZXSV.js} +1 -1
- package/dist/{chunk-UDBRUBEK.js → chunk-5RRJDPAJ.js} +2 -2
- package/dist/{chunk-EDWBCPO3.js → chunk-75IOOODG.js} +253 -53
- package/dist/{chunk-R5WRFPK2.js → chunk-7CAVFIMW.js} +5 -4
- package/dist/chunk-BWKWWLY4.js +9 -0
- package/dist/{chunk-4S4XDA4N.js → chunk-DYJKK5FW.js} +17 -15
- package/dist/{chunk-5L6EYUJB.js → chunk-EOBXYHTZ.js} +35 -7
- package/dist/{chunk-53MC5BR2.js → chunk-HP3EWKJL.js} +1 -1
- package/dist/{chunk-HI64OOAR.js → chunk-J47RI3G7.js} +1 -1
- package/dist/{chunk-RI73VJSH.js → chunk-JY62QO3W.js} +44 -21
- package/dist/{chunk-QQ2OR434.js → chunk-MT4X5FEO.js} +18 -2
- package/dist/{chunk-2RIARDXZ.js → chunk-OTXPSNNC.js} +5 -4
- package/dist/{chunk-5R7L5NM5.js → chunk-XDRCN4FC.js} +2 -2
- package/dist/{chunk-JHO2UQ5F.js → chunk-XKRNLFET.js} +394 -200
- package/dist/core/constants.cjs +17 -1
- package/dist/core/constants.cjs.map +1 -1
- package/dist/core/constants.d.ts +9 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/index.cjs +52 -24
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.js +6 -5
- package/dist/core/internal/abis/IERC7786Attributes.d.ts +21 -11
- package/dist/core/internal/abis/IInteropCenter.d.ts +4 -0
- package/dist/core/resources/deposits/priority.d.ts +37 -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/interop/plan.d.ts +11 -3
- package/dist/core/rpc/types.d.ts +1 -0
- package/dist/core/rpc/zks.d.ts +5 -1
- package/dist/core/types/errors.d.ts +5 -0
- package/dist/core/types/flows/interop.d.ts +11 -18
- package/dist/index.cjs +69 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -5
- package/package.json +1 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
export { createEthersClient as createClient, createEthersClient } from '../../chunk-
|
|
2
|
-
export { buildDirectRequestStruct, createDepositsResource, createEthersSdk, createFinalizationServices, createInteropFinalizationServices, createInteropResource, createTokensResource, createWithdrawalsResource, encodeNativeTokenVaultTransferData, encodeSecondBridgeArgs, encodeSecondBridgeDataV1, encodeSecondBridgeErc20Args, encodeSecondBridgeEthArgs, getL2TransactionHashFromLogs } from '../../chunk-
|
|
3
|
-
export { classifyReadinessFromRevert, createErrorHandlers, decodeRevert, registerErrorAbi, toZKsyncError } from '../../chunk-
|
|
4
|
-
import '../../chunk-
|
|
5
|
-
import '../../chunk-
|
|
6
|
-
import '../../chunk-
|
|
7
|
-
import '../../chunk-
|
|
8
|
-
import '../../chunk-
|
|
9
|
-
import '../../chunk-
|
|
1
|
+
export { createEthersClient as createClient, createEthersClient } from '../../chunk-7CAVFIMW.js';
|
|
2
|
+
export { buildDirectRequestStruct, createDepositsResource, createEthersSdk, createFinalizationServices, createInteropFinalizationServices, createInteropResource, createTokensResource, createWithdrawalsResource, encodeNativeTokenVaultTransferData, encodeSecondBridgeArgs, encodeSecondBridgeDataV1, encodeSecondBridgeErc20Args, encodeSecondBridgeEthArgs, getL2TransactionHashFromLogs } from '../../chunk-XKRNLFET.js';
|
|
3
|
+
export { classifyReadinessFromRevert, createErrorHandlers, decodeRevert, registerErrorAbi, toZKsyncError } from '../../chunk-5RRJDPAJ.js';
|
|
4
|
+
import '../../chunk-EOBXYHTZ.js';
|
|
5
|
+
import '../../chunk-3HHUZXSV.js';
|
|
6
|
+
import '../../chunk-BWKWWLY4.js';
|
|
7
|
+
import '../../chunk-HP3EWKJL.js';
|
|
8
|
+
import '../../chunk-DYJKK5FW.js';
|
|
9
|
+
import '../../chunk-JY62QO3W.js';
|
|
10
|
+
import '../../chunk-MT4X5FEO.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type PriorityTxGasBreakdown } from '../../../../../core/resources/deposits/priority.ts';
|
|
2
|
+
import type { Address } from '../../../../../core/types/primitives';
|
|
3
|
+
export type CanonicalPriorityTxInput = {
|
|
4
|
+
sender: Address;
|
|
5
|
+
l2Contract: Address;
|
|
6
|
+
l2Value: bigint;
|
|
7
|
+
l2Calldata: `0x${string}`;
|
|
8
|
+
gasPerPubdata: bigint;
|
|
9
|
+
factoryDepsHashes?: bigint[];
|
|
10
|
+
};
|
|
11
|
+
export declare function getPriorityTxEncodedLength(input: CanonicalPriorityTxInput): bigint;
|
|
12
|
+
export declare function getPriorityTxGasBreakdown(input: CanonicalPriorityTxInput): PriorityTxGasBreakdown;
|
|
@@ -34,8 +34,12 @@ export declare function determineErc20L2Gas(input: {
|
|
|
34
34
|
ctx: BuildCtx;
|
|
35
35
|
l1Token: Address;
|
|
36
36
|
modelTx?: TransactionRequest;
|
|
37
|
+
priorityFloorGasLimit?: bigint;
|
|
38
|
+
undeployedGasLimit?: bigint;
|
|
37
39
|
}): Promise<GasQuote | undefined>;
|
|
38
40
|
export declare function determineEthNonBaseL2Gas(input: {
|
|
39
41
|
ctx: BuildCtx;
|
|
40
42
|
modelTx?: TransactionRequest;
|
|
43
|
+
priorityFloorGasLimit?: bigint;
|
|
44
|
+
undeployedGasLimit?: bigint;
|
|
41
45
|
}): Promise<GasQuote | undefined>;
|
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
import type { EthersClient } from '../../client';
|
|
2
2
|
import type { AttributesResource } from '../../../../core/resources/interop/attributes/resource';
|
|
3
|
-
import type { InteropRoute, InteropPlan, InteropQuote, InteropStatus, InteropFinalizationResult } from '../../../../core/types/flows/interop';
|
|
3
|
+
import type { InteropRoute, InteropPlan, InteropQuote, InteropStatus, InteropFinalizationResult, InteropParams, InteropHandle, InteropWaitable, InteropFinalizationInfo } from '../../../../core/types/flows/interop';
|
|
4
4
|
import type { ContractsResource } from '../contracts';
|
|
5
5
|
import type { TokensResource } from '../../../../core/types/flows/token';
|
|
6
6
|
import type { InteropRouteStrategy } from './routes/types';
|
|
7
7
|
import type { TransactionRequest } from 'ethers';
|
|
8
8
|
import { createInteropFinalizationServices, type InteropFinalizationServices } from './services/finalization';
|
|
9
9
|
import type { LogsQueryOptions } from './services/finalization/data-fetchers';
|
|
10
|
-
import type {
|
|
10
|
+
import type { ChainRef, InteropConfig } from './types';
|
|
11
11
|
export declare const ROUTES: Record<InteropRoute, InteropRouteStrategy>;
|
|
12
12
|
export interface InteropResource {
|
|
13
|
-
quote(params: InteropParams): Promise<InteropQuote>;
|
|
14
|
-
tryQuote(params: InteropParams): Promise<{
|
|
13
|
+
quote(dstChain: ChainRef, params: InteropParams): Promise<InteropQuote>;
|
|
14
|
+
tryQuote(dstChain: ChainRef, params: InteropParams): Promise<{
|
|
15
15
|
ok: true;
|
|
16
16
|
value: InteropQuote;
|
|
17
17
|
} | {
|
|
18
18
|
ok: false;
|
|
19
19
|
error: unknown;
|
|
20
20
|
}>;
|
|
21
|
-
prepare(params: InteropParams): Promise<InteropPlan<TransactionRequest>>;
|
|
22
|
-
tryPrepare(params: InteropParams): Promise<{
|
|
21
|
+
prepare(dstChain: ChainRef, params: InteropParams): Promise<InteropPlan<TransactionRequest>>;
|
|
22
|
+
tryPrepare(dstChain: ChainRef, params: InteropParams): Promise<{
|
|
23
23
|
ok: true;
|
|
24
24
|
value: InteropPlan<TransactionRequest>;
|
|
25
25
|
} | {
|
|
26
26
|
ok: false;
|
|
27
27
|
error: unknown;
|
|
28
28
|
}>;
|
|
29
|
-
create(params: InteropParams): Promise<InteropHandle<TransactionRequest>>;
|
|
30
|
-
tryCreate(params: InteropParams): Promise<{
|
|
29
|
+
create(dstChain: ChainRef, params: InteropParams): Promise<InteropHandle<TransactionRequest>>;
|
|
30
|
+
tryCreate(dstChain: ChainRef, params: InteropParams): Promise<{
|
|
31
31
|
ok: true;
|
|
32
32
|
value: InteropHandle<TransactionRequest>;
|
|
33
33
|
} | {
|
|
34
34
|
ok: false;
|
|
35
35
|
error: unknown;
|
|
36
36
|
}>;
|
|
37
|
-
status(h: InteropWaitable, opts?: LogsQueryOptions): Promise<InteropStatus>;
|
|
38
|
-
wait(h: InteropWaitable, opts?: {
|
|
37
|
+
status(dstChain: ChainRef, h: InteropWaitable, opts?: LogsQueryOptions): Promise<InteropStatus>;
|
|
38
|
+
wait(dstChain: ChainRef, h: InteropWaitable, opts?: {
|
|
39
39
|
pollMs?: number;
|
|
40
40
|
timeoutMs?: number;
|
|
41
41
|
}): Promise<InteropFinalizationInfo>;
|
|
42
|
-
tryWait(h: InteropWaitable, opts?: {
|
|
42
|
+
tryWait(dstChain: ChainRef, h: InteropWaitable, opts?: {
|
|
43
43
|
pollMs?: number;
|
|
44
44
|
timeoutMs?: number;
|
|
45
45
|
}): Promise<{
|
|
@@ -49,8 +49,8 @@ export interface InteropResource {
|
|
|
49
49
|
ok: false;
|
|
50
50
|
error: unknown;
|
|
51
51
|
}>;
|
|
52
|
-
finalize(h: InteropWaitable | InteropFinalizationInfo, opts?: LogsQueryOptions): Promise<InteropFinalizationResult>;
|
|
53
|
-
tryFinalize(h: InteropWaitable | InteropFinalizationInfo, opts?: LogsQueryOptions): Promise<{
|
|
52
|
+
finalize(dstChain: ChainRef, h: InteropWaitable | InteropFinalizationInfo, opts?: LogsQueryOptions): Promise<InteropFinalizationResult>;
|
|
53
|
+
tryFinalize(dstChain: ChainRef, h: InteropWaitable | InteropFinalizationInfo, opts?: LogsQueryOptions): Promise<{
|
|
54
54
|
ok: true;
|
|
55
55
|
value: InteropFinalizationResult;
|
|
56
56
|
} | {
|
|
@@ -58,6 +58,6 @@ export interface InteropResource {
|
|
|
58
58
|
error: unknown;
|
|
59
59
|
}>;
|
|
60
60
|
}
|
|
61
|
-
export declare function createInteropResource(client: EthersClient, tokens?: TokensResource, contracts?: ContractsResource, attributes?: AttributesResource): InteropResource;
|
|
61
|
+
export declare function createInteropResource(client: EthersClient, config?: InteropConfig, tokens?: TokensResource, contracts?: ContractsResource, attributes?: AttributesResource): InteropResource;
|
|
62
62
|
export { createInteropFinalizationServices };
|
|
63
63
|
export type { InteropFinalizationServices };
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
import { type AbstractProvider } from 'ethers';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export declare function resolveDstProvider(dstChain: DstChain): AbstractProvider;
|
|
6
|
-
export declare function resolveWaitableInput(waitableInput: InteropWaitable): {
|
|
7
|
-
dstProvider: AbstractProvider;
|
|
8
|
-
waitable: InteropWaitableBase;
|
|
9
|
-
};
|
|
2
|
+
import type { ChainRef } from './types';
|
|
3
|
+
/** Resolve a chain ref (URL string or provider) into an AbstractProvider. */
|
|
4
|
+
export declare function resolveChainRef(ref: ChainRef): AbstractProvider;
|
|
@@ -2,12 +2,13 @@ import type { TransactionRequest } from 'ethers';
|
|
|
2
2
|
import type { InteropParams } from '../../../../../core/types/flows/interop';
|
|
3
3
|
import type { BuildCtx } from '../context';
|
|
4
4
|
import type { PlanStep, ApprovalNeed } from '../../../../../core/types/flows/base';
|
|
5
|
-
import type { QuoteExtras } from '../../../../../core/types/flows/interop';
|
|
5
|
+
import type { QuoteExtras, InteropFee } from '../../../../../core/types/flows/interop';
|
|
6
6
|
export interface InteropRouteStrategy {
|
|
7
7
|
preflight(params: InteropParams, ctx: BuildCtx): Promise<void>;
|
|
8
8
|
build(params: InteropParams, ctx: BuildCtx): Promise<{
|
|
9
9
|
steps: Array<PlanStep<TransactionRequest>>;
|
|
10
10
|
approvals: ApprovalNeed[];
|
|
11
11
|
quoteExtras: QuoteExtras;
|
|
12
|
+
interopFee: InteropFee;
|
|
12
13
|
}>;
|
|
13
14
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type TransactionRequest } from 'ethers';
|
|
2
2
|
import type { Address, Hex } from '../../../../../core/types/primitives';
|
|
3
3
|
import type { InteropParams } from '../../../../../core/types/flows/interop';
|
|
4
|
+
import type { ApprovalNeed } from '../../../../../core/types/flows/base';
|
|
4
5
|
import type { BuildCtx } from '../context';
|
|
5
6
|
/** Collect unique ERC-20 token addresses referenced by `sendErc20` actions. */
|
|
6
7
|
export declare function getErc20Tokens(params: InteropParams): Address[];
|
|
@@ -11,5 +12,14 @@ export declare function buildEnsureTokenSteps(erc20Tokens: Address[], ctx: Build
|
|
|
11
12
|
description: string;
|
|
12
13
|
tx: TransactionRequest;
|
|
13
14
|
}>;
|
|
15
|
+
/**
|
|
16
|
+
* Check allowance for each approval and return approve steps only where needed.
|
|
17
|
+
*/
|
|
18
|
+
export declare function buildApproveSteps(approvals: ApprovalNeed[], ctx: BuildCtx): Promise<Array<{
|
|
19
|
+
key: string;
|
|
20
|
+
kind: string;
|
|
21
|
+
description: string;
|
|
22
|
+
tx: TransactionRequest;
|
|
23
|
+
}>>;
|
|
14
24
|
/** Resolve asset IDs for each ERC-20 token via a static-call to NTV. */
|
|
15
25
|
export declare function resolveErc20AssetIds(erc20Tokens: Address[], ctx: BuildCtx): Promise<Map<string, Hex>>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { InteropParams } from '../../../../../core/types/flows/interop';
|
|
2
|
+
import type { BuildCtx } from '../context';
|
|
3
|
+
import type { InteropFeeInfo } from '../../../../../core/resources/interop/plan';
|
|
4
|
+
/**
|
|
5
|
+
* Resolve fee information for a bundle.
|
|
6
|
+
*
|
|
7
|
+
* - useFixed=false (default when fees is unset): reads interopProtocolFee and
|
|
8
|
+
* returns the total as fee.value so the caller can add it to the sendBundle msg.value.
|
|
9
|
+
* - useFixed=true: reads ZK_INTEROP_FEE and zkToken address, returns an
|
|
10
|
+
* ApprovalNeed for the ZK token. The route handles the allowance check.
|
|
11
|
+
*/
|
|
12
|
+
export declare function buildFeeInfo(params: InteropParams, ctx: BuildCtx, numStarters: number): Promise<InteropFeeInfo>;
|
|
@@ -4,7 +4,7 @@ import type { EthersClient } from '../../../../client';
|
|
|
4
4
|
import type { LogsQueryOptions } from './data-fetchers';
|
|
5
5
|
export interface InteropFinalizationServices {
|
|
6
6
|
status(dstProvider: AbstractProvider, input: InteropWaitable, opts?: LogsQueryOptions): Promise<InteropStatus>;
|
|
7
|
-
wait(dstProvider: AbstractProvider, input: InteropWaitable, opts?: {
|
|
7
|
+
wait(dstProvider: AbstractProvider, gwProvider: AbstractProvider, input: InteropWaitable, opts?: {
|
|
8
8
|
pollMs?: number;
|
|
9
9
|
timeoutMs?: number;
|
|
10
10
|
}): Promise<InteropFinalizationInfo>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AbstractProvider } from 'ethers';
|
|
2
2
|
import type { InteropWaitable, InteropFinalizationInfo } from '../../../../../../core/types/flows/interop';
|
|
3
3
|
import type { EthersClient } from '../../../../client';
|
|
4
|
-
export declare function waitForFinalization(client: EthersClient, dstProvider: AbstractProvider, input: InteropWaitable, opts?: {
|
|
4
|
+
export declare function waitForFinalization(client: EthersClient, dstProvider: AbstractProvider, gwProvider: AbstractProvider, input: InteropWaitable, opts?: {
|
|
5
5
|
pollMs?: number;
|
|
6
6
|
timeoutMs?: number;
|
|
7
7
|
}): Promise<InteropFinalizationInfo>;
|
|
@@ -1,16 +1,8 @@
|
|
|
1
1
|
import type { AbstractProvider } from 'ethers';
|
|
2
|
-
|
|
3
|
-
export type
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
/** String URL or live provider — used only in resource/SDK config. */
|
|
3
|
+
export type ChainRef = string | AbstractProvider;
|
|
4
|
+
/** One-time configuration for the interop resource. */
|
|
5
|
+
export interface InteropConfig {
|
|
6
|
+
/** Gateway chain — used to fetch GW chain ID for interop root polling. */
|
|
7
|
+
gwChain: ChainRef;
|
|
6
8
|
}
|
|
7
|
-
export interface InteropHandle<Tx> extends InteropHandleBase<Tx> {
|
|
8
|
-
dstChain: DstChain;
|
|
9
|
-
}
|
|
10
|
-
export interface InteropFinalizationInfo extends InteropFinalizationInfoBase {
|
|
11
|
-
dstChain: DstChain;
|
|
12
|
-
}
|
|
13
|
-
export type InteropWaitable = InteropHandle<unknown> | {
|
|
14
|
-
dstChain: DstChain;
|
|
15
|
-
waitable: InteropWaitableBase;
|
|
16
|
-
};
|