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

pfbroxi-sdk

v1.0.4

Published

Pumpfun SDK — referring impl of pumpdotfun-sdk, suitable for broxi bots

Readme

Fixed and reworked version of rckprtr/pumpdotfun-sdk.
✅ Fixed buy/sell/create
✅ Added support for new events
✅ Added Jito and alternative relay support (Astra, 0Slot, NodeOne, NextBlock)
✅ Works on devnet and mainnet-beta
✅ ESM & CJS builds via Rollup in dist/
NEW: Token2022 & Mayhem Mode support (Nov 2025 breaking changes)


⚠️ BREAKING CHANGES (Nov 11, 2025): pump.fun introduced Token2022 support and Mayhem Mode. This SDK has been updated to support both the new createV2 instruction and legacy token creation. See MIGRATION_GUIDE.md for details.



✨ Features

| Module | Highlights | | --------------------- | --------------------------------------------------------------------------------------------------- | | PumpFunSDK | Entry point. Wraps Anchor Program & Connection and initializes all submodules. | | TradeModule | createAndBuy, createAndBuyV2 (Token2022), buy, sell, tx builders, slippage helpers | | TokenModule | Token metadata, ATA creation, mint helpers | | PdaModule | PDA helpers: global, bonding-curve, metadata, mayhem-state, etc. | | EventModule | Typed Anchor event listeners with automatic deserialization | | JitoModule | Submit Jito bundles for buy/sell. Requires jitoUrl and authKeypair in SDK options | | AstraModule | Sends buy/sell transactions via Astra relays. Adds tip transfers + optional ping() keep-alive | | SlotModule | Similar to Astra; optimized for 0Slot relays with buy() and ping() | | NextBlockModule | Similar to Astra; optimized for NextBlock relays with buy() and ping() | | NodeOneModule | Similar to Astra; optimized for NodeOne relays with buy() and ping() | | IDL exports | Full IDL JSON and type PumpFun helper |

Note: ping() on relay modules (e.g., sdk.slot.ping()) should be called periodically to keep upstream relay connection alive.


📦 Install

npm install pfbroxi-sdk

🔨 Quick Start

Replace DEVNET_RPC url with mainnet url

const DEVNET_RPC = "https://api.devnet.solana.com";
const SLIPPAGE_BPS = 100n;
const PRIORITY_FEE = { unitLimit: 250_000, unitPrice: 250_000 };

const secret = JSON.parse(process.env.WALLET!);
const wallet = Keypair.fromSecretKey(Uint8Array.from(secret));

async function printSOL(conn: Connection, pk: PublicKey, label = "") {
  const sol = (await conn.getBalance(pk)) / LAMPORTS_PER_SOL;
  console.log(`${label} SOL:`, sol.toFixed(4));
}

async function main() {
  const connection = new Connection(DEVNET_RPC, "confirmed");
  const provider = new AnchorProvider(connection, new Wallet(wallet), {
    commitment: "confirmed",
  });
  const sdk = new PumpFunSDK(provider);
  const mint = Keypair.generate();

  await printSOL(connection, wallet.publicKey, "user");

  const img = await import("node:fs/promises").then((fs) =>
    fs.readFile("example/images/test.png")
  );
  const blob = new Blob([img], { type: "image/png" });
  await sdk.trade.createAndBuy(
    wallet,
    mint,
    { name: "DEV-TEST", symbol: "DVT", description: "Devnet demo", file: blob },
    0.0001 * LAMPORTS_PER_SOL,
    SLIPPAGE_BPS,
    PRIORITY_FEE
  );
  console.log(
    "pump.fun link →",
    `https://pump.fun/${mint.publicKey}?cluster=devnet`
  );

  await sdk.trade.buy(
    wallet,
    mint.publicKey,
    0.0002 * LAMPORTS_PER_SOL,
    SLIPPAGE_BPS,
    PRIORITY_FEE
  );

  const bal = await getSPLBalance(connection, mint.publicKey, wallet.publicKey);
  console.log("Token balance:", bal / 10 ** DEFAULT_DECIMALS);

  await sdk.trade.sell(
    wallet,
    mint.publicKey,
    BigInt(bal),
    SLIPPAGE_BPS,
    PRIORITY_FEE
  );
  await printSOL(connection, wallet.publicKey, "user after sell");
}

main().catch(console.error);

🚀 Advanced Examples

🧠 Buy with Jito

const sdk = new PumpFunSDK(provider, {
  jitoUrl: "ny.mainnet.block-engine.jito.wtf",
  authKeypair: wallet,
});

await sdk.jito!.buyJito(
  wallet,
  mint.publicKey,
  BigInt(0.0002 * LAMPORTS_PER_SOL),
  SLIPPAGE_BPS,
  500_000,
  PRIORITY,
  "confirmed"
);

🛰️ Buy with 0Slot, NodeOne, Astra, or NextBlock

These modules use upstream relayers to speed up TX submission.
They support periodic ping() to keep-alive HTTPS connection and reduce TLS overhead.

const sdk = new PumpFunSDK(provider, {
  providerRegion: Region.Frankfurt,
  slotKey: "your-api-key", // or astraKey / nextBlockKey / nodeOneKey
});

await sdk.slot!.ping();

await sdk.slot!.buy(
  wallet,
  mint.publicKey,
  BigInt(0.0002 * LAMPORTS_PER_SOL),
  SLIPPAGE_BPS,
  500_000,
  PRIORITY,
  "confirmed"
);

AstraModule, NodeOneModule, NextBlockModule follow the same interface: buy(), sell(), ping()
Transactions are signed locally, and relayed via HTTPS POST (base64-encoded) for speed. Tx are sent over http for extra speed.


🧩 Tip: What ping() Does

Relay modules like SlotModule, AstraModule, NodeOneModule, and NextBlockModule implement ping().

Calling ping() periodically:

  • Prevents connection idle timeouts
  • Keeps the relay ready for low-latency submission
await sdk.astra!.ping();
await sdk.slot!.ping();

🌐 Supported Relay Regions

Each relay provider supports a defined set of regions for optimal latency. Below are the currently supported regions per provider:

Slot       📍 Frankfurt • New York • Tokyo • Amsterdam • Los Angeles
Astra      📍 Frankfurt • New York • Tokyo • Amsterdam
NodeOne    📍 New York • Tokyo • Amsterdam • Frankfurt
NextBlock  📍 Tokyo • Frankfurt • New York

You must specify providerRegion in PumpFunSDK options to select which regional relay to use.

⚠️ Disclaimer

This software is provided “as is,” without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and non-infringement.
In no event shall the authors or copyright holders be liable for any claim, damages, or other liability—whether in an action of contract, tort, or otherwise—arising from, out of, or in connection with the software or the use or other dealings in the software.

Use at your own risk.
The authors take no responsibility for any harm or damage caused by the use of this software.
Users are responsible for ensuring the suitability and safety of this software for their specific use cases.

By using this software, you acknowledge that you have read, understood, and agree to this disclaimer.