Recipes for multi-step Composer flows that combine bridging, swapping, and protocol deposits into a single user flow.
All multi-step flows use the same API pattern as single-step Composer operations. LI.FI’s routing engine automatically determines the optimal path (bridge, swap, deposit) based on the fromChain, toChain, fromToken, and toToken parameters.
Bridge + Deposit
The most common multi-step pattern: bridge assets from one chain and deposit into a protocol on another chain.
ETH on Ethereum → Morpho Vault on Base
Cross-chain Composer: deposit into a Morpho vault on Base using ETH from Ethereum. The routing engine determines the optimal path (bridge, swap, deposit) automatically.
curl -X GET 'https://li.quest/v1/quote?\
fromChain=1&\
toChain=8453&\
fromToken=0x0000000000000000000000000000000000000000&\
toToken=0x7BfA7C4f149E7415b73bdeDfe609237e29CBF34A&\
fromAddress=0xYOUR_WALLET_ADDRESS&\
toAddress=0xYOUR_WALLET_ADDRESS&\
fromAmount=100000000000000000'
What may happen under the hood:
- LI.FI bridges ETH from Ethereum to Base
- Swaps ETH to USDC on Base
- Deposits USDC into the Morpho vault
- Returns Morpho vault tokens to the user
The user signs one transaction on Ethereum. The routing engine determines the optimal path, and the exact sequence of steps will be visible in the route response.
Swap + Bridge + Deposit
Start with a token that needs to be swapped before bridging, then deposit on the destination chain.
USDT on Arbitrum → Morpho Vault on Base
curl -X GET 'https://li.quest/v1/quote?\
fromChain=42161&\
toChain=8453&\
fromToken=0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9&\
toToken=0x7BfA7C4f149E7415b73bdeDfe609237e29CBF34A&\
fromAddress=0xYOUR_WALLET_ADDRESS&\
toAddress=0xYOUR_WALLET_ADDRESS&\
fromAmount=1000000'
What may happen under the hood:
- LI.FI may swap USDT to a bridgeable token on Arbitrum (if needed)
- Bridges to Base
- Swaps to USDC on Base (the vault’s underlying asset)
- Deposits into the Morpho vault
- Returns vault tokens to the user
The routing engine decides the optimal sequence and may choose a different bridge, swap order, or intermediate token depending on available liquidity and gas costs.
Bridge + Stake
Bridge assets from one chain and stake on another.
USDC on Polygon → wstETH on Ethereum
curl -X GET 'https://li.quest/v1/quote?\
fromChain=137&\
toChain=1&\
fromToken=0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359&\
toToken=0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0&\
fromAddress=0xYOUR_WALLET_ADDRESS&\
toAddress=0xYOUR_WALLET_ADDRESS&\
fromAmount=1000000000'
What may happen under the hood:
- LI.FI bridges USDC from Polygon to Ethereum
- Swaps USDC to ETH on Ethereum
- Stakes ETH via Lido and wraps to wstETH
- Returns wstETH to the user
The routing engine may choose a different path (e.g., swap on Polygon first, then bridge ETH) if it finds a better outcome.
Bridge + Lend
Bridge assets and deposit into a lending protocol on another chain.
ETH on Optimism → Aave V3 on Base
curl -X GET 'https://li.quest/v1/quote?\
fromChain=10&\
toChain=8453&\
fromToken=0x0000000000000000000000000000000000000000&\
toToken=AAVE_V3_AUSDC_TOKEN_ADDRESS_ON_BASE&\
fromAddress=0xYOUR_WALLET_ADDRESS&\
toAddress=0xYOUR_WALLET_ADDRESS&\
fromAmount=100000000000000000'
Replace AAVE_V3_AUSDC_TOKEN_ADDRESS_ON_BASE with the actual Aave V3 aToken address. You can find aToken addresses on the Aave app.
Execution Flow for Multi-Step Recipes
All multi-step recipes follow the same execution pattern:
1. Get Quote
const quote = await axios.get('https://li.quest/v1/quote', { params });
2. Set Allowance (if needed)
If fromToken is not a native token (ETH), approve the estimate.approvalAddress from the quote response.
3. Send Transaction
const tx = await wallet.sendTransaction(quote.transactionRequest);
await tx.wait();
4. Poll Status
For cross-chain flows, poll GET /status until the transfer completes:
let status;
do {
const result = await axios.get('https://li.quest/v1/status', {
params: {
txHash: tx.hash,
fromChain: quote.action.fromChainId,
toChain: quote.action.toChainId,
},
});
status = result.data.status;
if (status === 'FAILED') {
console.error('Transfer failed:', result.data.substatusMessage);
break;
}
await new Promise((resolve) => setTimeout(resolve, 10000));
} while (status !== 'DONE');
For the full status reference, see Transaction Status Tracking.
Cross-Chain Timing
Cross-chain Composer flows involve bridge latency. Typical times vary by bridge:
- Fast bridges (e.g., Across, Relay): seconds to minutes
- Standard bridges (e.g., Stargate): 1-5 minutes
- Canonical bridges: 10-30+ minutes
LI.FI’s routing engine selects the optimal bridge based on speed, cost, and liquidity. You can influence this with the order parameter (CHEAPEST or FASTEST).
Error Handling for Multi-Step Flows
Cross-chain multi-step flows have specific failure modes:
| Scenario | What Happens | User Impact |
|---|
| Source transaction reverts | All steps fail atomically | Tokens stay in wallet (gas consumed) |
| Bridge fails | Refund process initiated | User receives refund on source chain |
| Destination deposit fails | Bridge succeeds, deposit fails | User has tokens on destination chain |
For partial completions (bridge succeeds, deposit fails), the user has the bridged tokens on the destination chain and can retry the deposit directly.
See Error Handling for the full error reference.
Next Steps