getYieldEarnings
Gets a wallet’s Earn earnings across every vault it holds on one chain: aggregate USD totals plus a per-vault breakdown. For Morpho and Kamino vaults, the values are indexed by the provider rather than read on-chain, so they trail the chain head by a short delay.getYieldPosition stays the source of truth for what a position is worth right now; use this function for earnings and PNL. Providers aggregate per chain, so chainId is required. Morpho Vault V1 positions are not covered.
The response combines positions from every provider on the chain, which depends on the wallet account’s chain family: an EVM wallet account returns Morpho and Aave positions, and a Solana wallet account returns Kamino positions.
Providers differ in what they report for a position:
- Morpho reports PNL and a time-weighted return, so
pnl,pnlUsd, androeare all set. - Kamino reports PNL but no time-weighted return, so
pnlandpnlUsdare set androeis alwaysnull. - Aave reports no cost basis, so
pnl,pnlUsd, androearenull. The entry still carriesassetsandassetsUsd.
totalAssetsUsd and add nothing to totalPnlUsd, so totalPnlUsd covers only positions from providers that report it.
Aggregate totals come back in USD only, because per-vault earnings are denominated in different underlying assets and are not additive. A vault with no USD price is skipped from the totals, not counted as zero.
Positions in vaults the environment does not offer are still included, with vaultId set to null for those entries.
Usage
Parameters
Returns
Promise<YieldEarnings> - The wallet’s aggregate USD totals and per-vault earnings.
Each entry in
vaults:
Examples
List per-vault earnings
Read a Solana wallet’s earnings
React
useGetYieldEarnings is a query hook that stays disabled until walletAccount is defined, safe to render before a wallet is connected.
Related
getYieldPerformance- The wallet’s earnings in a single vaultgetYieldPosition- The wallet’s current balance in a vaultlistYieldVaults- The vaults available to the environment