Install
$ agentstack add skill-sendaifun-skills-kamino ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ● Environment & secrets Used
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
Kamino Finance Development Guide
Build sophisticated DeFi applications on Solana with Kamino Finance - the comprehensive DeFi protocol offering lending, borrowing, automated liquidity management, leverage trading, and oracle aggregation.
Overview
Kamino Finance provides:
- Kamino Lend (K-Lend): Lending and borrowing protocol with isolated markets
- Kamino Liquidity (K-Liquidity): Automated CLMM liquidity management strategies
- Scope Oracle: Oracle price aggregator for reliable pricing
- Multiply/Leverage: Leveraged long/short positions on assets
- Vaults: Yield-generating vault strategies
- Obligation Orders: Automated LTV-based and price-based order execution
Quick Start
Installation
# Lending SDK
npm install @kamino-finance/klend-sdk
# Liquidity SDK
npm install @kamino-finance/kliquidity-sdk
# Oracle SDK
npm install @kamino-finance/scope-sdk
# Required peer dependencies
npm install @solana/web3.js @coral-xyz/anchor decimal.js
Environment Setup
# .env file
SOLANA_RPC_URL=https://api.mainnet-beta.solana.com
WALLET_KEYPAIR_PATH=./keypair.json
Kamino Lending (klend-sdk)
The lending SDK enables interaction with Kamino's lending markets for deposits, borrows, repayments, and liquidations.
Core Classes
| Class | Purpose | |-------|---------| | KaminoMarket | Load and interact with lending markets | | KaminoAction | Build lending transactions (deposit, borrow, repay, withdraw) | | KaminoObligation | Manage user obligations (positions) | | KaminoReserve | Access reserve configurations and stats | | VanillaObligation | Standard obligation type |
Initialize Market
import { KaminoMarket } from "@kamino-finance/klend-sdk";
import { Connection, PublicKey } from "@solana/web3.js";
const connection = new Connection("https://api.mainnet-beta.solana.com");
// Main lending market address
const MAIN_MARKET = new PublicKey("7u3HeHxYDLhnCoErrtycNokbQYbWGzLs6JSDqGAv5PfF");
// Load market with basic data
const market = await KaminoMarket.load(connection, MAIN_MARKET);
// Load reserves for detailed data
await market.loadReserves();
// Get specific reserve
const usdcReserve = market.getReserve("USDC");
console.log("Total Deposits:", usdcReserve?.stats.totalDepositsWads.toString());
console.log("LTV:", usdcReserve?.stats.loanToValueRatio);
console.log("Borrow APY:", usdcReserve?.stats.borrowInterestAPY);
console.log("Supply APY:", usdcReserve?.stats.supplyInterestAPY);
// Refresh all data including obligations
await market.refreshAll();
Deposit Collateral
import { KaminoAction, VanillaObligation, PROGRAM_ID } from "@kamino-finance/klend-sdk";
import { Keypair, sendAndConfirmTransaction } from "@solana/web3.js";
import Decimal from "decimal.js";
async function deposit(
market: KaminoMarket,
wallet: Keypair,
tokenSymbol: string,
amount: Decimal
) {
// Build deposit transaction
const kaminoAction = await KaminoAction.buildDepositTxns(
market,
amount.toString(), // Amount in base units
tokenSymbol, // e.g., "USDC", "SOL"
wallet.publicKey,
new VanillaObligation(PROGRAM_ID),
0, // Additional compute budget (optional)
true, // Include Ata init instructions
undefined, // Referrer (optional)
undefined, // Current slot (optional)
"finalized" // Commitment
);
// Get all instructions
const instructions = [
...kaminoAction.setupIxs,
...kaminoAction.lendingIxs,
...kaminoAction.cleanupIxs,
];
// Create and send transaction
const tx = new Transaction().add(...instructions);
const signature = await sendAndConfirmTransaction(connection, tx, [wallet]);
return signature;
}
Borrow Assets
async function borrow(
market: KaminoMarket,
wallet: Keypair,
tokenSymbol: string,
amount: Decimal
) {
const kaminoAction = await KaminoAction.buildBorrowTxns(
market,
amount.toString(),
tokenSymbol,
wallet.publicKey,
new VanillaObligation(PROGRAM_ID),
0,
true,
false, // Include deposit for fees (optional)
undefined,
undefined,
"finalized"
);
const instructions = [
...kaminoAction.setupIxs,
...kaminoAction.lendingIxs,
...kaminoAction.cleanupIxs,
];
const tx = new Transaction().add(...instructions);
return await sendAndConfirmTransaction(connection, tx, [wallet]);
}
Repay Loan
async function repay(
market: KaminoMarket,
wallet: Keypair,
tokenSymbol: string,
amount: Decimal | "max"
) {
const repayAmount = amount === "max" ? "max" : amount.toString();
const kaminoAction = await KaminoAction.buildRepayTxns(
market,
repayAmount,
tokenSymbol,
wallet.publicKey,
new VanillaObligation(PROGRAM_ID),
0,
true,
undefined,
"finalized"
);
const instructions = [
...kaminoAction.setupIxs,
...kaminoAction.lendingIxs,
...kaminoAction.cleanupIxs,
];
const tx = new Transaction().add(...instructions);
return await sendAndConfirmTransaction(connection, tx, [wallet]);
}
Withdraw Collateral
async function withdraw(
market: KaminoMarket,
wallet: Keypair,
tokenSymbol: string,
amount: Decimal | "max"
) {
const withdrawAmount = amount === "max" ? "max" : amount.toString();
const kaminoAction = await KaminoAction.buildWithdrawTxns(
market,
withdrawAmount,
tokenSymbol,
wallet.publicKey,
new VanillaObligation(PROGRAM_ID),
0,
true,
undefined,
"finalized"
);
const instructions = [
...kaminoAction.setupIxs,
...kaminoAction.lendingIxs,
...kaminoAction.cleanupIxs,
];
const tx = new Transaction().add(...instructions);
return await sendAndConfirmTransaction(connection, tx, [wallet]);
}
Get User Obligations
// Get single vanilla obligation for user
const obligation = await market.getUserVanillaObligation(wallet.publicKey);
if (obligation) {
console.log("Deposits:", obligation.state.deposits);
console.log("Borrows:", obligation.state.borrows);
console.log("Health Factor:", obligation.refreshedStats.borrowLimit);
}
// Get all obligations for user
const allObligations = await market.getAllUserObligations(wallet.publicKey);
// Get obligations for specific reserve
const reserveObligations = await market.getAllUserObligationsForReserve(
wallet.publicKey,
usdcReserve
);
// Check if reserve is part of obligation
const isReserveInObligation = market.isReserveInObligation(
obligation,
usdcReserve
);
Liquidation
async function liquidate(
market: KaminoMarket,
liquidator: Keypair,
obligationOwner: PublicKey,
repayTokenSymbol: string,
withdrawTokenSymbol: string,
repayAmount: Decimal
) {
const kaminoAction = await KaminoAction.buildLiquidateTxns(
market,
repayAmount.toString(),
repayTokenSymbol,
withdrawTokenSymbol,
obligationOwner,
liquidator.publicKey,
new VanillaObligation(PROGRAM_ID),
0,
true,
"finalized"
);
const instructions = [
...kaminoAction.setupIxs,
...kaminoAction.lendingIxs,
...kaminoAction.cleanupIxs,
];
const tx = new Transaction().add(...instructions);
return await sendAndConfirmTransaction(connection, tx, [liquidator]);
}
Leverage/Multiply Operations
Kamino supports leveraged positions through the multiply feature.
Open Leveraged Position
import {
getLeverageDepositIxns,
getLeverageWithdrawIxns,
calculateLeverageMultiplier
} from "@kamino-finance/klend-sdk/leverage";
async function openLeveragedPosition(
market: KaminoMarket,
wallet: Keypair,
collateralToken: string,
borrowToken: string,
depositAmount: Decimal,
targetLeverage: number // e.g., 2x, 3x
) {
// Calculate parameters for target leverage
const leverageParams = await calculateLeverageMultiplier(
market,
collateralToken,
borrowToken,
depositAmount,
targetLeverage
);
// Build leverage deposit instructions
const { instructions, lookupTables } = await getLeverageDepositIxns(
market,
wallet.publicKey,
collateralToken,
borrowToken,
depositAmount,
leverageParams,
new VanillaObligation(PROGRAM_ID)
);
// Execute transaction with address lookup tables
const tx = new VersionedTransaction(/* ... */);
return await sendAndConfirmTransaction(connection, tx, [wallet]);
}
Close Leveraged Position
async function closeLeveragedPosition(
market: KaminoMarket,
wallet: Keypair,
collateralToken: string,
borrowToken: string
) {
const { instructions, lookupTables } = await getLeverageWithdrawIxns(
market,
wallet.publicKey,
collateralToken,
borrowToken,
"max", // Withdraw full position
new VanillaObligation(PROGRAM_ID)
);
const tx = new VersionedTransaction(/* ... */);
return await sendAndConfirmTransaction(connection, tx, [wallet]);
}
Obligation Orders
Automate actions based on LTV or price thresholds.
LTV-Based Orders
import {
createLtvBasedOrder,
LtvOrderType
} from "@kamino-finance/klend-sdk/obligation_orders";
// Create order to repay when LTV exceeds threshold
async function createLtvOrder(
market: KaminoMarket,
wallet: Keypair,
targetLtv: number, // e.g., 0.8 for 80%
repayToken: string,
repayAmount: Decimal
) {
const orderIx = await createLtvBasedOrder(
market,
wallet.publicKey,
new VanillaObligation(PROGRAM_ID),
{
type: LtvOrderType.REPAY_ON_HIGH_LTV,
triggerLtv: targetLtv,
repayToken,
repayAmount: repayAmount.toString(),
}
);
const tx = new Transaction().add(orderIx);
return await sendAndConfirmTransaction(connection, tx, [wallet]);
}
Price-Based Orders
import {
createPriceBasedOrder,
PriceOrderType
} from "@kamino-finance/klend-sdk/obligation_orders";
// Create stop-loss order
async function createStopLossOrder(
market: KaminoMarket,
wallet: Keypair,
tokenSymbol: string,
triggerPrice: Decimal,
action: "repay" | "withdraw"
) {
const orderIx = await createPriceBasedOrder(
market,
wallet.publicKey,
new VanillaObligation(PROGRAM_ID),
{
type: PriceOrderType.STOP_LOSS,
tokenSymbol,
triggerPrice: triggerPrice.toString(),
action,
}
);
const tx = new Transaction().add(orderIx);
return await sendAndConfirmTransaction(connection, tx, [wallet]);
}
Kamino Liquidity (kliquidity-sdk)
Automated liquidity management for concentrated liquidity positions on Orca, Raydium, and Meteora.
Initialize SDK
import { Kamino } from "@kamino-finance/kliquidity-sdk";
import { Connection, clusterApiUrl } from "@solana/web3.js";
const connection = new Connection(clusterApiUrl("mainnet-beta"));
const kamino = new Kamino("mainnet-beta", connection);
Fetch Strategies
// Get all strategies
const strategies = await kamino.getStrategies();
// Get strategy by address
const strategy = await kamino.getStrategyByAddress(
new PublicKey("strategy_address")
);
// Get strategy by kToken mint
const strategyByMint = await kamino.getStrategyByKTokenMint(
new PublicKey("ktoken_mint")
);
// Get strategies with filters
const filteredStrategies = await kamino.getAllStrategiesWithFilters({
strategyType: "NON_PEGGED", // NON_PEGGED, PEGGED, STABLE
status: "LIVE", // LIVE, STAGING, DEPRECATED
tokenA: new PublicKey("..."), // Filter by token A
tokenB: new PublicKey("..."), // Filter by token B
});
Strategy Types
| Type | Description | Example Pairs | |------|-------------|---------------| | NON_PEGGED | Uncorrelated assets | SOL-BONK, SOL-USDC | | PEGGED | Loosely correlated | BSOL-JitoSOL, mSOL-SOL | | STABLE | Price-stable | USDC-USDT, USDH-USDC |
Get Strategy Data
// Get share price
const sharePrice = await kamino.getStrategySharePrice(strategy);
console.log("Share Price:", sharePrice.toString());
// Get share data
const shareData = await kamino.getStrategyShareData(strategy);
console.log("Total Shares:", shareData.totalShares);
console.log("Token A per Share:", shareData.tokenAPerShare);
console.log("Token B per Share:", shareData.tokenBPerShare);
// Get token amounts per share
const tokenAmounts = await kamino.getTokenAAndBPerShare(strategy);
console.log("Token A:", tokenAmounts.tokenA);
console.log("Token B:", tokenAmounts.tokenB);
// Get strategy price range
const range = await kamino.getStrategyRange(strategy);
console.log("Lower Price:", range.lowerPrice);
console.log("Upper Price:", range.upperPrice);
console.log("Current Price:", range.currentPrice);
Deposit to Strategy
import Decimal from "decimal.js";
async function depositToStrategy(
kamino: Kamino,
wallet: Keypair,
strategyAddress: PublicKey,
tokenAAmount: Decimal,
tokenBAmount: Decimal,
slippage: Decimal // e.g., new Decimal(0.01) for 1%
) {
const strategy = await kamino.getStrategyByAddress(strategyAddress);
// Build deposit instructions
const depositIxs = await kamino.deposit(
strategy,
wallet.publicKey,
tokenAAmount,
tokenBAmount,
slippage
);
// Create transaction with extra compute budget
const tx = kamino.createTransactionWithExtraBudget();
tx.add(...depositIxs);
await kamino.assignBlockInfoToTransaction(tx);
return await sendAndConfirmTransaction(connection, tx, [wallet]);
}
Single Token Deposit
async function singleTokenDeposit(
kamino: Kamino,
wallet: Keypair,
strategyAddress: PublicKey,
tokenAmount: Decimal,
isTokenA: boolean, // true for Token A, false for Token B
slippage: Decimal
) {
const strategy = await kamino.getStrategyByAddress(strategyAddress);
const depositIxs = await kamino.singleTokenDeposit(
strategy,
wallet.publicKey,
tokenAmount,
isTokenA,
slippage
);
const tx = kamino.createTransactionWithExtraBudget();
tx.add(...depositIxs);
await kamino.assignBlockInfoToTransaction(tx);
return await sendAndConfirmTransaction(connection, tx, [wallet]);
}
Withdraw from Strategy
async function withdrawFromStrategy(
kamino: Kamino,
wallet: Keypair,
strategyAddress: PublicKey,
shareAmount: Decimal, // Number of shares to withdraw
slippage: Decimal
) {
const strategy = await kamino.getStrategyByAddress(strategyAddress);
const withdrawIxs = await kamino.withdraw(
strategy,
wallet.publicKey,
shareAmount,
slippage
);
const tx = kamino.createTransactionWithExtraBudget();
tx.add(...withdrawIxs);
await kamino.assignBlockInfoToTransaction(tx);
return await sendAndConfirmTransaction(connection, tx, [wallet]);
}
// Withdraw all shares
async function withdrawAllShares(
kamino: Kamino,
wallet: Keypair,
strategyAddress: PublicKey,
slippage: Decimal
) {
const strategy = await kamino.getStrategyByAddress(strategyAddress);
const withdrawIxs = await kamino.withdrawAllShares(
strategy,
wallet.publicKey,
slippage
);
const tx = kamino.createTransactionWithExtraBudget();
tx.add(...withdrawIxs);
await kamino.assignBlockInfoToTransaction(tx);
return await sendAndConfirmTransaction(connection, tx, [wallet]);
}
Collect Fees & Rewards
async function collectFeesAndRewards(
kamino: Kamino,
wallet: Keypair,
strategyAddress: PublicKey
) {
const strategy = await kamino.getStrategyByAddress(strategyAddress);
const collectIxs = await kamino.collectFeesAndRewards(
strategy,
wallet.publicKey
);
const tx = kamino.createTransactionWithExtraBudget();
tx.add(...collectIxs);
await kamino.assignBlockInfoToTransaction(tx);
return await sendAndConfirmTransaction(
…
## Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- **Author:** [sendaifun](https://github.com/sendaifun)
- **Source:** [sendaifun/skills](https://github.com/sendaifun/skills)
- **License:** Apache-2.0
- **Homepage:** https://solanaskills.com
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.