Prerequisites
Before you begin, ensure that you’ve: These are required so any example below runs with a validkit and adapter.
Check your position
Pass the vault address and the wallet’s adapter and chain to query the current position:TypeScript
Shell
pnl.status is a discriminated union with three values:"available": P&L is computed.pnl.principalDepositedandpnl.totalYieldEarnedare present."pending": P&L is still reconciling. Retry after a short delay.currentBalanceandsharesare still accurate."unavailable": P&L cannot be computed for this position.pnl.reasonexplains why.currentBalanceandsharesare still accurate.
getPosition as often as you need. Cache the result if you’re
polling frequently. Vault balances update on the vault’s own schedule, not
per-block.