Skip to main content
These flows use many instructions. If you hit compute limits, add ComputeBudgetProgram.setComputeUnitLimit({ units: 1_000_000 }) (or higher) as the first instruction in your transaction.
“Multiply” (often called “looping” or “leveraging”) is the process of using borrowed capital to increase your exposure to an asset. Use Jupiter Lite API for swap quotes and instructions. For example, to multiply your SOL exposure using USDC debt:
  1. You have 1 SOL (collateral).
  2. Flashloan 100 USDC from Jupiter Lend (debt asset).
  3. Swap 100 USDC → SOL using Jupiter Lite API.
  4. Deposit your SOL + swapped SOL into the vault and borrow 100 USDC.
  5. Pay back the flashloan with the borrowed USDC.
All of this happens atomically in a single Solana transaction.

Multiply

1

Import Dependencies

Import Solana web3, Jupiter Lend SDKs, and BN for amounts.
2

Load Keypair and Initialise Connection

Load the signer and create the RPC connection.
3

Get Flashloan Instructions

Use getFlashBorrowIx and getFlashPaybackIx to flashloan the debt asset (e.g. USDC).
4

Get Quote and Swap Instructions (Jupiter Lite API)

Fetch a quote from Jupiter Lite API, then POST to swap-instructions to get the swap instruction. Build your own transaction, do not use a pre-built swap transaction.
The jupIxToTransactionInstruction helper converts the JSON instruction from the API into a Solana TransactionInstruction:
5

Get Vault Operations

Compute total collateral (initial + swapped) and get operate instructions.
6

Assemble and Execute the Transaction

Fetch address lookup tables for the swap, then create a versioned transaction with instructions in order.Order: Flashloan Borrow → Swap (USDC→SOL) → Vault Operate (deposit + borrow) → Flashloan PaybackThe getAddressLookupTableAccounts helper resolves lookup table addresses into account objects:

Full code example

Ensure supply and borrow token ATAs exist for the user before building the transaction. Use createAssociatedTokenAccountIdempotentInstruction from @solana/spl-token if needed.