Skip to main content
Return borrowed assets to reduce or close positions. The SDK handles transaction building, instruction creation for debt repayment.

Repay

Return borrowed assets into 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 Repay Instructions

Fetch the existing obligation and generate repay instructions for the specified token and amount.
4

Build and Sign Transaction

Combine all instructions and build the transaction using Kit’s functional pipe pattern.
All setup, lending, and cleanup instructions are combined in a single transaction for repayment.
5

Send and Confirm Transaction

Send the transaction and confirm it using WebSocket.
Repaying reduces your debt and improves your loan-to-value (LTV) ratio, making your position healthier and reducing liquidation risk.
  1. Assets are transferred from your wallet to the reserve pool
  2. Your borrow amount decreases in your obligation
  3. You stop paying interest on the repaid amount
  4. Your loan-to-value (LTV) ratio decreases (healthier position)
  5. Your available borrowing capacity increases
Repay some of your debt to improve your LTV:
  • Repaying entire borrowed amount + accrued interest eliminates debt
  • Full repayment allows you to withdraw all collateral
  • You must repay the principal + accrued interest
  • Interest accrues continuously