Two layers, one flow. This recipe uses the Earn Data API for discovery and Composer for execution. The Earn Data API tells you where to deposit. Composer handles how.
Step 1: Find the Best USDC Vaults on Base
Query the Earn Data API for USDC vaults on Base, sorted by APY:Step 2: Filter for Depositable Vaults
Not all vaults support deposits via Composer. Filter using theisTransactional flag:
TypeScript
Step 3: Get a Composer Quote
When the user selects a vault, use its contract address as thetoToken in a Composer quote request. This is the handoff from Earn to Composer.
The Composer quote endpoint is
https://li.quest/v1/quote. This is the Composer layer of LI.FI Earn, not the Earn Data API. See the Composer API Integration Guide for full details on parameters, token approvals, and transaction submission.Step 4: Execute the Transaction
Submit the transaction from the quote response. See the Composer API Integration Guide for the full execution flow including token approvals and status tracking.TypeScript
Step 5: Verify the Position
After the deposit confirms, use the Earn portfolio endpoint to verify the user’s new position:Cross-Chain Deposits
Vaults are chain-specific, but Composer handles cross-chain deposits seamlessly. To deposit from a different chain, changefromChain and fromToken in the quote request:
TypeScript
Full Example
Here is the complete flow in a single function:TypeScript
Related
Earn API Reference
Full endpoint reference with all parameters
Composer Vault Deposits
More vault deposit recipes with protocol-specific examples
Composer API Guide
Full Composer integration guide including approvals and status tracking
Cross-Chain Compose
Cross-chain deposit patterns and bridge selection

