Cross-chain / Bridge·EVM · Solana · Multi-chain
LI.FI
Cross-chain bridge and DEX aggregator. Routes any-to-any swaps across 30+ chains and 20+ bridges with a single SDK/API, including Solana and EVM.
- 01cross-chain swaps
- 02bridge aggregation
- 03any-to-any token routing
- 04EVM <-> Solana flows
- 05embedded bridge widgets
- pnpm add @lifi/sdk viem
| Variable | Scope | Description |
|---|---|---|
| LIFI_API_KEY | Server | LI.FI API key from the LI.FI partner portal. Required for production rate limits and integrator-fee attribution. |
Use the LI.FI SDK by calling `createConfig({ integrator: 'your-app-name', apiKey })` once at startup. Fetch routes with `getRoutes({ fromChainId, toChainId, fromTokenAddress, toTokenAddress, fromAmount, fromAddress })`, pick `routes[0]`, and execute via `executeRoute(route)` — the SDK handles approvals, signatures (EIP-2612/Permit2/EIP-5792), bridge submission, and destination-chain status polling. Subscribe to `updateRouteHook` for per-step status. For Solana legs ensure a Solana adapter wallet is configured. Use `getStatus({ txHash, bridge, fromChain, toChain })` to resume tracking after page refresh.
- ⚑Cross-chain routes have two slippages (source DEX + destination DEX) plus bridge fees — surface the full breakdown to users, not just `toAmount`.
- ⚑Route execution is multi-step (approve, source swap, bridge, dest swap); always persist the `route.id` so users can resume after refresh via `resumeRoute`.
- ⚑Some bridges (e.g., native CCTP, canonical) have minimum amounts and minute-scale finality; show realistic ETAs from `route.steps[].estimate.executionDuration`.
- ⚑Chain coverage and bridge availability change frequently — treat the route list as dynamic and gracefully fall back to alternatives if the preferred bridge is offline.
- ⚑Without an integrator API key, requests are heavily rate-limited and integrator fees cannot be collected.
- ⚑EIP-5792 batched calls require a wallet that supports it (Smart Accounts / 7702) — gracefully fall back to sequential txs otherwise.