Skip to main content
Use these instructions when your strategy vault should run a collateralized borrow position on Jupiter Lend Borrow. For Jupiter’s deposit-only Earn product, see Jupiter Lend Earn instructions. A vault interacts with Jupiter Borrow in three lifecycle phases:
  1. InitinitPosition creates the borrow position once per vaultId.
  2. Operate — semantic helpers (depositCollateral, borrowDebt, repayDebt, withdrawCollateral, plus four paired ops) move collateral and debt against an existing position.
  3. RefreshupdateExchangePrices is occasionally needed to refresh oracle state before an operate call lands.
The semantic operate helpers are the recommended path. They take positive amounts and encode the correct signed newCol / newDebt deltas internally. The low-level createJupiterBorrowOperateInstruction is available for callers that need raw signed control.

Transaction structure

Every Jupiter Borrow action goes through createVaultSyncTransaction.

Init position

createJupiterBorrowInitPositionInstruction(accounts, args, programId?) creates the borrow position. Run once per vaultId before any operate calls.

Parameters

Operate accounts

All eight semantic operate helpers share the JupiterBorrowOperateAccounts shape. Build it once and reuse across calls in the same flow.
Refer to JupiterBorrowOperateAccounts in your TypeScript intellisense or in the SDK source for the complete list of required accounts. JUPITER_BORROW_ACCOUNT_INDICES exposes the on-chain index of each account if you need it for custom policy work.

Deposit collateral

createJupiterBorrowDepositCollateralInstruction(accounts, collateralAmount) increases collateral by a positive amount.

Parameters

Borrow debt

createJupiterBorrowBorrowDebtInstruction(accounts, debtAmount) increases debt by a positive amount.

Parameters

Repay debt

createJupiterBorrowRepayDebtInstruction(accounts, debtAmount) decreases debt by a positive amount. The helper negates the value internally — pass a positive number.

Parameters

Withdraw collateral

createJupiterBorrowWithdrawCollateralInstruction(accounts, collateralAmount) decreases collateral by a positive amount. The helper negates internally.

Parameters

Paired operations

Four paired helpers move collateral and debt in a single instruction. All amounts are positive — the helper applies the correct signs.

Parameters

Action wrapper options

All operate helpers wrap with jupiterBorrowAction.<method>({ instruction, vaultId }). The wrappers accept four optional fields beyond the required two:

Low-level operate

For callers that need raw signed control over newCol / newDebt, createJupiterBorrowOperateInstruction is available. The semantic helpers above are layered on top — prefer them unless you have a specific reason to encode signed deltas yourself.
encodeJupiterBorrowI128Le(value, label?) is the same signed i128 encoder the SDK uses internally for the newCol / newDebt fields and is exposed for callers writing custom policy data constraints.

Update exchange prices

createJupiterBorrowUpdateExchangePricesInstruction(accounts, args) refreshes oracle state for a Jupiter Borrow vault. Use the convenience variant when you already have an operate instruction in hand:

Constants

For policy authoring or custom data-constraint work, the SDK also exports JUPITER_BORROW_DISCRIMINATORS, JUPITER_BORROW_ACCOUNT_INDICES, and JUPITER_BORROW_OPERATE_OFFSETS (offsets for newCol, newDebt, transferTypeTag inside the operate instruction data). A matching policy must exist before executing. See Jupiter Lend Borrow Policy.

Full flow example

This example creates a borrow position, deposits collateral and borrows in one step, then later repays and withdraws.

Step 1: Initialize the position

Step 2: Deposit collateral and borrow in one operate

Step 3: Unwind with repay-and-withdraw