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 HTTP polling.Repaying reduces your debt and improves your loan-to-value (LTV) ratio, making
your position healthier and reducing liquidation risk.
What Happens When You Repay?
What Happens When You Repay?
- Assets are transferred from your wallet to the reserve pool
- Your borrow amount decreases in your obligation
- You stop paying interest on the repaid amount
- Your loan-to-value (LTV) ratio decreases (healthier position)
- Your available borrowing capacity increases
Repayment and Interest
Repayment and Interest
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