import type { DepositParamsStruct, IGatewayV1, IGatewayV2, SendParamsStruct, SwapParamsStruct, } from "./contracts"; export type MultiAddressStruct = { kind: number; data: string; }; export type GatewayV1OutboundMessageAccepted = { channelId: string; nonce: bigint; messageId: string; blockNumber: number; blockHash: string; txHash: string; txIndex: number; }; export type GatewayV2OutboundMessageAccepted = { nonce: bigint; payload: { origin: string; assets: [number, string][]; xcm: [number, string]; claimer: string; value: bigint; executionFee: bigint; relayerFee: bigint; }; blockNumber: number; blockHash: string; txHash: string; txIndex: number; }; export type L2MessageReceipt = { messageId: string; depositId: bigint; blockNumber: number; blockHash: string; txHash: string; txIndex: number; }; export type FeeData = { gasPrice: bigint | null; maxFeePerGas: bigint | null; maxPriorityFeePerGas: bigint | null; }; export type EncodedMultiAddress = MultiAddressStruct; export type L1AdapterDepositParams = { inputToken: string; outputToken: string; inputAmount: bigint; outputAmount: bigint; destinationChainId: number; fillDeadlineBuffer: bigint; }; export type L1SwapRouterExactOutputSingleParams = { tokenIn: string; tokenOut: string; fee: bigint; recipient: string; deadline: bigint; amountOut: bigint; amountInMaximum: bigint; sqrtPriceLimitX96: bigint; }; export type L1LegacySwapRouterExactOutputSingleParams = { tokenIn: string; tokenOut: string; fee: bigint; recipient: string; amountOut: bigint; amountInMaximum: bigint; sqrtPriceLimitX96: bigint; }; // Parameters for reconstructing the Across `message` (an `abi.encode`d // `Instructions { Call[] calls; address fallbackRecipient }`) that the L2 // adaptor emits on-chain. Used purely off-chain to obtain a message-aware gas // estimate from the Across `/suggested-fees` API. When `swap` is provided the // ERC20 (`sendTokenAndCall`) 7-call message is built, otherwise the native // ether (`sendEtherAndCall`) 2-call message is built. export type AcrossDepositMessageParams = { outputToken: string; gateway: string; l1Weth: string; fallbackRecipient: string; xcm: Uint8Array; assets: string[]; claimer: Uint8Array; executionFee: bigint; relayerFee: bigint; destinationExecutionFee: bigint; outputAmount: bigint; swap?: { router: string; inputAmount: bigint; callData: string; }; }; export interface EthereumProviderTypes { Connection: unknown; Contract: unknown; Abi: unknown; TransactionReceipt: unknown; ContractTransaction: unknown; } export type EthereumProviderConnectionOptions = { headers?: Record; }; export interface EthereumProvider { readonly providerTypes: T; createProvider(url: string, options?: EthereumProviderConnectionOptions): T["Connection"]; destroyProvider(provider: T["Connection"]): void; destroyContract(contract: T["Contract"]): Promise; connectContract( address: string, abi: T["Abi"], provider: T["Connection"], ): T["Contract"]; erc20Balance( provider: T["Connection"], tokenAddress: string, owner: string, spender: string, ): Promise<{ balance: bigint; gatewayAllowance: bigint }>; encodeFunctionData( abi: T["Abi"], method: string, args: readonly unknown[], ): string; encodeAbiParameters(types: string[], values: readonly unknown[]): string; decodeFunctionResult( abi: T["Abi"], method: string, data: string, ): U; encodeNativeAsset(tokenAddress: string, amount: bigint): string; buildAcrossDepositMessage(params: AcrossDepositMessageParams): string; l1AdapterDepositNativeEther( params: L1AdapterDepositParams, recipient: string, topic: string, ): string; l1AdapterDepositToken( params: L1AdapterDepositParams, recipient: string, topic: string, ): string; l1SwapRouterExactOutputSingle( params: L1SwapRouterExactOutputSingleParams, ): string; l1LegacySwapRouterExactOutputSingle( params: L1LegacySwapRouterExactOutputSingleParams, ): string; beneficiaryMultiAddress(beneficiary: string): MultiAddressStruct; estimateGas( provider: T["Connection"], tx: T["ContractTransaction"], ): Promise; getTransactionCount( provider: T["Connection"], address: string, blockTag?: "latest" | "pending", ): Promise; gatewayV1SendToken( provider: T["Connection"], gatewayAddress: string, sender: string, token: string, destinationChain: number, destinationAddress: MultiAddressStruct, destinationFee: bigint, amount: bigint, value: bigint, ): Promise; gatewayV2RegisterToken( provider: T["Connection"], gatewayAddress: string, sender: string, token: string, network: number, executionFee: bigint, relayerFee: bigint, value: bigint, ): Promise; gatewayV2CreateAgent( provider: T["Connection"], gatewayAddress: string, id: string, ): Promise; gatewayV2SendMessage( provider: T["Connection"], gatewayAddress: string, sender: string, xcm: Uint8Array, assets: string[], claimer: Uint8Array, executionFee: bigint, relayerFee: bigint, value: bigint, ): Promise; l2AdapterSendEtherAndCall( provider: T["Connection"], adapterAddress: string, sender: string, params: DepositParamsStruct, sendParams: SendParamsStruct, recipient: string, topic: string, value?: bigint, ): Promise; l2AdapterSendTokenAndCall( provider: T["Connection"], adapterAddress: string, sender: string, params: DepositParamsStruct, swapParams: SwapParamsStruct, sendParams: SendParamsStruct, recipient: string, topic: string, ): Promise; evmParachainTransferAssetsUsingTypeAndThenAddress( provider: T["Connection"], precompileAddress: string, sourceAccount: string, destination: [number, string[]], assets: [string, bigint][], assetsTransferType: number, remoteFeesIdIndex: number, feesTransferType: number, customXcmHex: string, ): Promise; getBalance(provider: T["Connection"], address: string): Promise; getFeeData(provider: T["Connection"]): Promise; parseUnits(value: string, decimals: number): bigint; gatewayOperatingMode( gateway: T["Contract"] & (IGatewayV1 | IGatewayV2), ): Promise; gatewayChannelOperatingModeOf( gateway: T["Contract"] & IGatewayV1, channelId: string, ): Promise; isContractAddress( provider: T["Connection"], address: string, ): Promise; scanGatewayV1OutboundMessageAccepted( receipt: T["TransactionReceipt"], ): GatewayV1OutboundMessageAccepted | null; scanGatewayV2OutboundMessageAccepted( receipt: T["TransactionReceipt"], ): GatewayV2OutboundMessageAccepted | null; scanL2WrapperDepositCallInvoked( receipt: T["TransactionReceipt"], ): L2MessageReceipt | null; }