import { Logger } from 'pino'; import { Address, HexString } from '@hyperlane-xyz/utils'; import { MultiProtocolProvider } from '../providers/MultiProtocolProvider.js'; import { TransactionFeeEstimate } from '../providers/transactionFeeEstimators.js'; import { IToken } from '../token/IToken.js'; import { Token } from '../token/Token.js'; import { TokenAmount } from '../token/TokenAmount.js'; import { ChainName, ChainNameOrId } from '../types.js'; import { FeeConstantConfig, RouteBlacklist, WarpCoreFeeEstimate, WarpTypedTransaction } from './types.js'; export interface WarpCoreOptions { logger?: Logger; localFeeConstants?: FeeConstantConfig; interchainFeeConstants?: FeeConstantConfig; routeBlacklist?: RouteBlacklist; } export declare class WarpCore { readonly multiProvider: MultiProtocolProvider<{ mailbox?: Address; }>; readonly tokens: Token[]; readonly localFeeConstants: FeeConstantConfig; readonly interchainFeeConstants: FeeConstantConfig; readonly routeBlacklist: RouteBlacklist; readonly logger: Logger; constructor(multiProvider: MultiProtocolProvider<{ mailbox?: Address; }>, tokens: Token[], options?: WarpCoreOptions); /** * Takes the serialized representation of a warp config and returns a WarpCore instance * @param multiProvider the MultiProtocolProvider containing chain metadata * @param config the config object of type WarpCoreConfig */ static FromConfig(multiProvider: MultiProtocolProvider<{ mailbox?: Address; }>, config: unknown): WarpCore; /** * Queries the token router for an interchain gas quote (i.e. IGP fee). * and for token fee quote if it exists. * Sender is only required for Sealevel origins. */ getInterchainTransferFee({ originTokenAmount, destination, sender, recipient, destinationToken, }: { originTokenAmount: TokenAmount; destination: ChainNameOrId; sender?: Address; recipient: Address; destinationToken?: IToken; }): Promise<{ igpQuote: TokenAmount; tokenFeeQuote?: TokenAmount; }>; /** * Simulates a transfer to estimate 'local' gas fees on the origin chain */ getLocalTransferFee({ originToken, destination, sender, senderPubKey, interchainFee, tokenFeeQuote, destinationToken, }: { originToken: IToken; destination: ChainNameOrId; sender: Address; senderPubKey?: HexString; interchainFee?: TokenAmount; tokenFeeQuote?: TokenAmount; destinationToken?: IToken; }): Promise; /** * Similar to getLocalTransferFee in that it estimates local gas fees * but it also resolves the native token and returns a TokenAmount * @todo: rename to getLocalTransferFee for consistency (requires breaking change) */ getLocalTransferFeeAmount({ originToken, destination, sender, senderPubKey, interchainFee, tokenFeeQuote, destinationToken, }: { originToken: IToken; destination: ChainNameOrId; sender: Address; senderPubKey?: HexString; interchainFee?: TokenAmount; tokenFeeQuote?: TokenAmount; destinationToken?: IToken; }): Promise; /** * Gets a list of populated transactions required to transfer a token to a remote chain * Typically just 1 transaction but sometimes more, like when an approval is required first */ getTransferRemoteTxs({ originTokenAmount, destination, sender, recipient, interchainFee, tokenFeeQuote, destinationToken, }: { originTokenAmount: TokenAmount; destination: ChainNameOrId; sender: Address; recipient: Address; interchainFee?: TokenAmount; tokenFeeQuote?: TokenAmount; destinationToken?: IToken; }): Promise>; /** * Check if this is a MultiCollateral transfer. * Returns true if both tokens are MultiCollateral tokens. */ protected isMultiCollateralTransfer(originToken: IToken, destinationToken?: IToken): destinationToken is IToken; /** * Executes a MultiCollateral transfer between different collateral routers. * Uses transferRemoteTo for both same-chain and cross-chain transfers. * Same-chain: calls handle() directly on target router (atomic, no relay needed). */ protected getMultiCollateralTransferTxs({ originTokenAmount, destination, sender, recipient, destinationToken, }: { originTokenAmount: TokenAmount; destination: ChainNameOrId; sender: Address; recipient: Address; destinationToken: IToken; }): Promise>; /** * Fetch local and interchain fee estimates for a remote transfer */ estimateTransferRemoteFees({ originTokenAmount, destination, recipient, sender, senderPubKey, destinationToken, }: { originTokenAmount: TokenAmount; destination: ChainNameOrId; recipient: Address; sender: Address; senderPubKey?: HexString; destinationToken?: IToken; }): Promise; /** * Estimate fees for a MultiCollateral transfer. */ protected estimateMultiCollateralFees({ originTokenAmount, destination, destinationToken, recipient, sender, senderPubKey, }: { originTokenAmount: TokenAmount; destination: ChainNameOrId; destinationToken: IToken; recipient: Address; sender: Address; senderPubKey?: HexString; }): Promise; /** * Computes the max transferrable amount of the from the given * token balance, accounting for local and interchain gas fees */ getMaxTransferAmount({ balance, destination, recipient, sender, senderPubKey, feeEstimate, destinationToken, }: { balance: TokenAmount; destination: ChainNameOrId; recipient: Address; sender: Address; senderPubKey?: HexString; feeEstimate?: WarpCoreFeeEstimate; destinationToken?: IToken; }): Promise; getTokenCollateral(token: IToken): Promise; /** * Checks if destination chain's collateral is sufficient to cover the transfer */ isDestinationCollateralSufficient({ originTokenAmount, destination, destinationToken, }: { originTokenAmount: TokenAmount; destination: ChainNameOrId; destinationToken?: IToken; }): Promise; /** * Checks if a token transfer requires an approval tx first */ isApproveRequired({ originTokenAmount, owner, }: { originTokenAmount: TokenAmount; owner: Address; }): Promise; /** * Ensure the remote token transfer would be valid for the given chains, amount, sender, and recipient */ validateTransfer({ originTokenAmount, destination, recipient, sender, senderPubKey, destinationToken, }: { originTokenAmount: TokenAmount; destination: ChainNameOrId; recipient: Address; sender: Address; senderPubKey?: HexString; destinationToken?: IToken; }): Promise | null>; /** * Ensure the origin and destination chains are valid and known by this WarpCore */ protected validateChains(origin: ChainNameOrId, destination: ChainNameOrId): Record | null; /** * Ensure recipient address is valid for the destination chain */ protected validateRecipient(recipient: Address, destination: ChainNameOrId): Record | null; /** * Ensure token amount is valid */ protected validateAmount(originTokenAmount: TokenAmount, destination: ChainNameOrId, recipient: Address, destinationToken?: IToken): Promise | null>; /** * Ensure the sender has sufficient balances for transfer and interchain gas */ protected validateTokenBalances(originTokenAmount: TokenAmount, destination: ChainNameOrId, sender: Address, recipient: Address, senderPubKey?: HexString, destinationToken?: IToken): Promise | null>; /** * Ensure the sender has sufficient balances for transfer and interchain gas */ protected validateDestinationCollateral(originTokenAmount: TokenAmount, destination: ChainNameOrId, destinationToken?: IToken): Promise | null>; /** * Ensure the sender has sufficient balances for minting */ protected validateDestinationRateLimit(originTokenAmount: TokenAmount, destination: ChainNameOrId, destinationToken?: IToken): Promise | null>; /** * Ensure the sender has sufficient balances for transfer and interchain gas */ protected validateOriginCollateral(originTokenAmount: TokenAmount): Promise | null>; protected resolveDestinationToken({ originToken, destination, destinationToken, }: { originToken: IToken; destination: ChainNameOrId; destinationToken?: IToken; }): IToken; /** * Search through token list to find token with matching chain and address */ findToken(chainName: ChainName, addressOrDenom?: Address | string): Token | null; /** * Get the list of chains referenced by the tokens in this WarpCore */ getTokenChains(): ChainName[]; /** * Get the subset of tokens whose chain matches the given chainName */ getTokensForChain(chainName: ChainName): Token[]; /** * Get the subset of tokens whose chain matches the given chainName * and which are connected to a token on the given destination chain */ getTokensForRoute(origin: ChainName, destination: ChainName): Token[]; } //# sourceMappingURL=WarpCore.d.ts.map