Skip to main content
Withdraw from Jupiter Earn to redeem your shares for the underlying tokens. The Jupiter Lend SDK handles transaction building and vault interaction.

Getting Started

Import the required packages for Solana RPC and Jupiter Earn SDK operations.
1

Import Dependencies

Import the packages you need for Solana RPC and Jupiter Lend (Earn) SDK operations.
2

Build instructions

Use the Jupiter Earn SDK to generate withdraw instructions.
Important
  • amount = underlying token amount (e.g. USDC)
  • Not vault shares
  • To withdraw by vault shares, use getRedeemIxs
To withdraw all of your position (full underlying amount), fetch the user’s position with getUserLendingPositionByAsset from @jup-ag/lend/earn, then pass userPosition.underlyingAssets as amount to getWithdrawIxs. To redeem all shares (burn all jlTokens for underlying), use getRedeemIxs with userPosition.lendingTokenShares as shares.

Complete Flow

This example builds, signs, and sends a withdraw transaction.
1

Import Dependencies

Import the packages you need for Solana RPC and Jupiter Lend (Earn) SDK operations.
2

Set up connection and withdraw parameters

Set your RPC, signer, asset mint, and withdraw amount.
If your signer is stored as a local JSON keypair file, you can load it using the helper function below.
Then initialise your signer:
3

Build withdraw instructions

Build a transaction from the withdraw instructions, set blockhash and fee payer, then sign with the user keypair and send the transaction.
4

Build and send transaction

Build a transaction from the withdraw instructions, set blockhash and fee payer, then sign with the user keypair and send the transaction.
You have successfully withdrawn your assets from Jupiter Earn vaults.

Full code example