npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@jpool/sdk

v0.1.1

Published

TypeScript SDK for interacting with the JPool Solana liquid staking pool.

Readme

JPool TypeScript SDK

TypeScript SDK for interacting with the JPool Solana liquid staking pool.

Installation

npm install @jpool/sdk
# or
pnpm add @jpool/sdk
# or
yarn add @jpool/sdk

Quick Start

import { Connection, clusterApiUrl, PublicKey, LAMPORTS_PER_SOL } from '@solana/web3.js'
import { JPoolClient } from '@jpool/sdk'

// Create connection and client
const connection = new Connection(clusterApiUrl('mainnet-beta'))
const client = new JPoolClient(connection)

// Get pool information
const poolInfo = await client.poolInfo()
console.log('Total staked:', Number(poolInfo.totalLamports) / LAMPORTS_PER_SOL, 'SOL')

// Calculate exchange rate
const rate = client.poolTokenRate(poolInfo)
console.log('Exchange rate:', rate, 'lamports per pool token')

Features

  • Deposit SOL - Stake SOL and receive LST pool tokens
  • Withdraw SOL - Unstake SOL instantly
  • Direct Staking - Stake to specific validators
  • Pool Information - Query pool state, rates, and fees
  • Balance Tracking - Check direct stakes and wallet bindings

Usage

Deposit SOL

import { Transaction, PublicKey, LAMPORTS_PER_SOL } from '@solana/web3.js'

const userPublicKey = new PublicKey('YOUR_WALLET_ADDRESS')

// Get deposit instructions
const { instructions, signers } = await client.depositSol({
  from: userPublicKey,
  lamports: 1 * LAMPORTS_PER_SOL,
})

// Create and configure transaction
const transaction = new Transaction().add(...instructions)
const { blockhash } = await connection.getLatestBlockhash()
transaction.recentBlockhash = blockhash
transaction.feePayer = userPublicKey

// Sign with ephemeral signers first, then with your wallet
transaction.sign(...signers)
// ... sign with wallet and send transaction

Deposit with Direct Staking

Support a specific validator while maintaining pool token liquidity:

const validatorVoteAccount = new PublicKey('VALIDATOR_VOTE_ACCOUNT')

const { instructions, signers } = await client.depositSol({
  from: userPublicKey,
  lamports: 5 * LAMPORTS_PER_SOL,
  directVote: validatorVoteAccount, // Direct stake to this validator
})

Withdraw SOL

// Amount is in pool tokens, not SOL
const poolTokensToBurn = 10

const { instructions, signers } = await client.withdrawSol({
  from: userPublicKey,
  amount: poolTokensToBurn,
})

// Create transaction (same pattern as deposit)
const transaction = new Transaction().add(...instructions)
// ... configure, sign, and send

Withdraw Stake Account

Receive a delegated stake account instead of liquid SOL:

const { instructions, signers } = await client.withdrawStake({
  from: userPublicKey,
  amount: poolTokensToBurn,
})

Get Direct Stakes

Query your direct stake positions:

const directStakes = await client.getDirectStakes({
  wallet: userPublicKey,
})

// Or query by validator
const validatorStakes = await client.getDirectStakes({
  vote: validatorVoteAccount,
})

Configuration

Custom Configuration

import { STAKE_POOL_PROGRAM_ID } from '@solana/spl-stake-pool'

const client = new JPoolClient(connection, {
  poolAddress: new PublicKey('CUSTOM_POOL_ADDRESS'),
  programId: STAKE_POOL_PROGRAM_ID,
  refCode: 'YOUR_REFERRAL_CODE', // Optional referral tracking
})

Update Configuration

// Update individual options
client.configure('refCode', 'NEW_REFERRAL_CODE')

API Reference

JPoolClient

Methods

  • poolInfo(): Promise<StakePoolInfo> - Get current pool state and statistics
  • poolTokenRate(poolInfo): number - Calculate lamports per pool token exchange rate
  • reserveBalance(poolInfo): Promise<number> - Get current reserve balance
  • depositSol(props): Promise<{instructions, signers}> - Deposit SOL into the pool
  • depositStake(props): Promise<{instructions, signers}> - Deposit stake account into the pool
  • withdrawSol(props): Promise<{instructions, signers}> - Withdraw SOL from the pool
  • withdrawStake(props): Promise<{instructions, signers}> - Withdraw as stake account
  • getDirectStakes(query): Promise<any> - Query direct stake records
  • getWalletBindings(query): Promise<any> - Query wallet bindings

Important Notes

Transaction Signing

All SDK methods return { instructions, signers } where:

  • instructions - Array of transaction instructions to add to your transaction
  • signers - Ephemeral keypairs that must sign the transaction along with your wallet

You must:

  1. Create a Transaction and add the instructions
  2. Set the transaction's recentBlockhash and feePayer
  3. Sign with ephemeral signers: transaction.sign(...signers)
  4. Sign with your wallet (e.g., Phantom, Solflare)
  5. Send the transaction to the network

Pool Token Amounts

When withdrawing, the amount parameter is in pool tokens, not SOL:

// Calculate SOL you'll receive
const poolInfo = await client.poolInfo()
const rate = client.poolTokenRate(poolInfo)
const expectedSOL = poolTokenAmount * rate

Fees

All operations have fees that are automatically deducted:

  • Deposit fee: Applied when depositing SOL
  • Withdrawal fee: Applied when withdrawing SOL or stake

Check current fees:

const poolInfo = await client.poolInfo()
console.log('Deposit fee:', poolInfo.solDepositFee * 100, '%')
console.log('Withdrawal fee:', poolInfo.solWithdrawalFee * 100, '%')

Examples

See the example/ directory for complete working examples:

  • example/deposit.ts - Deposit operations and calculations
  • example/withdraw.ts - Withdrawal operations and balance checking

Run examples:

npx tsx example/deposit.ts
npx tsx example/withdraw.ts

Constants

import { POOL_ADDRESS, POOL_MINT_ADDRESS } from '@jpool/sdk'

console.log('Pool address:', POOL_ADDRESS.toBase58())
console.log('Pool token mint:', POOL_MINT_ADDRESS.toBase58())

Links

License

MIT