@matterlabs/zksync-js 0.0.8 → 0.0.10
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 +1640 -236
- package/dist/adapters/ethers/client.cjs.map +1 -1
- package/dist/adapters/ethers/client.d.ts +11 -0
- package/dist/adapters/ethers/client.js +5 -5
- package/dist/adapters/ethers/index.cjs +4395 -1525
- package/dist/adapters/ethers/index.cjs.map +1 -1
- package/dist/adapters/ethers/index.d.ts +4 -0
- package/dist/adapters/ethers/index.js +8 -8
- package/dist/adapters/ethers/resources/contracts/types.d.ts +15 -0
- package/dist/adapters/ethers/resources/deposits/context.d.ts +3 -3
- package/dist/adapters/ethers/resources/deposits/services/gas.d.ts +2 -2
- package/dist/adapters/ethers/resources/deposits/services/verification.d.ts +1 -1
- package/dist/adapters/ethers/resources/interop/address.d.ts +18 -0
- package/dist/adapters/ethers/resources/interop/attributes/resource.d.ts +9 -0
- package/dist/adapters/ethers/resources/interop/context.d.ts +36 -0
- package/dist/adapters/ethers/resources/interop/index.d.ts +63 -0
- package/dist/adapters/ethers/resources/interop/resolvers.d.ts +9 -0
- package/dist/adapters/ethers/resources/interop/routes/direct.d.ts +2 -0
- package/dist/adapters/ethers/resources/interop/routes/indirect.d.ts +2 -0
- package/dist/adapters/ethers/resources/interop/routes/types.d.ts +13 -0
- package/dist/adapters/ethers/resources/interop/services/erc20.d.ts +15 -0
- package/dist/adapters/ethers/resources/interop/services/finalization/bundle.d.ts +15 -0
- package/dist/adapters/ethers/resources/interop/services/finalization/data-fetchers.d.ts +17 -0
- package/dist/adapters/ethers/resources/interop/services/finalization/decoders.d.ts +12 -0
- package/dist/adapters/ethers/resources/interop/services/finalization/index.d.ts +13 -0
- package/dist/adapters/ethers/resources/interop/services/finalization/polling.d.ts +7 -0
- package/dist/adapters/ethers/resources/interop/services/finalization/status.d.ts +5 -0
- package/dist/adapters/ethers/resources/interop/services/finalization/topics.d.ts +6 -0
- package/dist/adapters/ethers/resources/interop/services/starter-data.d.ts +6 -0
- package/dist/adapters/ethers/resources/interop/types.d.ts +16 -0
- package/dist/adapters/ethers/resources/withdrawals/context.d.ts +2 -2
- package/dist/adapters/ethers/sdk.cjs +3357 -917
- package/dist/adapters/ethers/sdk.cjs.map +1 -1
- package/dist/adapters/ethers/sdk.d.ts +10 -8
- package/dist/adapters/ethers/sdk.js +6 -6
- package/dist/adapters/viem/client.cjs +684 -31
- package/dist/adapters/viem/client.cjs.map +1 -1
- package/dist/adapters/viem/client.js +5 -3
- package/dist/adapters/viem/index.cjs +267 -273
- package/dist/adapters/viem/index.cjs.map +1 -1
- package/dist/adapters/viem/index.d.ts +1 -0
- package/dist/adapters/viem/index.js +8 -7
- package/dist/adapters/viem/resources/deposits/context.d.ts +3 -3
- package/dist/adapters/viem/resources/deposits/services/gas.d.ts +2 -2
- package/dist/adapters/viem/resources/deposits/services/verification.d.ts +1 -1
- package/dist/adapters/viem/resources/withdrawals/context.d.ts +2 -2
- package/dist/adapters/viem/sdk.cjs +39 -58
- package/dist/adapters/viem/sdk.cjs.map +1 -1
- package/dist/adapters/viem/sdk.js +6 -5
- package/dist/{chunk-NODVRI3E.js → chunk-AIFHAPJC.js} +8 -2
- package/dist/{chunk-3GFCAGGI.js → chunk-FBKBF7YM.js} +1533 -1434
- package/dist/chunk-HOZTREW6.js +209 -0
- package/dist/{chunk-L343N56B.js → chunk-IYEDEUXG.js} +1 -1
- package/dist/{chunk-63DNJXS3.js → chunk-MBEMIFYS.js} +1375 -75
- package/dist/chunk-N3FVEFOK.js +113 -0
- package/dist/{chunk-NVULC4JB.js → chunk-QDJOEVGJ.js} +2 -2
- package/dist/{chunk-5V2JRM5J.js → chunk-SRPKTXIF.js} +1 -1
- package/dist/{chunk-SHQQI3UD.js → chunk-UIXU35ZU.js} +1 -1
- package/dist/{chunk-ODMBZ2VX.js → chunk-VKUTFNZA.js} +42 -31
- package/dist/{chunk-LNIEQ7AN.js → chunk-ZBGQQ63V.js} +36 -167
- package/dist/{chunk-QZVYN3YA.js → chunk-ZVHFVUDE.js} +2 -37
- package/dist/core/index.cjs +3 -2
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.js +4 -4
- package/dist/core/resources/interop/attributes/types.d.ts +0 -2
- package/dist/core/resources/interop/finalization.d.ts +0 -1
- package/dist/core/types/errors.d.ts +15 -5
- package/dist/core/types/fees.d.ts +9 -0
- package/dist/core/types/flows/interop.d.ts +12 -36
- package/dist/core/types/primitives.d.ts +1 -0
- package/dist/index.cjs +3 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -4
- package/package.json +1 -1
- package/dist/chunk-FGXRG2JS.js +0 -142
|
@@ -4,10 +4,14 @@ export * from './sdk';
|
|
|
4
4
|
export * from './resources/utils';
|
|
5
5
|
export { createDepositsResource } from './resources/deposits';
|
|
6
6
|
export type { DepositsResource } from './resources/deposits';
|
|
7
|
+
export { getL2TransactionHashFromLogs } from './resources/deposits/services/verification';
|
|
7
8
|
export { createWithdrawalsResource } from './resources/withdrawals';
|
|
8
9
|
export { createFinalizationServices } from './resources/withdrawals';
|
|
9
10
|
export type { WithdrawalsResource, FinalizationServices } from './resources/withdrawals';
|
|
10
11
|
export { createTokensResource } from './resources/tokens';
|
|
12
|
+
export { createInteropResource } from './resources/interop';
|
|
13
|
+
export { createInteropFinalizationServices } from './resources/interop';
|
|
14
|
+
export type { InteropResource, InteropFinalizationServices } from './resources/interop';
|
|
11
15
|
export * from './errors/error-ops';
|
|
12
16
|
export * from './errors/revert';
|
|
13
17
|
export type * from './typechain';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { createEthersClient as createClient, createEthersClient } from '../../chunk-
|
|
2
|
-
export { buildDirectRequestStruct, createDepositsResource, createEthersSdk, createFinalizationServices, createTokensResource, createWithdrawalsResource, encodeNativeTokenVaultTransferData, encodeSecondBridgeArgs, encodeSecondBridgeDataV1, encodeSecondBridgeErc20Args, encodeSecondBridgeEthArgs } 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-
|
|
1
|
+
export { createEthersClient as createClient, createEthersClient } from '../../chunk-HOZTREW6.js';
|
|
2
|
+
export { buildDirectRequestStruct, createDepositsResource, createEthersSdk, createFinalizationServices, createInteropFinalizationServices, createInteropResource, createTokensResource, createWithdrawalsResource, encodeNativeTokenVaultTransferData, encodeSecondBridgeArgs, encodeSecondBridgeDataV1, encodeSecondBridgeErc20Args, encodeSecondBridgeEthArgs, getL2TransactionHashFromLogs } from '../../chunk-MBEMIFYS.js';
|
|
3
|
+
export { classifyReadinessFromRevert, createErrorHandlers, decodeRevert, registerErrorAbi, toZKsyncError } from '../../chunk-QDJOEVGJ.js';
|
|
4
|
+
import '../../chunk-AIFHAPJC.js';
|
|
5
|
+
import '../../chunk-ZVHFVUDE.js';
|
|
6
|
+
import '../../chunk-UIXU35ZU.js';
|
|
7
|
+
import '../../chunk-SRPKTXIF.js';
|
|
8
|
+
import '../../chunk-FBKBF7YM.js';
|
|
9
9
|
import '../../chunk-C3AGOEHR.js';
|
|
@@ -11,6 +11,9 @@ export interface ContractInstances {
|
|
|
11
11
|
l2AssetRouter: Contract;
|
|
12
12
|
l2NativeTokenVault: Contract;
|
|
13
13
|
l2BaseTokenSystem: Contract;
|
|
14
|
+
interopCenter: Contract;
|
|
15
|
+
interopHandler: Contract;
|
|
16
|
+
l2MessageVerification: Contract;
|
|
14
17
|
}
|
|
15
18
|
/**
|
|
16
19
|
* Contracts resource interface providing access to resolved addresses
|
|
@@ -57,4 +60,16 @@ export interface ContractsResource {
|
|
|
57
60
|
* Returns the L2 Base Token System contract instance.
|
|
58
61
|
*/
|
|
59
62
|
l2BaseTokenSystem(): Promise<Contract>;
|
|
63
|
+
/**
|
|
64
|
+
* Returns the Interop Center contract instance.
|
|
65
|
+
*/
|
|
66
|
+
interopCenter(): Promise<Contract>;
|
|
67
|
+
/**
|
|
68
|
+
* Returns the Interop Handler contract instance.
|
|
69
|
+
*/
|
|
70
|
+
interopHandler(): Promise<Contract>;
|
|
71
|
+
/**
|
|
72
|
+
* Returns the L2 Message Verification contract instance.
|
|
73
|
+
*/
|
|
74
|
+
l2MessageVerification(): Promise<Contract>;
|
|
60
75
|
}
|
|
@@ -2,7 +2,7 @@ import type { EthersClient } from '../../client';
|
|
|
2
2
|
import type { Address, Hex } from '../../../../core/types/primitives';
|
|
3
3
|
import type { DepositParams, DepositRoute } from '../../../../core/types/flows/deposits';
|
|
4
4
|
import type { CommonCtx } from '../../../../core/types/flows/base';
|
|
5
|
-
import type
|
|
5
|
+
import { type TxGasOverrides } from '../../../../core/types/fees';
|
|
6
6
|
import type { ResolvedToken, TokensResource } from '../../../../core/types/flows/token';
|
|
7
7
|
import type { ContractsResource } from '../contracts';
|
|
8
8
|
export interface BuildCtx extends CommonCtx {
|
|
@@ -14,7 +14,7 @@ export interface BuildCtx extends CommonCtx {
|
|
|
14
14
|
baseTokenL1: Address;
|
|
15
15
|
baseIsEth: boolean;
|
|
16
16
|
l1AssetRouter: Address;
|
|
17
|
-
gasOverrides?:
|
|
17
|
+
gasOverrides?: TxGasOverrides;
|
|
18
18
|
l2GasLimit?: bigint;
|
|
19
19
|
gasPerPubdata: bigint;
|
|
20
20
|
operatorTip: bigint;
|
|
@@ -33,7 +33,7 @@ export declare function commonCtx(p: DepositParams, client: EthersClient, tokens
|
|
|
33
33
|
bridgehub: `0x${string}`;
|
|
34
34
|
chainIdL2: bigint;
|
|
35
35
|
sender: `0x${string}`;
|
|
36
|
-
gasOverrides:
|
|
36
|
+
gasOverrides: TxGasOverrides | undefined;
|
|
37
37
|
l2GasLimit: bigint | undefined;
|
|
38
38
|
gasPerPubdata: bigint;
|
|
39
39
|
operatorTip: bigint;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { TransactionRequest } from 'ethers';
|
|
2
2
|
import type { BuildCtx } from '../context';
|
|
3
3
|
import type { DepositRoute } from '../../../../../core/types/flows/deposits';
|
|
4
|
-
import type {
|
|
4
|
+
import type { TxGasOverrides } from '../../../../../core/types/fees';
|
|
5
5
|
import type { Address } from '../../../../../core/types/primitives';
|
|
6
6
|
import { type GasQuote } from '../../../../../core/resources/deposits/gas';
|
|
7
7
|
export type { GasQuote };
|
|
8
8
|
export type QuoteL1GasInput = {
|
|
9
9
|
ctx: BuildCtx;
|
|
10
10
|
tx: TransactionRequest;
|
|
11
|
-
overrides?:
|
|
11
|
+
overrides?: TxGasOverrides;
|
|
12
12
|
fallbackGasLimit?: bigint;
|
|
13
13
|
};
|
|
14
14
|
export type QuoteL2GasInput = {
|
|
@@ -2,7 +2,7 @@ import { Interface, type Log, type Provider, type TransactionReceipt } from 'eth
|
|
|
2
2
|
import type { Hex } from '../../../../../core/types/primitives';
|
|
3
3
|
export declare const I_BRIDGEHUB: Interface;
|
|
4
4
|
export declare const TOPIC_BRIDGEHUB_NPR: string;
|
|
5
|
-
export declare function
|
|
5
|
+
export declare function getL2TransactionHashFromLogs(logs: ReadonlyArray<Log>): Hex | null;
|
|
6
6
|
export declare function waitForL2ExecutionFromL1Tx(l1: Provider, l2: Provider, l1TxHash: Hex): Promise<{
|
|
7
7
|
l2Receipt: TransactionReceipt;
|
|
8
8
|
l2TxHash: Hex;
|
|
@@ -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,9 @@
|
|
|
1
|
+
import { Interface } from 'ethers';
|
|
2
|
+
import { type AttributesResource } from '../../../../../core/resources/interop/attributes/resource';
|
|
3
|
+
import type { InteropParams } from '../../../../../core/types/flows/interop';
|
|
4
|
+
import type { BuildCtx } from '../context';
|
|
5
|
+
import type { InteropAttributes } from '../../../../../core/resources/interop/plan';
|
|
6
|
+
export declare function getInteropAttributes(params: InteropParams, ctx: BuildCtx): InteropAttributes;
|
|
7
|
+
export declare function createEthersAttributesResource(opts?: {
|
|
8
|
+
iface?: Interface;
|
|
9
|
+
}): AttributesResource;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { AbstractProvider } from 'ethers';
|
|
2
|
+
import { Interface } from 'ethers';
|
|
3
|
+
import type { EthersClient } from '../../client';
|
|
4
|
+
import type { Address } from '../../../../core/types/primitives';
|
|
5
|
+
import type { CommonCtx } from '../../../../core/types/flows/base';
|
|
6
|
+
import type { InteropParams } from '../../../../core/types/flows/interop';
|
|
7
|
+
import { type TxGasOverrides } from '../../../../core/types/fees';
|
|
8
|
+
import type { TokensResource } from '../../../../core/types/flows/token';
|
|
9
|
+
import type { AttributesResource } from '../../../../core/resources/interop/attributes/resource';
|
|
10
|
+
import type { ContractsResource } from '../contracts';
|
|
11
|
+
export interface BuildCtx extends CommonCtx {
|
|
12
|
+
client: EthersClient;
|
|
13
|
+
tokens: TokensResource;
|
|
14
|
+
contracts: ContractsResource;
|
|
15
|
+
bridgehub: Address;
|
|
16
|
+
dstChainId: bigint;
|
|
17
|
+
dstProvider: AbstractProvider;
|
|
18
|
+
chainId: bigint;
|
|
19
|
+
interopCenter: Address;
|
|
20
|
+
interopHandler: Address;
|
|
21
|
+
l2MessageVerification: Address;
|
|
22
|
+
l2AssetRouter: Address;
|
|
23
|
+
l2NativeTokenVault: Address;
|
|
24
|
+
baseTokens: {
|
|
25
|
+
src: Address;
|
|
26
|
+
dst: Address;
|
|
27
|
+
matches: boolean;
|
|
28
|
+
};
|
|
29
|
+
ifaces: {
|
|
30
|
+
interopCenter: Interface;
|
|
31
|
+
interopHandler: Interface;
|
|
32
|
+
};
|
|
33
|
+
attributes: AttributesResource;
|
|
34
|
+
gasOverrides?: TxGasOverrides;
|
|
35
|
+
}
|
|
36
|
+
export declare function commonCtx(dstProvider: AbstractProvider, params: InteropParams, client: EthersClient, tokens: TokensResource, contracts: ContractsResource, attributes: AttributesResource): Promise<BuildCtx>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { EthersClient } from '../../client';
|
|
2
|
+
import type { AttributesResource } from '../../../../core/resources/interop/attributes/resource';
|
|
3
|
+
import type { InteropRoute, InteropPlan, InteropQuote, InteropStatus, InteropFinalizationResult } from '../../../../core/types/flows/interop';
|
|
4
|
+
import type { ContractsResource } from '../contracts';
|
|
5
|
+
import type { TokensResource } from '../../../../core/types/flows/token';
|
|
6
|
+
import type { InteropRouteStrategy } from './routes/types';
|
|
7
|
+
import type { TransactionRequest } from 'ethers';
|
|
8
|
+
import { createInteropFinalizationServices, type InteropFinalizationServices } from './services/finalization';
|
|
9
|
+
import type { LogsQueryOptions } from './services/finalization/data-fetchers';
|
|
10
|
+
import type { InteropParams, InteropHandle, InteropWaitable, InteropFinalizationInfo } from './types';
|
|
11
|
+
export declare const ROUTES: Record<InteropRoute, InteropRouteStrategy>;
|
|
12
|
+
export interface InteropResource {
|
|
13
|
+
quote(params: InteropParams): Promise<InteropQuote>;
|
|
14
|
+
tryQuote(params: InteropParams): Promise<{
|
|
15
|
+
ok: true;
|
|
16
|
+
value: InteropQuote;
|
|
17
|
+
} | {
|
|
18
|
+
ok: false;
|
|
19
|
+
error: unknown;
|
|
20
|
+
}>;
|
|
21
|
+
prepare(params: InteropParams): Promise<InteropPlan<TransactionRequest>>;
|
|
22
|
+
tryPrepare(params: InteropParams): Promise<{
|
|
23
|
+
ok: true;
|
|
24
|
+
value: InteropPlan<TransactionRequest>;
|
|
25
|
+
} | {
|
|
26
|
+
ok: false;
|
|
27
|
+
error: unknown;
|
|
28
|
+
}>;
|
|
29
|
+
create(params: InteropParams): Promise<InteropHandle<TransactionRequest>>;
|
|
30
|
+
tryCreate(params: InteropParams): Promise<{
|
|
31
|
+
ok: true;
|
|
32
|
+
value: InteropHandle<TransactionRequest>;
|
|
33
|
+
} | {
|
|
34
|
+
ok: false;
|
|
35
|
+
error: unknown;
|
|
36
|
+
}>;
|
|
37
|
+
status(h: InteropWaitable, opts?: LogsQueryOptions): Promise<InteropStatus>;
|
|
38
|
+
wait(h: InteropWaitable, opts?: {
|
|
39
|
+
pollMs?: number;
|
|
40
|
+
timeoutMs?: number;
|
|
41
|
+
}): Promise<InteropFinalizationInfo>;
|
|
42
|
+
tryWait(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(h: InteropWaitable | InteropFinalizationInfo, opts?: LogsQueryOptions): Promise<InteropFinalizationResult>;
|
|
53
|
+
tryFinalize(h: InteropWaitable | InteropFinalizationInfo, opts?: LogsQueryOptions): Promise<{
|
|
54
|
+
ok: true;
|
|
55
|
+
value: InteropFinalizationResult;
|
|
56
|
+
} | {
|
|
57
|
+
ok: false;
|
|
58
|
+
error: unknown;
|
|
59
|
+
}>;
|
|
60
|
+
}
|
|
61
|
+
export declare function createInteropResource(client: EthersClient, tokens?: TokensResource, contracts?: ContractsResource, attributes?: AttributesResource): InteropResource;
|
|
62
|
+
export { createInteropFinalizationServices };
|
|
63
|
+
export type { InteropFinalizationServices };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type AbstractProvider } from 'ethers';
|
|
2
|
+
import type { InteropWaitable as InteropWaitableBase } from '../../../../core/types/flows/interop';
|
|
3
|
+
import type { DstChain, InteropWaitable } from './types';
|
|
4
|
+
/** Resolve a destination chain input (URL string or provider) into an AbstractProvider. */
|
|
5
|
+
export declare function resolveDstProvider(dstChain: DstChain): AbstractProvider;
|
|
6
|
+
export declare function resolveWaitableInput(waitableInput: InteropWaitable): {
|
|
7
|
+
dstProvider: AbstractProvider;
|
|
8
|
+
waitable: InteropWaitableBase;
|
|
9
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TransactionRequest } from 'ethers';
|
|
2
|
+
import type { InteropParams } from '../../../../../core/types/flows/interop';
|
|
3
|
+
import type { BuildCtx } from '../context';
|
|
4
|
+
import type { PlanStep, ApprovalNeed } from '../../../../../core/types/flows/base';
|
|
5
|
+
import type { QuoteExtras } from '../../../../../core/types/flows/interop';
|
|
6
|
+
export interface InteropRouteStrategy {
|
|
7
|
+
preflight(params: InteropParams, ctx: BuildCtx): Promise<void>;
|
|
8
|
+
build(params: InteropParams, ctx: BuildCtx): Promise<{
|
|
9
|
+
steps: Array<PlanStep<TransactionRequest>>;
|
|
10
|
+
approvals: ApprovalNeed[];
|
|
11
|
+
quoteExtras: QuoteExtras;
|
|
12
|
+
}>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type TransactionRequest } from 'ethers';
|
|
2
|
+
import type { Address, Hex } from '../../../../../core/types/primitives';
|
|
3
|
+
import type { InteropParams } from '../../../../../core/types/flows/interop';
|
|
4
|
+
import type { BuildCtx } from '../context';
|
|
5
|
+
/** Collect unique ERC-20 token addresses referenced by `sendErc20` actions. */
|
|
6
|
+
export declare function getErc20Tokens(params: InteropParams): Address[];
|
|
7
|
+
/** Build NTV `ensureTokenIsRegistered` steps for each ERC-20 token. */
|
|
8
|
+
export declare function buildEnsureTokenSteps(erc20Tokens: Address[], ctx: BuildCtx): Array<{
|
|
9
|
+
key: string;
|
|
10
|
+
kind: string;
|
|
11
|
+
description: string;
|
|
12
|
+
tx: TransactionRequest;
|
|
13
|
+
}>;
|
|
14
|
+
/** Resolve asset IDs for each ERC-20 token via a static-call to NTV. */
|
|
15
|
+
export declare function resolveErc20AssetIds(erc20Tokens: Address[], ctx: BuildCtx): Promise<Map<string, Hex>>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type AbstractProvider, type TransactionReceipt } from 'ethers';
|
|
2
|
+
import type { Hex } from '../../../../../../core/types/primitives';
|
|
3
|
+
import type { InteropFinalizationInfo } from '../../../../../../core/types/flows/interop';
|
|
4
|
+
import type { EthersClient } 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: EthersClient, dstProvider: AbstractProvider, topics: InteropTopics, bundleHash: Hex, opts?: LogsQueryOptions): Promise<{
|
|
9
|
+
phase: InteropPhase;
|
|
10
|
+
dstExecTxHash?: Hex;
|
|
11
|
+
}>;
|
|
12
|
+
export declare function executeBundle(client: EthersClient, dstProvider: AbstractProvider, info: InteropFinalizationInfo, opts?: LogsQueryOptions): Promise<{
|
|
13
|
+
hash: Hex;
|
|
14
|
+
wait: () => Promise<TransactionReceipt>;
|
|
15
|
+
}>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type AbstractProvider } from 'ethers';
|
|
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: AbstractProvider, txHash: Hex): Promise<{
|
|
9
|
+
logs: {
|
|
10
|
+
address: Address;
|
|
11
|
+
topics: Hex[];
|
|
12
|
+
data: Hex;
|
|
13
|
+
transactionHash: Hex;
|
|
14
|
+
}[];
|
|
15
|
+
} | null>;
|
|
16
|
+
export declare function getLogs(provider: AbstractProvider, address: Address, topics: Array<Hex | null>, opts?: LogsQueryOptions): Promise<Log[]>;
|
|
17
|
+
export declare function getInteropRoot(provider: AbstractProvider, rootChainId: bigint, batchNumber: bigint): Promise<Hex>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type Interface } from 'ethers';
|
|
2
|
+
import type { Hex } from '../../../../../../core/types/primitives';
|
|
3
|
+
import type { Log } from '../../../../../../core/types/transactions';
|
|
4
|
+
export declare function decodeInteropBundleSent(centerIface: Interface, log: {
|
|
5
|
+
data: Hex;
|
|
6
|
+
topics: Hex[];
|
|
7
|
+
}): {
|
|
8
|
+
bundleHash: Hex;
|
|
9
|
+
sourceChainId: bigint;
|
|
10
|
+
destinationChainId: bigint;
|
|
11
|
+
};
|
|
12
|
+
export declare function decodeL1MessageData(log: Log): Hex;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AbstractProvider } from 'ethers';
|
|
2
|
+
import type { InteropStatus, InteropWaitable, InteropFinalizationInfo, InteropFinalizationResult } from '../../../../../../core/types/flows/interop';
|
|
3
|
+
import type { EthersClient } from '../../../../client';
|
|
4
|
+
import type { LogsQueryOptions } from './data-fetchers';
|
|
5
|
+
export interface InteropFinalizationServices {
|
|
6
|
+
status(dstProvider: AbstractProvider, input: InteropWaitable, opts?: LogsQueryOptions): Promise<InteropStatus>;
|
|
7
|
+
wait(dstProvider: AbstractProvider, input: InteropWaitable, opts?: {
|
|
8
|
+
pollMs?: number;
|
|
9
|
+
timeoutMs?: number;
|
|
10
|
+
}): Promise<InteropFinalizationInfo>;
|
|
11
|
+
finalize(dstProvider: AbstractProvider, info: InteropFinalizationInfo, opts?: LogsQueryOptions): Promise<InteropFinalizationResult>;
|
|
12
|
+
}
|
|
13
|
+
export declare function createInteropFinalizationServices(client: EthersClient): InteropFinalizationServices;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AbstractProvider } from 'ethers';
|
|
2
|
+
import type { InteropWaitable, InteropFinalizationInfo } from '../../../../../../core/types/flows/interop';
|
|
3
|
+
import type { EthersClient } from '../../../../client';
|
|
4
|
+
export declare function waitForFinalization(client: EthersClient, dstProvider: AbstractProvider, input: InteropWaitable, opts?: {
|
|
5
|
+
pollMs?: number;
|
|
6
|
+
timeoutMs?: number;
|
|
7
|
+
}): Promise<InteropFinalizationInfo>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AbstractProvider } from 'ethers';
|
|
2
|
+
import type { InteropStatus, InteropWaitable } from '../../../../../../core/types/flows/interop';
|
|
3
|
+
import type { EthersClient } from '../../../../client';
|
|
4
|
+
import type { LogsQueryOptions } from './data-fetchers';
|
|
5
|
+
export declare function getStatus(client: EthersClient, dstProvider: AbstractProvider, input: InteropWaitable, opts?: LogsQueryOptions): Promise<InteropStatus>;
|
|
@@ -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,16 @@
|
|
|
1
|
+
import type { AbstractProvider } from 'ethers';
|
|
2
|
+
import type { InteropParams as InteropParamsBase, InteropHandle as InteropHandleBase, InteropWaitable as InteropWaitableBase, InteropFinalizationInfo as InteropFinalizationInfoBase } from '../../../../core/types/flows/interop';
|
|
3
|
+
export type DstChain = string | AbstractProvider;
|
|
4
|
+
export interface InteropParams extends InteropParamsBase {
|
|
5
|
+
dstChain: DstChain;
|
|
6
|
+
}
|
|
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
|
+
};
|
|
@@ -2,7 +2,7 @@ import type { EthersClient } from '../../client';
|
|
|
2
2
|
import type { Address } from '../../../../core/types/primitives';
|
|
3
3
|
import { type WithdrawParams, type WithdrawRoute } from '../../../../core/types/flows/withdrawals';
|
|
4
4
|
import type { CommonCtx } from '../../../../core/types/flows/base';
|
|
5
|
-
import type
|
|
5
|
+
import { type TxGasOverrides } from '../../../../core/types/fees';
|
|
6
6
|
import type { Hex } from '../../../../core/types/primitives';
|
|
7
7
|
import type { ResolvedToken, TokensResource } from '../../../../core/types/flows/token';
|
|
8
8
|
import type { ContractsResource } from '../contracts';
|
|
@@ -20,7 +20,7 @@ export interface BuildCtx extends CommonCtx {
|
|
|
20
20
|
l2AssetRouter: Address;
|
|
21
21
|
l2NativeTokenVault: Address;
|
|
22
22
|
l2BaseTokenSystem: Address;
|
|
23
|
-
gasOverrides?:
|
|
23
|
+
gasOverrides?: TxGasOverrides;
|
|
24
24
|
}
|
|
25
25
|
export declare function commonCtx(p: WithdrawParams, client: EthersClient, tokens: TokensResource, contracts: ContractsResource): Promise<BuildCtx & {
|
|
26
26
|
route: WithdrawRoute;
|