New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@builderz/pump-science

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@builderz/pump-science

Pump Science

latest
Source
npmnpm
Version
6.0.0
Version published
Maintainers
1
Created
Source

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);

FAQs

Package last updated on 06 Oct 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts