Portal’s Web SDK provides comprehensive yield opportunities capabilities through theDocumentation Index
Fetch the complete documentation index at: https://docs.portalhq.io/llms.txt
Use this file to discover all available pages before exploring further.
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
- Deposit and withdraw in one call using the high-level
depositandwithdrawhelpers (sign, confirm between steps, and track with Yield.xyz)
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.
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.We recommend always specifying a
yieldId on each balance query. When yieldId is provided, Yield.xyz can resolve balances directly, so you don’t need to call the track endpoint after entering or exiting positions.Exiting Yield Positions
Use theexit method to withdraw from yield positions.
For complete API documentation, see the Yield.xyz exit yield reference.
High-Level Methods
Usedeposit and withdraw when you want one call for the full flow: resolve the yield, build the action, sign and send each transaction in order, wait between steps when configured, and report hashes to Yield.xyz.
Specify the position with yieldId, or with chain (CAIP-2) + token (must match your Portal yield defaults). Both methods require amount and address. Optionally set arguments.
Signatures
Essential parameters
| Name | Required | Description |
|---|---|---|
yieldId or chain + token | Yes | Non-empty yieldId wins over chain / token. On Web, chain must be a full CAIP-2 id (for example eip155:11155111). |
amount | Yes | Amount to deposit or withdraw. |
address | Yes | Wallet address for the action. |
arguments | No | Protocol-specific Yield.xyz arguments. |
YieldSubmitOptions:
| Name | Required | Description |
|---|---|---|
onProgress | No | Callback fired at each step per transaction: signing, submitted, confirming, confirmed. |
signAndSendTransaction | No | Per-call signer. Receives the unsigned transaction payload and the network string; must return the submitted tx hash. Takes priority over the instance-level setter. When omitted, Portal’s built-in MPC signer is used automatically. |
waitForConfirmation | No | Per-call confirmation override. Called after each broadcast with (txHash, network). MUST return true for confirmed success. The behavior for each return value is:• true → Transaction confirmed successfully. Execution continues to next step.• false → Transaction failed on-chain (e.g., reverted with receipt status 0x0). Execution stops immediately and returns partial results with status: 'FAILED'.• Throws or times out → Execution stops safely and returns partial results with status: 'PARTIAL_SUCCESS' (if some transactions completed) or status: 'FAILED' (if none completed).When omitted, portal.waitForConfirmation is used for supported EVM networks. |
evmRequestFn | No | Web SDK: JSON-RPC function used when building the default confirmation waiter for EVM (for example receipt polling via eth_getTransactionReceipt). |
evmPollerOptions | No | Tune the built-in EVM receipt poller (pollIntervalMs, timeoutMs) when the default confirmation path uses evmRequestFn. Has no effect when waitForConfirmation is provided. |
Strict confirmation semantics: Yield operations use strict confirmation. Only
waitForConfirmation(...) === true is considered success.Confirmation outcomes:- Returns
true: Transaction confirmed successfully. Execution continues to next step. - Returns
false: Transaction failed on-chain (e.g., reverted withreceipt.status === "0x0"). Execution stops immediately and returns partial results withstatus: 'FAILED'. - Throws or times out: Execution stops safely and returns partial results with
status: 'PARTIAL_SUCCESS'(if some transactions completed) orstatus: 'FAILED'(if none completed).
SUCCESS: All required confirmations returnedtrue, OR no confirmation waiter was configuredPARTIAL_SUCCESS: At least one confirmation succeeded, but execution stopped before completing all steps (e.g., timeout or later transaction failed)FAILED: First transaction confirmation returnedfalseor failed (zero confirmations reached)
- Timeout:
900_000ms(15 minutes) - Poll interval:
4_000ms
tradeAsset, where any confirmation failure throws and aborts the entire operation — Yield’s approach allows graceful recovery with partial progress when confirmations time out or are uncertain.Return value
| Field | Description |
|---|---|
hashes | Submitted transaction hashes, in order. Contains hashes for all transactions that were submitted, regardless of final outcome. |
yieldId | Resolved yield id. |
status | Operation result status: • SUCCESS — All transactions confirmed successfully (or no waitForConfirmation configured).• PARTIAL_SUCCESS — Some transactions confirmed, but execution stopped before completing all steps (e.g., timeout).• FAILED — A transaction failed on-chain (receipt status 0x0) or confirmation returned false. |
chain / token | Set when you passed chain + token. |
yieldOpportunityDetails | Action metadata from Yield.xyz. |
Handling Results
Always check thestatus field to determine the outcome:
hashes array does NOT guarantee success. Always check status.
Reverted transactions: When an EVM transaction is reverted on-chain (
receipt.status === "0x0"), the default waitForConfirmation implementation returns false, which causes the SDK to stop execution immediately and set status: 'FAILED'. This is the correct behavior — a reverted transaction is a definitive failure, not an uncertain state.If you implement a custom waitForConfirmation, ensure reverted transactions either:- Return
false(recommended for graceful degradation in multi-step flows) - Throw an error (for explicit failures)
true for a reverted transaction.Example (deposit with progress and poller tuning)
withdraw the same way with identical parameter shapes.
Example (custom confirmation logic)
Example (custom signer)
Get Validators
UsegetValidators() to fetch the validator addresses for a specific yieldId.These addresses are used for token approval flows.
Example
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 (low-level enter / exit / manage)
If you use deposit() or withdraw(), skip this section—the Web SDK already sequences transactions, waits between steps when configured, and calls Yield.xyz tracking.
For manual flows that return raw transactions from enter, exit, or manage: process steps in order, and wait for inclusion before sending the next transaction (multi-step actions depend on prior txs mining; the high-level methods use portal.waitForConfirmation or your override between steps).
For standard transaction-hash flows, prefer portal.waitForConfirmation(txHash, network) rather than writing your own receipt polling. If your signer returns a non-standard identifier — such as a user operation hash for account abstraction — you will need a custom wait loop against the appropriate receipt API (e.g., eth_getUserOperationReceipt for bundler-based AA wallets). After the wait step, call portal.yield.yieldXyz.track({ transactionId, hash }).
For complete API documentation, see the Yield.xyz submit transaction hash reference and get transaction details reference.
Best Practices
- Always check the
statusfield in deposit/withdraw results to determine operation outcome (SUCCESS,PARTIAL_SUCCESS, orFAILED) - Always check yield availability before attempting to enter positions
- Prefer
deposit()/withdraw()when you want Portal to handle signing, confirmation between steps, and tracking—avoid copying receipt-poll loops from older examples - Process low-level transactions sequentially when using
enter/exit/managedirectly; later steps depend on earlier transactions being mined - Handle network errors gracefully and provide user feedback
- Monitor transaction status and provide progress updates to users (
onProgresson high-level methods) - Validate user balances before initiating yield operations
- Check for pending actions in balances before calling the manage method
- Test on testnets first (for example Sepolia) before moving to mainnet
Supported Networks
The yield functionality supports various networks including:- Monad (
eip155:143) - Monad Testnet (
eip155:10143) - Arbitrum (
eip155:42161) - Avalanche C (
eip155:43114) - Base (
eip155:8453) - Base Sepolia (
eip155:84532) - Celo (
eip155:42220) - Core (
eip155:1116) - Ethereum (
eip155:1) - Ethereum Sepolia (
eip155:11155111) - Fantom (
eip155:250) - Gnosis (
eip155:100) - Harmony (
eip155:1666600000) - Hyperevm (
eip155:999) - Katana (
eip155:747474) - Linea (
eip155:59144) - Moonriver (
eip155:1285) - Optimism (
eip155:10) - Optimism Sepolia (
eip155:11155420) - Plasma (
eip155:9745) - Polygon (
eip155:137) - Polygon Amoy (
eip155:80002) - Sonic (
eip155:146) - Unichain (
eip155:130) - Viction (
eip155:88) - zkSync (
eip155:324) - Solana (
solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp) - Solana Devnet (
solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1) - Stellar (
stellar:pubnet) - Stellar Testnet (
stellar:testnet) - Tron (
tron:mainnet)
Next Steps
- Learn about managing wallet lifecycle states
- Explore transaction simulation
- Check out Portal API methods