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

pumpfun-sdk

v1.0.3

Published

SDK for interacting with Pump.fun

Readme

PumpFun SDK

A comprehensive TypeScript/JavaScript SDK for interacting with Pump.fun on the Solana blockchain. This SDK provides utilities for trading operations, wallet management, and automated trading strategies.

npm version License: MIT

Table of Contents

Installation

npm install pumpfun-sdk
# or
yarn add pumpfun-sdk

Features

  • Trading Operations

    • Buy and sell tokens on Pump.fun
    • Transaction simulation before execution
    • Priority fee management
    • Slippage protection
    • Transaction tracking to finality
  • Market Data

    • Token details and pricing
    • Market overview with trending tokens
    • Transaction history
    • Price quotes without execution
  • Wallet Management

    • Generate multiple wallets
    • Distribute SOL to wallets
    • Collect remaining funds
    • Batch operations support
  • Advanced Utilities

    • Enhanced retry mechanism with intelligent backoff
    • Comprehensive error classification
    • Transaction confirmation tracking
    • Type-safe interfaces and validation

Quick Start

import { 
  pumpFunBuy,
  pumpFunSell, 
  TransactionMode, 
  getCoinData,
  getMarketOverview,
  getBuyPriceQuote,
  WalletGenerator 
} from 'pumpfun-sdk';

// Get market overview with trending tokens
const market = await getMarketOverview(10); // Top 10 tokens
console.log(`Total tokens: ${market.totalTokens}`);
console.log(`Top token: ${market.tokens[0].name} (${market.tokens[0].mint})`);

// Get detailed coin data
const coin = await getCoinData('TOKEN_MINT_ADDRESS');
console.log(`${coin.name} price: ${coin.price_sol} SOL`);

// Get price quote without executing a transaction
const quote = await getBuyPriceQuote('TOKEN_MINT_ADDRESS', 0.1); // 0.1 SOL
console.log(`Expected tokens: ${quote.expectedOutputAmount}`);
console.log(`Price impact: ${(quote.priceImpact * 100).toFixed(2)}%`);

// Execute a buy operation with custom configuration
const result = await pumpFunBuy(
    TransactionMode.Execution,
    'YOUR_PRIVATE_KEY',
    'TOKEN_MINT_ADDRESS',
    0.1,          // SOL amount
    0.0001,       // Priority fee
    0.25,         // Slippage
    {             // Optional configuration
      rpcUrl: 'https://api.mainnet-beta.solana.com',
      commitment: 'confirmed',
      trackTx: true
    }
);
console.log(`Transaction signature: ${result.signature}`);
console.log(`Tokens purchased: ${result.expectedOutput}`);

// Initialize wallet generator for multi-wallet operations
const generator = new WalletGenerator({
    rpcUrl: 'https://api.mainnet-beta.solana.com',
    numberOfWallets: 10,
    solanaToDistribute: 0.1
});

// Generate wallets
const wallets = generator.generateWallets();

Detailed Usage

Trading Operations

Buy Operations

The SDK provides a comprehensive interface for buying tokens:

import { pumpFunBuy, TransactionMode } from 'pumpfun-sdk';

await pumpFunBuy(
    TransactionMode.Execution,  // or TransactionMode.Simulation
    privateKey,                 // Base58 encoded private key
    mintAddress,               // Token mint address
    solAmount,                 // Amount of SOL to spend
    priorityFee,               // Optional priority fee in SOL
    slippage                   // Optional slippage tolerance (0-1)
);

Sell Operations

Similar interface for selling tokens:

await pumpFunSell(
    TransactionMode.Execution,
    privateKey,
    mintAddress,
    tokenAmount,               // Amount of tokens to sell
    priorityFee,
    slippage
);

Wallet Management

The WalletGenerator class provides comprehensive wallet management features:

const generator = new WalletGenerator({
    rpcUrl: 'https://api.devnet.solana.com',
    numberOfWallets: 10,
    solanaToDistribute: 0.1,
    batchSize: 5,
    delayMs: 1000,
    minRemainingBalance: 5000
});

// Generate wallets
const wallets = generator.generateWallets();

// Distribute SOL
await generator.distributeToWallets(mainWalletPrivateKey, wallets);

// Collect remaining funds
await generator.collectFromAllWallets(wallets, destinationPublicKey);

Configuration

WalletGenerator Configuration

interface WalletGeneratorConfig {
    rpcUrl: string;              // Solana RPC endpoint
    numberOfWallets?: number;    // Number of wallets to generate (default: 100)
    solanaToDistribute?: number; // SOL amount to distribute (default: 2)
    batchSize?: number;         // Batch size for operations (default: 5)
    delayMs?: number;           // Delay between operations (default: 1000)
    minRemainingBalance?: number; // Min balance to keep (default: 5000 lamports)
}

Error Handling

The SDK implements comprehensive error handling with retry mechanisms:

