This tutorial walks you through building a yield integration for a wallet application. You will detect idle assets in a user’s wallet, show them personalized deposit opportunities, prepare and execute a deposit transaction, and then track the resulting position. The full example code is available in the official tutorial repositories:Documentation Index
Fetch the complete documentation index at: https://docs.vaults.fyi/llms.txt
Use this file to discover all available pages before exploring further.
Run the example
Step-by-step walkthrough
1. Initialize the SDK
Create the client once and reuse it across all calls.2. Detect idle assets
CallgetIdleAssets to find tokens sitting in a wallet that are not currently earning yield. This is the starting point for any yield nudge or suggestion UI.
3. Get personalized deposit options
CallgetDepositOptions with a list of assets the user holds. The API returns ranked vault opportunities filtered to those assets, sorted by APY.
4. Check transaction context
Before building a deposit transaction, callgetTransactionsContext to confirm the vault is ready to accept a deposit. The response tells you which steps are required (for example, an ERC-20 approval before the deposit itself) and the current deposit limits.
5. Build the deposit transaction
CallgetActions with action: 'deposit' to receive ready-to-sign transaction calldata. Pass the calldata directly to the user’s wallet or signer library — no intermediate contract needed.
getActions may return multiple steps when an approval is required before the deposit. Execute each step in order using the user’s wallet.
6. Track the user’s position
After the deposit confirms onchain, callgetPositions to retrieve the user’s updated vault positions. Display the balance, current APY, and accumulated returns in your portfolio view.
getUserVaultTotalReturns with the same userAddress, network, and vaultAddress.
What to build next
- Surface pending rewards with
getRewardsTransactionsContextand let users claim in one tap usinggetRewardsClaimActions. - Show per-vault event history (deposits and withdrawals) with
getUserVaultEvents. - Compare the vault’s current APY against benchmark rates using
getBenchmarksto give users context on whether the yield is competitive.

