@matterlabs/zksync-js 0.0.14 → 0.0.16
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.map +1 -1
- package/dist/adapters/ethers/client.d.ts +1 -2
- package/dist/adapters/ethers/client.js +4 -5
- package/dist/adapters/ethers/index.cjs +200 -32
- package/dist/adapters/ethers/index.cjs.map +1 -1
- package/dist/adapters/ethers/index.js +6 -7
- package/dist/adapters/ethers/resources/interop/index.d.ts +4 -1
- package/dist/adapters/ethers/resources/interop/services/finalization/bundle.d.ts +4 -0
- package/dist/adapters/ethers/resources/interop/services/gas.d.ts +12 -0
- package/dist/adapters/ethers/sdk.cjs +200 -32
- package/dist/adapters/ethers/sdk.cjs.map +1 -1
- package/dist/adapters/ethers/sdk.js +5 -6
- package/dist/adapters/viem/client.cjs +787 -3
- package/dist/adapters/viem/client.cjs.map +1 -1
- package/dist/adapters/viem/client.d.ts +6 -1
- package/dist/adapters/viem/client.js +4 -5
- package/dist/adapters/viem/index.cjs +6502 -2966
- package/dist/adapters/viem/index.cjs.map +1 -1
- package/dist/adapters/viem/index.d.ts +5 -0
- package/dist/adapters/viem/index.js +6 -7
- package/dist/adapters/viem/resources/interop/address.d.ts +18 -0
- package/dist/adapters/viem/resources/interop/attributes/resource.d.ts +6 -0
- package/dist/adapters/viem/resources/interop/context.d.ts +31 -0
- package/dist/adapters/viem/resources/interop/index.d.ts +65 -0
- package/dist/adapters/viem/resources/interop/resolvers.d.ts +4 -0
- package/dist/adapters/viem/resources/interop/routes/direct.d.ts +2 -0
- package/dist/adapters/viem/resources/interop/routes/indirect.d.ts +2 -0
- package/dist/adapters/viem/resources/interop/routes/types.d.ts +23 -0
- package/dist/adapters/viem/resources/interop/services/erc20.d.ts +25 -0
- package/dist/adapters/viem/resources/interop/services/fee.d.ts +12 -0
- package/dist/adapters/viem/resources/interop/services/finalization/bundle.d.ts +19 -0
- package/dist/adapters/viem/resources/interop/services/finalization/data-fetchers.d.ts +17 -0
- package/dist/adapters/viem/resources/interop/services/finalization/decoders.d.ts +11 -0
- package/dist/adapters/viem/resources/interop/services/finalization/index.d.ts +13 -0
- package/dist/adapters/viem/resources/interop/services/finalization/polling.d.ts +7 -0
- package/dist/adapters/viem/resources/interop/services/finalization/status.d.ts +5 -0
- package/dist/adapters/viem/resources/interop/services/finalization/topics.d.ts +4 -0
- package/dist/adapters/viem/resources/interop/services/gas.d.ts +12 -0
- package/dist/adapters/viem/resources/interop/services/starter-data.d.ts +6 -0
- package/dist/adapters/viem/resources/interop/types.d.ts +8 -0
- package/dist/adapters/viem/sdk.cjs +6665 -3173
- package/dist/adapters/viem/sdk.cjs.map +1 -1
- package/dist/adapters/viem/sdk.d.ts +8 -1
- package/dist/adapters/viem/sdk.js +5 -5
- package/dist/{chunk-7CAVFIMW.js → chunk-24TE2NNJ.js} +2 -3
- package/dist/{chunk-75IOOODG.js → chunk-3KH5PCD6.js} +1233 -31
- package/dist/{chunk-XKRNLFET.js → chunk-5HG2DUYW.js} +150 -375
- package/dist/{chunk-OTXPSNNC.js → chunk-CK5UFAZK.js} +64 -7
- package/dist/{chunk-HP3EWKJL.js → chunk-JSBMIT4S.js} +1 -1
- package/dist/{chunk-5RRJDPAJ.js → chunk-NJK325XV.js} +2 -2
- package/dist/chunk-NLUCYVMX.js +658 -0
- package/dist/{chunk-XDRCN4FC.js → chunk-SBGBYZJM.js} +10 -2
- package/dist/{chunk-J47RI3G7.js → chunk-TYYUG5GA.js} +1 -1
- package/dist/{chunk-JY62QO3W.js → chunk-UEKFQAOS.js} +420 -6
- package/dist/core/index.js +2 -3
- package/dist/core/resources/deposits/chains.d.ts +1 -0
- package/dist/core/resources/deposits/gas.d.ts +7 -0
- package/dist/core/resources/deposits/priority.d.ts +4 -0
- package/dist/core/resources/interop/protocol.d.ts +3 -0
- package/dist/core/types/errors.d.ts +1 -0
- package/dist/core/types/flows/interop.d.ts +0 -2
- package/dist/core/types/primitives.d.ts +2 -0
- package/dist/index.js +2 -3
- package/package.json +1 -1
- package/dist/chunk-DYJKK5FW.js +0 -417
- package/dist/chunk-EOBXYHTZ.js +0 -265
|
@@ -11,5 +11,10 @@ export type { WithdrawalsResource, FinalizationServices } from './resources/with
|
|
|
11
11
|
export { createTokensResource } from './resources/tokens';
|
|
12
12
|
export { createContractsResource } from './resources/contracts';
|
|
13
13
|
export type { ContractsResource, ContractInstances } from './resources/contracts';
|
|
14
|
+
export { createInteropResource } from './resources/interop';
|
|
15
|
+
export { createInteropFinalizationServices } from './resources/interop';
|
|
16
|
+
export type { InteropResource, InteropFinalizationServices } from './resources/interop';
|
|
17
|
+
export type { ViemTransactionRequest } from './resources/interop/routes/types';
|
|
18
|
+
export type { InteropConfig, ChainRef } from './resources/interop/types';
|
|
14
19
|
export * from './errors/error-ops';
|
|
15
20
|
export * from './errors/revert';
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
export { buildDirectRequestStruct, createContractsResource, createDepositsResource, createFinalizationServices, createTokensResource, createViemSdk, createWithdrawalsResource, encodeNativeTokenVaultTransferData, encodeSecondBridgeArgs, encodeSecondBridgeDataV1, encodeSecondBridgeErc20Args, encodeSecondBridgeEthArgs, getL2TransactionHashFromLogs } from '../../chunk-
|
|
2
|
-
import '../../chunk-
|
|
1
|
+
export { buildDirectRequestStruct, createContractsResource, createDepositsResource, createFinalizationServices, createInteropFinalizationServices, createInteropResource, createTokensResource, createViemSdk, createWithdrawalsResource, encodeNativeTokenVaultTransferData, encodeSecondBridgeArgs, encodeSecondBridgeDataV1, encodeSecondBridgeErc20Args, encodeSecondBridgeEthArgs, getL2TransactionHashFromLogs } from '../../chunk-3KH5PCD6.js';
|
|
2
|
+
import '../../chunk-NLUCYVMX.js';
|
|
3
3
|
import '../../chunk-3HHUZXSV.js';
|
|
4
|
-
export { createViemClient as createClient, createViemClient } from '../../chunk-
|
|
5
|
-
export { classifyReadinessFromRevert, createErrorHandlers, decodeRevert, registerErrorAbi, toZKsyncError } from '../../chunk-
|
|
4
|
+
export { createViemClient as createClient, createViemClient } from '../../chunk-CK5UFAZK.js';
|
|
5
|
+
export { classifyReadinessFromRevert, createErrorHandlers, decodeRevert, registerErrorAbi, toZKsyncError } from '../../chunk-SBGBYZJM.js';
|
|
6
6
|
import '../../chunk-BWKWWLY4.js';
|
|
7
|
-
import '../../chunk-
|
|
8
|
-
import '../../chunk-
|
|
9
|
-
import '../../chunk-JY62QO3W.js';
|
|
7
|
+
import '../../chunk-JSBMIT4S.js';
|
|
8
|
+
import '../../chunk-UEKFQAOS.js';
|
|
10
9
|
import '../../chunk-MT4X5FEO.js';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Address, Hex } from '../../../../core/types/primitives';
|
|
2
|
+
/**
|
|
3
|
+
* Formats an ERC-7930 interoperable address (version 1) that describes an EVM chain
|
|
4
|
+
* without specifying a destination address. Mirrors InteroperableAddress.formatEvmV1(chainId).
|
|
5
|
+
*/
|
|
6
|
+
export declare function formatInteropEvmChain(chainId: bigint): Hex;
|
|
7
|
+
/**
|
|
8
|
+
* Formats an ERC-7930 interoperable address (version 1) that describes an EVM address
|
|
9
|
+
* without a chain reference. Mirrors InteroperableAddress.formatEvmV1(address).
|
|
10
|
+
*/
|
|
11
|
+
export declare function formatInteropEvmAddress(address: Address): Hex;
|
|
12
|
+
/**
|
|
13
|
+
* Codec for interop address encoding used by route builders.
|
|
14
|
+
*/
|
|
15
|
+
export declare const interopCodec: {
|
|
16
|
+
formatChain: typeof formatInteropEvmChain;
|
|
17
|
+
formatAddress: typeof formatInteropEvmAddress;
|
|
18
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type AttributesResource } from '../../../../../core/resources/interop/attributes/resource';
|
|
2
|
+
import type { InteropParams } from '../../../../../core/types/flows/interop';
|
|
3
|
+
import type { BuildCtx } from '../context';
|
|
4
|
+
import type { InteropAttributes } from '../../../../../core/resources/interop/plan';
|
|
5
|
+
export declare function getInteropAttributes(params: InteropParams, ctx: BuildCtx): InteropAttributes;
|
|
6
|
+
export declare function createViemAttributesResource(): AttributesResource;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { PublicClient } from 'viem';
|
|
2
|
+
import type { ViemClient } from '../../client';
|
|
3
|
+
import type { Address } from '../../../../core/types/primitives';
|
|
4
|
+
import type { CommonCtx } from '../../../../core/types/flows/base';
|
|
5
|
+
import type { InteropParams } from '../../../../core/types/flows/interop';
|
|
6
|
+
import { type TxGasOverrides } from '../../../../core/types/fees';
|
|
7
|
+
import type { TokensResource } from '../../../../core/types/flows/token';
|
|
8
|
+
import type { AttributesResource } from '../../../../core/resources/interop/attributes/resource';
|
|
9
|
+
import type { ContractsResource } from '../contracts';
|
|
10
|
+
export interface BuildCtx extends CommonCtx {
|
|
11
|
+
client: ViemClient;
|
|
12
|
+
tokens: TokensResource;
|
|
13
|
+
contracts: ContractsResource;
|
|
14
|
+
bridgehub: Address;
|
|
15
|
+
dstChainId: bigint;
|
|
16
|
+
dstPublicClient: PublicClient;
|
|
17
|
+
chainId: bigint;
|
|
18
|
+
interopCenter: Address;
|
|
19
|
+
interopHandler: Address;
|
|
20
|
+
l2MessageVerification: Address;
|
|
21
|
+
l2AssetRouter: Address;
|
|
22
|
+
l2NativeTokenVault: Address;
|
|
23
|
+
baseTokens: {
|
|
24
|
+
src: Address;
|
|
25
|
+
dst: Address;
|
|
26
|
+
matches: boolean;
|
|
27
|
+
};
|
|
28
|
+
attributes: AttributesResource;
|
|
29
|
+
gasOverrides?: TxGasOverrides;
|
|
30
|
+
}
|
|
31
|
+
export declare function commonCtx(dstPublicClient: PublicClient, params: InteropParams, client: ViemClient, tokens: TokensResource, contracts: ContractsResource, attributes: AttributesResource): Promise<BuildCtx>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { ViemClient } from '../../client';
|
|
2
|
+
import type { Hex } from '../../../../core/types/primitives';
|
|
3
|
+
import type { AttributesResource } from '../../../../core/resources/interop/attributes/resource';
|
|
4
|
+
import type { InteropRoute, InteropPlan, InteropQuote, InteropStatus, InteropFinalizationResult, InteropParams, InteropHandle, InteropWaitable, InteropFinalizationInfo } from '../../../../core/types/flows/interop';
|
|
5
|
+
import type { ContractsResource } from '../contracts';
|
|
6
|
+
import type { TokensResource } from '../../../../core/types/flows/token';
|
|
7
|
+
import type { InteropRouteStrategy, ViemTransactionRequest } from './routes/types';
|
|
8
|
+
import { createInteropFinalizationServices, type InteropFinalizationServices } from './services/finalization';
|
|
9
|
+
import { type LogsQueryOptions } from './services/finalization/data-fetchers';
|
|
10
|
+
import type { ChainRef, InteropConfig } from './types';
|
|
11
|
+
export declare const ROUTES: Record<InteropRoute, InteropRouteStrategy>;
|
|
12
|
+
export interface InteropResource {
|
|
13
|
+
quote(dstChain: ChainRef, params: InteropParams): Promise<InteropQuote>;
|
|
14
|
+
tryQuote(dstChain: ChainRef, params: InteropParams): Promise<{
|
|
15
|
+
ok: true;
|
|
16
|
+
value: InteropQuote;
|
|
17
|
+
} | {
|
|
18
|
+
ok: false;
|
|
19
|
+
error: unknown;
|
|
20
|
+
}>;
|
|
21
|
+
prepare(dstChain: ChainRef, params: InteropParams): Promise<InteropPlan<ViemTransactionRequest>>;
|
|
22
|
+
tryPrepare(dstChain: ChainRef, params: InteropParams): Promise<{
|
|
23
|
+
ok: true;
|
|
24
|
+
value: InteropPlan<ViemTransactionRequest>;
|
|
25
|
+
} | {
|
|
26
|
+
ok: false;
|
|
27
|
+
error: unknown;
|
|
28
|
+
}>;
|
|
29
|
+
create(dstChain: ChainRef, params: InteropParams): Promise<InteropHandle<ViemTransactionRequest>>;
|
|
30
|
+
tryCreate(dstChain: ChainRef, params: InteropParams): Promise<{
|
|
31
|
+
ok: true;
|
|
32
|
+
value: InteropHandle<ViemTransactionRequest>;
|
|
33
|
+
} | {
|
|
34
|
+
ok: false;
|
|
35
|
+
error: unknown;
|
|
36
|
+
}>;
|
|
37
|
+
status(dstChain: ChainRef, h: InteropWaitable, opts?: LogsQueryOptions): Promise<InteropStatus>;
|
|
38
|
+
wait(dstChain: ChainRef, h: InteropWaitable, opts?: {
|
|
39
|
+
pollMs?: number;
|
|
40
|
+
timeoutMs?: number;
|
|
41
|
+
}): Promise<InteropFinalizationInfo>;
|
|
42
|
+
tryWait(dstChain: ChainRef, h: InteropWaitable, opts?: {
|
|
43
|
+
pollMs?: number;
|
|
44
|
+
timeoutMs?: number;
|
|
45
|
+
}): Promise<{
|
|
46
|
+
ok: true;
|
|
47
|
+
value: InteropFinalizationInfo;
|
|
48
|
+
} | {
|
|
49
|
+
ok: false;
|
|
50
|
+
error: unknown;
|
|
51
|
+
}>;
|
|
52
|
+
finalize(dstChain: ChainRef, h: InteropWaitable | InteropFinalizationInfo, opts?: LogsQueryOptions): Promise<InteropFinalizationResult>;
|
|
53
|
+
tryFinalize(dstChain: ChainRef, h: InteropWaitable | InteropFinalizationInfo, opts?: LogsQueryOptions): Promise<{
|
|
54
|
+
ok: true;
|
|
55
|
+
value: InteropFinalizationResult;
|
|
56
|
+
} | {
|
|
57
|
+
ok: false;
|
|
58
|
+
error: unknown;
|
|
59
|
+
}>;
|
|
60
|
+
getInteropRoot(dstChain: ChainRef, rootChainId: bigint, batchNumber: bigint): Promise<Hex>;
|
|
61
|
+
verifyBundle(dstChain: ChainRef, h: InteropWaitable | InteropFinalizationInfo): Promise<InteropFinalizationResult>;
|
|
62
|
+
}
|
|
63
|
+
export declare function createInteropResource(client: ViemClient, config?: InteropConfig, tokens?: TokensResource, contracts?: ContractsResource, attributes?: AttributesResource): InteropResource;
|
|
64
|
+
export { createInteropFinalizationServices };
|
|
65
|
+
export type { InteropFinalizationServices };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { InteropParams } from '../../../../../core/types/flows/interop';
|
|
2
|
+
import type { BuildCtx } from '../context';
|
|
3
|
+
import type { PlanStep, ApprovalNeed } from '../../../../../core/types/flows/base';
|
|
4
|
+
import type { QuoteExtras, InteropFee } from '../../../../../core/types/flows/interop';
|
|
5
|
+
/** Minimal transaction request for a viem L2 interop step. */
|
|
6
|
+
export interface ViemTransactionRequest {
|
|
7
|
+
to?: `0x${string}`;
|
|
8
|
+
data?: `0x${string}`;
|
|
9
|
+
value?: bigint;
|
|
10
|
+
gas?: bigint;
|
|
11
|
+
gasLimit?: bigint;
|
|
12
|
+
maxFeePerGas?: bigint;
|
|
13
|
+
maxPriorityFeePerGas?: bigint;
|
|
14
|
+
}
|
|
15
|
+
export interface InteropRouteStrategy {
|
|
16
|
+
preflight(params: InteropParams, ctx: BuildCtx): Promise<void>;
|
|
17
|
+
build(params: InteropParams, ctx: BuildCtx): Promise<{
|
|
18
|
+
steps: Array<PlanStep<ViemTransactionRequest>>;
|
|
19
|
+
approvals: ApprovalNeed[];
|
|
20
|
+
quoteExtras: QuoteExtras;
|
|
21
|
+
interopFee: InteropFee;
|
|
22
|
+
}>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Address, Hex } from '../../../../../core/types/primitives';
|
|
2
|
+
import type { InteropParams } from '../../../../../core/types/flows/interop';
|
|
3
|
+
import type { ApprovalNeed } from '../../../../../core/types/flows/base';
|
|
4
|
+
import type { BuildCtx } from '../context';
|
|
5
|
+
import type { ViemTransactionRequest } from '../routes/types';
|
|
6
|
+
/** Collect unique ERC-20 token addresses referenced by `sendErc20` actions. */
|
|
7
|
+
export declare function getErc20Tokens(params: InteropParams): Address[];
|
|
8
|
+
/** Build NTV `ensureTokenIsRegistered` steps for each ERC-20 token. */
|
|
9
|
+
export declare function buildEnsureTokenSteps(erc20Tokens: Address[], ctx: BuildCtx): Array<{
|
|
10
|
+
key: string;
|
|
11
|
+
kind: string;
|
|
12
|
+
description: string;
|
|
13
|
+
tx: ViemTransactionRequest;
|
|
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: ViemTransactionRequest;
|
|
23
|
+
}>>;
|
|
24
|
+
/** Resolve asset IDs for each ERC-20 token via a static-call to NTV. */
|
|
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>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type PublicClient, type TransactionReceipt } from 'viem';
|
|
2
|
+
import type { Hex } from '../../../../../../core/types/primitives';
|
|
3
|
+
import type { InteropFinalizationInfo } from '../../../../../../core/types/flows/interop';
|
|
4
|
+
import type { ViemClient } from '../../../../client';
|
|
5
|
+
import type { InteropPhase } from '../../../../../../core/types/flows/interop';
|
|
6
|
+
import type { InteropTopics } from '../../../../../../core/resources/interop/events';
|
|
7
|
+
import { type LogsQueryOptions } from './data-fetchers';
|
|
8
|
+
export declare function getBundleStatus(client: ViemClient, dstProvider: PublicClient, topics: InteropTopics, bundleHash: Hex, opts?: LogsQueryOptions): Promise<{
|
|
9
|
+
phase: InteropPhase;
|
|
10
|
+
dstExecTxHash?: Hex;
|
|
11
|
+
}>;
|
|
12
|
+
export declare function executeBundle(client: ViemClient, dstProvider: PublicClient, info: InteropFinalizationInfo, opts?: LogsQueryOptions): Promise<{
|
|
13
|
+
hash: Hex;
|
|
14
|
+
wait: () => Promise<TransactionReceipt>;
|
|
15
|
+
}>;
|
|
16
|
+
export declare function verifyBundle(client: ViemClient, dstProvider: PublicClient, info: InteropFinalizationInfo): Promise<{
|
|
17
|
+
hash: Hex;
|
|
18
|
+
wait: () => Promise<TransactionReceipt>;
|
|
19
|
+
}>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { PublicClient } from 'viem';
|
|
2
|
+
import type { Address, Hex } from '../../../../../../core/types/primitives';
|
|
3
|
+
import type { Log } from '../../../../../../core/types/transactions';
|
|
4
|
+
export interface LogsQueryOptions {
|
|
5
|
+
maxBlocksBack?: number;
|
|
6
|
+
logChunkSize?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function getTxReceipt(provider: PublicClient, txHash: Hex): Promise<{
|
|
9
|
+
logs: {
|
|
10
|
+
address: `0x${string}`;
|
|
11
|
+
topics: Hex[];
|
|
12
|
+
data: `0x${string}`;
|
|
13
|
+
transactionHash: `0x${string}`;
|
|
14
|
+
}[];
|
|
15
|
+
} | null>;
|
|
16
|
+
export declare function getLogs(provider: PublicClient, address: Address, topics: Array<Hex | null>, opts?: LogsQueryOptions): Promise<Log[]>;
|
|
17
|
+
export declare function getInteropRoot(provider: PublicClient, rootChainId: bigint, batchNumber: bigint): Promise<Hex>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Hex } from '../../../../../../core/types/primitives';
|
|
2
|
+
import type { Log } from '../../../../../../core/types/transactions';
|
|
3
|
+
export declare function decodeInteropBundleSent(log: {
|
|
4
|
+
data: Hex;
|
|
5
|
+
topics: Hex[];
|
|
6
|
+
}): {
|
|
7
|
+
bundleHash: Hex;
|
|
8
|
+
sourceChainId: bigint;
|
|
9
|
+
destinationChainId: bigint;
|
|
10
|
+
};
|
|
11
|
+
export declare function decodeL1MessageData(log: Log): Hex;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { PublicClient } from 'viem';
|
|
2
|
+
import type { InteropStatus, InteropWaitable, InteropFinalizationInfo, InteropFinalizationResult } from '../../../../../../core/types/flows/interop';
|
|
3
|
+
import type { ViemClient } from '../../../../client';
|
|
4
|
+
import type { LogsQueryOptions } from './data-fetchers';
|
|
5
|
+
export interface InteropFinalizationServices {
|
|
6
|
+
status(dstProvider: PublicClient, input: InteropWaitable, opts?: LogsQueryOptions): Promise<InteropStatus>;
|
|
7
|
+
wait(dstProvider: PublicClient, gwProvider: PublicClient, input: InteropWaitable, opts?: {
|
|
8
|
+
pollMs?: number;
|
|
9
|
+
timeoutMs?: number;
|
|
10
|
+
}): Promise<InteropFinalizationInfo>;
|
|
11
|
+
finalize(dstProvider: PublicClient, info: InteropFinalizationInfo, opts?: LogsQueryOptions): Promise<InteropFinalizationResult>;
|
|
12
|
+
}
|
|
13
|
+
export declare function createInteropFinalizationServices(client: ViemClient): InteropFinalizationServices;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PublicClient } from 'viem';
|
|
2
|
+
import type { InteropWaitable, InteropFinalizationInfo } from '../../../../../../core/types/flows/interop';
|
|
3
|
+
import type { ViemClient } from '../../../../client';
|
|
4
|
+
export declare function waitForFinalization(client: ViemClient, dstProvider: PublicClient, gwProvider: PublicClient, input: InteropWaitable, opts?: {
|
|
5
|
+
pollMs?: number;
|
|
6
|
+
timeoutMs?: number;
|
|
7
|
+
}): Promise<InteropFinalizationInfo>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PublicClient } from 'viem';
|
|
2
|
+
import type { InteropStatus, InteropWaitable } from '../../../../../../core/types/flows/interop';
|
|
3
|
+
import type { ViemClient } from '../../../../client';
|
|
4
|
+
import type { LogsQueryOptions } from './data-fetchers';
|
|
5
|
+
export declare function getStatus(client: ViemClient, dstProvider: PublicClient, input: InteropWaitable, opts?: LogsQueryOptions): Promise<InteropStatus>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ViemTransactionRequest } from '../routes/types';
|
|
2
|
+
import type { BuildCtx } from '../context';
|
|
3
|
+
/**
|
|
4
|
+
* Estimates the combined L2 gas cost for all steps in an interop plan.
|
|
5
|
+
*
|
|
6
|
+
* Fetches gas price once, then estimates gas for each step using ctx.sender as the
|
|
7
|
+
* from address. Applies the standard buffer and sums gasLimit × maxFeePerGas across
|
|
8
|
+
* all steps. Returns undefined if estimation fails for any step.
|
|
9
|
+
*/
|
|
10
|
+
export declare function quoteStepsL2Fee(steps: Array<{
|
|
11
|
+
tx: ViemTransactionRequest;
|
|
12
|
+
}>, ctx: BuildCtx): Promise<bigint | undefined>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Hex } from '../../../../../core/types/primitives';
|
|
2
|
+
import type { InteropParams } from '../../../../../core/types/flows/interop';
|
|
3
|
+
import type { BuildCtx } from '../context';
|
|
4
|
+
import type { InteropStarterData } from '../../../../../core/resources/interop/plan';
|
|
5
|
+
/** Build interop starter data for all actions in the bundle. */
|
|
6
|
+
export declare function getStarterData(params: InteropParams, ctx: BuildCtx, erc20AssetIds: Map<string, Hex>): Promise<InteropStarterData[]>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PublicClient } from 'viem';
|
|
2
|
+
/** String URL or live PublicClient — used only in resource/SDK config. */
|
|
3
|
+
export type ChainRef = string | PublicClient;
|
|
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;
|
|
8
|
+
}
|