Documentation Index
Fetch the complete documentation index at: https://kamino.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
Reading Farm Data
A delegated farm (for example a klend reserve farm or a kvault farm) has no stake-token mint of its own. A delegate authority stakes on users’ behalf, so
farmState.token.mint is empty and farmState.delegateAuthority is set. A non-delegated farm owns its stake token, so farmState.token gives the stake mint and decimals. For the TypeScript shapes used below, see Farm Types.Farm state fields reference
Farm state fields reference
A
FarmState account exposes the values below. An Address field set to the default pubkey means it is unused, for example strategyId and vaultId on a farm attached to neither.| Field | Type | Description |
|---|---|---|
token | TokenInfo | Stake token: mint, decimals, and token program. Empty on delegated farms. |
rewardInfos | RewardInfo[] | Fixed-size array of reward slots. Only slots with a real mint are active. |
numRewardTokens | BN | Count of active reward tokens. |
totalStakedAmount | BN | Total tokens staked and earning rewards, in raw units. |
isFarmDelegated | number | 1 when the farm is delegated, so a delegate authority stakes on users’ behalf. |
isFarmFrozen | number | 1 when the farm is frozen and no new deposits are allowed. |
delegateAuthority | Address | The delegate that stakes for users. Set only on delegated farms. |
depositWarmupPeriod | number | Seconds between a deposit and when it starts earning. 0 if unused. |
withdrawalCooldownPeriod | number | Seconds between unstaking and being able to withdraw. |
depositCapAmount | BN | Maximum total stake the farm accepts, in raw units. |
lockingDuration | BN | Deposit lockup length, in the farm’s time unit. |
lockingEarlyWithdrawalPenaltyBps | BN | Penalty in basis points for withdrawing before the lockup ends. |
scopePrices | Address | Scope oracle prices account the farm reads for reward accrual. |
strategyId | Address | kliquidity strategy this farm is attached to. Default if none. |
vaultId | Address | kvault this farm is attached to. Default if none. |
farmVault | Address | Token account that holds the staked tokens. |
Get Farm State
Live on-chain read of a single farm: stake token, totals, time gates, and reward slots.getFarmState
depositWarmupPeriod and withdrawalCooldownPeriod are farm-level time gates in seconds, stored on the farm state with no REST equivalent. The cooldown is the wait between unstaking and being able to withdraw. To load several farms at once, use FarmState.fetchMultiple(rpc, [addr, ...]). On a non-delegated farm, farms.getStakedAmountForFarm(FARM) returns the total staked in share units, already divided by the stake-token decimals.Find Farms
Discover farms by their stake token, or batch-load known farm addresses in one call.findFarms
getFarmsForMint filters on the stake-token mint, so it only finds non-delegated farms. Delegated farms leave that field empty, so you get their address elsewhere (a reserve’s farmCollateral / farmDebt, or a kvault’s vaultFarm; see the locating table in the overview) and batch-load them with getAllFarmStatesByPubkeys.Get Incentive APY
Compute a farm’s reward APY two ways: the easy path for a strategy farm, and the generic path for any farm.getIncentiveApy
getRewardsAPYForStrategy is the easy path for a strategy farm: the SDK derives the share price and reward prices itself. calculateFarmIncentivesApy is generic and works for any farm, but you supply a getPrice callback for reward tokens (from the oracle endpoint) plus the staked-token price (from the kliquidity SDK, since a strategy share is not an oracle-tracked asset). The two totals land close to each other.Simulate APY After Stake or Unstake
Project how the incentive APY changes after a hypothetical stake or unstake, reusing thegetPrice callback and stakedTokenPrice from the previous example.
simulateApy
stakedTokenDelta is in share units (the decimal share amount, not raw lamports) and adds to the current total stake. A positive delta simulates staking more, so the same rewards spread over a bigger pool and APY falls. A negative delta simulates unstaking, so APY rises.Farm Types
TypeScript shapes used by the Farms SDK for farm reads.- FarmState
- TokenInfo
- RewardInfo
- FarmIncentives
On-chain farm account. Fetched with
FarmState.fetch / fetchMultiple. See the collapsible field reference at the top of the page for what each value means.