PumpCrateDocs
  1. Docs
  2. Open tools
  3. Library and examples

Using pumpcheck as a JavaScript library

Everything the command line does is exported as plain functions. There is no build step and no dependency, so a script can import them straight from the unpacked folder.

Updated 2 min readBy the PumpCrate team

A minimal script#

After npm install pump-fun-volume-bot, import from the package name. From the unpacked zip, import from ./src/index.mjs instead.

import { Rpc, fetchTrades, summarize, fetchCurve } from "pump-fun-volume-bot";

const rpc = new Rpc(process.env.SOLANA_RPC_URL);
const mint = "<mint>";

const { trades } = await fetchTrades(rpc, mint, { minutes: 30, limit: 500 });
const summary = summarize(trades);
console.log(summary.volumeSol, summary.makers, summary.trades);

const curve = await fetchCurve(rpc, mint);
console.log(curve.live ? curve.live.progress : "complete");

Exports#

FunctionReturns
new Rpc(url)A JSON-RPC client with retry and backoff on rate limits
fetchTrades(rpc, mint, options)The trades found in the coin's recent transactions, oldest first
parseTrade(tx, mint, curve)One trade from a parsed transaction, or null if it is not a trade
summarize(trades)Volume, sides, makers, trade sizes, pace and the largest makers
perMinute(trades)Trades, volume and makers for each minute
curveAddress(mint)The bonding curve account address, derived locally
fetchCurve(rpc, mint)The curve account's reserves and the live price, market cap and progress
stateFromRealSol(sol)A point on the standard curve, for the math functions
tokensForBuy, solForSell, priceImpactOfBuy, solForPriceMultipleThe bonding curve formulas
plan(volume, coins)The cheapest packs for a target and the split per coin
fetchLivePacks()Current packs from the PumpCrate MCP server

A trade object has signature, time, maker, side, sol, tokens and venue, where venue is curve or pool.

Included examples#

FileWhat it does
examples/watch-session.mjsPrints volume, trades and makers for a coin every minute while a session runs
examples/session-report.mjsSaves a JSON report of a window: summary, per-minute series and curve state
examples/curve-table.mjsPrints the standard bonding curve table, no network needed
examples/mcp-packs.shReads the current packs from the MCP server with curl
node examples/watch-session.mjs <mint> 10 60
node examples/session-report.mjs <mint> 60
node examples/curve-table.mjs

Tests#

npm test

The suite runs on the Node test runner. It checks the curve math against the tables on the bonding curve reference, the curve address derivation against a real coin, the trade parser against curve buys, pool sells and plain transfers, and the pack planner.

License#

pumpcheck is released under the MIT license. You can use it, change it and ship it inside your own tools. It is published by PumpCrate.

Something unclear or out of date on this page? Tell us on Telegram at @pump_crate_bot or by email at support@pumpcrate.com.