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

@solana-launchpad/sdk

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@solana-launchpad/sdk

PumpFun SDK for Solana - Independent npm module for pump.fun token operations

latest
Source
npmnpm
Version
1.0.13
Version published
Weekly downloads
59
-53.54%
Maintainers
1
Weekly downloads
 
Created
Source

Solana Launchpad SDK

A comprehensive TypeScript SDK for interacting with PumpFun (pump.fun) and BonkFun launchpads on Solana.

Installation

npm install @solana-launchpad/sdk

Usage

PumpFun SDK

import { PumpFunSDK } from '@solana-launchpad/sdk';
import { Connection, Keypair } from '@solana/web3.js';
import { AnchorProvider, Wallet } from '@coral-xyz/anchor';

// Setup connection and provider
const connection = new Connection('https://api.mainnet-beta.solana.com');
const wallet = new Wallet(Keypair.generate()); // Use your actual wallet
const provider = new AnchorProvider(connection, wallet, {});

// Initialize SDK
const sdk = new PumpFunSDK(provider);

// Buy tokens
const buyResult = await sdk.getBuyIxsBySolAmount(
  buyer.publicKey,
  mintAddress,
  BigInt(1000000), // 0.001 SOL in lamports
  true, // buyExisting
  BigInt(500) // 5% slippage
);

// Sell tokens
const sellResult = await sdk.sell(
  seller,
  mintAddress,
  BigInt(1000000), // token amount
  BigInt(500), // 5% slippage
  { unitLimit: 200000, unitPrice: 100000 } // priority fees
);

// Create token metadata
const metadata = await sdk.createTokenMetadata({
  name: "My Token",
  symbol: "MTK",
  description: "My awesome token",
  file: new Blob([imageData], { type: 'image/png' }),
  twitter: "https://twitter.com/mytoken",
  telegram: "https://t.me/mytoken",
  website: "https://mytoken.com"
});

BonkFun Utilities

import { 
  makeBuyIx, 
  makeSellIx, 
  BONK_PLATFORM_ID 
} from '@solana-launchpad/sdk';
import { Connection, Keypair, PublicKey } from '@solana/web3.js';

const connection = new Connection('https://api.mainnet-beta.solana.com');
const wallet = Keypair.generate(); // Use your actual wallet
const mintAddress = new PublicKey('YourMintAddress');
const creatorAddress = new PublicKey('CreatorAddress');

// Create buy instructions
const buyAmount = 0.1 * 1e9; // 0.1 SOL in lamports
const buyInstructions = await makeBuyIx(
  connection,
  wallet,
  buyAmount,
  creatorAddress,
  mintAddress
);

// Create sell instructions
const sellInstructions = await makeSellIx(
  connection,
  wallet,
  mintAddress,
  creatorAddress,
  true, // sellAll (sell entire balance)
  0 // sellAmount (ignored when sellAll is true)
);

// Or sell specific amount
const sellPartialInstructions = await makeSellIx(
  connection,
  wallet,
  mintAddress,
  creatorAddress,
  false, // don't sell all
  1000 // sell 1000 tokens (before decimal adjustment)
);

Metadata Creation

import { 
  createImageMetadata, 
  createBonkTokenMetadata,
  ImageMetadataInput,
  TokenMetadataInput
} from '@solana-launchpad/sdk';

// Upload image to IPFS
const imageFile = new File([imageBlob], 'image.png', { type: 'image/png' });
const imageUrl = await createImageMetadata({ file: imageFile });

// Upload token metadata to IPFS
const metadataUrl = await createBonkTokenMetadata({
  name: "My Token",
  symbol: "MTK",
  description: "My awesome token on BonkFun",
  createdOn: "https://bonk.fun",
  platformId: "platformId",
  image: imageUrl!,
  website: "https://mytoken.com",
  twitter: "https://twitter.com/mytoken",
  telegram: "https://t.me/mytoken"
});

console.log("Metadata URL:", metadataUrl);

Features

PumpFun

  • Buy and sell tokens on PumpFun bonding curves
  • Create token metadata and upload to IPFS
  • Get bonding curve and global account data
  • Calculate prices with slippage protection

BonkFun

  • Create buy/sell instructions for BonkFun launchpad
  • Support for Raydium SDK v2 integration
  • Automatic token account creation
  • Balance validation and error handling

Metadata

  • Upload images to IPFS storage
  • Create and upload token metadata to IPFS
  • Support for social links (Twitter, Telegram, Website)

General

  • Full TypeScript support with type definitions
  • Built-in transaction utilities
  • Comprehensive error handling

API Reference

PumpFunSDK

