To integrate a bridge aggregator API into an app, request a quote, approve the quoted spender for the input token, and send the returned transaction through the user’s wallet. Then poll the transfer status until it reaches a final state. The flow is complete when your app shows the chain, token, and amount that actually arrived, including a partial delivery or refund.
Build the transfer flow
A LI.FI transfer flow needs a connected wallet, an RPC connection for the source chain, and token addresses for both chains. The wallet must hold the input token and enough native currency for gas. LI.FI selects a route and builds calldata; your app obtains the signatures, broadcasts the transactions, and tracks settlement. Have a destination address ready as well, especially when the recipient differs from the sender.
USDT on Ethereum is an ERC-20 token with six decimals, which makes the amount and allowance checks concrete. A USDT bridge moves USDT from one blockchain to another; its cross-chain delivery makes it a useful test of whether your app reports the token received, rather than assuming it matches the token requested.
-
Request a quote. Call LI.FI’s quote endpoint with fromChain, toChain, fromToken, toToken, fromAmount, fromAddress, and slippage. Use chain-specific token addresses. Send fromAmount as an integer string in base units: 1 USDT on Ethereum is 1000000 units. The visible result is an estimated output, a minimum output, route details, estimate.approvalAddress, and transactionRequest.
-
Present the route before asking for signatures. Show the source and destination tokens, estimated amount, minimum amount, fees, and the bridge LI.FI selected, such as Across or Stargate. Slippage is the permitted movement in the quoted execution price. Let the user review the receiving address. The visible result is a transfer summary the user can compare with the wallet prompt.
-
Set the ERC-20 allowance. Read the input token’s allowance(owner, spender) on the source chain, using the connected wallet as owner and estimate.approvalAddress as spender. If it is below fromAmount, ask the wallet to approve that spender and wait for the approval receipt. Read the allowance again. The visible result is sufficient on-chain permission for the quoted transfer; approving the transaction destination by guesswork can authorize the wrong contract.
-
Refresh and send the transfer. A quote can become stale while the user approves. Request a fresh quote before the transfer signature if its price, route, or estimated gas has aged, then repeat the allowance check against its approval address. Confirm that transactionRequest.from matches the wallet and its chain matches the source chain. Pass its to, data, and value to the wallet, broadcast the transaction, and save the source transaction hash. The visible result is a submitted source-chain transaction, not yet a completed cross-chain transfer.
-
Poll for settlement. Query LI.FI’s status endpoint with txHash; supplying fromChain and toChain helps narrow the lookup. Keep polling through PENDING and brief NOT_FOUND responses after broadcast. Stop at DONE or FAILED, and read substatus. A source-chain receipt confirms that the send transaction ran; the status response tells you what happened to the cross-chain delivery.
-
Reconcile the outcome and confirm completion. For DONE with COMPLETED, display the actual receiving.amount, receiving.token, and receiving.chainId, formatted with that token’s decimals. For PARTIAL, state what arrived and how it differs from the requested token or amount. A route may deliver a different token even though the source transaction succeeded. For REFUNDED, report the refund’s actual chain, token, and amount; use the recorded receiving leg or confirmed refund transaction rather than the original quote. On FAILED, show the failure reason and any confirmed refund, or say that the refund is still pending. The task is done when the user can see the settled asset or the specific recovery state.
-
Quote in base units and approve only the returned spender.
-
Sign a fresh transaction request and track its source hash.
-
Report the settled token and amount, including partial deliveries and refunds.
Common integration questions
These integration questions cover fees, API access, wallet support, and testing.
How do I set an integrator fee in a LI.FI quote?
Add integrator and fee to the quote request. The fee is a decimal share of the transaction, so review the returned fee costs and output estimate before the user signs.
How should LI.FI rate limits and API keys be handled?
Debounce quote requests, cache chain and token lists, and back off on HTTP 429 using the response’s rate-limit information. Keep an API key on your backend and send it in the x-lifi-api-key header; LI.FI’s rate-limit documentation lists the current quotas.
Can a smart contract wallet execute a bridge quote?
Yes, when the wallet can approve the input token and execute the quoted call on the source chain. Use the contract wallet as fromAddress, ensure it owns the funds, and simulate the approval and transfer calls because route support depends on the wallet and bridge.
How do I test bridges on testnets?
LI.FI does not support testnet bridge testing. Mock quote and status responses to exercise error states, then run a small mainnet transfer on a low-gas chain pair to verify real settlement.