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 vaults, the values are indexed by Morpho 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. Morpho aggregates per chain, so chainId is required and Vault V1 positions are not covered.
The response combines positions from every provider on the chain. Not every provider reports a cost basis for a position. For a vault whose provider does not, the entry in vaults still carries assets and assetsUsd, but pnl, pnlUsd, and roe are null. Those positions add to totalAssetsUsd and add nothing to totalPnlUsd, so totalPnlUsd covers only positions from providers that report a cost basis.
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
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