- Init —
initPositioncreates the borrow position once pervaultId. - Operate — semantic helpers (
depositCollateral,borrowDebt,repayDebt,withdrawCollateral, plus four paired ops) move collateral and debt against an existing position. - Refresh —
updateExchangePricesis occasionally needed to refresh oracle state before an operate call lands.
newCol / newDebt deltas internally. The low-level createJupiterBorrowOperateInstruction is available for callers that need raw signed control.
Transaction structure
Every Jupiter Borrow action goes throughcreateVaultSyncTransaction.
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 theJupiterBorrowOperateAccounts shape. Build it once and reuse across calls in the same flow.
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 withjupiterBorrowAction.<method>({ instruction, vaultId }). The wrappers accept four optional fields beyond the required two:
Low-level operate
For callers that need raw signed control overnewCol / 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.