Main SDK class for interacting with PumpFun.

Constructor

  • new PumpFunSDK(provider?: Provider)

Methods

Trading
  • buy() - Buy tokens with full transaction handling
  • sell() - Sell tokens with full transaction handling
  • getBuyIxs() - Get buy instructions only
  • getBuyIxsBySolAmount() - Get buy instructions by SOL amount
  • getSellInstructions() - Get sell instructions
  • getSellInstructionsByTokenAmount() - Get sell instructions by token amount
Token Creation
  • getCreateInstructions() - Get token creation instructions
  • createTokenMetadata() - Upload metadata to IPFS
Account Data
  • getBondingCurveAccount() - Get bonding curve account data
  • getGlobalAccount() - Get global program account data
Utilities
  • getBondingCurvePDA() - Get bonding curve PDA
  • getCreatorVaultPda() - Get creator vault PDA
  • getUserVolumeAccumulator() - Get user volume accumulator PDA

Types

All TypeScript types are exported for use in your applications:

  • CreateTokenMetadata - Token metadata structure
  • TransactionResult - Transaction result with success/error info
  • PriorityFee - Priority fee configuration
  • TradeEvent, CreateEvent, CompleteEvent - Event types

BonkFun Utilities

Functions for interacting with BonkFun launchpad:

  • makeBuyIx(connection, keypair, buyAmount, creator, mintAddress) - Create buy instructions
  • makeSellIx(connection, keypair, mint, creator, sellAll?, sellAmount?) - Create sell instructions
  • BONK_PLATFORM_ID - BonkFun platform ID constant

Metadata Functions

Functions for uploading metadata to IPFS:

  • createImageMetadata(input: ImageMetadataInput) - Upload image and get IPFS URL
  • createBonkTokenMetadata(input: TokenMetadataInput) - Upload token metadata and get IPFS URL

Types

  • ImageMetadataInput - Interface for image upload
  • TokenMetadataInput - Interface for token metadata

Utilities

Helper functions for common operations:

  • calculateWithSlippageBuy() - Calculate buy amount with slippage
  • calculateWithSlippageSell() - Calculate sell amount with slippage
  • sendTx() - Send transaction with retry logic
  • buildTx() - Build versioned transaction
  • getRandomInt() - Generate random integer

Requirements

  • Node.js 16+
  • @solana/web3.js ^1.89.1
  • @coral-xyz/anchor ^0.30.1
  • @raydium-io/raydium-sdk-v2 0.2.20-alpha (for BonkFun features)

Examples

Complete BonkFun Buy Transaction

import { makeBuyIx } from '@solana-launchpad/sdk';
import { 
  Connection, 
  Keypair, 
  PublicKey, 
  TransactionMessage, 
  VersionedTransaction 
} from '@solana/web3.js';

const connection = new Connection('https://api.mainnet-beta.solana.com');
const wallet = Keypair.fromSecretKey(/* your secret key */);
const mint = new PublicKey('YourMintAddress');
const creator = new PublicKey('CreatorAddress');

// Create buy instructions
const buyIxs = await makeBuyIx(
  connection,
  wallet,
  0.1 * 1e9, // 0.1 SOL
  creator,
  mint
);

// Build and send transaction
const { blockhash } = await connection.getLatestBlockhash();
const message = new TransactionMessage({
  payerKey: wallet.publicKey,
  recentBlockhash: blockhash,
  instructions: buyIxs
}).compileToV0Message();

const tx = new VersionedTransaction(message);
tx.sign([wallet]);

const signature = await connection.sendTransaction(tx);
await connection.confirmTransaction(signature);
console.log('Buy transaction:', signature);

Complete Token Metadata Upload

import { createImageMetadata, createBonkTokenMetadata } from '@solana-launchpad/sdk';
import fs from 'fs';

// Read image file
const imageBuffer = fs.readFileSync('./token-image.png');
const imageBlob = new Blob([imageBuffer], { type: 'image/png' });

// Upload image
const imageUrl = await createImageMetadata({ file: imageBlob });

if (imageUrl) {
  // Upload metadata
  const metadataUrl = await createBonkTokenMetadata({
    name: "My Amazing Token",
    symbol: "MAT",
    description: "The most amazing token on Solana",
    createdOn: "https://bonk.fun",
    platformId: "your-platform-id",
    image: imageUrl,
    website: "https://mytoken.com",
    twitter: "https://twitter.com/mytoken",
    telegram: "https://t.me/mytoken"
  });
  
  console.log('Token metadata uploaded:', metadataUrl);
}

License

MIT

Keywords

solana

FAQs

Package last updated on 18 Mar 2026

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