Documentation Index
Fetch the complete documentation index at: https://kamino.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
Repaying debt on a multiply position reduces your outstanding debt balance, lowers your LTV (Loan-to-Value) ratio, and improves position health. This example shows how to repay USDC debt on a TSLAx multiply position using the Klend SDK.
Multiply Repay with xStocks
Repay debt on a TSLAx multiply position to reduce leverage and improve position health.Import Dependencies
Import the required packages for Solana RPC communication, Kamino SDK operations, and transaction building.Find TSLAx Reserve in Market
Dynamically discover the TSLAx token mint by searching the market reserves by symbol.This dynamic discovery approach allows the code to work across different markets without hardcoding token mint addresses.
Configure Repay Parameters
Set the amount of USDC to repay. This example repays $10 USDC.You can repay any amount up to your total debt. After repaying, you are able to withdraw your collateral.
Fetch Existing Multiply Obligation
Create the multiply obligation type and fetch the existing position from the blockchain.The
MultiplyObligation type identifies this as a leveraged position rather than a standard borrow. The obligation must exist before you can repay debt.Build Repay Transaction
UseKaminoAction.buildRepayTxns to generate the repay instructions.buildRepayTxns handles all the complexity of repaying multiply positions, including ATA creation, scope price refreshes, and obligation updates.Send Transaction
Get a fresh blockhash, build the transaction, sign it, and send it to the network.The repay transaction is complete, reducing your debt balance and improving your position’s health factor.
Borrow and Multiply SDK Methods
| Method | Operation | When to Use |
|---|---|---|
getDepositWithLeverageIxs | Open position or add collateral | Creating or adding to a leveraged position |
buildRepayTxns | Repay with wallet funds | Reducing debt using USDC, SOL, etc. from wallet |
buildWithdrawTxns | Withdraw collateral | Withdrawing collateral after debt is repaid |
getWithdrawWithLeverageIxs | Deleverage and withdraw | Sell collateral to repay debt and receive remaining value in wallet |
getRepayWithCollIxs | Repay debt with collateral | Sell collateral to repay debt without withdrawing (value stays in position) |
Multiply operations use
MultiplyObligation. Vanilla operations use VanillaObligation. The obligation type determines which PDA is derived for your position.