UNPKG

@hyperlane-xyz/sdk

Version:

The official SDK for the Hyperlane Network

78 lines 4.79 kB
import { TransactionReceipt } from '@ethersproject/providers'; import { ethers } from 'ethers'; import type { TransactionReceipt as ViemTxReceipt } from 'viem'; import { IMessageRecipient } from '@hyperlane-xyz/core'; import { Address, AddressBytes32 } from '@hyperlane-xyz/utils'; import { HyperlaneApp } from '../app/HyperlaneApp.js'; import { HyperlaneAddressesMap } from '../contracts/types.js'; import { DerivedHookConfig } from '../hook/types.js'; import { DerivedIsmConfig } from '../ism/types.js'; import { MultiProvider } from '../providers/MultiProvider.js'; import { RouterConfig } from '../router/types.js'; import { ChainMap, ChainName, OwnableConfig } from '../types.js'; import { CoreFactories } from './contracts.js'; import { DispatchEvent } from './events.js'; import { DispatchedMessage } from './types.js'; export declare class HyperlaneCore extends HyperlaneApp<CoreFactories> { static fromAddressesMap(addressesMap: HyperlaneAddressesMap<any>, multiProvider: MultiProvider): HyperlaneCore; getRouterConfig: (owners: Address | ChainMap<OwnableConfig>) => ChainMap<RouterConfig>; quoteGasPayment: (origin: ChainName, destination: ChainName, recipient: AddressBytes32, body: string, metadata?: string, hook?: Address) => Promise<ethers.BigNumber>; getDestination(message: DispatchedMessage): ChainName; getOrigin(message: DispatchedMessage): ChainName; getRecipientIsmAddress(message: DispatchedMessage): Promise<Address>; getHookAddress(message: DispatchedMessage): Promise<Address>; getRecipientIsmConfig(message: DispatchedMessage): Promise<DerivedIsmConfig>; getHookConfig(message: DispatchedMessage): Promise<DerivedHookConfig>; sendMessage(origin: ChainName, destination: ChainName, recipient: Address, body: string, hook?: Address, metadata?: string): Promise<{ dispatchTx: TransactionReceipt; message: DispatchedMessage; }>; onDispatch(handler: (message: DispatchedMessage, event: DispatchEvent) => Promise<void>, chains?: string[]): { removeHandler: (chains?: ChainName[]) => void; }; getDefaults(): Promise<ChainMap<{ ism: Address; hook: Address; }>>; getIsm(destinationChain: ChainName, recipientAddress: Address): Promise<Address>; protected getRecipient(message: DispatchedMessage): IMessageRecipient; estimateHandle(message: DispatchedMessage): Promise<string>; /** * Estimates gas for calling handle() on a recipient contract. * * This is a flexible utility that accepts minimal parameters (destination, * recipient, origin, sender, body) instead of requiring a full DispatchedMessage. * Use this when you have message components but not a complete DispatchedMessage object. * * @param params - Object containing: * - destination: The destination chain name * - recipient: The recipient contract address (or any IMessageRecipient implementation like ICA router) * - origin: The origin domain ID * - sender: The sender address (as bytes32 string) * - body: The message body (as hex string) * - mailbox: Optional mailbox address override (defaults to chain's configured mailbox) * @returns Gas estimate as a string, or '0' if estimation fails */ estimateHandleGas(params: { destination: ChainName; recipient: Address; origin: number; sender: string; body: string; mailbox?: Address; }): Promise<string>; deliver(message: DispatchedMessage, ismMetadata: string): Promise<ethers.ContractReceipt>; getHook(originChain: ChainName, senderAddress: Address): Promise<Address>; isDelivered(message: DispatchedMessage): Promise<boolean>; getSenderHookAddress(message: DispatchedMessage): Promise<Address>; getProcessedReceipt(message: DispatchedMessage): Promise<ethers.ContractReceipt>; protected waitForProcessReceipt(message: DispatchedMessage): Promise<ethers.ContractReceipt>; waitForMessageIdProcessed(messageId: string, destination: ChainName, delayMs?: number, maxAttempts?: number): Promise<true>; waitForMessageProcessing(sourceTx: ethers.ContractReceipt | ViemTxReceipt): Promise<ethers.ContractReceipt[]>; waitForMessageProcessed(sourceTx: ethers.ContractReceipt | ViemTxReceipt, delay?: number, maxAttempts?: number): Promise<void>; getDispatchedMessages(sourceTx: TransactionReceipt | ViemTxReceipt): DispatchedMessage[]; getDispatchTx(originChain: ChainName, messageId: string, blockNumber?: number): Promise<TransactionReceipt>; static parseDispatchedMessage(message: string): DispatchedMessage; static getDispatchedMessages(sourceTx: TransactionReceipt | ViemTxReceipt): DispatchedMessage[]; } //# sourceMappingURL=HyperlaneCore.d.ts.map