Skip to main content
Withdraw collateral (supply assets) from an existing Jupiter Lend borrow position. The SDK builds operate instructions with a negative collateral amount and zero debt change. You can only withdraw up to the amount that keeps your position within the vault’s LTV limits. Transactions use versioned (v0) format with address lookup tables.

Withdraw

1

Import Dependencies

Import the required packages for Solana RPC, Jupiter Lend borrow SDK, and versioned transaction building.
Withdraw uses getOperateIx with negative colAmount and zero debtAmount. The withdrawn collateral is sent back to your wallet.
2

Load Keypair and Initialise Connection

Load the signer and create the RPC connection. Set vault ID, position ID, and withdraw amount (positive number; the script passes it as negative to the SDK).
Withdrawing collateral increases your LTV. Ensure you stay below the liquidation threshold; repay debt first if needed.
3

Build Withdraw Instructions

Build operate instructions with negative collateral amount and no debt change.
Withdraw is operate with colAmount < 0 and debtAmount = 0. Use .neg() so the SDK receives a negative BN. The vault may reject if the withdrawal would breach LTV limits.
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.
Withdrawing reduces your collateral and borrowing capacity. Repay debt first if you are near the LTV limit.

Operate parameters

getOperateIx accepts the following parameters: For withdraw: colAmount < 0 (negative), debtAmount = 0.
You can withdraw collateral as long as the resulting position stays within the vault’s LTV rules. If you have outstanding debt, the protocol may limit how much you can withdraw until you repay.
To withdraw all collateral in one go, use MAX_WITHDRAW_AMOUNT from the SDK as colAmount. The protocol treats this sentinel as “withdraw all collateral”:
This only succeeds if the resulting position stays within LTV (e.g. you have no debt, or you repay first). Otherwise the vault will reject the transaction.

Full code example