Skip to content

Instantly share code, notes, and snippets.

@KrisXCorner
KrisXCorner / rpc_fetch_pump_token_price.ts
Created November 6, 2024 13:42 — forked from rubpy/rpc_fetch_pump_token_price.ts
Fetching Pump.fun bonding curve state and calculating price of token/SOL.
import * as web3 from "@solana/web3.js";
//////////////////////////////////////////////////
function readBytes(buf: Buffer, offset: number, length: number): Buffer {
const end = offset + length;
if (buf.byteLength < end) throw new RangeError("range out of bounds");
return buf.subarray(offset, end);
}