Skip to content
On this page

Stake Solana

The stake namespace contains method used for sending transactions on stake. This method includes createAccount and delegation together. The unique method to the stake namespace is:

  • stake(token, address, lamports, source): Stake user tokens.

Stake Code Example

ts
// Import SDK
import { Solana } from '@everstake/wallet-sdk';

// User wallet address.
const address = 'exampleCnpYVG5ukLQsfusLqMGFRm5kJwcNhVdA3NS94';

// Token ID.
const token = process.env.TOKEN; // 3155f389-d943-4966-8e18-f159c2a6ef66

// The amount that the user delegates.
const lamports = 1000000000; // min value 0.01 (SOL)

// Your source identificator
const source = '99'

const stake = await Solana.stake(
    token, 
    address,
    lamports,
    source
);
console.log(stake); // Raw Transaction Object