Skip to main content
Repay debt on a Jupiter Lend borrow position. The SDK builds operate instructions with zero collateral change and a negative debt amount. You must hold the borrow token in your wallet. Transactions use versioned (v0) format with address lookup tables.

Repay

1

Import Dependencies

Import the required packages for Solana RPC, Jupiter Lend borrow SDK, and versioned transaction building.
Repay uses getOperateIx with zero colAmount and negative debtAmount. The repay amount is taken from your wallet and reduces your position’s debt.
2

Load Keypair and Initialise Connection

Load the signer and create the RPC connection. Set vault ID, position ID, and repay amount (positive number; the script passes it as negative to the SDK).
You must hold at least REPAY_AMOUNT of the borrow token in your wallet (or associated token account). Partial repay is supported; use an amount up to your current debt.
3

Build Repay Instructions

Build operate instructions with no collateral change and negative debt amount.
Repay is operate with colAmount = 0 and debtAmount < 0. Use .neg() so the SDK receives a negative BN. Repaying reduces debt and improves your LTV.
4

Build and Sign Transaction

Build a v0 message with the instructions and address lookup tables, then sign.
5

Send and Confirm Transaction

Send the transaction and confirm.
Repaying reduces your debt and interest accrual. Full repay uses your total debt amount (you may need to leave a tiny dust amount depending on the protocol).

Operate parameters

getOperateIx accepts the following parameters: For repay: colAmount = 0, debtAmount < 0 (negative).
You can repay any amount up to your current debt. Partial repay reduces debt by that amount. For full repay, use your position’s total debt (check vault APIs or UI for the exact value).
To repay all debt in one go, use MAX_REPAY_AMOUNT from the SDK as debtAmount. The protocol treats this sentinel as “repay full debt”:
You must hold enough borrow token to cover the full debt; the protocol will take what is needed.

Full code example