Build on Pump.fun
The unofficial TypeScript SDK for creating, buying, and selling tokens on the Solana blockchain. Bonding curve pricing, AMM migration, tiered fees, creator fee sharing & more.
npm install @nirholas/pump-sdk
๐ King of the Hill
Core features that make Pump SDK the go-to toolkit
Offline-First SDK
Build transaction instructions without a connection. Pure functions, <1ms, zero async overhead. Compose your own transactions with full control.
Bonding Curve Math
Precise buy/sell calculations with BN.js. Get token amounts from SOL, SOL from tokens, price impact, graduation progress.
AMM Pool Trading
Post-graduation PumpSwap AMM with swap, deposit, and withdraw. Constant-product pools with protocol fees.
Fee System
Dynamic tiered fees based on market cap. Creator fee sharing with configurable shareholders (10,000 BPS). Cashback rewards.
๐ Documentation
Everything you need to build on Pump
๐ On-Chain Programs
Three programs powering the Pump protocol
Pump Program
6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P
Bonding curve operations โ create tokens, buy, sell, with virtual and real reserves. Supports create_v2, Token2022, and mayhem mode.
PumpSwap AMM
pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA
Graduated AMM pools โ constant-product swap, deposit liquidity, withdraw. Post-graduation trading with protocol fees.
PumpFees
pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ
Fee sharing and distribution โ dynamic tiers based on market cap, creator fee configs with shareholders summing to 10,000 BPS.
๐ Quick Start
Go from zero to building in under a minute
// Install the SDK
npm install @nirholas/pump-sdk
// Peer dependencies
npm install @solana/web3.js @solana/spl-token @coral-xyz/anchor bn.js
import { PUMP_SDK } from "@nirholas/pump-sdk";
// Create a new token (v2 โ never use v1)
const ix = await PUMP_SDK.createV2Instruction({
mint, // Keypair for new token mint
name, // Token name
symbol, // Token symbol
uri, // Metadata URI
creator, // Creator public key
user, // Transaction payer
mayhemMode: false,
cashback: false,
});
import { PUMP_SDK, OnlinePumpSdk } from "@nirholas/pump-sdk";
import { TOKEN_PROGRAM_ID } from "@solana/spl-token";
const online = new OnlinePumpSdk(connection);
const global = await online.fetchGlobal();
const state = await online.fetchBuyState(mint, user);
const ixs = await PUMP_SDK.buyInstructions({
global,
bondingCurveAccountInfo: state.bondingCurveAccountInfo,
bondingCurve: state.bondingCurve,
associatedUserAccountInfo: state.associatedUserAccountInfo,
mint, user, solAmount, amount,
slippage: 1,
tokenProgram: TOKEN_PROGRAM_ID,
});
import { PUMP_SDK, OnlinePumpSdk } from "@nirholas/pump-sdk";
const online = new OnlinePumpSdk(connection);
const global = await online.fetchGlobal();
const bc = await online.fetchBondingCurve(mint);
const ixs = await PUMP_SDK.sellInstructions({
global,
bondingCurve: bc,
mint, user, amount,
slippage: 1,
tokenProgram: TOKEN_PROGRAM_ID,
});
import { PUMP_SDK } from "@nirholas/pump-sdk";
// Shares MUST total exactly 10,000 BPS
const ix = await PUMP_SDK.createFeeSharingConfig({
mint,
shareholders: [
{ address: creator, shareBps: 7000 }, // 70%
{ address: partner, shareBps: 3000 }, // 30%
],
user,
});
๐ Documentation
Comprehensive guides and references for the Pump SDK
โก SDK Reference
Architecture, API surface, types, and patterns
Architecture
PumpSdk offline
decode*()โ Deserialize accounts*Instruction()โ Build single IX*Instructions()โ Build IX arrays
PUMP_SDKOnlinePumpSdk online
fetch*()โ RPC account fetchesfetchBuyState()โ All state for buyingfetchGlobal()โ Protocol global config
Key Types
BondingCurve
{
virtualTokenReserves: BN
virtualSolReserves: BN
realTokenReserves: BN
realSolReserves: BN
tokenTotalSupply: BN
complete: boolean
creator: PublicKey
isMayhemMode: boolean
}
Global
{
initialized: boolean
authority: PublicKey
feeRecipient: PublicKey
initialVirtualTokenReserves: BN
initialVirtualSolReserves: BN
initialRealTokenReserves: BN
tokenTotalSupply: BN
feeBasisPoints: BN
}
Shareholder
{
address: PublicKey
shareBps: number
// All shareholders must
// sum to exactly 10,000 BPS
}
FeeConfig
{
feeRecipient: PublicKey
feeBasisPoints: BN
// Dynamic tiers based
// on market cap
}
Import Map
// Core SDK
import { PUMP_SDK, PumpSdk, OnlinePumpSdk } from "@nirholas/pump-sdk";
// Constants
import { PUMP_PROGRAM_ID, PUMP_AMM_PROGRAM_ID, PUMP_FEE_PROGRAM_ID } from "@nirholas/pump-sdk";
// Bonding curve math
import { getBuyTokenAmountFromSolAmount, getSellSolAmountFromTokenAmount } from "@nirholas/pump-sdk";
// PDAs
import { bondingCurvePda, globalPda, feeSharingConfigPda } from "@nirholas/pump-sdk";
// State types
import type { BondingCurve, Global, FeeConfig, Pool } from "@nirholas/pump-sdk";
// Analytics
import { calculateBuyPriceImpact, getGraduationProgress, getTokenPrice } from "@nirholas/pump-sdk";
// Fees
import { getFee, computeFeesBps, calculateFeeTier } from "@nirholas/pump-sdk";
โ ๏ธ Common Pitfalls
Using createInstruction (v1)
DEPRECATED. Always use createV2Instruction.
Using number for amounts
WRONG. Use new BN(...) for all financial math. Always.
Trading a graduated curve
Check bondingCurve.complete. If true, use AMM methods instead.
Shares not summing to 10,000
Fee sharing config requires exactly 10,000 BPS total.
Returning Transaction objects
SDK returns TransactionInstruction[], never Transaction.
Importing from internal paths
Import from @nirholas/pump-sdk, not .../dist/...
๐ ๏ธ Tools & Dashboards
Live tools, generators, bots, and dashboards built with Pump SDK
AI Agent Integration
55 tools, 4 resources, 5 prompts via Model Context Protocol. Connect any AI agent to Pump.fun.
Live Token Launches
Real-time token launch feed via WebSocket. GitHub detection, metadata fetching, auto-reconnect.
Live Trades Dashboard
Buy/sell/create/migrate feed with volume charts, whale alerts, top tokens, and analytics sidebar.
Vanity Address Generator
Client-side Solana vanity address generation. Multi-threaded, difficulty estimation, export keypairs.
Rust Vanity Generator
High-performance vanity generator with rayon + solana-sdk. 100K+ keys/sec multi-threaded.
Telegram Bot
PumpFun activity monitor with 10 commands. Fee claims, CTO alerts, whale trades, graduation tracking.
WebSocket Relay
Real-time token launch broadcasting server. 10K connections, 50K msg/sec per vCPU.
Channel Bot
Telegram channel bot for broadcasting token launches and graduation events to your community.
Claim Bot
Automated fee claiming bot. Monitors and claims creator fees from bonding curves and AMM pools.
PumpOS Desktop
Full web desktop environment with app store, file system, window manager. 169 Pump-Store apps.
x402 Payments
HTTP 402 micropayment protocol with Solana USDC. Pay-per-request API monetization.
Swarm Agents
Multi-agent DeFi intelligence swarm. Coordinated agents for token analysis and trading strategies.
๐ Ecosystem
The complete Pump SDK ecosystem โ everything you need to build on Pump.fun