Stake SOL

Learn how to stake SOL using Jupiter Validator

Stake your SOL tokens with Jupiter validator to earn staking rewards. This creates liquid staking positions using jupSOL token.

Copy

// Stake 1 SOL
const signature = await agent.methods.stake(1);

// Stake 0.5 SOL
const signature = await agent.methods.stake(0.5);

Parameter
Type
Required
Description

amount

number

Yes

Amount of SOL to stake

Copy

"Stake 1 SOL with Jupiter validator"

"Create a liquid staking position with 2.5 SOL"

"Stake half a SOL to earn rewards"

"Convert my SOL to jupSOL by staking 5 SOL"

Copy

// Stake 1 SOL
{
  "amount": 1
}

// Stake 2.5 SOL
{
  "amount": 2.5
}

// Stake minimum amount
{
  "amount": 0.1
}

Copy

import { PingAgentKit } from "ping-agent-kit";

async function stakeSOL(agent: PingAgentKit) {
  try {
    // Stake 1 SOL
    const signature = await agent.methods.stake(1);
    console.log("Staking successful:", signature);
    
    // You'll receive jupSOL tokens in return
    const jupsolBalance = await agent.methods.getBalance(
      new PublicKey("jupSoLaHXQiZZTSfEWMTRRgpnyFm8f6sZdosWBjx93v")
    );
    console.log("jupSOL balance:", jupsolBalance);
  } catch (error) {
    console.error("Staking failed:", error);
  }
}

  • Uses Jupiter’s validator for staking

  • Converts SOL to jupSOL tokens

  • Automatically handles transaction versioning

  • Includes proper transaction confirmation

  • Provides liquid staking position

Copy

// Successful response
{
  status: "success",
  message: "Staked successfully",
  transaction: "4VfgJ5vVZxUxefDGqzqkVLHzHxVTyYH9StYyHKgvHYmXJgqJKxEqy9k4Rz9LpXrHF9kUZB7",
  amount: 1
}

// Error response
{
  status: "error",
  message: "Error message here",
  code: "ERROR_CODE"
}

Copy

try {
  const signature = await agent.methods.stake(amount);
} catch (error) {
  if (error.message.includes("insufficient funds")) {
    // Handle insufficient SOL balance
  } else if (error.message.includes("slippage")) {
    // Handle price movement
  }
}

  1. Balance Verification

    • Check SOL balance before staking

    • Account for transaction fees

    • Consider minimum stake amounts

  2. Transaction Management

    • Monitor transaction status

    • Implement proper error handling

    • Use appropriate commitment levels

  3. Security

    • Verify transaction details

    • Double-check amounts

    • Keep private keys secure

  4. User Experience

    • Show transaction progress

    • Display staking rewards

    • Explain jupSOL conversion

  • Minimum staking amount: 0.1 SOL

  • jupSOL token address: jupSoLaHXQiZZTSfEWMTRRgpnyFm8f6sZdosWBjx93v

  • Returns liquid staking token (jupSOL)

  • Staking rewards auto-compound

  • No unbonding period required

  • getBalance: Check SOL/jupSOL balances

  • transfer: Send SOL/jupSOL tokens

  • trade: Swap between SOL and jupSOL

Last updated