Withdraw for Lending
Withdraw liquidity from the reserve.1
Import Dependencies
Import the required packages for Solana RPC communication, Kamino SDK operations, and Kit transaction building.@solana/kit provides modern utilities for RPC, transaction building, and
signing. @kamino-finance/klend-sdk contains market operation methods.2
Initialize RPC and Load Market
Initialize the RPC connection and load the Kamino market instance.KaminoMarket.load() fetches the current market state including all reserve
data and configuration.3
Fetch Obligation and Build Withdraw Instructions
Fetch the existing obligation from the blockchain and build withdraw instructions.4
Build and Sign Transaction
Use Kit’s functional pipe pattern to build and sign the transaction.Kit’s
pipe function enables functional composition of transaction building
steps for cleaner, more maintainable code.5
Withdraw for Borrowing
Withdraw collateral from an obligation.1
Import Dependencies
Import the required packages for Solana RPC communication, Kamino SDK operations, and Kit transaction building.@solana/kit provides modern utilities for RPC, transaction building, and
signing. @kamino-finance/klend-sdk contains market operation methods.2
Initialize RPC and Load Market
Initialize the RPC connection and load the Kamino market instance.KaminoMarket.load() fetches the current market state including all reserve
data and configuration.3
Fetch Obligation and Build Withdraw Instructions
Fetch the existing obligation from the blockchain and build withdraw instructions.4
5
What Happens When You Withdraw Collateral?
What Happens When You Withdraw Collateral?
- The collateral amount is removed from your obligation
- Your borrowing capacity decreases
- Your loan-to-value (LTV) ratio increases