### Setup Examples Environment Source: https://github.com/kamino-finance/kliquidity-sdk/blob/master/README.md Navigate to the examples directory and install dependencies. Set the RPC_ENDPOINT environment variable before running examples. ```bash cd examples yarn install export RPC_ENDPOINT=YOUR_RPC_URL_HERE ``` -------------------------------- ### Install Kamino Liquidity SDK (Yarn) Source: https://github.com/kamino-finance/kliquidity-sdk/blob/master/docs/overview.md Install the SDK using Yarn. ```bash yarn add @kamino-finance/kliquidity-sdk ``` -------------------------------- ### Install Kamino Liquidity SDK Source: https://github.com/kamino-finance/kliquidity-sdk/blob/master/docs/overview.md Install the SDK and its peer dependencies using npm. ```bash npm install @kamino-finance/kliquidity-sdk @solana/kit decimal.js ``` -------------------------------- ### Deposit and Stake Example Source: https://github.com/kamino-finance/kliquidity-sdk/blob/master/examples/README.md Deposits tokens into a strategy and stakes the resulting shares in the strategy's farm. This example requires a funded wallet and WS endpoint. ```bash yarn deposit-and-stake ``` -------------------------------- ### Deposit and Stake (Noop Signer) Example Source: https://github.com/kamino-finance/kliquidity-sdk/blob/master/examples/README.md Performs the same deposit and stake actions as the previous example but utilizes a noop signer. This is useful for constructing multisig proposals. ```bash yarn deposit-and-stake-noop-signer ``` -------------------------------- ### Read Strategy Data Example Source: https://github.com/kamino-finance/kliquidity-sdk/blob/master/examples/README.md Fetches strategy information, including share price, token balances, and vault holdings. This example does not require a wallet or WS endpoint. ```bash yarn read-strategy ``` -------------------------------- ### Install Peer Dependencies Source: https://github.com/kamino-finance/kliquidity-sdk/blob/master/docs/overview.md Install the required peer dependencies for the SDK if they are not already present in your project. ```bash npm install @solana/kit decimal.js ``` -------------------------------- ### Example API Request with Environment Parameter Source: https://github.com/kamino-finance/kliquidity-sdk/blob/master/docs/api-reference.md Demonstrates how to specify the environment (e.g., mainnet-beta) in an API request. ```bash https://api.kamino.finance/strategies?env=mainnet-beta ``` -------------------------------- ### Install Dependencies and Set Environment Variables Source: https://github.com/kamino-finance/kliquidity-sdk/blob/master/examples/README.md Installs project dependencies and sets up necessary environment variables for RPC and optionally WS endpoints. The WS endpoint is only required for sending transactions. ```bash cd kliquidity-sdk/examples yarn install export RPC_ENDPOINT=YOUR_RPC_URL_HERE export WS_ENDPOINT=YOUR_WS_ENDPOINT_HERE # only needed for sending transactions ``` -------------------------------- ### Unstake and Withdraw Example Source: https://github.com/kamino-finance/kliquidity-sdk/blob/master/examples/README.md Unstakes shares from a farm and withdraws tokens from a strategy. This example requires a funded wallet and WS endpoint. ```bash yarn unstake-and-withdraw ``` -------------------------------- ### Start Local Solana Validator Source: https://github.com/kamino-finance/kliquidity-sdk/blob/master/README.md Start a local Solana validator for testing purposes. Ensure the 'deps' directory contains the correct Solana Program Library (SPL) or program binaries. ```bash yarn start-validator ``` -------------------------------- ### Run All Tests Source: https://github.com/kamino-finance/kliquidity-sdk/blob/master/README.md Execute all tests for the SDK. This command will start the validator and run the test suite. ```bash yarn start-validator-and-test ``` -------------------------------- ### Sync Smart Contracts with Local Development Source: https://github.com/kamino-finance/kliquidity-sdk/blob/master/README.md Install dependencies, dump the Kamino program from mainnet to the local 'deps' directory, and regenerate the client code. ```bash yarn solana program dump 6LtLpnUFNByNXLyCoK9wA2MykKAmQNZKBdY8s47dehDc -u m deps/kamino.so yarn codegen ``` -------------------------------- ### Read User Positions Example Source: https://github.com/kamino-finance/kliquidity-sdk/blob/master/examples/README.md Retrieves all Kamino Liquidity positions for a given wallet and calculates their USD values. This is a read-only operation. ```bash yarn read-positions ``` -------------------------------- ### List All Live Strategies Source: https://github.com/kamino-finance/kliquidity-sdk/blob/master/docs/api-reference.md Retrieve a summary of all currently active strategies. Use the `status=LIVE` filter to get only live strategies. ```bash GET /strategies?env=mainnet-beta&status=LIVE ``` -------------------------------- ### Strategy Summary JSON Response Source: https://github.com/kamino-finance/kliquidity-sdk/blob/master/docs/api-reference.md Example JSON structure for a strategy summary, including its address, type, and token mints. ```json [ { "address": "2H4xebnp2M9JYgPPfUw58uUQahWF8f1YTNxwwtmdqVYV", "type": "STABLE", "shareMint": "HYmVV4g4BDpSrz5nPSeFkQ8ysRa5XDHBnKSBjW7FPFjg", "status": "LIVE", "tokenAMint": "USDH1SM1ojwWUga67PGrgFWUHibbjqMvuMaDkRJTgkX", "tokenBMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" } ] ``` -------------------------------- ### Setup Strategy Lookup Table Source: https://context7.com/kamino-finance/kliquidity-sdk/llms.txt Creates the necessary Solana Address Lookup Table for strategy transactions. This is primarily for newly created strategies. ```APIDOC ## setupStrategyLookupTable() ### Description Creates the Solana Address Lookup Table required for strategy transactions. Only needed for newly created strategies; existing strategies expose `strategy.strategyLookupTable`. ### Usage For existing strategies, the lookup table is available on the strategy object (`strategy.strategyLookupTable`). For newly created strategies, this function must be called first to generate the lookup table instructions. ### Example ```typescript import { address } from '@solana/kit'; import { Kamino } from '@kamino-finance/kliquidity-sdk'; // For EXISTING strategies — lookup table is already on the strategy object: // const lut = strategyState.strategy.strategyLookupTable; // Use directly in sendAndConfirmTx(..., [lut]) // For NEWLY CREATED strategies — must create the lookup table first: const slot = await kamino.getConnection().getSlot({ commitment: 'finalized' }).send(); const lookupTableSetup = await kamino.setupStrategyLookupTable(keypair, strategyAddress, slot); // lookupTableSetup contains instructions to create and extend the LUT // After sending those instructions, subsequent transactions can use the new LUT ``` ``` -------------------------------- ### Import Core SDK Types Source: https://github.com/kamino-finance/kliquidity-sdk/blob/master/docs/sdk-types.md Import essential types from the Kamino Liquidity SDK for use in your application. Ensure the SDK is installed. ```typescript import { Kamino, StrategyWithAddress, KaminoPosition, Holdings, TokenAmounts, ShareData, StrategyBalances, StrategyPrices, StrategyHolder, StrategyWithPendingFees, StrategiesFilters, } from '@kamino-finance/kliquidity-sdk'; ``` -------------------------------- ### Read Strategy Holders Example Source: https://github.com/kamino-finance/kliquidity-sdk/blob/master/examples/README.md Lists all wallets that hold shares of a specific strategy, along with their corresponding USD values. This is a read-only operation. ```bash yarn strategy-holders ``` -------------------------------- ### Get All User Positions Source: https://github.com/kamino-finance/kliquidity-sdk/blob/master/docs/positions-and-pnl.md Retrieves all strategies a user has shares in, along with details about their positions. ```APIDOC ## Get All User Positions ### Description Retrieves all strategies a user has shares in, along with details about their positions. ### Method `getUserPositions` ### Parameters #### Path Parameters - **walletAddress** (address) - Required - The public key of the user's wallet. ### Response #### Success Response (200) - **positions** (Array) - An array of position objects, each containing strategy, shareMint, sharesAmount, and strategyDex. ### Request Example ```typescript import { address } from '@solana/kit'; const walletAddress = address('HrwbdQYwSnAyVpVHuGQ661HiNbWmGjDp5DdDR9YMw7Bu'); const positions = await kamino.getUserPositions(walletAddress); for (const pos of positions) { console.log('Strategy:', pos.strategy); console.log('Share Mint:', pos.shareMint); console.log('Shares Held:', pos.sharesAmount.toString()); console.log('DEX:', pos.strategyDex); // 'ORCA' | 'RAYDIUM' | 'METEORA' } ``` ``` -------------------------------- ### Get All Strategy Metrics Source: https://github.com/kamino-finance/kliquidity-sdk/blob/master/docs/api-reference.md Retrieve metrics for all strategies that match the specified status filter. This is useful for an overview of multiple strategies. ```bash GET /strategies/metrics?env=mainnet-beta&status=LIVE ``` -------------------------------- ### Read Strategy APY and Range Example Source: https://github.com/kamino-finance/kliquidity-sdk/blob/master/examples/README.md Reads the APR/APY breakdown, position range, and current pool price for a strategy. This is a read-only operation. ```bash yarn strategy-apy ``` -------------------------------- ### User Position PnL JSON Response Source: https://github.com/kamino-finance/kliquidity-sdk/blob/master/docs/api-reference.md Example JSON showing a user's total profit/loss and cost basis in various denominations. ```json { "totalPnl": { "usd": "125.50", "sol": "1.15", "a": "125.50", "b": "0.0058" }, "totalCostBasis": { "usd": "1000.00", "sol": "9.20", "a": "500.00", "b": "2.50" } } ``` -------------------------------- ### Strategy Metrics JSON Response Source: https://github.com/kamino-finance/kliquidity-sdk/blob/master/docs/api-reference.md Example JSON response containing detailed metrics for a strategy, including APY, TVL, and balance information. ```json { "strategy": "1k1LKNtugkPkSVGFfMAFXQoVGRsBNJzphNoghLNGtps", "tokenAMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", "tokenBMint": "So11111111111111111111111111111111111111112", "tokenA": "USDC", "tokenB": "SOL", "rewardMints": ["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"], "krewardMints": [], "profitAndLoss": "0", "sharePrice": "0.03725687025547599494", "sharesIssued": "8700761.465532", "totalValueLocked": "324163.14104517", "kaminoApy": { "vault": { "apr7d": "42.15", "apy7d": "52.01", "apr24h": "38.50", "apr30d": "40.20", "apy24h": "46.93", "apy30d": "49.53", "krewardsApr7d": "0", "krewardsApy7d": "0", "lastCalculated": "2026-02-18T15:01:09.206Z" }, "kamino": [], "totalApy": "52.01" }, "apy": { "vault": { "feeApr": "42.15", "feeApy": "52.01", "totalApr": "42.15", "totalApy": "52.01", "poolPrice": "0.00946", "priceLower": "0.00876", "priceUpper": "0.01023", "rewardsApr": [], "rewardsApy": [], "strategyOutOfRange": false }, "kamino": [], "totalApy": "52.01" }, "vaultBalances": { "tokenA": { "invested": "90000.00", "available": "5000.00", "total": "95000.00", "totalUsd": "95000.00" }, "tokenB": { "invested": "2000.00", "available": "100.00", "total": "2100.00", "totalUsd": "229000.00" } } } ``` -------------------------------- ### Get Strategy TVL Source: https://context7.com/kamino-finance/kliquidity-sdk/llms.txt Retrieves the total USD value locked across all Kamino Finance strategies. ```bash curl "https://api.kamino.finance/strategies/tvl?env=mainnet-beta" # Response: { "tvl": "12345678.90" } ``` ```bash curl "https://api.kamino.finance/strategies/all-time-volume?env=mainnet-beta" # Response: { "volumeUsd": "987654321.00", "lastCalculated": "2026-02-18T16:15:06.371Z" } ``` ```bash curl "https://api.kamino.finance/strategies/all-time-fees-and-rewards?env=mainnet-beta" # Response: aggregated all-time fees and rewards per strategy ``` -------------------------------- ### Get All User Positions Source: https://github.com/kamino-finance/kliquidity-sdk/blob/master/docs/positions-and-pnl.md Fetches all strategies a user has shares in. Requires the user's wallet address. Iterates through positions to log strategy details. ```typescript import { address } from '@solana/kit'; const walletAddress = address('HrwbdQYwSnAyVpVHuGQ661HiNbWmGjDp5DdDR9YMw7Bu'); // Get all strategies the user has shares in const positions = await kamino.getUserPositions(walletAddress); for (const pos of positions) { console.log('Strategy:', pos.strategy); console.log('Share Mint:', pos.shareMint); console.log('Shares Held:', pos.sharesAmount.toString()); console.log('DEX:', pos.strategyDex); // 'ORCA' | 'RAYDIUM' | 'METEORA' } ``` -------------------------------- ### List All Strategies via REST API Source: https://context7.com/kamino-finance/kliquidity-sdk/llms.txt Fetches summaries for all strategies matching the specified status filter. Use this endpoint to get a list of available strategies. ```bash curl "https://api.kamino.finance/strategies?env=mainnet-beta&status=LIVE" ``` -------------------------------- ### Get and Collect Fees from Kamino Strategies Source: https://context7.com/kamino-finance/kliquidity-sdk/llms.txt Reads uncollected fees for specified strategies and builds an instruction to collect them. This action is permissionless and can be called by anyone. ```typescript import { address } from '@solana/kit'; import { Kamino } from '@kamino-finance/kliquidity-sdk'; const strategyAddress = address('2H4xebnp2M9JYgPPfUw58uUQahWF8f1YTNxwwtmdqVYV'); const strategyWithAddress = { strategy: await kamino.getStrategyByAddress(strategyAddress)!, address: strategyAddress }; // Read pending (uncollected) fees across multiple strategies const pendingFees = await kamino.getPendingFees([strategyAddress]); for (const pf of pendingFees) { console.log('Strategy:', pf.strategy.address); console.log('Pending Token A fees:', pf.pendingFees.a.toString()); console.log('Pending Token B fees:', pf.pendingFees.b.toString()); } // Collect fees and rewards (permissionless — anyone can call this) const collectIx = await kamino.collectFeesAndRewards(strategyWithAddress, keypair); // Include collectIx in your transaction and send ``` -------------------------------- ### Get Specific Strategy Metrics Source: https://github.com/kamino-finance/kliquidity-sdk/blob/master/docs/api-reference.md Fetch detailed performance metrics for a given strategy address. The `strategyAddress` should be replaced with the actual strategy public key. ```bash GET /strategies/:strategyAddress/metrics?env=mainnet-beta ``` -------------------------------- ### Get Strategy Historical Time Series Data Source: https://context7.com/kamino-finance/kliquidity-sdk/llms.txt Retrieve time-series data for a strategy, including share price, TVL, and fees. Specify the environment, start and end dates, and frequency (minute, hour, or day). ```bash curl "https://api.kamino.finance/v2/strategies/1k1LKNtugkPkSVGFfMAFXQoVGRsBNJzphNoghLNGtps/history?env=mainnet-beta&start=2026-02-17T00:00:00Z&end=2026-02-18T00:00:00Z&frequency=hour" ``` -------------------------------- ### Get Strategy History (Time Series) Source: https://github.com/kamino-finance/kliquidity-sdk/blob/master/docs/api-reference.md Retrieve time-series data for a specific strategy, suitable for charting performance over a defined period. Allows specifying start and end times, and data frequency (minute, hour, day). ```http GET /v2/strategies/:strategyAddress/history?env=mainnet-beta&start=2026-02-17T00:00:00Z&end=2026-02-18T00:00:00Z&frequency=hour ``` ```json [ { "timestamp": "2026-02-17T00:00:00.000Z", "feesCollectedCumulativeA": "386564.538238", "feesCollectedCumulativeB": "2178.223047595", "rewardsCollectedCumulative0": "0", "sharePrice": "0.03725687025547599494", "sharesIssued": "8700761.465532", "tokenAAmounts": "94374.091296", "tokenBAmounts": "2104.502578997", "tokenAPrice": "0.9999506", "tokenBPrice": "109.19146126", "totalValueLocked": "324163.14", "solPrice": "86.54727332", "profitAndLoss": "0" } ] ``` -------------------------------- ### Initialize Kamino SDK and Fetch Strategies Source: https://github.com/kamino-finance/kliquidity-sdk/blob/master/docs/overview.md Initialize the Kamino SDK with a Solana RPC endpoint and fetch live strategies. Ensure you have the necessary imports from '@kamino-finance/kliquidity-sdk' and '@solana/kit'. ```typescript import { Kamino } from '@kamino-finance/kliquidity-sdk'; import { createSolanaRpc } from '@solana/kit'; const rpc = createSolanaRpc('https://api.mainnet-beta.solana.com'); const kamino = new Kamino('mainnet-beta', rpc); // List all live strategies const strategies = await kamino.getAllStrategiesWithFilters({ strategyCreationStatus: 'LIVE' }); // Get share price for a strategy const sharePrice = await kamino.getStrategySharePrice(strategies[0].address); console.log('Share price:', sharePrice.toString()); ``` -------------------------------- ### Initialize Kamino SDK Source: https://github.com/kamino-finance/kliquidity-sdk/blob/master/docs/overview.md Set up the Kamino SDK instance by providing the Solana cluster and an RPC connection. For production, use your own RPC endpoint instead of a public one. ```typescript import { Kamino } from '@kamino-finance/kliquidity-sdk'; import { createSolanaRpc } from '@solana/kit'; // Using a public RPC (rate-limited, use your own RPC for production) const rpc = createSolanaRpc('https://api.mainnet-beta.solana.com'); const kamino = new Kamino('mainnet-beta', rpc); ``` -------------------------------- ### Setup Strategy Lookup Table Source: https://github.com/kamino-finance/kliquidity-sdk/blob/master/examples/README.md Sets up a lookup table for a new strategy, which is recommended before opening positions or sending large transactions. It requires fetching a finalized slot and passing it explicitly. ```typescript const slot = await kamino.getConnection().getSlot({ commitment: 'finalized' }).send(); const lookupTableSetup = await kamino.setupStrategyLookupTable(signer, strategyAddress, slot); ``` -------------------------------- ### SDK Initialization Source: https://context7.com/kamino-finance/kliquidity-sdk/llms.txt Creates the main SDK instance. All SDK methods are called on this object. Ensure you use your own RPC endpoint in production to avoid rate limits. ```APIDOC ## SDK Initialization — `new Kamino(cluster, rpc)` Creates the main SDK instance. All SDK methods are called on this object. ```typescript import { Kamino } from '@kamino-finance/kliquidity-sdk'; import { createSolanaRpc } from '@solana/kit'; // Use your own RPC endpoint in production to avoid rate limits const rpc = createSolanaRpc('https://api.mainnet-beta.solana.com'); const kamino = new Kamino('mainnet-beta', rpc); // Optional overrides (devnet example): // const kamino = new Kamino('devnet', rpc, customGlobalConfig, customProgramId); ``` ``` -------------------------------- ### Get All Strategy Metrics Source: https://github.com/kamino-finance/kliquidity-sdk/blob/master/docs/api-reference.md Retrieves detailed metrics for all strategies that match the specified status filter. ```APIDOC ## Get All Strategy Metrics ### Description Returns the same metrics format as `Get Strategy Metrics` but for all strategies matching the status filter. ### Method GET ### Endpoint /strategies/metrics ### Query Parameters - **env** (string) - Optional - Environment to query (e.g., `mainnet-beta`). - **status** (string) - Optional - Filter strategies by status (e.g., `LIVE`). ### Response #### Success Response (200) Returns an array of strategy metrics objects, each in the same format as the response for `Get Strategy Metrics`. ``` -------------------------------- ### Get Strategy Metrics Source: https://github.com/kamino-finance/kliquidity-sdk/blob/master/docs/api-reference.md Retrieves detailed performance metrics for a specific strategy identified by its address. ```APIDOC ## Get Strategy Metrics ### Description Returns detailed metrics for a single strategy. ### Method GET ### Endpoint /strategies/:strategyAddress/metrics ### Path Parameters - **strategyAddress** (string) - Required - The public key of the strategy. ### Query Parameters - **env** (string) - Optional - Environment to query (e.g., `mainnet-beta`). ### Response #### Success Response (200) - **strategy** (string) - Strategy address. - **tokenAMint** (string) - Token A mint address. - **tokenBMint** (string) - Token B mint address. - **tokenA** (string) - Symbol for Token A. - **tokenB** (string) - Symbol for Token B. - **rewardMints** (array) - Array of reward token mint addresses. - **krewardMints** (array) - Array of k-reward token mint addresses. - **profitAndLoss** (string) - Total profit and loss in USD. - **sharePrice** (string) - Current USD value of one share. - **sharesIssued** (string) - Total shares outstanding. - **totalValueLocked** (string) - Total USD value locked in the strategy. - **kaminoApy** (object) - Kamino-specific APY details. - **vault** (object) - Vault APY metrics. - **apr7d** (string) - 7-day annualized return rate. - **apy7d** (string) - 7-day compounded annual return. - **apr24h** (string) - 24-hour annualized return rate. - **apr30d** (string) - 30-day annualized return rate. - **apy24h** (string) - 24-hour compounded annual return. - **apy30d** (string) - 30-day compounded annual return. - **krewardsApr7d** (string) - 7-day annualized k-rewards rate. - **krewardsApy7d** (string) - 7-day compounded k-rewards annual return. - **lastCalculated** (string) - Timestamp of the last calculation. - **kamino** (array) - Kamino specific APY breakdowns. - **totalApy** (string) - Overall total APY. - **apy** (object) - General APY details. - **vault** (object) - Vault APY metrics. - **feeApr** (string) - APR from trading fees. - **feeApy** (string) - APY from trading fees. - **totalApr** (string) - Total annualized return rate. - **totalApy** (string) - Total compounded annual return. - **poolPrice** (string) - Current pool price (Token A in terms of Token B). - **priceLower** (string) - Lower bound of the position range. - **priceUpper** (string) - Upper bound of the position range. - **rewardsApr** (array) - Array of reward APRs. - **rewardsApy** (array) - Array of reward APYs. - **strategyOutOfRange** (boolean) - Indicates if the strategy is out of range. - **kamino** (array) - Kamino specific APY breakdowns. - **totalApy** (string) - Overall total APY. - **vaultBalances** (object) - Balances of tokens within the vault. - **tokenA** (object) - Details for Token A. - **invested** (string) - Amount of Token A actively providing liquidity. - **available** (string) - Amount of Token A available in the vault. - **total** (string) - Total amount of Token A. - **totalUsd** (string) - USD value of all Token A. - **tokenB** (object) - Details for Token B. - **invested** (string) - Amount of Token B actively providing liquidity. - **available** (string) - Amount of Token B available in the vault. - **total** (string) - Total amount of Token B. - **totalUsd** (string) - USD value of all Token B. ### Response Example ```json { "strategy": "1k1LKNtugkPkSVGFfMAFXQoVGRsBNJzphNoghLNGtps", "tokenAMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", "tokenBMint": "So11111111111111111111111111111111111111112", "tokenA": "USDC", "tokenB": "SOL", "rewardMints": ["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"], "krewardMints": [], "profitAndLoss": "0", "sharePrice": "0.03725687025547599494", "sharesIssued": "8700761.465532", "totalValueLocked": "324163.14104517", "kaminoApy": { "vault": { "apr7d": "42.15", "apy7d": "52.01", "apr24h": "38.50", "apr30d": "40.20", "apy24h": "46.93", "apy30d": "49.53", "krewardsApr7d": "0", "krewardsApy7d": "0", "lastCalculated": "2026-02-18T15:01:09.206Z" }, "kamino": [], "totalApy": "52.01" }, "apy": { "vault": { "feeApr": "42.15", "feeApy": "52.01", "totalApr": "42.15", "totalApy": "52.01", "poolPrice": "0.00946", "priceLower": "0.00876", "priceUpper": "0.01023", "rewardsApr": [], "rewardsApy": [], "strategyOutOfRange": false }, "kamino": [], "totalApy": "52.01" }, "vaultBalances": { "tokenA": { "invested": "90000.00", "available": "5000.00", "total": "95000.00", "totalUsd": "95000.00" }, "tokenB": { "invested": "2000.00", "available": "100.00", "total": "2100.00", "totalUsd": "229000.00" } } } ``` ``` -------------------------------- ### Get a Single Strategy Source: https://github.com/kamino-finance/kliquidity-sdk/blob/master/docs/reading-strategies.md Fetches a single strategy's on-chain account data by its address. ```APIDOC ## Get a Single Strategy ### Description Fetches a single strategy's on-chain account data by its address. ### Method `kamino.getStrategyByAddress(strategyAddress: string)` ### Parameters #### Path Parameters - **strategyAddress** (string) - Required - The address of the strategy account. ### Response #### Success Response (200) - **strategy** (StrategyAccount) - The on-chain WhirlpoolStrategy account data. ### Request Example ```typescript import { address } from '@solana/kit'; const strategyAddress = address('2H4xebnp2M9JYgPPfUw58uUQahWF8f1YTNxwwtmdqVYV'); const strategy = await kamino.getStrategyByAddress(strategyAddress); ``` ### Response Example ```json { "address": "", "strategy": { "tokenAMint": "", "tokenBMint": "", "strategyDex": 0, // 0=ORCA, 1=RAYDIUM, 2=METEORA "sharesIssued": "" } } ``` ``` -------------------------------- ### Setup Strategy Address Lookup Table (LUT) Source: https://context7.com/kamino-finance/kliquidity-sdk/llms.txt Creates the necessary Solana Address Lookup Table for strategy transactions. This is only required for newly created strategies. Existing strategies have the LUT available on the strategy object. ```typescript import { address } from '@solana/kit'; import { Kamino } from '@kamino-finance/kliquidity-sdk'; // For EXISTING strategies — lookup table is already on the strategy object: const lut = strategyState.strategy.strategyLookupTable; // Use directly in sendAndConfirmTx(..., [lut]) // For NEWLY CREATED strategies — must create the lookup table first: const slot = await kamino.getConnection().getSlot({ commitment: 'finalized' }).send(); const lookupTableSetup = await kamino.setupStrategyLookupTable(keypair, strategyAddress, slot); // lookupTableSetup contains instructions to create and extend the LUT // After sending those instructions, subsequent transactions can use the new LUT ``` -------------------------------- ### Get Strategy Holders Source: https://context7.com/kamino-finance/kliquidity-sdk/llms.txt Retrieves all wallet addresses holding shares of a specific strategy along with their respective share amounts. ```APIDOC ## getStrategyHolders(address) ### Description Returns all wallet addresses holding shares of a strategy and their share amounts. ### Parameters - **address** (address): The address of the strategy. ### Returns An array of objects, where each object contains `holderPubkey` and `amount`. ### Example ```typescript import { address } from '@solana/kit'; import { Kamino } from '@kamino-finance/kliquidity-sdk'; const strategyAddress = address('2H4xebnp2M9JYgPPfUw58uUQahWF8f1YTNxwwtmdqVYV'); const holders = await kamino.getStrategyHolders(strategyAddress); console.log(`Total holders: ${holders.length}`); for (const holder of holders) { console.log('Wallet:', holder.holderPubkey.toString()); console.log('Shares:', holder.amount.toString()); } ``` ``` -------------------------------- ### Set up Strategy Lookup Table with Kamino SDK Source: https://github.com/kamino-finance/kliquidity-sdk/blob/master/docs/faq.md Handle Solana Address Lookup Tables for Kamino strategies. Existing strategies expose the lookup table directly. For new strategies, you must explicitly set up a lookup table using a finalized slot. ```typescript // Existing strategies expose the lookup table on the strategy object. const lut = strategyState.strategy.strategyLookupTable; // For a newly created strategy, fetch a fresh finalized slot and pass it explicitly. const slot = await kamino.getConnection().getSlot({ commitment: 'finalized' }).send(); const lookupTableSetup = await kamino.setupStrategyLookupTable(signer, strategyAddress, slot); ``` -------------------------------- ### List All LIVE Strategies Source: https://github.com/kamino-finance/kliquidity-sdk/blob/master/docs/reading-strategies.md Retrieve all strategies with a 'LIVE' status. You can filter by status, type, and community management. Use 'LIVE' for production strategies. ```typescript const strategies = await kamino.getAllStrategiesWithFilters({ strategyCreationStatus: 'LIVE', }); for (const s of strategies) { console.log('Strategy:', s.address); console.log('Token A Mint:', s.strategy.tokenAMint); console.log('Token B Mint:', s.strategy.tokenBMint); console.log('DEX:', s.strategy.strategyDex.toString()); // 0=ORCA, 1=RAYDIUM, 2=METEORA console.log('Shares Issued:', s.strategy.sharesIssued.toString()); } ``` -------------------------------- ### Get User Transaction History Source: https://context7.com/kamino-finance/kliquidity-sdk/llms.txt Retrieves all deposit, withdrawal, and claim transactions for a wallet across all strategies. Requires a wallet address. ```typescript interface ShareholderTransaction { strategy: string; instruction: 'deposit' | 'withdraw' | 'claim'; signature: string; // Solana transaction signature timestamp: string; // ISO 8601 numberOfShares: string; // shares minted (deposit) or burned (withdraw) sharePrice: string; // share price at time of tx tokenAAmount: string; // Token A deposited or received tokenBAmount: string; solPrice: string; // SOL/USD at time of tx fullWithdraw: boolean; // true if user withdrew all shares } // Response example: // [{ "instruction": "deposit", "numberOfShares": "100.5", "sharePrice": "1.05", // "tokenAAmount": "50.25", "timestamp": "2026-01-15T10:30:00.000Z" }] ``` ```bash curl "https://api.kamino.finance/v2/shareholders/HrwbdQYwSnAyVpVHuGQ661HiNbWmGjDp5DdDR9YMw7Bu/transactions?env=mainnet-beta" ``` -------------------------------- ### Get Strategy Share Price Source: https://context7.com/kamino-finance/kliquidity-sdk/llms.txt Calculates the current price of a single share for a given strategy. This is essential for valuing user positions. ```APIDOC ## Get Strategy Share Price — `kamino.getStrategySharePrice(strategy)` Retrieves the current price of one share for a given strategy. ### Parameters - `strategy`: The strategy object. ### Returns - A Decimal representing the price of one share. ``` -------------------------------- ### Get All-Time Strategy Volume Source: https://github.com/kamino-finance/kliquidity-sdk/blob/master/docs/api-reference.md Fetch the total all-time trading volume in USD for all strategies. Includes the timestamp of the last calculation. ```http GET /strategies/all-time-volume?env=mainnet-beta ``` ```json { "volumeUsd": "...", "lastCalculated": "..." } ``` -------------------------------- ### List All Strategies Source: https://github.com/kamino-finance/kliquidity-sdk/blob/master/docs/api-reference.md Retrieves a summary of all available strategies, filterable by status. ```APIDOC ## List All Strategies ### Description Returns an array of strategy summaries. ### Method GET ### Endpoint /strategies ### Query Parameters - **env** (string) - Optional - Environment to query (e.g., `mainnet-beta`). - **status** (string) - Optional - Filter strategies by status (e.g., `LIVE`). ### Response #### Success Response (200) - **address** (string) - Strategy public key. - **type** (string) - Strategy type (`NON_PEGGED`, `PEGGED`, or `STABLE`). - **shareMint** (string) - SPL token mint for this strategy's shares. - **status** (string) - Strategy status (`LIVE`, `DEPRECATED`, etc.). - **tokenAMint** (string) - Token A mint address. - **tokenBMint** (string) - Token B mint address. ### Response Example ```json [ { "address": "2H4xebnp2M9JYgPPfUw58uUQahWF8f1YTNxwwtmdqVYV", "type": "STABLE", "shareMint": "HYmVV4g4BDpSrz5nPSeFkQ8ysRa5XDHBnKSBjW7FPFjg", "status": "LIVE", "tokenAMint": "USDH1SM1ojwWUga67PGrgFWUHibbjqMvuMaDkRJTgkX", "tokenBMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" } ] ``` ``` -------------------------------- ### Get Strategy Share Price Source: https://github.com/kamino-finance/kliquidity-sdk/blob/master/docs/reading-strategies.md Calculate the current USD value of one strategy share. This is useful for understanding the value of user investments. ```typescript // Share price - the USD value of one share const sharePrice = await kamino.getStrategySharePrice(strategyAddress); console.log('Share price (USD):', sharePrice.toString()); ``` -------------------------------- ### Get Strategy Share Price and Token Breakdown Source: https://context7.com/kamino-finance/kliquidity-sdk/llms.txt Use `getStrategySharePrice` to find the USD value of a single share and `getTokenAAndBPerShare` to determine the amount of each token backing one share. This is useful for calculating the total value of a user's holdings. ```typescript import { address } from '@solana/kit'; import { Kamino } from '@kamino-finance/kliquidity-sdk'; const strategyAddress = address('2H4xebnp2M9JYgPPfUw58uUQahWF8f1YTNxwwtmdqVYV'); // USD value of a single share const sharePrice = await kamino.getStrategySharePrice(strategyAddress); console.log('Share price (USD):', sharePrice.toString()); // Output: Share price (USD): 0.03725687025547599494 // How much Token A and Token B backs one share const tokensPerShare = await kamino.getTokenAAndBPerShare(strategyAddress); console.log('Token A per share:', tokensPerShare.a.toString()); console.log('Token B per share:', tokensPerShare.b.toString()); // Calculate a user's position value given their share balance import Decimal from 'decimal.js'; const userShares = new Decimal('1500'); const positionValueUsd = userShares.mul(sharePrice); console.log('Position value (USD):', positionValueUsd.toFixed(2)); ``` -------------------------------- ### Withdraw Shares from Kamino Strategy Source: https://context7.com/kamino-finance/kliquidity-sdk/llms.txt Builds instructions to burn shares and withdraw proportional Token A and Token B from a vault. Requires setup for ATAs and potentially closing empty ATAs. ```typescript import Decimal from 'decimal.js'; import { address } from '@solana/kit'; import { Kamino, createComputeUnitLimitIx, getAssociatedTokenAddressAndAccount, } from '@kamino-finance/kliquidity-sdk'; const strategyAddress = address('2H4xebnp2M9JYgPPfUw58uUQahWF8f1YTNxwwtmdqVYV'); const strategy = await kamino.getStrategyByAddress(strategyAddress); if (!strategy) throw new Error('Strategy not found'); const strategyWithAddress = { strategy, address: strategyAddress }; // Get or create ATAs for Token A, Token B, and Shares const [sharesAta, sharesMintData] = await getAssociatedTokenAddressAndAccount( kamino.getConnection(), strategy.sharesMint, keypair.address ); const [tokenAAta, tokenAData] = await getAssociatedTokenAddressAndAccount( kamino.getConnection(), strategy.tokenAMint, keypair.address ); const [tokenBAta, tokenBData] = await getAssociatedTokenAddressAndAccount( kamino.getConnection(), strategy.tokenBMint, keypair.address ); const tx = [createComputeUnitLimitIx(1_400_000)]; // Create any missing ATAs const ataIxs = await kamino.getCreateAssociatedTokenAccountInstructionsIfNotExist( keypair, strategyWithAddress, tokenAData, tokenAAta, tokenBData, tokenBAta, sharesMintData, sharesAta ); tx.push(...ataIxs); // Withdraw 5 shares const withdrawResult = await kamino.withdrawShares(strategyWithAddress, new Decimal(5), keypair); tx.push(...withdrawResult.prerequisiteIxs); // required setup (e.g., collect fees for Raydium) tx.push(withdrawResult.withdrawIx); // the actual burn+withdrawal if (withdrawResult.closeSharesAtaIx) { tx.push(withdrawResult.closeSharesAtaIx); // optionally close shares ATA if now empty } // Withdraw ALL shares at once: const allWithdrawIxns = await kamino.withdrawAllShares(strategyWithAddress, keypair); if (allWithdrawIxns) tx.push(...allWithdrawIxns); // Send with strategy lookup table // await sendAndConfirmTx(rpc, keypair, tx, [], [strategy.strategyLookupTable]); ``` -------------------------------- ### List Live Strategies with Filters Source: https://context7.com/kamino-finance/kliquidity-sdk/llms.txt Fetches all live strategies matching the given filters. Strategies can also be filtered by type ('NON_PEGGED', 'PEGGED', 'STABLE') and community status. ```typescript import { Kamino } from '@kamino-finance/kliquidity-sdk'; import { createSolanaRpc } from '@solana/kit'; const rpc = createSolanaRpc('https://api.mainnet-beta.solana.com'); const kamino = new Kamino('mainnet-beta', rpc); // Fetch all live strategies const strategies = await kamino.getAllStrategiesWithFilters({ strategyCreationStatus: 'LIVE', }); // Also filterable by strategyType ('NON_PEGGED' | 'PEGGED' | 'STABLE') and isCommunity const stableStrategies = await kamino.getAllStrategiesWithFilters({ strategyCreationStatus: 'LIVE', strategyType: 'STABLE', }); for (const s of strategies) { console.log('Strategy:', s.address); console.log('Token A Mint:', s.strategy.tokenAMint); console.log('Token B Mint:', s.strategy.tokenBMint); console.log('DEX:', s.strategy.strategyDex.toString()); // 0=ORCA, 1=RAYDIUM, 2=METEORA console.log('Shares Issued:', s.strategy.sharesIssued.toString()); } // Output: // Strategy: 2H4xebnp2M9JYgPPfUw58uUQahWF8f1YTNxwwtmdqVYV // Token A Mint: USDH1SM1ojwWUga67PGrgFWUHibbjqMvuMaDkRJTgkX // Token B Mint: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v // DEX: 0 // Shares Issued: 8700761.465532 ``` -------------------------------- ### Get User Position PnL Source: https://context7.com/kamino-finance/kliquidity-sdk/llms.txt Retrieves the total profit/loss and cost basis for a specific user in a given strategy. Requires strategy and wallet addresses. ```typescript interface PositionPnl { totalPnl: { usd: string; // "125.50" — profit/loss in USD sol: string; // "1.15" — in SOL a: string; // denominated in Token A b: string; // denominated in Token B }; totalCostBasis: { usd: string; // "1000.00" — total deposited sol: string; a: string; b: string; }; } // Response example: // { "totalPnl": { "usd": "125.50", "sol": "1.15", "a": "125.50", "b": "0.0058" }, // "totalCostBasis": { "usd": "1000.00", "sol": "9.20", "a": "500.00", "b": "2.50" } } ``` ```bash curl "https://api.kamino.finance/v2/strategies/2H4xebnp2M9JYgPPfUw58uUQahWF8f1YTNxwwtmdqVYV/shareholders/HrwbdQYwSnAyVpVHuGQ661HiNbWmGjDp5DdDR9YMw7Bu/pnl?env=mainnet-beta" ``` -------------------------------- ### All Strategy Metrics Source: https://context7.com/kamino-finance/kliquidity-sdk/llms.txt Retrieves detailed metrics for all strategies at once, in the same format as the single strategy metrics endpoint. ```APIDOC ## GET /strategies/metrics ### Description Returns the same metrics format as the single strategy metrics endpoint but for all strategies matching the status filter. ### Method GET ### Endpoint `https://api.kamino.finance/strategies/metrics?env=&status=` ### Query Parameters - **env** (string) - Required - The environment to query (e.g., `mainnet-beta`). - **status** (string) - Required - The status of the strategies to filter by (e.g., `LIVE`). ### Response #### Success Response (200) Returns an array of `StrategyMetrics` objects. ### Request Example ```bash curl "https://api.kamino.finance/strategies/metrics?env=mainnet-beta&status=LIVE" ``` ``` -------------------------------- ### Get Single Strategy by Address Source: https://context7.com/kamino-finance/kliquidity-sdk/llms.txt Fetches the on-chain `WhirlpoolStrategy` account for a specific strategy address. The result is then wrapped into `StrategyWithAddress` for use with other SDK methods. ```typescript import { address } from '@solana/kit'; import { Kamino, StrategyWithAddress } from '@kamino-finance/kliquidity-sdk'; const strategyAddress = address('2H4xebnp2M9JYgPPfUw58uUQahWF8f1YTNxwwtmdqVYV'); const strategy = await kamino.getStrategyByAddress(strategyAddress); if (!strategy) { throw new Error('Strategy not found'); } // Wrap into StrategyWithAddress for use with other SDK methods const strategyWithAddress: StrategyWithAddress = { strategy, address: strategyAddress, }; console.log('Token A Mint:', strategy.tokenAMint.toString()); console.log('Token B Mint:', strategy.tokenBMint.toString()); console.log('Shares Mint:', strategy.sharesMint.toString()); console.log('Lookup Table:', strategy.strategyLookupTable.toString()); console.log('Farm:', strategy.farm.toString()); ```