Prerequisites
- A wallet with USDC on Base (1 USDC is enough)
- Node.js 18+ with
axiosandvieminstalled, orcurlfor the quote only
1
Get a Composer quote
Request a quote with If a DEX can buy the vault token more cheaply, the quote uses that DEX instead (for example
toToken set to the vault token address:curl
toToken is the position token address of the target protocol, such as a vault share token. Take it from Supported Protocols & Chains, which lists every token Composer can route to.The response includes transactionRequest, a ready-to-sign EVM transaction, and the estimated output. The route uses Composer when a step in includedSteps has tool: "composer":TypeScript
tool: "nordstern"). The user still receives the vault token.2
Set token allowance
Approve the address in
quote.estimate.approvalAddress to spend fromAmount of the input token. On Base this is the audited LI.FI Diamond at 0x1231DEB6f5749EF6cE6943a275A1D3E7486F4EaE; always approve the address returned in the quote. Native tokens such as ETH need no approval. The full working example shows the allowance check, the approval and the send.3
Send the transaction
Send the
transactionRequest from the quote. A same-chain route runs in one atomic transaction: either every step (swap and deposit) succeeds, or the transaction reverts and the USDC stays in the wallet. The deposit is complete once the transaction confirms. Cross-chain routes also need status polling and PARTIAL handling; see Cross-chain deposits.The quote was simulated against current chain state, but prices and state can change before the transaction lands. estimate.toAmountMin is the minimum output after slippage; the transaction reverts below it.Full working example
This script runs the three steps. SetPRIVATE_KEY in the environment before running it.
Next steps
Cross-chain deposits
Bridge + deposit and swap + bridge + deposit across EVM chains
Withdrawals Guide
Add the other half of the user journey with withdraw flows
SDK Integration
Use the LI.FI SDK for managed execution with hooks and events
Vault Deposit Recipes
Copy-paste recipes for Morpho, Aave, Euler, and more

