UNPKG

@avalanche-sdk/interchain

Version:
65 lines 3.72 kB
import { WalletClient } from "viem"; import { ChainConfig } from "../chains/types/chainConfig"; import { DefaultICMParams } from "./types/defaultICMParams"; import { SendMessageArgs } from "./types/sendMsgArgs"; /** * Inter-Chain Messaging (ICM) client for sending cross-chain messages via Teleporter protocol. * * This class provides functionality to send messages between different blockchains * using the Teleporter bridge protocol. It handles message encoding, fee management, * and contract interactions. */ export declare class ICM { /** The Teleporter contract address for cross-chain messaging */ teleporterAddress: `0x${string}`; /** The viem's wallet client for signing and sending transactions */ wallet: WalletClient; /** Default recipient address when none is specified (zero address) */ defaultRecipient: "0x0000000000000000000000000000000000000000"; /** Source blockchain configuration */ sourceChain: ChainConfig | undefined; /** Destination blockchain configuration */ destinationChain: ChainConfig | undefined; /** Default fee information for cross-chain messages */ feeInfo: { feeTokenAddress: string; amount: bigint; }; /** Default gas limit required for message execution on destination chain */ requiredGasLimit: bigint; /** List of allowed relayer addresses for message delivery */ allowedRelayerAddresses: string[]; private telemetry; constructor(wallet: WalletClient, sourceChain?: ChainConfig, destinationChain?: ChainConfig, defaultParams?: DefaultICMParams, enableTelemetry?: boolean); /** * Sends a cross-chain message to the specified destination blockchain. * * This method encodes the message, constructs the Teleporter message input, * and submits the transaction to the Teleporter contract on the source chain. * * @param params - Parameters for sending the cross-chain message * @param params.message - The message content to send (will be encoded as string) * @param params.sourceChain - Source blockchain configuration (required if not set in constructor) * @param params.destinationChain - Destination blockchain configuration (required if not set in constructor) * @param params.recipientAddress - Optional recipient address on destination chain (defaults to zero address) * @param params.feeInfo - Optional fee information (overrides default if provided) * @param params.requiredGasLimit - Optional gas limit (overrides default if provided) * @param params.allowedRelayerAddresses - Optional relayer addresses (overrides default if provided) * * @returns Promise<string> - The transaction hash of the submitted cross-chain message */ sendMsg(params: SendMessageArgs): Promise<string>; } /** * Creates a new ICM client instance. * * @param wallet - The Viem's wallet client for signing and sending transactions * @param sourceChain - Optional source blockchain configuration. If not provided, must be specified in sendMsg calls * @param destinationChain - Optional destination blockchain configuration. If not provided, must be specified in sendMsg calls * @param defaultParams - Optional default parameters for cross-chain messaging * @param defaultParams.feeInfo - Default fee information (token address and amount) * @param defaultParams.requiredGasLimit - Default gas limit for message execution * @param defaultParams.allowedRelayerAddresses - Default list of allowed relayer addresses */ export declare function createICMClient(wallet: WalletClient, sourceChain?: ChainConfig, destinationChain?: ChainConfig, defaultParams?: DefaultICMParams): ICM; //# sourceMappingURL=icm.d.ts.map