portal.trading.lifi API. This guide covers getting quotes, finding routes, executing swaps and bridges, and tracking transaction status.
Overview
The Li.Fi functionality allows you to:- Get quotes for bridging or swapping tokens across chains
- Find routes to discover the best paths for your cross-chain transfers
- Execute swaps and bridges by signing and submitting transactions
- Track transaction status for cross-chain transfers
Supported Chains: Li.Fi integration currently supports EVM-compatible chains (Ethereum, Base, Arbitrum, Polygon, etc.) and Solana. Other non-EVM chains may not be supported for Li.Fi operations.
Prerequisites
Before using Li.Fi operations, ensure you have:- A properly initialized Portal client
- An active wallet with the required token(s) on the source network (see Create a wallet)
- Li.Fi integration enabled in your Portal Dashboard (see Li.Fi Integration)
High-Level Methods
tradeAsset
Runs the end-to-end Li.Fi flow in one call:
- Discover routes (
getRoutes) - Select a route (
routeIndex, default0) - Build each step (
getRouteStep) - Sign and broadcast each step transaction
- Wait for on-chain confirmation for that step
- Poll Li.Fi status until terminal for that step
- Continue to the next step
tradeAsset uses strict confirmation semantics. Each step MUST be confirmed on-chain before proceeding to the next step. If waitForConfirmation returns false, times out, or throws, the entire flow fails and an error is thrown. There is no optimistic fallback.
Signature
Second argument
LifiTradeAssetOptions:
Return value
Example (progress + per-call confirmation options)
tradeAsset in try/catch; failures (no route, step error, receipt timeout, Li.Fi terminal FAILED, …) throw after onProgress may report 'failed'.
Progress lifecycle
onProgress can emit statuses such as:
fetching_routesroute_selectedpreparing_stepsigningsubmittedconfirminglifi_pendingstep_donecompletefailed
pollStatus
Built-in Li.Fi status polling with retries and backoff. Use when you already have a tx hash (for example from a manual flow) and want the same polling behavior as inside tradeAsset, without implementing the loop yourself.
pollStatus options
Return
false from the update callback to stop early; return true (or nothing) to continue.
Route Options
TherouteOptions parameter on tradeAsset (and the options field on LifiRoutesRequest) accepts a LifiRoutesRequestOptions object:
Getting a Quote
Finding Routes
Getting Route Step Details
Executing Transactions
NoteLifiTransactionRequestmay includegasLimitandgasPrice. You can omit these fields to let Portal estimate gas automatically, or include them if you prefer to use Li.Fi’s suggested values.
Processing Multi-Step Routes
Tracking Transaction Status
Polling Until Completion
Supported Networks
Portal’s Li.Fi integration supports the following mainnet networks:- Monad (
eip155:143) - Ethereum (
eip155:1) - Optimism (
eip155:10) - BSC (
eip155:56) - Gnosis (
eip155:100) - Unichain (
eip155:130) - Polygon (
eip155:137) - Sonic (
eip155:146) - Mantle (
eip155:5000) - Base (
eip155:8453) - Arbitrum (
eip155:42161) - Celo (
eip155:42220) - Avalanche (
eip155:43114) - Linea (
eip155:59144) - Berachain (
eip155:80094) - Katana (
eip155:747474) - Solana (
solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp) - Bitcoin (
bip122:000000000019d6689c085ae165831e93-p2wpkh)
Testnets are not supported.
Next Steps
- Learn about signing Ethereum transactions
- Explore sending tokens
- Check out the Client API Li.Fi endpoints