Pump SDK

TypeScript SDK for the Pump protocol on Solana โ€” token creation, bonding curves, AMM pools, fee sharing, and volume rewards.

npm version license downloads TypeScript Solana

## What is Pump SDK? Pump SDK is the community TypeScript SDK for the [Pump.fun](https://pump.fun) protocol on Solana. It provides **offline-first instruction builders** for every on-chain operation โ€” token creation, bonding curve trading, AMM pool management, tiered fee configuration, creator fee sharing, volume-based token incentives, and social referral fees. The SDK never sends transactions itself. It returns `TransactionInstruction[]` that you compose into transactions with your preferred signing and sending strategy. **Docs: https://sdk.pumpk.it/** ยท [Getting started](docs/getting-started.md) ยท [Examples](docs/examples.md) --- ## ๐Ÿ“‹ Table of Contents - [Quick Start](#-quick-start) - [The `pump` CLI](#-the-pump-cli) - [51 Runnable Examples](#-51-runnable-examples) - [Usage Examples](#-usage-examples) - [Create a Token](#create-a-token) - [Create a Token With a `...pump` Vanity Mint](#create-a-token-with-a-pump-vanity-mint) - [Buy Tokens on the Bonding Curve](#buy-tokens-on-the-bonding-curve) - [Sell Tokens](#sell-tokens) - [Check Graduation Progress](#check-graduation-progress) - [Set Up Fee Sharing](#set-up-fee-sharing) - [API Reference](#-api-reference) - [On-Chain Programs](#-on-chain-programs) - [Configuration](#-configuration) - [Error Handling](#-error-handling) - [FAQ](#-faq) - [Architecture](#-architecture) - [Contributing](#-contributing) - [License](#-license) - [Acknowledgments](#-acknowledgments) --- ## ๐Ÿš€ Live Demos & Resources - **[Token Launchpad](https://sdk.pumpk.it/live/launchpad)**: launch and trade real Pump tokens from your browser, built entirely on this SDK - **[SDK Docs & Live Dashboards](https://sdk.pumpk.it)** (trades, launches, vanity: [sdk.pumpk.it/live](https://sdk.pumpk.it/live/)) - **[pump.fun UI Template](https://demo.pumpk.it)** - **[DeFi Agents API](https://agents.pumpk.it)** - **[PumpKit](https://github.com/nirholas/pumpkit)** - **[PumpKit Site](https://pumpk.it)** - **[Telegram PumpFun Github Claim Tracker Bot](https://t.me/pumpfunclaims)** - **[Pump.fun GitHub Claims โ€” dedicated repository](https://github.com/nirholas/pumpfun-github-claims)** ยท [Product and notification rules](docs/github-claims-product.md) > A GitHub social-fee withdrawal is real on-chain activity, not automatic proof > that a developer created or endorses a coin. Claim cards distinguish verified > repository/creator-wallet relationships, identity mismatches, unverified > links, and unresolved pooled withdrawals. See the notification rules above. - **[Telegram PumpFun Graduation/Migration Tracker Bot](https://t.me/trackpumpfun)** - **[Pumpfun Claim Tracker](https://t.me/pfclaimsbot)** (best bot โ€” currently offline while building) ## ๐Ÿ“ˆ Proof & Virality **Proof the GitHub Claim Tracker bot is profitable to monitor** [โ†’ View tweet](https://x.com/nichxbt/status/2033377591592444056) **Went mega viral** [โ†’ View tweet](https://x.com/RoundtableSpace/status/2027417189918064915) > **just shipped a real-time PumpFun intelligence bot on Telegram** > > 17 commands. zero cost. fully on-chain. > > `/price` โ†’ instant token price & bonding curve > `/monitor` โ†’ live token launch feed > `/cto` โ†’ creator takeover alerts > `/watch` โ†’ wallet fee claim tracking > `/quote` โ†’ buy/sell estimates > `/graduated` โ†’ AMM graduation status > `/alerts` โ†’ customize your notifications > > all powered by the open-source **pump-fun-sdk** [โ†’ View original post](https://x.com/nichxbt/status/2027304823712817503) **The post that started it all** [โ†’ View tweet](https://x.com/nichxbt/status/2027087471683698811) # Looking for more? Check out PumpKit ๐Ÿ’Š๐Ÿ’š > Open-source framework for building PumpFun Telegram bots on Solana. Claim monitors, channel feeds, group trackers, whale alerts โ€” build your own or use ours. > > [PumpKit Web App + Documentation](https://pumpk.it) --- ## ๐Ÿš€ Quick Start ### Installation ```bash # npm npm install @nirholas/pump-sdk # yarn yarn add @nirholas/pump-sdk # pnpm pnpm add @nirholas/pump-sdk ``` ### Solana Packages `@solana/web3.js`, `@solana/spl-token`, `@coral-xyz/anchor` and `bn.js` are dependencies of the SDK and install with it. Install them yourself as well so your own code can import `Connection`, `PublicKey` and `BN`: ```bash npm install @solana/web3.js @solana/spl-token @coral-xyz/anchor bn.js ``` ### Minimal Example Save this as `index.ts`: ```typescript import { Connection, PublicKey } from "@solana/web3.js"; import { OnlinePumpSdk } from "@nirholas/pump-sdk"; async function main() { const [mintAddress] = process.argv.slice(2); if (!mintAddress) throw new Error("Usage: npx tsx index.ts "); // 1. Create an online SDK instance const connection = new Connection("https://api.mainnet-beta.solana.com"); const sdk = new OnlinePumpSdk(connection); // 2. Fetch current token state const summary = await sdk.fetchBondingCurveSummary(new PublicKey(mintAddress)); console.log("Market Cap:", summary.marketCap.toString(), "lamports"); console.log("Graduated:", summary.isGraduated); console.log("Progress:", summary.progressBps / 100, "%"); } main().catch((err) => { console.error(err); process.exit(1); }); ``` Run it with the mint address of any pump.fun token (the string at the end of its `pump.fun/coin/...` URL): ```bash npx tsx index.ts ``` A token that has graduated prints `Graduated: true` and a market cap of `0`, because migration empties the bonding curve. Read its PumpAMM pool with `sdk.fetchPool(mint)`, or run `pump curve `, which prices it from the pool for you. --- ## ๐Ÿ’ป The `pump` CLI The SDK ships with a binary. No wallet, no API key, and no configuration are needed for anything that reads the chain. ```bash npm install -g @nirholas/pump-sdk pump curve # price, market cap, graduation meter, fee tier pump quote buy --sol 1 # what 1 SOL really buys, after fees and impact pump watch # live dashboard pump doctor # check your RPC, wallet, and balance in one shot ``` Or without installing anything: `npx -p @nirholas/pump-sdk pump curve `. ``` FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump live on the bonding curve โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Market cap 93.705347 SOL Buy price 0.000000096 SOL per token Sell price 0.000000091 SOL per token Trading fee 1.25% 0.95% protocol + 0.3% creator Graduation โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘ 61.39% SOL to graduate 60.684661 SOL SOL in curve 24.921536 SOL Tokens left 306.21M of 793.1M ``` | Command | What it does | |---|---| | `pump curve` / `price` / `pool` / `global` | Read curve, price, AMM pool, and protocol state | | `pump quote buy\|sell` | Price a trade without a wallet, on the curve or the AMM pool: output, fees, effective price, impact | | `pump buy` / `sell` | Trade, auto-routing between the bonding curve and PumpAMM | | `pump create` | Launch a token, optionally with an atomic first buy | | `pump vanity` | Grind a `...pump` mint address | | `pump fees` / `incentives` | Check and claim creator fees and volume rewards | | `pump watch` | Live-refreshing dashboard, or a JSON price feed | | `pump events` | Decode the Pump events in any transaction | | `pump pda` | Derive any Pump program address | | `pump doctor` / `config` | Diagnose and configure | **Safe by construction.** Reads never load a keypair. Every trade is simulated before anything is sent, prints exactly what is about to happen, and waits for an explicit yes. `--simulate` sends nothing; `--yes` is the scripting escape hatch; a piped command with neither refuses rather than spending funds unattended. **Scriptable.** Every command takes `--json` and writes nothing else to stdout in that mode: ```bash pump curve --json | jq .marketCapSol pump watch --json --interval 10 | jq -r '"\(.at) \(.marketCapSol) SOL"' pump events --json | jq '.events[] | select(.type=="trade")' ``` Full reference: **[docs/cli.md](docs/cli.md)**. Ten-minute walkthrough: **[tutorial 45](tutorials/45-cli-quickstart.md)**. --- ## ๐Ÿงช 51 Runnable Examples The repo ships fifty-one tested, runnable examples covering the entire SDK surface. Each one runs with a single command and exports its logic for offline testing, and fifteen of them have a step-by-step walkthrough in [tutorials/examples/](tutorials/examples/). ```bash git clone https://github.com/nirholas/pump-fun-sdk && cd pump-fun-sdk && npm install npm run example # list all 51 npm run example 11 # offline buy quotes npm run test:examples # run every example's test suite offline ``` | Range | Category | |-------|----------| | 01-10 | Token Lifecycle: create, buy, sell, mayhem mode, cashback | | 11-20 | Curve Math & Fees: offline quotes, tiers, price impact | | 21-30 | Accounts & Events: every PDA, every decoder | | 31-40 | Live Data: mainnet reads, batching, WebSocket feeds | | 41-51 | AMM & Advanced: pools, liquidity, fee sharing, incentives, vanity mints, holder rewards | Full catalog: [docs/examples.md](docs/examples.md) ยท Browse: [examples/](examples/) ยท Tutorials: [tutorials/examples/](tutorials/examples/) --- ## ๐Ÿ“– Usage Examples ### Create a Token ```typescript import { Keypair } from "@solana/web3.js"; import { PUMP_SDK } from "@nirholas/pump-sdk"; const mintKeypair = Keypair.generate(); const creator = wallet.publicKey; const createIx = await PUMP_SDK.createV2Instruction({ mint: mintKeypair.publicKey, name: "My Token", symbol: "MYTKN", uri: "https://arweave.net/metadata.json", creator, user: creator, mayhemMode: false, }); // createIx is a TransactionInstruction โ€” add to a Transaction and send ``` > **Warning**: Do NOT use `createInstruction` โ€” it is deprecated (v1). Always use `createV2Instruction`. ### Create a Holder-Reward Token Set `holderReward: true` to direct creator fees to the protocol-derived holder rewards PDA. Pump.fun distributes those fees to holders automatically; holders do not need to submit claims. ```typescript import { PUMP_SDK } from "@nirholas/pump-sdk"; const createIx = await PUMP_SDK.createV2Instruction({ mint: mintKeypair.publicKey, name: "Holder Helper", symbol: "HOLD", uri: "https://example.com/holder-helper.json", creator: wallet.publicKey, user: wallet.publicKey, mayhemMode: false, holderReward: true, }); ``` For an atomic launch and initial buy, pass the same flag to `createV2AndBuyInstructions`; the SDK routes the buy through `creatorVaultPda(holderRewardsPda(mint))`. Run the complete broadcast-free demo with `npm run example 51`. New cashback launches are deprecated and rejected. Existing cashback coins remain tradeable and accrued cashback remains claimable. ### Create a Token With a `...pump` Vanity Mint Mint addresses ending in `pump` (like the ones on pump.fun) are produced by grinding keypairs off-chain. The SDK exposes this as a first-class helper โ€” swap `Keypair.generate()` for `generateVanityMint()` and the rest of the flow is unchanged. ```typescript import { generateVanityMint, PUMP_SDK } from "@nirholas/pump-sdk"; // Grind until we find a mint whose address ends in "pump" (~11M attempts, ~1โ€“4 min in Node) const { keypair: mintKeypair } = await generateVanityMint({ suffix: "pump" }); const createIx = await PUMP_SDK.createV2Instruction({ mint: mintKeypair.publicKey, // โ† ends in "pump" name: "My Token", symbol: "MYTKN", uri: "https://arweave.net/metadata.json", creator: wallet.publicKey, user: wallet.publicKey, mayhemMode: false, }); // Sign the transaction with BOTH the payer and the mint keypair. // tx.sign([wallet, mintKeypair]); ``` Supports `prefix`, `suffix`, `caseInsensitive`, `maxAttempts`, `onProgress`, and `AbortSignal`. For patterns longer than 4 characters, use the multi-threaded Rust generator at [`rust/`](rust/). See [Tutorial 13: Vanity Mints](tutorials/13-vanity-addresses.md) for the full end-to-end flow and a runnable devnet example. ### Buy Tokens on the Bonding Curve ```typescript import { Connection, PublicKey } from "@solana/web3.js"; import BN from "bn.js"; import { getBuyTokenAmountFromSolAmount, OnlinePumpSdk } from "@nirholas/pump-sdk"; const connection = new Connection("https://api.mainnet-beta.solana.com"); const sdk = new OnlinePumpSdk(connection); const mint = new PublicKey("TokenMintAddress..."); const user = wallet.publicKey; // Fetch all required state in parallel โ€” buyState includes tokenProgram (auto-detected) const [buyState, global, feeConfig] = await Promise.all([ sdk.fetchBuyState(mint, user), sdk.fetchGlobal(), sdk.fetchFeeConfig(), ]); assert(!buyState.bondingCurve.complete, "Token has already graduated to AMM"); // Calculate expected tokens for 0.1 SOL const solAmount = new BN(100_000_000); // 0.1 SOL in lamports const expectedTokens = getBuyTokenAmountFromSolAmount({ global, feeConfig, mintSupply: buyState.bondingCurve.tokenTotalSupply, bondingCurve: buyState.bondingCurve, amount: solAmount, }); // buyState spreads: bondingCurveAccountInfo, bondingCurve, associatedUserAccountInfo, tokenProgram const buyIxs = await sdk.buyInstructions({ ...buyState, mint, user, amount: expectedTokens, solAmount, slippage: 5, // percent: 5 = 5% slippage tolerance }); // buyIxs is TransactionInstruction[] โ€” compose into a VersionedTransaction and send ``` > **Note**: `fetchBuyState` auto-detects whether the token uses SPL Token or Token-2022 and returns `tokenProgram` accordingly. Always spread `...buyState` into `buyInstructions` to ensure the correct program is used. ### Sell Tokens ```typescript import BN from "bn.js"; import { getSellSolAmountFromTokenAmount, OnlinePumpSdk } from "@nirholas/pump-sdk"; const sdk = new OnlinePumpSdk(connection); // Fetch required state in parallel // Pass buyState.tokenProgram if you have it to avoid a second mint account fetch const [sellState, global, feeConfig] = await Promise.all([ sdk.fetchSellState(mint, user), sdk.fetchGlobal(), sdk.fetchFeeConfig(), ]); const tokenAmount = new BN(1_000_000_000); // amount in raw units (6 decimals) const expectedSol = getSellSolAmountFromTokenAmount({ global, feeConfig, mintSupply: sellState.bondingCurve.tokenTotalSupply, bondingCurve: sellState.bondingCurve, amount: tokenAmount, }); // sellState spreads: bondingCurveAccountInfo, bondingCurve, tokenProgram const sellIxs = await sdk.sellInstructions({ ...sellState, mint, user, amount: tokenAmount, solAmount: expectedSol, slippage: 5, // percent: 5 = 5% slippage tolerance }); ``` > **Note**: `fetchSellState` returns `tokenProgram` (auto-detected from the mint). Always spread `...sellState` into `sellInstructions`. ### Check Graduation Progress ```typescript import { OnlinePumpSdk } from "@nirholas/pump-sdk"; const sdk = new OnlinePumpSdk(connection); const progress = await sdk.fetchGraduationProgress(mint); console.log(`Progress: ${progress.progressBps / 100}%`); console.log(`Graduated: ${progress.isGraduated}`); console.log(`Tokens remaining: ${progress.tokensRemaining.toString()}`); console.log(`SOL accumulated: ${progress.solAccumulated.toString()}`); ``` ### Set Up Fee Sharing ```typescript import { PublicKey } from "@solana/web3.js"; import { PUMP_SDK } from "@nirholas/pump-sdk"; // Create a fee sharing config (creator only, before or after graduation) const createConfigIx = await PUMP_SDK.createFeeSharingConfig({ creator: wallet.publicKey, mint: tokenMint, pool: null, // null for pre-graduation tokens }); // Update shareholders (must total exactly 10,000 BPS = 100%) const updateIx = await PUMP_SDK.updateFeeShares({ authority: wallet.publicKey, mint: tokenMint, currentShareholders: [wallet.publicKey], newShareholders: [ { address: wallet.publicKey, shareBps: 7000 }, // 70% { address: new PublicKey("Partner..."), shareBps: 3000 }, // 30% ], }); ``` > **Warning**: Shares must total **exactly** 10,000 BPS. The SDK throws `InvalidShareTotalError` otherwise. Maximum 10 shareholders. --- ## ๐Ÿ“š API Reference See [docs/api-reference.md](./docs/api-reference.md) for the complete API documentation with full TypeScript signatures, parameters, and examples. ### Core Classes | Class | Description | |-------|-------------| | `PumpSdk` | Offline instruction builder โ€” no RPC connection required | | `OnlinePumpSdk` | Wraps a `Connection`: RPC fetchers for account state, plus builders that fetch what they need | | `PUMP_SDK` | Pre-instantiated singleton of `PumpSdk` | ### Bonding Curve Functions | Function | Returns | Description | |----------|---------|-------------| | `getBuyTokenAmountFromSolAmount(...)` | `BN` | Tokens received for a given SOL amount | | `getBuySolAmountFromTokenAmount(...)` | `BN` | SOL cost for a given token amount | | `getSellSolAmountFromTokenAmount(...)` | `BN` | SOL received for selling tokens | | `bondingCurveMarketCap(...)` | `BN` | Current market cap in the quote mint's base units | | `newBondingCurve(global, quoteMint?, ...)` | `BondingCurve` | Fresh bonding curve from global config, for any quote mint | | `getBuyV3QuoteAmountFromTokenAmount(...)` | `BN` | `buy_v3` cost, including the post-completion leg of a synthetic migration | | `getBuyV3TokenAmountFromQuoteAmount(...)` | `BN` | Tokens `buy_exact_quote_in_v3` buys for a quote budget | | `pumpQuoteReserves(global, quote)` | `{ virtualQuoteReserves, depth }` | Starting reserves `create_v2` derives for a coin quoted in a pump coin | ### Analytics Functions | Function | Returns | Description | |----------|---------|-------------| | `calculateBuyPriceImpact(...)` | `PriceImpactResult` | Price impact for a buy trade | | `calculateSellPriceImpact(...)` | `PriceImpactResult` | Price impact for a sell trade | | `getGraduationProgress(...)` | `GraduationProgress` | Bonding curve completion percentage | | `getTokenPrice(...)` | `TokenPriceInfo` | Current buy/sell price per token | | `getBondingCurveSummary(...)` | `BondingCurveSummary` | Complete bonding curve overview | ### Fee Functions | Function | Returns | Description | |----------|---------|-------------| | `getFee(...)` | `BN` | Fee amount for a trade | | `computeFeesBps(...)` | `CalculatedFeesBps` | Current fee basis points (protocol + creator) | | `calculateFeeTier(...)` | `Fees` | Fee tier for a given market cap | | `selectCurveFeeSchedule(...)` | `Fees` | Fee schedule by quote mint (SOL-like tiers, stable tiers, or exotic flat fees) | ### October 2026 Program Upgrade (3.0.0) | Builder | Description | |---------|-------------| | `buyV3Instructions` / `buyExactQuoteInV3Instructions` / `sellV3Instructions` | v3 curve trades for SOL and token-quoted curves; fees stay on the curve for a sweep | | `buyV2Instructions` / `buyExactQuoteInV2Instructions` / `sellV2Instructions` | v2 curve trades that pay fees out in the trade; the lane for cashback coins | | `ammBuyV2Instruction` / `ammBuyExactQuoteInV2Instruction` / `ammSellV2Instruction` | PumpSwap v2 trades; fees stay in the pool for a sweep | | `multiHopSwapInstructions` | One exact-input route through pump pools and pump-coin quoted curves | | `sweepCreatorFeeInstruction` / `ammSweepCreatorFeeInstruction` (and the protocol variants) | Pay fees left by v3 / v2 trades out to the creator vault or protocol recipients | | `OnlinePumpSdk.creatorFeeSweepInstructions(mint, payer)` | Exactly the sweeps a coin needs before a distribution, CTO or fee-share change | | `createV2Instruction({ quoteMint, pumpQuote, ... })` | Launch a coin quoted in a whitelisted, `QuoteControl`-listed, or pump coin mint | Program guides for each are in [docs/pump-official/docs/instructions](./docs/pump-official/docs/instructions); the SDK side is in [docs/api-reference.md](./docs/api-reference.md), [docs/amm-trading.md](./docs/amm-trading.md) and [docs/bonding-curve-math.md](./docs/bonding-curve-math.md). Upgrading from 2.x: see the 3.0.0 entry in [CHANGELOG.md](./CHANGELOG.md). ### Token Incentive Functions | Function | Returns | Description | |----------|---------|-------------| | `totalUnclaimedTokens(...)` | `BN` | Unclaimed $PUMP reward tokens | | `currentDayTokens(...)` | `BN` | Tokens earned today | --- ## ๐Ÿ”— On-Chain Programs | Program | ID | Purpose | |---------|----|---------| | **Pump** | `6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P` | Bonding curve creation, buying, selling, migration | | **PumpAMM** | `pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA` | Graduated AMM pools โ€” trading, liquidity, fees | | **PumpFees** | `pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ` | Fee sharing config and social fee PDAs | --- ## ๐Ÿ”ง Configuration ### Constructor The SDK has no required environment variables. You configure it via the constructor: | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `connection` | `Connection` | Only for `OnlinePumpSdk` | Solana RPC connection | ### Key Constants | Constant | Value | Description | |----------|-------|-------------| | `PUMP_PROGRAM_ID` | `6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P` | Main Pump program | | `PUMP_AMM_PROGRAM_ID` | `pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA` | AMM program | | `PUMP_FEE_PROGRAM_ID` | `pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ` | Fee program | | `PUMP_TOKEN_MINT` | `pumpCmXqMfrsAkQ5r49WcJnRayYRqmXz6ae8H7H9Dfn` | $PUMP token mint | | `MAX_SHAREHOLDERS` | `10` | Maximum shareholders in fee sharing | | `ONE_BILLION_SUPPLY` | `1000000000000000` | 1B tokens with 6 decimals | | `BONDING_CURVE_NEW_SIZE` | `166` | Bonding curve account size in bytes | --- ## โš ๏ธ Error Handling The SDK defines typed errors for fee sharing validation: | Error | Cause | Fix | |-------|-------|-----| | `NoShareholdersError` | Empty shareholders array | Provide at least 1 shareholder | | `TooManyShareholdersError` | More than 10 shareholders | Reduce to โ‰ค 10 shareholders | | `ZeroShareError` | A shareholder has 0 or negative BPS | Set all shares to positive values | | `InvalidShareTotalError` | Shares don't sum to 10,000 BPS | Ensure shares total exactly 10,000 | | `DuplicateShareholderError` | Same address appears twice | Remove duplicate addresses | | `ShareCalculationOverflowError` | BPS sum exceeds safe integer range | Check share values | | `PoolRequiredForGraduatedError` | `pool` is null for a graduated coin | Pass the pool address from `fetchPool()` | ### Common Pitfalls > **Warning**: Never use JavaScript `number` for token or lamport amounts. Always use `BN` from bn.js. JavaScript numbers lose precision above 2^53. > **Warning**: Check `bondingCurve.complete` before trading. If `true`, the token has graduated to AMM โ€” use `ammBuyInstruction`/`ammSellInstruction` instead. > **Warning**: `createInstruction` is deprecated. Use `createV2Instruction` for all new token creation. --- ## โ“ FAQ **Q: Do I need an RPC connection to use the SDK?** No. `PumpSdk` (and the `PUMP_SDK` singleton) builds instructions offline. Only use `OnlinePumpSdk` when you need to fetch on-chain state. **Q: How do I know if a token has graduated to AMM?** Check `bondingCurve.complete === true` or use `sdk.isGraduated(mint)`. Graduated tokens trade on PumpAMM, not the bonding curve. **Q: What is `slippage` in buy/sell instructions?** A percent for `buyInstructions`, `sellInstructions` and the other bonding curve builders: `slippage: 5` is 5%, and `slippage: 0.05` is 0.05%, which fails on almost any price movement. The SDK adjusts `maxSolCost` (buy) or `minSolOutput` (sell) by that much. The routed and `...BySolAmount` / `...ByTokenAmount` AMM helpers take a decimal instead (`0.05` = 5%). The unit of every method is listed in [Slippage units](./docs/TROUBLESHOOTING.md#slippage-units). **Q: Why do amounts use `BN` instead of `number`?** Solana token amounts (lamports, token units) regularly exceed JavaScript's safe integer limit (2^53). `BN` provides arbitrary-precision arithmetic. **Q: What's the difference between Pump and PumpAMM programs?** Pump handles the bonding curve phase (creation โ†’ graduation). PumpAMM handles post-graduation trading with constant-product AMM pools. **Q: How does fee sharing work?** Token creators can split their creator fees among up to 10 shareholders. Each shareholder gets a share in basis points (1/10,000). The total must equal exactly 10,000 BPS (100%). **Q: What is Mayhem Mode?** A special token creation mode with randomized bonding curve parameters. Tokens created with `mayhemMode: true` have unpredictable pricing dynamics. **Q: Can I use the SDK in the browser?** Yes. The SDK has no Node.js-specific dependencies. The ESM build works in modern browsers with a bundler. --- ## ๐Ÿ—๏ธ Architecture See [docs/architecture.md](./docs/architecture.md) for detailed system design, data flow diagrams, and module explanations. --- ## ๐Ÿค Contributing We welcome contributions! See [CONTRIBUTING.md](./CONTRIBUTING.md) for: - Development setup - Branch naming and commit conventions - Testing requirements - PR process --- ## ๐Ÿ“„ License [Apache-2.0](./LICENSE) ยฉ [nirholas](https://github.com/nirholas) --- ## ๐Ÿ™ Acknowledgments - **[Pump.fun](https://pump.fun)** โ€” The protocol this SDK interfaces with - **[Solana Labs](https://solana.com)** โ€” Blockchain infrastructure and `@solana/web3.js` - **[Coral (Anchor)](https://www.anchor-lang.com/)** โ€” IDL-based program interaction via `@coral-xyz/anchor` - **[bn.js](https://github.com/indutny/bn.js)** โ€” Arbitrary-precision arithmetic for financial math - **[@pump-fun/pump-swap-sdk](https://www.npmjs.com/package/@pump-fun/pump-swap-sdk)** โ€” AMM swap integration ## Documentation Full documentation site: **https://sdk.pumpk.it** - [Getting started](docs/getting-started.md) covers install and first run. - [Examples](docs/examples.md) has copy-paste snippets. ## Star History [![Star History Chart](https://api.star-history.com/svg?repos=nirholas/pump-fun-sdk&type=Date)](https://www.star-history.com/#nirholas/pump-fun-sdk&Date) ## Support the project If pump-fun-sdk saves you time, **[star it on GitHub](https://github.com/nirholas/pump-fun-sdk)**. Stars are how other developers and AI agents find the repositories worth trusting, and they cost you one click. Know someone who would use it? [Post on X](https://twitter.com/intent/tweet?text=pump-fun-sdk%3A%20Token%20creation%20launching%2C%20bonding%20curve%20trading%2C%20AMM%20migration%2C%20tiered%20fees%2C%20creator%20fee%20sharing&url=https%3A%2F%2Fgithub.com%2Fnirholas%2Fpump-fun-sdk) ยท [Share on Bluesky](https://bsky.app/intent/compose?text=pump-fun-sdk%3A%20Token%20creation%20launching%2C%20bonding%20curve%20trading%2C%20AMM%20migration%2C%20tiered%20fees%2C%20creator%20fee%20sharing%20https%3A%2F%2Fgithub.com%2Fnirholas%2Fpump-fun-sdk) ยท [Share on LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fgithub.com%2Fnirholas%2Fpump-fun-sdk) ยท [Submit to Hacker News](https://news.ycombinator.com/submitlink?u=https%3A%2F%2Fgithub.com%2Fnirholas%2Fpump-fun-sdk&t=pump-fun-sdk%3A%20Token%20creation%20launching%2C%20bonding%20curve%20trading%2C%20AMM%20migration%2C%20tiered%20fees%2C%20creator%20fee%20sharing) ยท [Share on Reddit](https://www.reddit.com/submit?url=https%3A%2F%2Fgithub.com%2Fnirholas%2Fpump-fun-sdk&title=pump-fun-sdk%3A%20Token%20creation%20launching%2C%20bonding%20curve%20trading%2C%20AMM%20migration%2C%20tiered%20fees%2C%20creator%20fee%20sharing) ## Built for AI agents too Coding agents and LLM tooling can read this repo directly: [AGENTS.md](./AGENTS.md), [llms.txt](./llms.txt), [llms-full.txt](./llms-full.txt). Point an agent at `https://github.com/nirholas/pump-fun-sdk` and it has the context it needs. ## More from the same author - [All repositories by nirholas](https://github.com/nirholas/nirholas#readme): the full catalog, grouped by topic - [three.ws](https://three.ws): the platform for 3D AI agents with Solana wallets, a skill marketplace and x402 payments - Questions or ideas: [open an issue](https://github.com/nirholas/pump-fun-sdk/issues) or [start a discussion](https://github.com/nirholas/pump-fun-sdk/discussions) ## Contributors [![Contributors](https://contrib.rocks/image?repo=nirholas/pump-fun-sdk)](https://github.com/nirholas/pump-fun-sdk/graphs/contributors) ---

Built by nirholas ยท @nichxbt ยท github.com/nirholas