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-solana";

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

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

// Your source identificator
const source = "99";

// Select network: "mainnet-beta" | "devnet"
const network = "mainnet-beta";

// Create SDK instance
const solanaClient = new Solana(network);

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