import { type LiFiStep } from '@lifi/sdk'; import { ProtocolType } from '@hyperlane-xyz/utils'; import type { Logger } from 'pino'; import type { BridgeQuote, BridgeQuoteParams, BridgeTransferResult, BridgeTransferStatus, ExternalBridgeConfig, IExternalBridge } from '../interfaces/IExternalBridge.js'; /** * LiFi implementation of IExternalBridge using the official @lifi/sdk. * * The SDK provides: * - Automatic token approvals via executeRoute() * - Multi-step route handling (swap → bridge → swap) * - Built-in status tracking via getStatus() * - Native support for EVM, Solana, and other chains * * @see https://docs.li.fi/integrate-li.fi-sdk */ export declare class LiFiBridge implements IExternalBridge { private static readonly NATIVE_TOKEN_ADDRESS; readonly externalBridgeId = "lifi"; /** * Convert a Hyperlane domain ID to a LiFi-compatible chain ID. * For EVM chains, these are identical (e.g., Arbitrum = 42161 in both). * For non-EVM chains like Solana, LiFi uses different chain identifiers. */ static toLiFiChainId(chainId: number): number; readonly logger: Logger; private initialized; private _executeLock; private readonly config; private readonly chainMetadataByChainId; constructor(config: ExternalBridgeConfig, logger: Logger); getNativeTokenAddress(): string; private initialize; /** * Resolve RPC URL for a given EVM chainId from chain metadata. * Iterates metadata to find matching chainId and returns first HTTP RPC URL. */ private getRpcUrlForChainId; private getProtocolTypeForChainId; private getMetadataForChainId; private addressesEqual; /** * Configure the LiFi SDK provider for the route source protocol. */ private configureLiFiProvider; /** * Get a quote for bridging tokens. * Supports two modes: * - fromAmount: "I'm sending X, what do I get?" (uses SDK) * - toAmount: "I want X, how much do I send?" (uses REST API) * * Returns route data ready for execution. */ quote(params: BridgeQuoteParams): Promise>; /** * Get a quote by specifying the amount to send (standard quote). * Uses the LiFi SDK. */ private quoteBySpendingAmount; /** * Get a quote by specifying the amount to receive (reverse quote). * Uses the LiFi REST API directly since the SDK doesn't support toAmount. */ private quoteByReceivingAmount; /** * Extract gas and fee costs from a LiFi quote response. * - gasCosts: Sum of all gas costs (transaction fees) * - feeCosts: Sum of non-included fee costs (protocol fees not deducted from amount) */ private extractCosts; /** * Execute a bridge transfer using the SDK. * Handles approvals, transaction signing, and execution automatically. * * @param quote - Quote obtained from quote() * @param privateKeys - Private keys keyed by protocol type for signing transactions */ execute(quote: BridgeQuote, privateKeys: Partial>): Promise; /** * Validate that the route returned by LiFi matches the original request parameters. * Prevents execution against wrong chains, tokens, or recipients if the bridge API * returns a route that diverges from what was originally requested. * * TODO: Layer 2 validation — validate transaction calldata in route.steps[].transactionRequest * and route.steps[0].estimate.approvalAddress against a known whitelist. */ private validateRouteAgainstRequest; /** * Get the status of a bridge transfer. * Uses SDK's built-in status tracking. */ getStatus(txHash: string, fromChain: number, toChain: number): Promise; } //# sourceMappingURL=LiFiBridge.d.ts.map