Resources
- Turnkey quickstart
@turnkey/ethers, the Turnkey ethers signer- Working example in the Turnkey SDK repo
- Enter and exit flows and EVM signing
Prerequisites
- A Yield.xyz API key. See Onboarding.
- A Turnkey organization set up with the quickstart:
- Organization ID: the grouping for your users, wallets and policies.
- Root quorum user: a root user with an API key pair.
- Non-root user: a second user with its own API key, outside the root quorum. This user signs yield transactions.
- Wallet: an HD wallet with at least one Ethereum account, funded with ETH and USDC on Base for this example.
Restrict the signing key with policies
The non-root user should only be able to approve USDC and deposit into or withdraw from the vault you offer. Create the policies with the root user. Each one matches the target contract (eth.tx.to) and the function selector, the first four bytes of eth.tx.data: 0x095ea7b3 for approve, 0x6e553f65 for ERC-4626 deposit and 0xba087652 for ERC-4626 redeem.
How Yield.xyz fits
Yield.xyz gives you one API across 4,000+ yields on 85+ networks:- Discover:
GET /v1/yieldsreturns yields with their metadata. - Act:
POST /v1/actions/enter,/exitand/managereturn an ordered list of unsigned transactions. - Track:
POST /v1/yields/{yieldId}/balancesandPOST /v1/yields/balancesreturn lifecycle-aware balances.
Discover a yield
Discovery is a plain read and Turnkey doesn’t change it. Run it on your server so your API key stays private.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: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 enter action, then sign and broadcast each transaction with the non-root Turnkey user, in order.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; 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 bymechanics.requirements.kycRequired: true on the yield.
Check the wallet before you show a deposit button:
authorizeUrl when the status is not_started or rejected, 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.
to and selector they use. Issuer minimums and eligibility are in RWA KYC and on each issuer’s page under RWAs.
Read the position balance
Balances are lifecycle-aware: each one has atype that says whether funds are active, entering, exiting, withdrawable, claimable or locked.
POST /v1/yields/balances with { "queries": [{ "address", "network" }] }. See Tracking balances.
Handle pending actions
A balance can carrypendingActions, such as CLAIM_REWARDS or CLAIM_UNSTAKED. Pass one back to POST /v1/actions/manage unchanged:
Exit a yield
Exiting is the same pattern as entering:signAndTrack sends them in order.
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.
Track transaction status
After each broadcast, report the hash withPUT /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
stepIndexorder and skip any already at a terminal status. - Never change
unsignedTransactionbefore signing; use itschainId. - Build arguments from
mechanics.arguments.*for the right fields and units. - Scope Turnkey policies to the exact
toand selector pairs your yields use, and add new ones when you add a yield. - Keep your Yield.xyz API key on the server.
Monetization
How you earn depends on the yield type. Each yield’smechanics.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.
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 Turnkey signs it.
Embedded wallets
The same flow with other wallet providers.

