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.
Earn Vaults Earn interest on assets
Retrieve vault holdings, APY and exchange rate information.
import { createSolanaRpc , address } from '@solana/kit' ;
import { KaminoVault } from '@kamino-finance/klend-sdk' ;
const vault = new KaminoVault (
createSolanaRpc ( 'https://api.mainnet-beta.solana.com' ), // RPC
address ( 'HDsayqAsDWy3QvANGqh2yNraqcD8Fnjgh73Mhb3WRS5E' ) // USDC vault
);
console . log ({
holdings: ( await vault . getVaultHoldings ()). asJSON (),
apys: await vault . getAPYs (),
exchangeRate: ( await vault . getExchangeRate ()). toString (),
});
View Code
Get User Position
Check a user’s share balance and token value for a specific vault.
import { createSolanaRpc , address } from '@solana/kit' ;
import { KaminoVault } from '@kamino-finance/klend-sdk' ;
const vault = new KaminoVault (
createSolanaRpc ( 'https://api.mainnet-beta.solana.com' ), // RPC
address ( 'HDsayqAsDWy3QvANGqh2yNraqcD8Fnjgh73Mhb3WRS5E' ) // USDC vault
);
const user = address ( 'EZC9wzVCvihCsCHEMGADYdsRhcpdRYWzSCZAVegSCfqY' );
const shares = await vault . getUserShares ( user );
const rate = await vault . getExchangeRate ();
console . log ({
shares: shares . totalShares . toString (),
tokens: shares . totalShares . mul ( rate ). toString (), // the user's position in tokens
});
View Code
Get All User Positions
Fetch a user’s share balances across all vaults they participate in.
import { createSolanaRpc , address } from '@solana/kit' ;
import { KaminoManager } from '@kamino-finance/klend-sdk' ;
const manager = new KaminoManager ( createSolanaRpc ( 'https://api.mainnet-beta.solana.com' ));
const user = address ( 'EZC9wzVCvihCsCHEMGADYdsRhcpdRYWzSCZAVegSCfqY' );
const userSharesAllVaults = await manager . getUserSharesBalanceAllVaults ( user );
userSharesAllVaults . forEach (( shares , vault ) => {
console . log ( `User shares in ${ vault } :` , shares );
});
View Code
Deposit to Vault
Generate deposit instructions to add tokens to a vault.
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 ); // from here the instructions have to be sent, check examples/kvault-examples/example_user_deposit.ts for transaction sending
View Code
Withdraw from Vault
Generate withdrawal instructions to remove shares from a vault.
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 ); // from here the instructions have to be sent, check examples/kvault-examples/example_user_withdraw.ts for transaction sending
View Code
Get Vault Allocations
View how vault assets are allocated across different reserves with target weights.
import { createSolanaRpc , address } from '@solana/kit' ;
import { KaminoVault } from '@kamino-finance/klend-sdk' ;
const vault = new KaminoVault (
createSolanaRpc ( 'https://api.mainnet-beta.solana.com' ), // RPC
address ( 'HDsayqAsDWy3QvANGqh2yNraqcD8Fnjgh73Mhb3WRS5E' ) // USDC vault
);
const allocations = await vault . getVaultAllocations ();
for ( const [ address , overview ] of allocations ) {
console . log (
`Reserve: ${ address } : weight ${ overview . targetWeight . toString () } , allocation: ${ overview . ctokenAllocation . toString () } `
);
}
View Code
Get Vault Incentives
Access comprehensive vault incentive data including farm and reserve rewards.
import { createSolanaRpc , address } from '@solana/kit' ;
import { KaminoManager , KaminoVault } from '@kamino-finance/klend-sdk' ;
import { Decimal } from 'decimal.js' ;
const rpc = createSolanaRpc ( 'https://api.mainnet-beta.solana.com' );
const vault = new KaminoVault (
rpc ,
address ( 'HDsayqAsDWy3QvANGqh2yNraqcD8Fnjgh73Mhb3WRS5E' ) // USDC vault
);
const kaminoManager = new KaminoManager ( rpc );
const vaultTokenPrice = new Decimal ( 1.0 ); // as it is an USDC vault the token price is 1
const vaultOverview = await kaminoManager . getVaultOverview ( vault , vaultTokenPrice );
console . log ( 'vaultOverview' , vaultOverview );
console . log ( 'delegated farm incentives' , vaultOverview . delegatedFarmIncentives );
console . log ( 'reserves farm incentives' , vaultOverview . reservesFarmsIncentives );
console . log ( 'vault farm incentives' , vaultOverview . vaultFarmIncentives );
View Code
Get Vault Metrics History
Retrieve historical vault-level performance metrics including TVL, APY, and farm rewards APY over time.
const kvaultPubkey = 'HDsayqAsDWy3QvANGqh2yNraqcD8Fnjgh73Mhb3WRS5E' ; // vault address
const API_BASE_URL = 'https://api.kamino.finance' ;
const params = new URLSearchParams ({
start: '2024-06-01T00:00:00.000Z' ,
end: '2025-01-01T00:00:00.000Z' ,
}). toString ();
const url = ` ${ API_BASE_URL } /kvaults/vaults/ ${ kvaultPubkey } /metrics/history? ${ params } ` ;
const res = await fetch ( url );
if ( ! res . ok ) {
throw new Error ( `Request failed: ${ res . status } ${ res . statusText } ` );
}
const data = await res . json ();
for ( const item of data ) {
console . log ({
tvl: item . tvl ,
apy: item . apy ,
apyFarmRewards: item . apyFarmRewards ,
});
}
View Code
Get User Position History
Retrieve historical performance metrics for a user’s position in a specific vault.
const kvaultPubkey = 'A2wsxhA7pF4B2UKVfXocb6TAAP9ipfPJam6oMKgDE5BK' ;
const ownerPubkey = '883AnESJiUVzCnwowgaWCpXp4EGsK4JMVzUUUcjSSs62' ; // user
const API_BASE_URL = 'https://api.kamino.finance' ;
const params = new URLSearchParams ({
start: '2024-01-01T00:00:00.000Z' ,
end: '2025-10-01T00:00:00.000Z' ,
}). toString ();
const url = ` ${ API_BASE_URL } /kvaults/users/ ${ ownerPubkey } /vaults/ ${ kvaultPubkey } /metrics/history? ${ params } ` ;
const res = await fetch ( url );
if ( ! res . ok ) {
throw new Error ( `Request failed: ${ res . status } ${ res . statusText } ` );
}
const data = await res . json ();
for ( const item of data ) {
console . log ({
createdOn: item . createdOn ,
sharesAmount: item . sharesAmount ,
usdAmount: item . usdAmount ,
apy: item . apy ,
cumulativeInterestEarnedUsd: item . cumulativeInterestEarnedUsd ,
});
}
View Code
Get All User Position History
Fetch cumulative historical metrics for a user across all their vault positions.
const ownerPubkey = 'AxqtG9SHDkZTLSWg81Sp7VqAzQpRqXtR9ziJ3VQAS8As' ; // user address
const API_BASE_URL = 'https://api.kamino.finance' ;
const params = new URLSearchParams ({
start: '2024-01-01T00:00:00.000Z' ,
end: '2025-11-20T00:00:00.000Z' ,
}). toString ();
const url = ` ${ API_BASE_URL } /kvaults/users/ ${ ownerPubkey } /metrics/history? ${ params } ` ;
const res = await fetch ( url );
if ( ! res . ok ) {
throw new Error ( `Request failed: ${ res . status } ${ res . statusText } ` );
}
const data = await res . json ();
for ( const item of data ) {
console . log ({
createdOn: item . createdOn ,
usdAmount: item . usdAmount ,
solAmount: item . solAmount ,
weightedApy: item . weightedApy ,
cumulativeInterestEarnedUsd: item . cumulativeInterestEarnedUsd ,
});
}
View Code
Get User Vault Position History
Access historical metrics for a user’s position in a specific vault over time.
const kvaultPubkey = 'HDsayqAsDWy3QvANGqh2yNraqcD8Fnjgh73Mhb3WRS5E' ; // vault address
const ownerPubkey = 'AxqtG9SHDkZTLSWg81Sp7VqAzQpRqXtR9ziJ3VQAS8As' ; // user address
const API_BASE_URL = 'https://api.kamino.finance' ;
const params = new URLSearchParams ({
start: '2024-01-01T00:00:00.000Z' ,
end: '2025-01-01T00:00:00.000Z' ,
}). toString ();
const url = ` ${ API_BASE_URL } /kvaults/users/ ${ ownerPubkey } /vaults/ ${ kvaultPubkey } /metrics/history? ${ params } ` ;
const res = await fetch ( url );
if ( ! res . ok ) {
throw new Error ( `Request failed: ${ res . status } ${ res . statusText } ` );
}
const data = await res . json ();
for ( const item of data ) {
console . log ({
createdOn: item . createdOn ,
sharesAmount: item . sharesAmount ,
usdAmount: item . usdAmount ,
apy: item . apy ,
cumulativeInterestEarnedUsd: item . cumulativeInterestEarnedUsd ,
});
}
View Code
Get User P&L
Calculate a user’s profit and loss for their position in a vault.
const kvaultPubkey = 'HDsayqAsDWy3QvANGqh2yNraqcD8Fnjgh73Mhb3WRS5E' ; // vault address
const ownerPubkey = 'AxqtG9SHDkZTLSWg81Sp7VqAzQpRqXtR9ziJ3VQAS8As' ; // user address
const API_BASE_URL = 'https://api.kamino.finance' ;
const url = ` ${ API_BASE_URL } /kvaults/ ${ kvaultPubkey } /users/ ${ ownerPubkey } /pnl` ;
const res = await fetch ( url );
if ( ! res . ok ) {
throw new Error ( `Request failed: ${ res . status } ${ res . statusText } ` );
}
const data = await res . json ();
console . log ({
totalPnlUsd: data . totalPnl . usd ,
totalPnlSol: data . totalPnl . sol ,
totalPnlToken: data . totalPnl . token ,
totalCostBasisUsd: data . totalCostBasis . usd ,
});
View Code
Vault Revenue Share
Earn revenue by deploying vaults with custom fee structures. Set performance fees on profits and management fees on assets under management.
import { createSolanaRpc , address , generateKeyPairSigner } from '@solana/kit' ;
import { KaminoManager , KaminoVaultConfig } from '@kamino-finance/klend-sdk' ;
import { TOKEN_PROGRAM_ADDRESS } from '@solana-program/token' ;
import { Decimal } from 'decimal.js' ;
const rpc = createSolanaRpc ( 'https://api.mainnet-beta.solana.com' );
const adminSigner = await generateKeyPairSigner ();
const tokenMint = address ( 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' ); // USDC
const kaminoManager = new KaminoManager ( rpc );
const kaminoVaultConfig = new KaminoVaultConfig ({
admin: adminSigner ,
tokenMint: tokenMint ,
tokenMintProgramId: TOKEN_PROGRAM_ADDRESS ,
performanceFeeRatePercentage: new Decimal ( 10.0 ), // 10% performance fee on profits
managementFeeRatePercentage: new Decimal ( 1.0 ), // 1% annual management fee on AUM
name: 'Revenue Share Vault' ,
vaultTokenSymbol: 'kUSDC' ,
vaultTokenName: 'kUSDC receipt' ,
});
View Code