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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@builderz/pump-science

v6.0.0

Published

Pump Science

Downloads

283

Readme

JavaScript Client for Pump.Science

A Umi-compatible JavaScript library for interacting with the Pump.Science protocol on Solana.

Features

  • Create bonding curves for tokens
  • Execute buy/sell swaps on bonding curves

Installation

First, if you're not already using Umi, follow these instructions to install the Umi framework.

Install the library:

npm install @builderz/pump-science

Quick Start

import { createUmi } from '@metaplex-foundation/umi-bundle-defaults';
import { keypairIdentity } from '@metaplex-foundation/umi';
import { PumpScienceSDK } from '@builderz/pump-science';

// Initialize Umi
const umi = createUmi('https://api.mainnet-beta.solana.com'); // Or devnet if used with dev environment

// Set up your wallet (replace with your keypair)
const wallet = umi.eddsa.generateKeypair();
umi.use(keypairIdentity(wallet));

// Initialize the SDK
const sdk = new PumpScienceSDK(umi);

Creating a Bonding Curve

TypeScript Interface

interface LaunchTokenRequest {
  cluster?: 'mainnet-beta' | 'devnet' | 'localhost';
  description: string;
  twitter?: string;
  telegram?: string;
  transaction: string; // base64 encoded transaction
  links: Array<{
    compound: string;
    link: string;
  }>;
  compounds: Array<{
    name: string;
  }>;
}

Creating Transaction

import { LAMPORTS_PER_SOL } from '@solana/web3.js';
import { toWeb3JsTransaction } from '@metaplex-foundation/umi-web3js-adapters';

// Get fee receiver from global data
const { feeReceiver } = await sdk.fetchGlobalData();

// Generate a new mint keypair
const mintKeypair = umi.eddsa.generateKeypair();

// Get the curve SDK for this mint
const curveSdk = sdk.getCurveSDK(mintKeypair.publicKey, feeReceiver);

// Create bonding curve transaction
let txBuilder = curveSdk.createBondingCurve(
  {
    name: "My Token",
    symbol: "MTK",
    uri: "https://your-metadata-uri.com/metadata.json",
    startSlot: null, // For immediate start
  },
  mintKeypair,
  false // isWhitelistEnabled
);

// Add first buy if desired (max 1.5 SOL)
txBuilder = txBuilder.add(
  curveSdk.swap({
    direction: 'buy',
    exactInAmount: 1.5 * LAMPORTS_PER_SOL, // MAX 1.5 SOL allowed
    minOutAmount: 0,
  })
);

// Build and sign transaction
const tx = txBuilder.build(umi);
const signedTx = await umi.identity.signTransaction(tx);
const web3Tx = toWeb3JsTransaction(signedTx);
const serializedTx = web3Tx.serialize();

Submitting to API

// Prepare request body
const requestBody: LaunchTokenRequest = {
  cluster: 'mainnet-beta', // optional: 'mainnet-beta' | 'devnet' | 'localhost'
  description: "Revolutionary token for scientific research and innovation",
  twitter: "https://twitter.com/mytoken",
  telegram: "https://t.me/mytoken", 
  transaction: Buffer.from(serializedTx).toString('base64'),
  links: [
    {
      compound: "compound-123",
      link: "https://example.com/compound-123"
    }
  ],
  compounds: [
    {
      name: "Innovative Compound Alpha"
    }
  ],
};

// Choose environment
const environment: 'dev' | 'prod' = 'prod';
const apiUrl = environment === 'prod'
  ? 'https://us-central1-pump-science-443711.cloudfunctions.net/prod/api'
  : 'https://us-central1-pump-science-443711.cloudfunctions.net/dev/api';

// Submit transaction
const response = await fetch(`${apiUrl}/launch-token`, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(requestBody),
});

if (!response.ok) {
  throw new Error(`API request failed: ${response.statusText}`);
}

const result = await response.json();
console.log('Token launched successfully:', result);

Complete Example

For a complete working example, see launch-token.ts in this directory.

Trading on Bonding Curves

Buying Tokens

const curveSdk = sdk.getCurveSDK(mintPublicKey, feeReceiver);

const buyTx = curveSdk.swap({
  direction: 'buy',
  exactInAmount: 0.1 * LAMPORTS_PER_SOL, // 0.1 SOL
  minOutAmount: 0, // Calculate based on slippage tolerance
});

await buyTx.sendAndConfirm(umi);

Selling Tokens

const sellTx = curveSdk.swap({
  direction: 'sell', 
  exactInAmount: 1000000n, // Amount in token's smallest unit
  minOutAmount: 0, // Minimum SOL to receive
});

await sellTx.sendAndConfirm(umi);