Skip to main content
This guide builds a flow where users discover a yield across DeFi, staking and tokenized real-world assets, enter it, track the position and exit, signing with Portal’s MPC wallets.

Resources

Prerequisites

  • A Yield.xyz API key. See Onboarding.
  • A Portal client API key, with the Portal SDK initialized in your app.

Getting started with Portal

Follow Portal’s SDK quickstart. Before connecting Yield.xyz, make sure you can:
  • Initialize the Portal SDK
  • Create a wallet for a user
  • Send an EVM transaction with portal.request({ method: "eth_sendTransaction" })

How Yield.xyz fits

Yield.xyz gives you one API across 4,000+ yields on 85+ networks:
  • Discover: GET /v1/yields returns yields with their metadata.
  • Act: POST /v1/actions/enter, /exit and /manage return an ordered list of unsigned transactions.
  • Track: POST /v1/yields/{yieldId}/balances and POST /v1/yields/balances return lifecycle-aware balances.
Yield.xyz builds transactions and never signs or holds funds. Portal signs them in the user’s wallet. This guide uses EVM networks. Portal also supports Solana; see Solana signing for that payload.

Keep the API key on your server

Keep your Yield.xyz API key on your server. The snippets in this guide call a small proxy route that adds the key, for example a Next.js route handler:
On the client, one helper calls it:

Discover a yield

The discovery response already carries what your UI needs, so you don’t need a second request per yield.
Every field on a yield is described in Yield metadata.

Find yields to offer

Rather than hardcoding yield IDs, which change as yields are added and retired, query the catalog for what you want to offer:
Add prime=true to return only yields that meet the Prime quality bar. For staking, default users to preferred validators. For DeFi, wrap yields in an OAV to charge fees and auto-compound incentives (see Monetization).

Enter a yield

Build the action, then send each transaction through Portal, in order, and report each hash. Portal takes CAIP-2 chain IDs, such as eip155:8453 for Base.
Build the arguments from mechanics.arguments.enter.fields rather than hardcoding { amount }, so the same code works for yields that also need a validatorAddress or another field. Amounts are in token units, for example "100" for 100 USDC. See Enter and exit flows.

KYC-gated RWA yields

Tokenized real-world assets, such as US Treasuries, money market funds and private credit, use the same enter and exit flow, so no new signing code is needed. Some issuers require the wallet to be allowlisted first, shown by mechanics.requirements.kycRequired: true on the yield. Check the wallet when it connects, so you can show “Verify identity” instead of “Deposit” for a gated yield:
Send the user to authorizeUrl when the status is not_started or rejected, ideally in a new tab or after saving the pending deposit so you can resume it, and enter once it is approved. If you call enter for a wallet that is not cleared, the API returns 412 with RwaKycError, and the message includes the issuer’s KYC URL:
Read entryLimits.minimum before you build the action: many RWA yields have high minimums. Issuer eligibility is in RWA KYC and on each issuer’s page under RWAs.

Read the position balance

Balances are lifecycle-aware: each one has a type that says whether funds are active, entering, exiting, withdrawable, claimable or locked.
For many yields or wallets at once, use POST /v1/yields/balances with { "queries": [{ "address", "network" }] }, up to 25 queries per request:
See Tracking balances.

Handle pending actions

A balance can carry pendingActions, such as CLAIM_REWARDS or CLAIM_UNSTAKED. Pass one back to POST /v1/actions/manage unchanged, then sign the result the same way as an enter:

Exit a yield

Exiting is the same pattern as entering:
Some exits need more than one transaction, for example withdraw and unwrap. Not every exit settles at once. Staking unbonds wait out the network’s cooldown, and many RWA redemptions settle on a NAV strike or over several days. While that happens the position shows as an exiting balance. When it settles it becomes withdrawable with a CLAIM_UNSTAKED pending action, which you complete through POST /v1/actions/manage as above. Poll balances on a sensible cadence and show the in-flight state in your UI.

Track transaction status

After each broadcast, report the hash with PUT /v1/transactions/{transactionId}/submit-hash, then poll GET /v1/transactions/{transactionId} (or GET /v1/actions/{actionId}) until it reaches a terminal status:
See Monitoring and alerting.

Integration tips

  • Send transactions in stepIndex order and skip any already at a terminal status.
  • Never change to, data, value, gas or nonce before signing.
  • Build arguments from mechanics.arguments.* for the right fields and units.
  • Keep your Yield.xyz API key on the server.
  • Geo-blocking is applied by the API for your project; see Geo-blocking.
  • Portal uses CAIP-2 chain IDs: build them from the transaction’s own chainId, for example eip155:1 or eip155:8453.

Monetization

How you earn depends on the yield type. Each yield’s mechanics.possibleFeeTakingMechanisms says which fees you can configure on it.
  • Staking: deposit fees, deducted atomically in the same transaction, and a share of validator revenue through Yield.xyz’s validator agreements. See Preferred validators.
  • DeFi: revenue share from some protocols and curators, and user-facing deposit, performance and management fees through OAVs.
  • RWAs: issuer fees are set by the issuer and passed through. Where an RWA is wrapped in an OAV, you can add your own fees on top.
OAVs also improve the user experience: incentive tokens are sold into the deposit asset and reinvested automatically, wrapping and swapping are handled for the user, and users only ever see their deposit token. See Earn monetization for fee configuration, and Plans for commercial terms.

Next steps

Enter and exit flows

The full request, sign and poll loop.

Yield metadata

Every field returned on a yield.

Shield

Verify each transaction before Portal signs it.

Embedded wallets

The same flow with other wallet providers.