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, interest from borrowers becomes yield for depositors, and positions are tracked inside the Kamino Lend program. There is no wallet receipt token to manage. Users deposit, view their position in the app, and withdraw when ready.

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, createNoopSigner } 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'), // RPC
  address('HDsayqAsDWy3QvANGqh2yNraqcD8Fnjgh73Mhb3WRS5E') // USDC vault
);

const depositIxs = await vault.depositIxs(
  createNoopSigner(address('EZC9wzVCvihCsCHEMGADYdsRhcpdRYWzSCZAVegSCfqY')), // user
  new Decimal(100.0)
);

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, createNoopSigner } 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'), // RPC
  address('HDsayqAsDWy3QvANGqh2yNraqcD8Fnjgh73Mhb3WRS5E') // USDC vault
);

const withdrawIxs = await vault.withdrawIxs(
  createNoopSigner(address('EZC9wzVCvihCsCHEMGADYdsRhcpdRYWzSCZAVegSCfqY')), // user
  new Decimal(1.5) // withdraw 1.5 shares
);

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>
  cumulativeEarnedInterestSf: BN
  cumulativeMgmtFeesSf: BN
  cumulativePerfFeesSf: BN
  name: Array<number>
  vaultFarm: Address
  creationTimestamp: BN
  allocationAdmin: Address
}
View Full Typescript VaultState