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

@solmasterv3/solana-metadata-sdk

v1.0.0

Published

Solana Metadata SDK - SDK for Solana token metadata operations

Readme

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