Borrow
Import Dependencies
Import the required packages for Solana RPC, Jupiter Lend borrow SDK, and versioned transaction building.
Borrow uses
getOperateIx with zero colAmount and positive debtAmount. The borrowed asset is sent to your wallet.Load Keypair and Initialise Connection
Load the signer and create the RPC connection. Set vault ID, position ID, and borrow amount.
Build Borrow Instructions
Build operate instructions with no collateral change and positive debt amount.
Borrow is operate with
colAmount = 0 and debtAmount > 0. The borrow token is sent to your wallet; you accrue interest until you Repay.Build and Sign Transaction
Build a v0 message with the instructions and address lookup tables, then sign.
Operate parameters
getOperateIx accepts the following parameters:
| Parameter | Type | Description |
|---|---|---|
vaultId | number | Target vault (market) ID. |
positionId | number | Position NFT ID (from Create Position or a previous deposit). |
colAmount | BN | Signed collateral amount in base units. Positive = deposit. Negative = withdraw. Use new BN(0) for borrow-only. |
debtAmount | BN | Signed debt amount in base units. Positive = borrow (add debt). Negative = repay (reduce debt). Use new BN(0) for deposit/withdraw-only. |
connection | Connection | Solana RPC connection. |
signer | PublicKey | Wallet that signs the transaction (position owner). |
colAmount = 0, debtAmount > 0.
How much can you borrow?
How much can you borrow?
Your maximum borrow depends on your collateral value, the vault’s loan-to-value (LTV) limits, and current borrows. Keep LTV below the liquidation threshold. The SDK does not provide a “max borrow” sentinel. Compute the maximum from your position (e.g.
getCurrentPosition or getFinalPosition) and the vault’s LTV, or use your app/API for the limit.Interest
Interest
Borrowed amounts accrue interest over time. Repay to reduce debt and stop interest on the repaid portion.
