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

@openpump/sdk

v0.2.0

Published

TypeScript SDK for the OpenPump API

Readme

@openpump/sdk

TypeScript SDK for the OpenPump REST API. Zero runtime dependencies (uses global fetch), dual-format (ESM + CJS), fully typed.

Installation

npm install @openpump/sdk

Quick Start

import { OpenPump } from '@openpump/sdk';

const op = new OpenPump({ apiKey: 'op_sk_live_...' });

const wallets = await op.wallets.list();
console.log(wallets);

Configuration

const op = new OpenPump({
  apiKey: 'op_sk_live_...',           // Required
  baseUrl: 'https://api.openpump.io', // Default
  timeout: 30_000,                     // Default (ms)
});

Devnet

To test against Solana devnet (no real funds), point the SDK at the devnet API:

const op = new OpenPump({
  apiKey: 'op_sk_live_...',              // Devnet key from devnet.openpump.io
  baseUrl: 'https://devnet.openpump.io', // Devnet API
});

Devnet API keys are created at devnet.openpump.io and are separate from mainnet keys.

Resources

Wallets

// List all wallets
const wallets = await op.wallets.list();

// Create a wallet
const wallet = await op.wallets.create({ label: 'Trading Wallet' });

// Get a single wallet
const w = await op.wallets.get('wallet-id');

// Get balances (SOL + tokens)
const balance = await op.wallets.getBalance('wallet-id');

// Get deposit instructions
const deposit = await op.wallets.getDepositInstructions('wallet-id');

// Force-refresh balance (bypass 30s cache)
const fresh = await op.wallets.refreshBalance('wallet-id');

// Transfer SOL or SPL tokens
const tx = await op.wallets.transfer('wallet-id', {
  toAddress: 'recipient-public-key',
  amountLamports: '100000000',
});

// Get transaction history
const history = await op.wallets.getTransactions('wallet-id', {
  type: 'buy',
  limit: 20,
  offset: 0,
});

Tokens

// List your tokens
const tokens = await op.tokens.list();

// Create a new PumpFun token
const token = await op.tokens.create({
  name: 'My Token',
  symbol: 'MTK',
  description: 'A cool token',
  imageBase64: 'base64-encoded-image...',
  imageType: 'image/png',
  twitter: '@mytoken',
  website: 'https://mytoken.com',
});

// Get market info (mainnet only)
const market = await op.tokens.getMarketInfo('mint-address');

// Get bonding curve state
const curve = await op.tokens.getCurveState('mint-address');
console.log(curve.currentPriceSOL, curve.graduationPercent);

Trading

// Get a price quote
const quote = await op.trading.getQuote('mint-address', {
  action: 'buy',
  solAmount: '1000000000',
});

// Get SOL cost for a specific token amount
const cost = await op.trading.getQuoteBuyCost('mint-address', {
  tokenAmount: '1000000',
});

// Buy tokens
const buy = await op.trading.buy('mint-address', {
  walletId: 'wallet-id',
  amountLamports: '500000000',
  slippageBps: 500,
  priorityLevel: 'fast',
});

// Sell tokens
const sell = await op.trading.sell('mint-address', {
  walletId: 'wallet-id',
  tokenAmount: 'all',
  slippageBps: 500,
});

// Multi-wallet bundle sell (Jito bundles)
const bundleSell = await op.trading.bundleSell('mint-address', {
  walletSells: [
    { walletId: 'w1', tokenAmount: 'all' },
    { walletId: 'w2', tokenAmount: '500000' },
  ],
  slippageBps: 500,
});

Bundles

// Launch token + multi-wallet buy in a single Jito bundle
const { jobId } = await op.bundles.launch({
  devWalletId: 'wallet-1',
  buyWalletIds: ['wallet-2', 'wallet-3'],
  name: 'My Token',
  symbol: 'MTK',
  imageBase64: '...',
  imageType: 'image/png',
  walletBuyAmounts: ['500000000', '500000000'],
});

// Poll for completion
const result = await op.jobs.poll(jobId, {
  intervalMs: 2000,
  timeoutMs: 60_000,
  onProgress: (s) => console.log(`${s.progress}%`),
});

Jobs

// Get job status
const status = await op.jobs.get('job-id');

// Poll until completion with progress callback
const result = await op.jobs.poll('job-id', {
  intervalMs: 2000,
  timeoutMs: 60_000,
  onProgress: (s) => console.log(`${s.progress}%`),
});

// Poll with abort support
const controller = new AbortController();
const result = await op.jobs.poll('job-id', {
  signal: controller.signal,
});
// Call controller.abort() to cancel polling

Creator Fees

// Check accumulated fees
const fees = await op.creatorFees.getAccumulatedFees('creator-address');
console.log(fees.accumulatedSOL);

// Claim fees
const claim = await op.creatorFees.claim('creator-address');
console.log(claim.signature);

Error Handling

The SDK throws typed errors that map to HTTP status codes:

import {
  OpenPumpError,
  AuthenticationError,
  ValidationError,
  NotFoundError,
  RateLimitError,
} from '@openpump/sdk';

try {
  await op.wallets.list();
} catch (error) {
  if (error instanceof AuthenticationError) {
    // 401 - Invalid or expired API key
    console.error(error.code, error.message);
  } else if (error instanceof ValidationError) {
    // 422 - Invalid input
    console.error(error.details);
  } else if (error instanceof NotFoundError) {
    // 404 - Resource not found
  } else if (error instanceof RateLimitError) {
    // 429 - Too many requests
  } else if (error instanceof OpenPumpError) {
    // Any other API error
    console.error(error.status, error.code, error.message);
  }
}

All error classes extend OpenPumpError with these properties:

| Property | Type | Description | |-----------|-----------|----------------------------| | code | string | Machine-readable error code | | message | string | Human-readable description | | status | number | HTTP status code | | details | unknown | Optional validation details |

Build

pnpm --filter @openpump/sdk run build

Outputs ESM (.js), CJS (.cjs), and TypeScript declarations (.d.ts, .d.cts) to dist/.

Test

pnpm --filter @openpump/sdk exec npx vitest run

Requirements

  • Node.js 18+ (global fetch required)
  • TypeScript 5.3+