portal.yield.yieldxyz API. This guide covers discovering yield opportunities, entering positions, managing existing positions, and exiting yield opportunities.
Overview
The yield functionality allows users to:- Discover available yield opportunities across different protocols and networks
- Enter yield positions by depositing tokens into yield opportunities
- Manage existing positions (claim rewards, voting, etc.)
- Exit yield positions to withdraw aggregated tokens and rewards
- Track yield balances and historical yield actions
Prerequisites
Before using yield operations, ensure you have:- A properly initialized Portal client
- An active wallet with the required token(s) on the target network (see Create a wallet)
- Yield.xyz integration enabled in your Portal Dashboard (see Yield.xyz Integration)
Discovering Yield Opportunities
Use thediscover method to find available yield opportunities.
For complete API documentation, see the Yield.xyz API reference.
Popular, high-quality USDC yield options with no lockups or limits:
- USDC Aave V3 Lending:
base-usdc-aave-v3-lending
- USDC Fluid Vault:
base-usdc-fusdc-0xf42f5795d9ac7e9d757db633d693cd548cfd9169-4626-vault
- USDC Spark Savings Vault:
ethereum-usdc-spusdc-0x28b3a8fb53b741a8fd78c0fb9a6b2393d896a43d-4626-vault
Entering Yield Positions
To enter a yield position, first discover the specific yield, then use theenter method.
For complete API documentation, see the Yield.xyz enter yield reference.
For the example below, we will use the yield opportunity with the ID "ethereum-sepolia-link-aave-v3-lending". Fund your Portal client with the required LINK token to enter the position.
Checking Yield Balances
Retrieve current yield positions and balances. For complete API documentation, see the Yield.xyz get balances reference.Exiting Yield Positions
Use theexit method to withdraw from yield positions.
For complete API documentation, see the Yield.xyz exit yield reference.
Managing Yield Positions
If your Portal client has entered into a yield balance, they may have a yield balance that has an availablependingActions. You can use the manage method to perform actions on existing yield positions. For example, if the balance has a pendingAction of WITHDRAW or CLAIM_REWARDS, you can use the manage method to withdraw or claim rewards from the yield balance.
For complete API documentation, see the Yield.xyz manage yield reference.
Getting Historical Actions
Retrieve the history of yield actions for an address. For complete API documentation, see the Yield.xyz get actions reference.Transaction Processing
Yield operations can require multiple transactions. Process them sequentially, submit each, track it, and wait for on-chain confirmation (e.g. usingeth_getTransactionReceipt) before proceeding to the next.
For complete API documentation, see the Yield.xyz submit transaction hash reference and get transaction details reference.
Best Practices
- Always check yield availability before attempting to enter positions
- Process transactions sequentially as yield operations often require multiple steps and are dependent on previous transactions being mined successfully
- Handle network errors gracefully and provide user feedback
- Monitor transaction status and provide progress updates to users
- Validate user balances before initiating yield operations
Supported Networks
The yield functionality supports various networks including:- Monad Testnet (
eip155:10143) - Ethereum Mainnet (
eip155:1) - Ethereum Sepolia (
eip155:11155111) - Polygon (
eip155:137) - Polygon Amoy (
eip155:80002) - Base (
eip155:8453) - Base Sepolia (
eip155:84532) - Arbitrum (
eip155:42161) - Optimism (
eip155:10) - Optimism Sepolia (
eip155:11155420) - Solana (
solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp) - Solana Devnet (
solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1)
Next Steps
- Learn about managing wallet lifecycle states
- Explore transaction simulation
- Check out Portal API methods