Getting Started
Import the required packages for Solana RPC and Jupiter Earn SDK operations.Import Dependencies
Import the packages you need for Solana RPC and Jupiter Lend (Earn) SDK operations.
Max withdraw or redeem all
Max withdraw or redeem all
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.Import Dependencies
Import the packages you need for Solana RPC and Jupiter Lend (Earn) SDK operations.
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:
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.
