Skip to main content

Overview

Integrating Kamino’s Earn vaults lets users supply tokens to curated lending strategies on Solana. Deposits are routed to lending markets according to the vault configuration, and interest from borrowers becomes yield for depositors. On deposit, users receive share tokens representing their position. If the vault has a farm attached, shares are automatically staked in the farm and are not visible in the user’s wallet. If the vault has no farm, shares remain in the user’s wallet.

Key Components of Earn Integration

Vault Operations

Deposit, withdraw, and track user positions in the Lend program.

Yield Tracking

Read APY and performance from the public API or on-chain accounts, present recent and longer windows.

Ways to Fetch Data

Public API

Simplest source for vault lists, APY, TVL, status.

SDK

Helpers to deposit, withdraw, and read user positions.

Deposit

import { createSolanaRpc, address } from '@solana/kit';
import { KaminoVault } from '@kamino-finance/klend-sdk';
import { Decimal } from 'decimal.js';

const vault = new KaminoVault(
  createSolanaRpc('https://api.mainnet-beta.solana.com'),
  address('HDsayqAsDWy3QvANGqh2yNraqcD8Fnjgh73Mhb3WRS5E')
);

// Deposit 100 USDC
const depositIxs = await vault.depositIxs(
  user,  // TransactionSigner (multisig cannot sign directly)
  new Decimal(100.0)  // amount in tokens
);

console.log('Deposit Instructions:', depositIxs);
View Code
For the full deposit example, including transaction sending and confirmation, check out Deposit Operations.

Withdraw

import { createSolanaRpc, address } from '@solana/kit';
import { KaminoVault } from '@kamino-finance/klend-sdk';
import { Decimal } from 'decimal.js';

const vault = new KaminoVault(
  createSolanaRpc('https://api.mainnet-beta.solana.com'),
  address('HDsayqAsDWy3QvANGqh2yNraqcD8Fnjgh73Mhb3WRS5E')
);

// Withdraw 1.5 shares
const withdrawIxs = await vault.withdrawIxs(
  user,  // TransactionSigner (multisig cannot sign directly)
  new Decimal(1.5)  // shares to withdraw
);

console.log('Withdraw Instructions:', withdrawIxs);
View Code
For the full withdraw example, including transaction sending and confirmation, check out Withdraw Operations.

Key Data Structures

VaultState
class VaultState {
  tokenMint: Address
  tokenVault: Address
  sharesMint: Address
  tokenAvailable: BN
  sharesIssued: BN
  performanceFeeBps: BN
  managementFeeBps: BN
  vaultAllocationStrategy: Array<VaultAllocation>
  unallocatedTokensCap: BN
  unallocatedWeight: BN
  minDepositAmount: BN
  withdrawalPenaltyLamports: BN
  withdrawalPenaltyBps: BN
  cumulativeEarnedInterestSf: BN
  cumulativeMgmtFeesSf: BN
  cumulativePerfFeesSf: BN
  name: Array<number>
  vaultFarm: Address
  creationTimestamp: BN
  allowAllocationsInWhitelistedReservesOnly: Boolean
  allowInvestInWhitelistedReservesOnly: Boolean
}
View Full Typescript VaultState

Fetch Vaults Data via the API

Access vault metrics and performance data through REST endpoints.

Smart contract repository

Explore the on-chain program source code and documentation.

NPM SDK package

Install the TypeScript SDK to integrate vault operations.

More Earn tutorials

Step-by-step guides for building with Kamino Earn vaults.