Skip to main content

getYieldPosition

Gets a wallet’s current balance in an Earn vault. Reads on-chain, so the result always reflects the vault’s current state, so there’s no caching delay. The response has two numbers, shares and assets. Show assets, not shares, in your UI.
  • assets is what the wallet’s position is worth right now, in the underlying token (e.g. USDC). This is the number that grows as yield accrues, and it’s the balance and earnings your users care about.
  • shares is an internal accounting number the vault uses to track ownership. For some providers it’s set once at deposit time and doesn’t change after that, even while the position is earning yield, so showing it to a user creates a second, unmoving “balance” that looks broken next to the real one.
For some providers, the position is a balance that grows as interest accrues, so shares and assets are always the same number. Showing assets is correct either way.
For a Solana vault, shares counts every share the wallet owns in the vault, including shares staked in the vault’s farm. The position therefore does not change when a deposit’s farm-staking transaction confirms.
Both shares and assets come back as raw strings (e.g. "10500000"), not human-readable numbers. Divide by the vault’s assetDecimals (from getYieldDetails) before displaying either one. See the example below.

Usage

Parameters

Returns

Promise<YieldVaultPosition> - The wallet’s balance in the vault.

Examples

Format a position for display

React

useGetYieldPosition is a query hook that stays disabled until walletAccount is defined, so it’s safe to render before a wallet is connected.
Last modified on October 20, 2026