Using the TypeScript SDK

The TypeScript SDK provides a simple interface for interacting with stake pools. This section covers common operations and patterns.

Installation

pnpm add @ignitionfi/fogo-stake-pool @solana/web3.js

Or

npm install @ignitionfi/fogo-stake-pool @solana/web3.js

Basic Setup

import { Connection, PublicKey, Keypair, clusterApiUrl } from '@solana/web3.js';
import {
  getStakePoolAccount,
  getStakePoolAccounts,
  STAKE_POOL_PROGRAM_ID,
} from '@ignitionfi/fogo-stake-pool';

// Connect to cluster
const connection = new Connection('https://mainnet.fogo.io', 'confirmed');

// Load your keypair
const payer = Keypair.fromSecretKey(
  Buffer.from(JSON.parse(process.env.PRIVATE_KEY || '[]'))
);

Finding Stake Pools

Deposit Operations

Deposit SOL

Deposit Existing Stake Account

Withdraw Operations

Withdraw SOL

Withdraw Stake

Session-Based Operations (Gasless Transactions)

The SDK supports session-based operations for gasless transactions using the Fogo Sessions SDK. This is particularly useful for web applications where you want to provide a seamless user experience.

Setup with Fogo Sessions

Deposit with Session

Withdraw with Session

Validator Management Operations

Add Validator to Pool

Remove Validator from Pool

Increase Validator Stake

Decrease Validator Stake

Pool Maintenance and Information

Update Stake Pool

Get Stake Pool Information

Last updated