Deposit
Import Dependencies
Import the required packages for Solana RPC, Jupiter Lend borrow SDK, and versioned transaction building.
Deposit uses
getOperateIx with positive colAmount and zero debtAmount. Versioned transactions and address lookup tables are required.Load Keypair and Initialise Connection
Load the signer and create the RPC connection. Set vault ID, position ID, and deposit amount.
Pass
positionId: 0 to batch init position + deposit in one transaction. The SDK returns nftId (your new position ID) for future operations. If you already have a position, use its nftId instead.Build Deposit Instructions
Build operate instructions with positive collateral amount and no debt change.
Deposit is operate with
colAmount > 0 and debtAmount = 0. Your supplied tokens are locked as collateral and increase your borrowing capacity.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. Use 0 to create a new position and deposit in one transaction. |
colAmount | BN | Signed collateral amount in base units. Positive = deposit (add collateral). Negative = withdraw. Use new BN(0) for borrow/repay-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.
Deposit vs Borrow
Deposit vs Borrow
Deposit adds collateral (supply token) to your position. Borrow withdraws the borrow token from the vault to your wallet and increases your debt. Deposit first, then borrow.