try {
    await pumpFunBuy(/* ... */);
} catch (error) {
    if (error instanceof RetryError) {
        console.log(`Failed after ${error.attempts} attempts`);
    }
    // Handle other errors
}

API Reference

Market Data Functions

getCoinData

function getCoinData(mintStr: string): Promise<CoinData>

getMarketOverview

function getMarketOverview(limit: number = 50): Promise<MarketOverview>

getTokenTransactionHistory

function getTokenTransactionHistory(mintStr: string, limit: number = 20): Promise<any>

getBuyPriceQuote

function getBuyPriceQuote(mintStr: string, solAmount: number): Promise<any>

getSellPriceQuote

function getSellPriceQuote(mintStr: string, tokenAmount: number): Promise<any>

Trading Functions

pumpFunBuy

function pumpFunBuy(
    transactionMode: TransactionMode,
    payerPrivateKey: string,
    mintStr: string,
    solIn: number,
    priorityFeeInSol?: number,
    slippageDecimal?: number,
    config?: SwapConfig
): Promise<{
    success: boolean;
    signature?: string;
    expectedOutput: number;
    inputAmount: number;
    outputToken: string;
    simulation?: any;
    logs?: string[];
}>

pumpFunSell

function pumpFunSell(
    transactionMode: TransactionMode,
    payerPrivateKey: string,
    mintStr: string,
    tokenBalance: number,
    priorityFeeInSol?: number,
    slippageDecimal?: number,
    config?: SwapConfig
): Promise<{
    success: boolean;
    signature?: string;
    expectedOutput: number;
    inputAmount: number;
    outputToken: string;
    simulation?: any;
    logs?: string[];
}>

Wallet Management

WalletGenerator Methods

class WalletGenerator {
    generateWallets(): WalletData[];
    distributeToWallets(mainWalletPrivateKey: string, wallets: WalletData[]): Promise<Array<{
        publicKey: string;
        success: boolean;
        error?: string;
    }>>;
    collectFromAllWallets(wallets: WalletData[], destinationPublicKey: string): Promise<TransferResult[]>;
}

Examples

Complete Trading Workflow

import { WalletGenerator, TransactionMode, pumpFunBuy, pumpFunSell } from 'pumpfun-sdk';

async function tradingWorkflow() {
    // Initialize generator
    const generator = new WalletGenerator({
        rpcUrl: 'https://api.devnet.solana.com',
        numberOfWallets: 5
    });

    // Generate wallets
    const wallets = generator.generateWallets();

    // Distribute SOL
    await generator.distributeToWallets(mainWalletPrivateKey, wallets);

    // Execute trades
    for (const wallet of wallets) {
        // Buy operation
        await pumpFunBuy(
            TransactionMode.Execution,
            wallet.secretKey,
            mintAddress,
            0.05
        );

        // Sell operation
        await pumpFunSell(
            TransactionMode.Execution,
            wallet.secretKey,
            mintAddress,
            1000
        );
    }

    // Collect remaining funds
    await generator.collectFromAllWallets(wallets, destinationPublicKey);
}

Contributing

We welcome contributions to the PumpFun SDK! Here's how you can help:

Development Setup

  1. Clone the repository:
git clone https://github.com/yourusername/pumpfun-sdk.git
cd pumpfun-sdk
  1. Install dependencies:
npm install
  1. Create a new branch:
git checkout -b feature/your-feature-name

Building and Testing

  1. Build the project:
npm run build
  1. Run tests:
npm test

Contribution Guidelines

  1. Code Style

    • Follow TypeScript best practices
    • Use meaningful variable names
    • Add appropriate comments
    • Include type definitions
  2. Testing

    • Write unit tests for new features
    • Ensure all tests pass
    • Add integration tests when necessary
  3. Documentation

    • Update README.md if needed
    • Document new features
    • Add JSDoc comments to functions
  4. Pull Requests

    • Create descriptive pull request titles
    • Reference any related issues
    • Provide a clear description of changes
    • Update documentation as needed

Code Review Process

  1. All submissions require review
  2. Contributors should respond to comments
  3. Keep discussions focused and professional
  4. Address all feedback before merging

Security

Security Considerations

  1. Private Key Handling

    • Never log private keys
    • Use secure key storage
    • Implement proper key rotation
  2. Transaction Safety

    • Always use simulation before execution
    • Implement proper slippage protection
    • Handle transaction errors properly

License

This project is licensed under the MIT License - see the LICENSE file for details.

Troubleshooting

Common Issues

  1. Transaction Failed

    • Check RPC endpoint status
    • Verify account balances
    • Check for rate limiting
  2. Wallet Generation Issues

    • Verify RPC connection
    • Check system requirements
    • Ensure proper permissions

Support

For support, please:

  1. Check the documentation
  2. Search existing issues
  3. Create a new issue with detailed information

Release Process

Version Numbering

We follow Semantic Versioning:

  • MAJOR version for incompatible API changes
  • MINOR version for backwards-compatible functionality
  • PATCH version for backwards-compatible bug fixes

Built with ❤️ for the Solana community.