Skip to main content

Overview

Kamino Farms is the rewards distribution layer for Kamino products. Farms distribute incentive tokens to depositors, suppliers, and borrowers across the protocol, including KMNO emissions on vaults and lending positions. The TypeScript SDK provides access to farm and user state, along with instructions to stake, unstake, and harvest rewards.
Farms attached to lending positions and kvaults are delegated: position accounting lives in the parent program (klend or kvault), and unstake is a two-step flow gated by a cooldown. Read Farm rewards for the conceptual model before integrating.

Key Components of Farms Integration

Farm State

Decode a farm’s reward tokens, per-second emission rates, total staked amount, cooldown period, and scope-oracle binding.

User Positions

Read a wallet’s stake across one or many farms, pending rewards per reward token, and pending-unstake cooldown status.

Stake & Claim

Initialize user state, stake / unstake (with cooldown handling), and harvest accrued rewards in one or all reward tokens.

Locating a Farm Address

The SDK reads any farm given its pubkey. Three places that pubkey can come from:

Integration Options

TypeScript SDK

On-chain reads and transaction building for stake, unstake, harvest, and user-state management. TS/JS only.

Stake

View Code
For the full stake flow including first-time user-state creation and transaction confirmation, see Stake.

Unstake

View Code
Unstaking starts the withdrawal cooldown. After it elapses, withdraw the tokens back to your wallet. See Unstake.

What’s Covered

Farms

Read farm state, discover farms, and compute or simulate incentive APY.

User Position Data

Fetch a wallet’s stake, lockup and cooldown status, and pending rewards.

Stake

Initialize user state and stake share tokens into a farm.

Unstake

Unstake into pending withdrawal and start the cooldown.

Withdraw

Move unstaked tokens back to your wallet after the cooldown.

Harvest

Claim all pending reward tokens in one transaction.

Farms SDK repository

TypeScript SDK source, on-chain program docs, and example scripts.

KFarms program

Rust source for the on-chain farms program.

NPM SDK package

Install the TypeScript SDK to integrate reward operations.

Farm Rewards Concepts

Vault Farm, Autocompound, Insurance Pool farm, and cooldowns explained.