Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
refactor(pump-graduations): share graduation decoding between both sources
nirholas5d982ca88b1a
diff --git a/services/pump-graduations/Dockerfile b/services/pump-graduations/Dockerfileindex 22c116e1f..860b80295 100644--- a/services/pump-graduations/Dockerfile+++ b/services/pump-graduations/Dockerfile@@ -2,5 +2,5 @@ FROM node:20-alpineWORKDIR /appCOPY package.json ./RUN npm install --omit=dev-COPY index.js ./+COPY index.js carbon-source.js graduation-event.js token-info.js ./CMD ["node", "index.js"]diff --git a/services/pump-graduations/carbon-source.js b/services/pump-graduations/carbon-source.jsindex 2b35938ca..821724960 100644--- a/services/pump-graduations/carbon-source.js+++ b/services/pump-graduations/carbon-source.js@@ -4,24 +4,26 @@** Interface contract:* const src = new CarbonGraduationSource({ connection });- * src.start((ev) => { /* ev: { mint, signature, ts, marketCapUsd } *\/ });+ * src.start((ev) => { ... ev: { mint, signature, ts, marketCapUsd } });* src.stop();** The `logSubscriber` constructor option overrides the Solana subscription* call and is used exclusively by tests to inject a mock stream.*- * Env (inherited from parent service — no separate env needed):+ * Decoding is shared with the legacy source via graduation-event.js, so the+ * two can never disagree about what counts as a graduation.+ *+ * Env (inherited from parent service, no separate env needed):* SOLANA_RPC_URL / SOLANA_WS_URL are consumed by index.js before this* source is instantiated.*/-import { PublicKey } from '@solana/web3.js';-import bs58 from 'bs58';--const PUMP_PROGRAM_ID = new PublicKey('6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P');--// Anchor "event" CPI emit discriminator: sha256("event:CompleteEvent")[..8]-const COMPLETE_EVENT_DISCRIMINATOR = Buffer.from([95, 114, 97, 156, 212, 46, 152, 8]);+import {+ PUMP_PROGRAM_ID,+ SeenSignatures,+ isCandidateEntry,+ parseCompleteEvent,+} from './graduation-event.js';export class CarbonGraduationSource {/**@@ -38,7 +40,7 @@ export class CarbonGraduationSource {this._conn = connection;this._logSubscriber = logSubscriber;this._subId = null;- this._seen = new Set();+ this._seen = new SeenSignatures();}start(onGraduation) {@@ -58,42 +60,15 @@ export class CarbonGraduationSource {}_handle(entry, onGraduation) {- if (entry.err) return;- const sig = entry.signature;- if (this._seen.has(sig)) return;- if (!entry.logs?.some((l) => l.includes('Program data:'))) return;-- const ev = parseGraduation(sig, entry.logs);- if (!ev) return;-- this._seen.add(sig);- if (this._seen.size > 5000) this._seen.clear();-- onGraduation(ev);- }-}--/**- * Parse a CompleteEvent from raw program logs.- * Returns { mint, signature, ts, marketCapUsd } or null.- */-function parseGraduation(sig, logs) {- for (const line of logs) {- const m = line.match(/^Program data: (.+)$/);- if (!m) continue;- let data;- try { data = Buffer.from(m[1], 'base64'); } catch { continue; }- if (data.length < 8) continue;- if (!data.subarray(0, 8).equals(COMPLETE_EVENT_DISCRIMINATOR)) continue;-- // CompleteEvent layout: discriminator(8) user(32) mint(32) bondingCurve(32) timestamp(i64)- if (data.length < 8 + 32 + 32 + 32 + 8) continue;- let off = 8 + 32; // skip discriminator + user- const mint = bs58.encode(data.subarray(off, off + 32)); off += 32;- off += 32; // skip bondingCurve- const ts = Number(data.readBigInt64LE(off));-- return { mint, signature: sig, ts, marketCapUsd: null };+ if (!isCandidateEntry(entry)) return;+ const parsed = parseCompleteEvent(entry.signature, entry.logs);+ if (!parsed) return;+ if (!this._seen.add(parsed.signature)) return;+ onGraduation({+ mint: parsed.mint,+ signature: parsed.signature,+ ts: parsed.timestamp,+ marketCapUsd: null,+ });}- return null;}diff --git a/services/pump-graduations/graduation-event.js b/services/pump-graduations/graduation-event.jsnew file mode 100644index 000000000..fd4f76f73--- /dev/null+++ b/services/pump-graduations/graduation-event.js@@ -0,0 +1,89 @@+/**+ * CompleteEvent parsing, shared by every graduation source in this service.+ *+ * Pump emits an Anchor CPI event named `CompleteEvent` when a token finishes+ * its bonding curve. It arrives on the program's log stream as a single+ * `Program data: <base64>` line whose first 8 bytes are the Anchor event+ * discriminator, `sha256("event:CompleteEvent")[..8]` — the same fixed bytes+ * `@pumpkit/core` matches on.+ *+ * Both index.js (legacy `conn.onLogs`) and carbon-source.js parse with these+ * functions, so the two sources can never drift apart on layout or dedupe.+ */++import { PublicKey } from '@solana/web3.js';+import bs58 from 'bs58';++export const PUMP_PROGRAM_ID = new PublicKey('6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P');++export const COMPLETE_EVENT_DISCRIMINATOR = Buffer.from([95, 114, 97, 156, 212, 46, 152, 8]);++// discriminator(8) user(32) mint(32) bondingCurve(32) timestamp(i64)+const COMPLETE_EVENT_LEN = 8 + 32 + 32 + 32 + 8;++/**+ * Decode the first CompleteEvent found in a batch of program log lines.+ *+ * @param {string} signature Transaction signature the logs came from.+ * @param {string[]} logs Raw log lines as delivered by `logsSubscribe`.+ * @returns {{signature: string, mint: string, user: string, bondingCurve: string, timestamp: number}|null}+ */+export function parseCompleteEvent(signature, logs) {+ for (const line of logs || []) {+ const m = /^Program data: (.+)$/.exec(line);+ if (!m) continue;+ const data = Buffer.from(m[1], 'base64');+ if (data.length < COMPLETE_EVENT_LEN) continue;+ if (!data.subarray(0, 8).equals(COMPLETE_EVENT_DISCRIMINATOR)) continue;++ let off = 8;+ const user = bs58.encode(data.subarray(off, off + 32)); off += 32;+ const mint = bs58.encode(data.subarray(off, off + 32)); off += 32;+ const bondingCurve = bs58.encode(data.subarray(off, off + 32)); off += 32;+ const timestamp = Number(data.readBigInt64LE(off));++ return { signature, mint, user, bondingCurve, timestamp };+ }+ return null;+}++/**+ * True when a log entry is worth decoding at all: it landed successfully and+ * carries at least one Anchor event line.+ *+ * @param {{err: unknown, logs?: string[]}} entry+ */+export function isCandidateEntry(entry) {+ if (!entry || entry.err) return false;+ return Boolean(entry.logs?.some((l) => l.startsWith('Program data: ')));+}++/**+ * Bounded signature dedupe. Pump replays a log entry after a WS hiccup, and an+ * unbounded Set would grow for the life of the process.+ *+ * Drops the oldest quarter when full rather than clearing outright, so a+ * signature seen one event ago still dedupes right after a trim.+ */+export class SeenSignatures {+ constructor(limit = 5000) {+ this._limit = limit;+ this._sigs = new Set();+ }++ /** @returns {boolean} true the first time a signature is offered. */+ add(signature) {+ if (!signature || this._sigs.has(signature)) return false;+ this._sigs.add(signature);+ if (this._sigs.size > this._limit) {+ const drop = Math.floor(this._limit / 4);+ const it = this._sigs.values();+ for (let i = 0; i < drop; i++) this._sigs.delete(it.next().value);+ }+ return true;+ }++ get size() {+ return this._sigs.size;+ }+}diff --git a/services/pump-graduations/index.js b/services/pump-graduations/index.jsindex dbd17a5b8..d29d0f380 100644--- a/services/pump-graduations/index.js+++ b/services/pump-graduations/index.js@@ -1,12 +1,15 @@/*** pump-graduations worker* ------------------------ * Subscribes to Pump program logs and pushes graduation (bonding-curve →- * PumpAMM migration) events into Upstash Redis. The Vercel side reads from- * Redis; this service is the only thing that holds a long-lived WS.+ * Subscribes to Pump program logs and pushes graduation (bonding-curve to+ * PumpAMM migration) events into Upstash-protocol Redis. The three.ws side+ * reads them back from Redis; this service is the only piece of the platform+ * that holds a long-lived Solana WebSocket.*- * Detection: Pump emits a `complete` anchor event when a token graduates.- * Discriminator (8 bytes) matches @pumpkit/core: COMPLETE_EVENT_DISCRIMINATOR.+ * Detection lives in graduation-event.js, enrichment in token-info.js. This+ * file wires a source to Redis and is the process entrypoint. Everything below+ * the entrypoint guard is exported so the core path can be exercised by tests+ * without opening a subscription.** Env:* SOLANA_RPC_URL Helius (or any) HTTPS RPC@@ -20,126 +23,148 @@* Both sources emit the same events to Redis.*/-import { Connection, PublicKey } from '@solana/web3.js';+import { pathToFileURL } from 'node:url';+import { Connection } from '@solana/web3.js';import { Redis } from '@upstash/redis';-import bs58 from 'bs58';import { CarbonGraduationSource } from './carbon-source.js';+import {+ PUMP_PROGRAM_ID,+ SeenSignatures,+ isCandidateEntry,+ parseCompleteEvent,+} from './graduation-event.js';+import { canonicalPumpPoolAddress, fetchTokenMetadata } from './token-info.js';-const PUMP_PROGRAM_ID = new PublicKey('6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P');+export const DEFAULT_LIST_KEY = 'pf:graduations';+export const DEFAULT_MAX_LEN = 500;-// Anchor "event" CPI emit: discriminator is sha256("event:CompleteEvent")[..8].-// Borrowed from @pumpkit/core/monitor/GraduationMonitor — fixed bytes:-const COMPLETE_EVENT_DISCRIMINATOR = Buffer.from([95, 114, 97, 156, 212, 46, 152, 8]);--const RPC = required('SOLANA_RPC_URL');-const WS = required('SOLANA_WS_URL');-const LIST_KEY = process.env.GRADUATIONS_LIST_KEY || 'pf:graduations';-const MAX_LEN = Number(process.env.GRADUATIONS_MAX_LEN || 500);-const SOURCE = process.env.PUMP_GRADUATIONS_SOURCE || 'legacy';--const redis = new Redis({- url: required('UPSTASH_REDIS_REST_URL'),- token: required('UPSTASH_REDIS_REST_TOKEN'),-});--const conn = new Connection(RPC, { wsEndpoint: WS, commitment: 'confirmed' });-const seen = new Set();+/**+ * Turn a decoded CompleteEvent into the record shape stored in Redis, reading+ * the mint's real name and symbol and deriving the PumpSwap pool it migrates+ * into. Consumers (`api/_lib/pumpfun-mcp.js`) read exactly these field names.+ *+ * @param {import('@solana/web3.js').Connection} connection+ * @param {{signature: string, mint: string, timestamp?: number}} event+ */+export async function buildGraduationRecord(connection, event) {+ const { name, symbol } = await fetchTokenMetadata(connection, event.mint);+ return {+ signature: event.signature,+ mint: event.mint,+ tokenName: name,+ tokenSymbol: symbol,+ poolAddress: canonicalPumpPoolAddress(event.mint),+ timestamp: event.timestamp || Math.floor(Date.now() / 1000),+ };+}-console.log('[pump-graduations] starting; program=%s source=%s', PUMP_PROGRAM_ID.toBase58(), SOURCE);+/**+ * Append a graduation to the capped list and fan it out to live subscribers.+ *+ * @param {{lpush: Function, ltrim: Function, publish: Function}} redis+ * @param {object} record+ * @param {{listKey?: string, maxLen?: number}} [opts]+ */+export async function pushGraduation(redis, record, { listKey = DEFAULT_LIST_KEY, maxLen = DEFAULT_MAX_LEN } = {}) {+ const json = JSON.stringify(record);+ await redis.lpush(listKey, json);+ await redis.ltrim(listKey, 0, maxLen - 1);+ await redis.publish(`${listKey}:pub`, json);+ return json;+}-if (SOURCE === 'carbon') {- const src = new CarbonGraduationSource({ connection: conn });- src.start(async ({ mint, signature, ts }) => {+/**+ * Build the handler both sources funnel through: dedupe, enrich, push, log.+ *+ * @param {{connection: object, redis: object, listKey?: string, maxLen?: number, seen?: SeenSignatures, label?: string}} deps+ * @returns {(event: {signature: string, mint: string, timestamp?: number}) => Promise<object|null>}+ */+export function createGraduationHandler({+ connection,+ redis,+ listKey = DEFAULT_LIST_KEY,+ maxLen = DEFAULT_MAX_LEN,+ seen = new SeenSignatures(),+ label = 'legacy',+}) {+ return async function handleGraduation(event) {try {- if (seen.has(signature)) return;- seen.add(signature);- if (seen.size > 5000) seen.clear();- const enriched = await enrichToken({ signature, mint, timestamp: ts });- await pushGraduation(enriched);- console.log('[pump-graduations] pushed (carbon)', enriched.mint, signature);+ if (!seen.add(event.signature)) return null;+ const record = await buildGraduationRecord(connection, event);+ await pushGraduation(redis, record, { listKey, maxLen });+ console.log(+ '[pump-graduations] pushed (%s) %s %s',+ label,+ record.tokenSymbol || record.mint,+ record.signature,+ );+ return record;} catch (err) {- console.error('[pump-graduations] handler error (carbon):', err?.message || err);+ console.error('[pump-graduations] handler error (%s):', label, err?.message || err);+ return null;}- });-} else {- conn.onLogs(- PUMP_PROGRAM_ID,- async (entry) => {- try {- if (entry.err) return;- const sig = entry.signature;- if (seen.has(sig)) return;- if (!entry.logs?.some((l) => l.includes('Program data:'))) return;-- const ev = await tryParseGraduation(sig, entry.logs);- if (!ev) return;- seen.add(sig);- if (seen.size > 5000) seen.clear();+ };+}- const enriched = await enrichToken(ev);- await pushGraduation(enriched);- console.log('[pump-graduations] pushed', enriched.symbol || enriched.mint, sig);- } catch (err) {- console.error('[pump-graduations] handler error:', err?.message || err);- }- },- 'confirmed',- );+function required(name) {+ const v = process.env[name];+ if (!v) {+ console.error(`missing env ${name}`);+ process.exit(1);+ }+ return v;}-async function tryParseGraduation(sig, logs) {- for (const line of logs) {- const m = line.match(/^Program data: (.+)$/);- if (!m) continue;- let data;- try { data = Buffer.from(m[1], 'base64'); } catch { continue; }- if (data.length < 8) continue;- if (!data.subarray(0, 8).equals(COMPLETE_EVENT_DISCRIMINATOR)) continue;+function main() {+ const rpc = required('SOLANA_RPC_URL');+ const ws = required('SOLANA_WS_URL');+ const listKey = process.env.GRADUATIONS_LIST_KEY || DEFAULT_LIST_KEY;+ const maxLen = Number(process.env.GRADUATIONS_MAX_LEN || DEFAULT_MAX_LEN);+ const source = process.env.PUMP_GRADUATIONS_SOURCE || 'legacy';- // CompleteEvent layout (per Pump IDL): user(32) mint(32) bondingCurve(32) timestamp(i64)- if (data.length < 8 + 32 + 32 + 32 + 8) continue;- let off = 8;- const user = bs58.encode(data.subarray(off, off + 32)); off += 32;- const mint = bs58.encode(data.subarray(off, off + 32)); off += 32;- const bondingCurve = bs58.encode(data.subarray(off, off + 32)); off += 32;- const timestamp = Number(data.readBigInt64LE(off));+ const redis = new Redis({+ url: required('UPSTASH_REDIS_REST_URL'),+ token: required('UPSTASH_REDIS_REST_TOKEN'),+ });+ const connection = new Connection(rpc, { wsEndpoint: ws, commitment: 'confirmed' });- return { signature: sig, mint, user, bondingCurve, timestamp };- }- return null;-}+ console.log(+ '[pump-graduations] starting; program=%s source=%s list=%s',+ PUMP_PROGRAM_ID.toBase58(),+ source,+ listKey,+ );-async function enrichToken(ev) {- let name, symbol, poolAddress;- try {- const tx = await conn.getTransaction(ev.signature, { maxSupportedTransactionVersion: 0 });- const accounts = tx?.transaction?.message?.staticAccountKeys?.map((k) => k.toBase58()) || [];- // PumpAMM pool keypair is created in the same tx; we can't reliably pluck it- // without IDL decode. Leave undefined — the UI tolerates it.- poolAddress = accounts.find((k) => k !== ev.mint && k !== ev.user) || undefined;- } catch {}- return {- signature: ev.signature,- mint: ev.mint,- tokenName: name,- tokenSymbol: symbol,- poolAddress,- timestamp: ev.timestamp || Math.floor(Date.now() / 1000),- };-}+ const onGraduation = createGraduationHandler({+ connection,+ redis,+ listKey,+ maxLen,+ label: source,+ });-async function pushGraduation(ev) {- const json = JSON.stringify(ev);- await redis.lpush(LIST_KEY, json);- await redis.ltrim(LIST_KEY, 0, MAX_LEN - 1);- await redis.publish(`${LIST_KEY}:pub`, json);-}+ if (source === 'carbon') {+ const src = new CarbonGraduationSource({ connection });+ src.start((ev) => onGraduation({ signature: ev.signature, mint: ev.mint, timestamp: ev.ts }));+ const shutdown = () => { src.stop(); process.exit(0); };+ process.on('SIGTERM', shutdown);+ process.on('SIGINT', shutdown);+ return;+ }-function required(name) {- const v = process.env[name];- if (!v) { console.error(`missing env ${name}`); process.exit(1); }- return v;+ // Dedupe happens inside the handler, keyed on graduations only, so the+ // bounded seen-set is never spent on unrelated Pump traffic.+ connection.onLogs(+ PUMP_PROGRAM_ID,+ (entry) => {+ if (!isCandidateEntry(entry)) return;+ const ev = parseCompleteEvent(entry.signature, entry.logs);+ if (ev) onGraduation(ev);+ },+ 'confirmed',+ );+ process.on('SIGTERM', () => process.exit(0));+ process.on('SIGINT', () => process.exit(0));}-process.on('SIGTERM', () => process.exit(0));-process.on('SIGINT', () => process.exit(0));+if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) main();diff --git a/services/pump-graduations/package-lock.json b/services/pump-graduations/package-lock.jsonnew file mode 100644index 000000000..0eb11bca5--- /dev/null+++ b/services/pump-graduations/package-lock.json@@ -0,0 +1,1092 @@+{+ "name": "pump-graduations",+ "version": "0.1.0",+ "lockfileVersion": 3,+ "requires": true,+ "packages": {+ "": {+ "name": "pump-graduations",+ "version": "0.1.0",+ "dependencies": {+ "@solana/web3.js": "^1.98.0",+ "@upstash/redis": "^1.34.0",+ "bs58": "^6.0.0"+ },+ "engines": {+ "node": ">=20"+ }+ },+ "node_modules/@babel/runtime": {+ "version": "7.29.7",+ "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.29.7.tgz",+ "integrity": "sha512-Nq8OhGWiZIZGV6hLHoyAKLLcJihP/xFeBMGJoUrxTX2psI8dCifzLhZISFb+VWS3wFMRDmCGw5R+dOySCqPLhw==",+ "license": "MIT",+ "engines": {+ "node": ">=6.9.0"+ }+ },+ "node_modules/@noble/curves": {+ "version": "1.9.7",+ "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.9.7.tgz",+ "integrity": "sha512-gbKGcRUYIjA3/zCCNaWDciTMFI0dCkvou3TL8Zmy5Nc7sJ47a0jtOeZoTaMxkuqRo9cRhjOdZJXegxYE5FN/xw==",+ "license": "MIT",+ "dependencies": {+ "@noble/hashes": "1.8.0"+ },+ "engines": {+ "node": "^14.21.3 || >=16"+ },+ "funding": {+ "url": "https://paulmillr.com/funding/"+ }+ },+ "node_modules/@noble/hashes": {+ "version": "1.8.0",+ "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz",+ "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==",+ "license": "MIT",+ "engines": {+ "node": "^14.21.3 || >=16"+ },+ "funding": {+ "url": "https://paulmillr.com/funding/"+ }+ },+ "node_modules/@solana/buffer-layout": {+ "version": "4.0.1",+ "resolved": "https://registry.npmjs.org/@solana/buffer-layout/-/buffer-layout-4.0.1.tgz",+ "integrity": "sha512-E1ImOIAD1tBZFRdjeM4/pzTiTApC0AOBGwyAMS4fwIodCWArzJ3DWdoh8cKxeFM2fElkxBh2Aqts1BPC373rHA==",+ "license": "MIT",+ "dependencies": {+ "buffer": "~6.0.3"+ },+ "engines": {+ "node": ">=5.10"+ }+ },+ "node_modules/@solana/codecs-core": {+ "version": "2.3.0",+ "resolved": "https://registry.npmjs.org/@solana/codecs-core/-/codecs-core-2.3.0.tgz",+ "integrity": "sha512-oG+VZzN6YhBHIoSKgS5ESM9VIGzhWjEHEGNPSibiDTxFhsFWxNaz8LbMDPjBUE69r9wmdGLkrQ+wVPbnJcZPvw==",+ "license": "MIT",+ "dependencies": {+ "@solana/errors": "2.3.0"+ },+ "engines": {+ "node": ">=20.18.0"+ },+ "peerDependencies": {+ "typescript": ">=5.3.3"+ }+ },+ "node_modules/@solana/codecs-numbers": {+ "version": "2.3.0",+ "resolved": "https://registry.npmjs.org/@solana/codecs-numbers/-/codecs-numbers-2.3.0.tgz",+ "integrity": "sha512-jFvvwKJKffvG7Iz9dmN51OGB7JBcy2CJ6Xf3NqD/VP90xak66m/Lg48T01u5IQ/hc15mChVHiBm+HHuOFDUrQg==",+ "license": "MIT",+ "dependencies": {+ "@solana/codecs-core": "2.3.0",+ "@solana/errors": "2.3.0"+ },+ "engines": {+ "node": ">=20.18.0"+ },+ "peerDependencies": {+ "typescript": ">=5.3.3"+ }+ },+ "node_modules/@solana/errors": {+ "version": "2.3.0",+ "resolved": "https://registry.npmjs.org/@solana/errors/-/errors-2.3.0.tgz",+ "integrity": "sha512-66RI9MAbwYV0UtP7kGcTBVLxJgUxoZGm8Fbc0ah+lGiAw17Gugco6+9GrJCV83VyF2mDWyYnYM9qdI3yjgpnaQ==",+ "license": "MIT",+ "dependencies": {+ "chalk": "^5.4.1",+ "commander": "^14.0.0"+ },+ "bin": {+ "errors": "bin/cli.mjs"+ },+ "engines": {+ "node": ">=20.18.0"+ },+ "peerDependencies": {+ "typescript": ">=5.3.3"+ }+ },+ "node_modules/@solana/web3.js": {+ "version": "1.98.4",+ "resolved": "https://registry.npmjs.org/@solana/web3.js/-/web3.js-1.98.4.tgz",+ "integrity": "sha512-vv9lfnvjUsRiq//+j5pBdXig0IQdtzA0BRZ3bXEP4KaIyF1CcaydWqgyzQgfZMNIsWNWmG+AUHwPy4AHOD6gpw==",+ "license": "MIT",+ "dependencies": {+ "@babel/runtime": "^7.25.0",+ "@noble/curves": "^1.4.2",+ "@noble/hashes": "^1.4.0",+ "@solana/buffer-layout": "^4.0.1",+ "@solana/codecs-numbers": "^2.1.0",+ "agentkeepalive": "^4.5.0",+ "bn.js": "^5.2.1",+ "borsh": "^0.7.0",+ "bs58": "^4.0.1",+ "buffer": "6.0.3",+ "fast-stable-stringify": "^1.0.0",+ "jayson": "^4.1.1",+ "node-fetch": "^2.7.0",+ "rpc-websockets": "^9.0.2",+ "superstruct": "^2.0.2"+ }+ },+ "node_modules/@solana/web3.js/node_modules/base-x": {+ "version": "3.0.11",+ "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.11.tgz",+ "integrity": "sha512-xz7wQ8xDhdyP7tQxwdteLYeFfS68tSMNCZ/Y37WJ4bhGfKPpqEIlmIyueQHqOyoPhE6xNUqjzRr8ra0eF9VRvA==",+ "license": "MIT",+ "dependencies": {+ "safe-buffer": "^5.0.1"+ }+ },+ "node_modules/@solana/web3.js/node_modules/bs58": {+ "version": "4.0.1",+ "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz",+ "integrity": "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==",+ "license": "MIT",+ "dependencies": {+ "base-x": "^3.0.2"+ }+ },+ "node_modules/@swc/helpers": {+ "version": "0.5.23",+ "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.23.tgz",+ "integrity": "sha512-5lSsMOTXURePglDfvuAQUqkGek9Hg2kksOYay2m0+XR++b2NWYL/4sWyuvVBIs8oKnJaxkdi9whaL/sqN13afw==",+ "license": "Apache-2.0",+ "dependencies": {+ "tslib": "^2.8.0"+ }+ },+ "node_modules/@types/connect": {+ "version": "3.4.38",+ "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz",+ "integrity": "sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==",+ "license": "MIT",+ "dependencies": {+ "@types/node": "*"+ }+ },+ "node_modules/@types/node": {+ "version": "12.20.55",+ "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz",+ "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==",+ "license": "MIT"+ },+ "node_modules/@types/uuid": {+ "version": "10.0.0",+ "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-10.0.0.tgz",+ "integrity": "sha512-7gqG38EyHgyP1S+7+xomFtL+ZNHcKv6DwNaCZmJmo1vgMugyF3TCnXVg4t1uk89mLNwnLtnY3TpOpCOyp1/xHQ==",+ "license": "MIT"+ },+ "node_modules/@types/ws": {+ "version": "7.4.7",+ "resolved": "https://registry.npmjs.org/@types/ws/-/ws-7.4.7.tgz",+ "integrity": "sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==",+ "license": "MIT",+ "dependencies": {+ "@types/node": "*"+ }+ },+ "node_modules/@typescript/typescript-aix-ppc64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-aix-ppc64/-/typescript-aix-ppc64-7.0.2.tgz",+ "integrity": "sha512-MTKKkWB7p/0E9xi1d1tHtZ5PiLkGEMIq88pK2CubZjOsLtYTLqhgIgi6zepFa+9GHZ6h05NMCkQxGKiPXMxXtQ==",+ "cpu": [+ "ppc64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "aix"+ ],+ "peer": true,+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-darwin-arm64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-darwin-arm64/-/typescript-darwin-arm64-7.0.2.tgz",+ "integrity": "sha512-gowzar9MwS/aRWp6f3a4KUqzRjAZjOsmGNCM6LcTgXum+dBfgsBVMN+AgvOCCbguXyick6LJhpBszxMebJ8syA==",+ "cpu": [+ "arm64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "darwin"+ ],+ "peer": true,+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-darwin-x64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-darwin-x64/-/typescript-darwin-x64-7.0.2.tgz",+ "integrity": "sha512-SZ9xZInqApNlNGc9s0W1VSsktYSOe9cFqNOIqmN1Gs8SmkjKZYFt017G4VwPxASInODuAdbTW7sXiFUf893RgA==",+ "cpu": [+ "x64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "darwin"+ ],+ "peer": true,+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-freebsd-arm64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-freebsd-arm64/-/typescript-freebsd-arm64-7.0.2.tgz",+ "integrity": "sha512-W5NH4y/J0plIIS5b2xvTEkU7JFxyqdMAOgf+Ilhl0vHQXKO5dZoxd+C/jEtq56c4F3wk71RB4BMRQ2XdI+bwYQ==",+ "cpu": [+ "arm64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "freebsd"+ ],+ "peer": true,+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-freebsd-x64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-freebsd-x64/-/typescript-freebsd-x64-7.0.2.tgz",+ "integrity": "sha512-UMGDx5sTpzNw3WiPebH7l90IWfJggEd+egHt/q6p7/Cm3zqoV7VxkGXt+3DxPIw8CcmvAB0j3sVVfbhX+M4Tpw==",+ "cpu": [+ "x64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "freebsd"+ ],+ "peer": true,+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-linux-arm": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-arm/-/typescript-linux-arm-7.0.2.tgz",+ "integrity": "sha512-gffT3xPz9sR7j/YJExkyPntrI0P2EP9XbOyWzth2/Gs0RstK+90RBcO0ncXoXy/beYll1SXw846Nf2zdnEz0QQ==",+ "cpu": [+ "arm"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "peer": true,+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-linux-arm64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-arm64/-/typescript-linux-arm64-7.0.2.tgz",+ "integrity": "sha512-Qh4eU4/y3yDjnfjjyPYihMj5/ODIlmt+Bzu17OI+fiSRDW57QmU5SiN63exPRNJPKUzcc1INa1NXdrJ+MqHjUQ==",+ "cpu": [+ "arm64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "peer": true,+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-linux-loong64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-loong64/-/typescript-linux-loong64-7.0.2.tgz",+ "integrity": "sha512-uEHck9i8hoAzXPiYRib1O7miOnz23SxIeVl6F4LXox+qov1K35jHcEW6VHKvZI+pyvl7fZEP4MCU5LYvIq1GuQ==",+ "cpu": [+ "loong64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "peer": true,+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-linux-mips64el": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-mips64el/-/typescript-linux-mips64el-7.0.2.tgz",+ "integrity": "sha512-R4KvAMnE43W5Qeqb0Ly56O3mWMWIAgsMyz36DCaycd5nbg/9kzm0liw3JocfRqyJY0KPmzFjbswozXyW0DnIYA==",+ "cpu": [+ "mips64el"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "peer": true,+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-linux-ppc64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-ppc64/-/typescript-linux-ppc64-7.0.2.tgz",+ "integrity": "sha512-DORx5b3sd/4S7eayxm4FQv+A7CrkUIGRaHiwI8oiHTAI1fAPWhF4J0vAlkC8biAlHSVVwxMQ3tjZ2/DVbnQiiA==",+ "cpu": [+ "ppc64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "peer": true,+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-linux-riscv64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-riscv64/-/typescript-linux-riscv64-7.0.2.tgz",+ "integrity": "sha512-wf0jqEDOjrPRnKwYRyyJDRo11KMbvMFrU+q4zqKyChODBzvlkbhNQfKvLxQCcwTpdDaXSHZTVuh0JoCrKCUMHQ==",+ "cpu": [+ "riscv64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "peer": true,+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-linux-s390x": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-s390x/-/typescript-linux-s390x-7.0.2.tgz",+ "integrity": "sha512-IkwJc3L7yhytWd/ewjyxNDfOmswCm9GWMJT/ue/dU4aZNbwZeYAetq42VyLmsmSjvoX7z74X6ZaYCtzAr0EuGw==",+ "cpu": [+ "s390x"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "peer": true,+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-linux-x64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-x64/-/typescript-linux-x64-7.0.2.tgz",+ "integrity": "sha512-EYdf2cNg7rgCWJnxCdJ+F3V39O8ihb37eHAu1LK8oAFizgTQbPOK7zHHXbPt8rX24COqODXeI3sIf0fCXG7H/A==",+ "cpu": [+ "x64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "peer": true,+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-netbsd-arm64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-netbsd-arm64/-/typescript-netbsd-arm64-7.0.2.tgz",+ "integrity": "sha512-+polYF4MF04aPpO5FTkHran9yUQDSXqy5GiSDKpsll5jy3l3+g9QLhpf39T+ePtefhXLOGrLl0QIjkQP6VnelA==",+ "cpu": [+ "arm64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "netbsd"+ ],+ "peer": true,+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-netbsd-x64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-netbsd-x64/-/typescript-netbsd-x64-7.0.2.tgz",+ "integrity": "sha512-8YIT0EHM/3dq10ZOVF/A7pc/YSMtbcecct4rWtexrnSCHOPcpC2KTLXfTCR6vDpnSiY12heNb1GiN/wu+T/FyA==",+ "cpu": [+ "x64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "netbsd"+ ],+ "peer": true,+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-openbsd-arm64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-openbsd-arm64/-/typescript-openbsd-arm64-7.0.2.tgz",+ "integrity": "sha512-APT8+ClYnuYm1u9+kgGXoMj2VzWzcymwh2gNSQVySHfkRDGOTVkoWLjCmOQSaO+PoqQ57B0flRp9SA+7GnnkzQ==",+ "cpu": [+ "arm64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "openbsd"+ ],+ "peer": true,+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-openbsd-x64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-openbsd-x64/-/typescript-openbsd-x64-7.0.2.tgz",+ "integrity": "sha512-yX7s+Q0Dln0Dt9tEzZsAjXXR/+ytBM7AlglaqyeMPxQszJ1JhlJdZ6jLA+IzldHtflX81em7lDao1xXu+aRRkg==",+ "cpu": [+ "x64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "openbsd"+ ],+ "peer": true,+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-sunos-x64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-sunos-x64/-/typescript-sunos-x64-7.0.2.tgz",+ "integrity": "sha512-dLJDGaLZ1D4HPQn62u1n8mBDkJREwMsAkCdkwd4Ieqw+x3TUyTsqY0YiBCtE6H6OzzgGk3iuZ3vFWRS+E8/d1g==",+ "cpu": [+ "x64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "sunos"+ ],+ "peer": true,+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-win32-arm64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-win32-arm64/-/typescript-win32-arm64-7.0.2.tgz",+ "integrity": "sha512-Gyl1Vy6OsWesLzmq+EP0Fb7b4Nid5232AvcA2SFcdYreldpNtYFFofPjnt62y9hQy7VTaZp65ICJjuAQRaVcIQ==",+ "cpu": [+ "arm64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "win32"+ ],+ "peer": true,+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@typescript/typescript-win32-x64": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/@typescript/typescript-win32-x64/-/typescript-win32-x64-7.0.2.tgz",+ "integrity": "sha512-0BQ3HkAHHlKLSp1qRvf3SUhGpGsDuhB/jgFw75guyqbxJqEaS0Cw/VFO8i2nHglJUzQCRtMMR/IBAKE3ETMC4g==",+ "cpu": [+ "x64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "win32"+ ],+ "peer": true,+ "engines": {+ "node": ">=16.20.0"+ }+ },+ "node_modules/@upstash/redis": {+ "version": "1.38.2",+ "resolved": "https://registry.npmjs.org/@upstash/redis/-/redis-1.38.2.tgz",+ "integrity": "sha512-RZ+JaRCVIS+ZTGnjOnDMr+/0aqDxsBb5rV6aW+Pys4SGELwr5lwE3UbLHRCHqMQ5Ulxj0b/CFBHfbmE175Otog==",+ "license": "MIT",+ "dependencies": {+ "uncrypto": "^0.1.3"+ }+ },+ "node_modules/agentkeepalive": {+ "version": "4.6.0",+ "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.6.0.tgz",+ "integrity": "sha512-kja8j7PjmncONqaTsB8fQ+wE2mSU2DJ9D4XKoJ5PFWIdRMa6SLSN1ff4mOr4jCbfRSsxR4keIiySJU0N9T5hIQ==",+ "license": "MIT",+ "dependencies": {+ "humanize-ms": "^1.2.1"+ },+ "engines": {+ "node": ">= 8.0.0"+ }+ },+ "node_modules/base-x": {+ "version": "5.0.1",+ "resolved": "https://registry.npmjs.org/base-x/-/base-x-5.0.1.tgz",+ "integrity": "sha512-M7uio8Zt++eg3jPj+rHMfCC+IuygQHHCOU+IYsVtik6FWjuYpVt/+MRKcgsAMHh8mMFAwnB+Bs+mTrFiXjMzKg==",+ "license": "MIT"+ },+ "node_modules/base64-js": {+ "version": "1.5.1",+ "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",+ "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",+ "funding": [+ {+ "type": "github",+ "url": "https://github.com/sponsors/feross"+ },+ {+ "type": "patreon",+ "url": "https://www.patreon.com/feross"+ },+ {+ "type": "consulting",+ "url": "https://feross.org/support"+ }+ ],+ "license": "MIT"+ },+ "node_modules/bn.js": {+ "version": "5.2.5",+ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.5.tgz",+ "integrity": "sha512-Vq886eXykuP5E6HcKSSStP3bJgrE6In5WKxVUvJ8XGpWWYs2xZHWqUwzCtGgEtBcxyd57KBFDPFoUfNzdaHCNg==",+ "license": "MIT"+ },+ "node_modules/borsh": {+ "version": "0.7.0",+ "resolved": "https://registry.npmjs.org/borsh/-/borsh-0.7.0.tgz",+ "integrity": "sha512-CLCsZGIBCFnPtkNnieW/a8wmreDmfUtjU2m9yHrzPXIlNbqVs0AQrSatSG6vdNYUqdc83tkQi2eHfF98ubzQLA==",+ "license": "Apache-2.0",+ "dependencies": {+ "bn.js": "^5.2.0",+ "bs58": "^4.0.0",+ "text-encoding-utf-8": "^1.0.2"+ }+ },+ "node_modules/borsh/node_modules/base-x": {+ "version": "3.0.11",+ "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.11.tgz",+ "integrity": "sha512-xz7wQ8xDhdyP7tQxwdteLYeFfS68tSMNCZ/Y37WJ4bhGfKPpqEIlmIyueQHqOyoPhE6xNUqjzRr8ra0eF9VRvA==",+ "license": "MIT",+ "dependencies": {+ "safe-buffer": "^5.0.1"+ }+ },+ "node_modules/borsh/node_modules/bs58": {+ "version": "4.0.1",+ "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz",+ "integrity": "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==",+ "license": "MIT",+ "dependencies": {+ "base-x": "^3.0.2"+ }+ },+ "node_modules/bs58": {+ "version": "6.0.0",+ "resolved": "https://registry.npmjs.org/bs58/-/bs58-6.0.0.tgz",+ "integrity": "sha512-PD0wEnEYg6ijszw/u8s+iI3H17cTymlrwkKhDhPZq+Sokl3AU4htyBFTjAeNAlCCmg0f53g6ih3jATyCKftTfw==",+ "license": "MIT",+ "dependencies": {+ "base-x": "^5.0.0"+ }+ },+ "node_modules/buffer": {+ "version": "6.0.3",+ "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz",+ "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==",+ "funding": [+ {+ "type": "github",+ "url": "https://github.com/sponsors/feross"+ },+ {+ "type": "patreon",+ "url": "https://www.patreon.com/feross"+ },+ {+ "type": "consulting",+ "url": "https://feross.org/support"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "base64-js": "^1.3.1",+ "ieee754": "^1.2.1"+ }+ },+ "node_modules/bufferutil": {+ "version": "4.1.0",+ "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.1.0.tgz",+ "integrity": "sha512-ZMANVnAixE6AWWnPzlW2KpUrxhm9woycYvPOo67jWHyFowASTEd9s+QN1EIMsSDtwhIxN4sWE1jotpuDUIgyIw==",+ "hasInstallScript": true,+ "license": "MIT",+ "optional": true,+ "dependencies": {+ "node-gyp-build": "^4.3.0"+ },+ "engines": {+ "node": ">=6.14.2"+ }+ },+ "node_modules/chalk": {+ "version": "5.6.2",+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.6.2.tgz",+ "integrity": "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==",+ "license": "MIT",+ "engines": {+ "node": "^12.17.0 || ^14.13 || >=16.0.0"+ },+ "funding": {+ "url": "https://github.com/chalk/chalk?sponsor=1"+ }+ },+ "node_modules/commander": {+ "version": "14.0.3",+ "resolved": "https://registry.npmjs.org/commander/-/commander-14.0.3.tgz",+ "integrity": "sha512-H+y0Jo/T1RZ9qPP4Eh1pkcQcLRglraJaSLoyOtHxu6AapkjWVCy2Sit1QQ4x3Dng8qDlSsZEet7g5Pq06MvTgw==",+ "license": "MIT",+ "engines": {+ "node": ">=20"+ }+ },+ "node_modules/delay": {+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/delay/-/delay-5.0.0.tgz",+ "integrity": "sha512-ReEBKkIfe4ya47wlPYf/gu5ib6yUG0/Aez0JQZQz94kiWtRQvZIQbTiehsnwHvLSWJnQdhVeqYue7Id1dKr0qw==",+ "license": "MIT",+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/es6-promise": {+ "version": "4.2.8",+ "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz",+ "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==",+ "license": "MIT"+ },+ "node_modules/es6-promisify": {+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz",+ "integrity": "sha512-C+d6UdsYDk0lMebHNR4S2NybQMMngAOnOwYBQjTOiv0MkoJMP0Myw2mgpDLBcpfCmRLxyFqYhS/CfOENq4SJhQ==",+ "license": "MIT",+ "dependencies": {+ "es6-promise": "^4.0.3"+ }+ },+ "node_modules/eventemitter3": {+ "version": "5.0.4",+ "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.4.tgz",+ "integrity": "sha512-mlsTRyGaPBjPedk6Bvw+aqbsXDtoAyAzm5MO7JgU+yVRyMQ5O8bD4Kcci7BS85f93veegeCPkL8R4GLClnjLFw==",+ "license": "MIT"+ },+ "node_modules/eyes": {+ "version": "0.1.8",+ "resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz",+ "integrity": "sha512-GipyPsXO1anza0AOZdy69Im7hGFCNB7Y/NGjDlZGJ3GJJLtwNSb2vrzYrTYJRrRloVx7pl+bhUaTB8yiccPvFQ==",+ "engines": {+ "node": "> 0.1.90"+ }+ },+ "node_modules/fast-stable-stringify": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/fast-stable-stringify/-/fast-stable-stringify-1.0.0.tgz",+ "integrity": "sha512-wpYMUmFu5f00Sm0cj2pfivpmawLZ0NKdviQ4w9zJeR8JVtOpOxHmLaJuj0vxvGqMJQWyP/COUkF75/57OKyRag==",+ "license": "MIT"+ },+ "node_modules/humanize-ms": {+ "version": "1.2.1",+ "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz",+ "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==",+ "license": "MIT",+ "dependencies": {+ "ms": "^2.0.0"+ }+ },+ "node_modules/ieee754": {+ "version": "1.2.1",+ "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",+ "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==",+ "funding": [+ {+ "type": "github",+ "url": "https://github.com/sponsors/feross"+ },+ {+ "type": "patreon",+ "url": "https://www.patreon.com/feross"+ },+ {+ "type": "consulting",+ "url": "https://feross.org/support"+ }+ ],+ "license": "BSD-3-Clause"+ },+ "node_modules/isomorphic-ws": {+ "version": "4.0.1",+ "resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz",+ "integrity": "sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==",+ "license": "MIT",+ "peerDependencies": {+ "ws": "*"+ }+ },+ "node_modules/jayson": {+ "version": "4.3.0",+ "resolved": "https://registry.npmjs.org/jayson/-/jayson-4.3.0.tgz",+ "integrity": "sha512-AauzHcUcqs8OBnCHOkJY280VaTiCm57AbuO7lqzcw7JapGj50BisE3xhksye4zlTSR1+1tAz67wLTl8tEH1obQ==",+ "license": "MIT",+ "dependencies": {+ "@types/connect": "^3.4.33",+ "@types/node": "^12.12.54",+ "@types/ws": "^7.4.4",+ "commander": "^2.20.3",+ "delay": "^5.0.0",+ "es6-promisify": "^5.0.0",+ "eyes": "^0.1.8",+ "isomorphic-ws": "^4.0.1",+ "json-stringify-safe": "^5.0.1",+ "stream-json": "^1.9.1",+ "uuid": "^8.3.2",+ "ws": "^7.5.10"+ },+ "bin": {+ "jayson": "bin/jayson.js"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/jayson/node_modules/commander": {+ "version": "2.20.3",+ "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",+ "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",+ "license": "MIT"+ },+ "node_modules/json-stringify-safe": {+ "version": "5.0.1",+ "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",+ "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==",+ "license": "ISC"+ },+ "node_modules/ms": {+ "version": "2.1.3",+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",+ "license": "MIT"+ },+ "node_modules/node-fetch": {+ "version": "2.7.0",+ "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",+ "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",+ "license": "MIT",+ "dependencies": {+ "whatwg-url": "^5.0.0"+ },+ "engines": {+ "node": "4.x || >=6.0.0"+ },+ "peerDependencies": {+ "encoding": "^0.1.0"+ },+ "peerDependenciesMeta": {+ "encoding": {+ "optional": true+ }+ }+ },+ "node_modules/node-gyp-build": {+ "version": "4.8.4",+ "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.4.tgz",+ "integrity": "sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ==",+ "license": "MIT",+ "optional": true,+ "bin": {+ "node-gyp-build": "bin.js",+ "node-gyp-build-optional": "optional.js",+ "node-gyp-build-test": "build-test.js"+ }+ },+ "node_modules/rpc-websockets": {+ "version": "9.3.9",+ "resolved": "https://registry.npmjs.org/rpc-websockets/-/rpc-websockets-9.3.9.tgz",+ "integrity": "sha512-2iQDaTB4g5fDB2ihrTFSJSibCEuxaRi1q7qTW7ZO9/M5/TC+ToHA4D9/ffNLEbAoHNNrcdeP05oATNk44SKZXA==",+ "license": "LGPL-3.0-only",+ "dependencies": {+ "@swc/helpers": "^0.5.11",+ "@types/uuid": "^10.0.0",+ "@types/ws": "^8.2.2",+ "buffer": "^6.0.3",+ "eventemitter3": "^5.0.1",+ "uuid": "^14.0.0",+ "ws": "^8.5.0"+ },+ "funding": {+ "type": "paypal",+ "url": "https://paypal.me/kozjak"+ },+ "optionalDependencies": {+ "bufferutil": "^4.0.1",+ "utf-8-validate": "^6.0.0"+ }+ },+ "node_modules/rpc-websockets/node_modules/@types/ws": {+ "version": "8.18.1",+ "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.18.1.tgz",+ "integrity": "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg==",+ "license": "MIT",+ "dependencies": {+ "@types/node": "*"+ }+ },+ "node_modules/rpc-websockets/node_modules/utf-8-validate": {+ "version": "6.0.6",+ "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-6.0.6.tgz",+ "integrity": "sha512-q3l3P9UtEEiAHcsgsqTgf9PPjctrDWoIXW3NpOHFdRDbLvu4DLIcxHangJ4RLrWkBcKjmcs/6NkerI8T/rE4LA==",+ "hasInstallScript": true,+ "license": "MIT",+ "optional": true,+ "dependencies": {+ "node-gyp-build": "^4.3.0"+ },+ "engines": {+ "node": ">=6.14.2"+ }+ },+ "node_modules/rpc-websockets/node_modules/uuid": {+ "version": "14.0.1",+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-14.0.1.tgz",+ "integrity": "sha512-6ZxzVpzDXDa3bJWaHilVayA+BH/1zmxCJoVgvmqJnid/gPoKHxUrS/aC/T6LGQtNHT+XHG9fXPJB4d+IrU30Ew==",+ "funding": [+ "https://github.com/sponsors/broofa",+ "https://github.com/sponsors/ctavan"+ ],+ "license": "MIT",+ "bin": {+ "uuid": "dist-node/bin/uuid"+ }+ },+ "node_modules/rpc-websockets/node_modules/ws": {+ "version": "8.21.3",+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.21.3.tgz",+ "integrity": "sha512-201TZ/kPWxoPr/OKWjquZR1SWKXcvxdH+e1xrx89b3YbmzLMFCLfnaG1HFIgWzJOEWZ7MvpK++odZufgYR50Rw==",+ "license": "MIT",+ "engines": {+ "node": ">=10.0.0"+ },+ "peerDependencies": {+ "bufferutil": "^4.0.1",+ "utf-8-validate": ">=5.0.2"+ },+ "peerDependenciesMeta": {+ "bufferutil": {+ "optional": true+ },+ "utf-8-validate": {+ "optional": true+ }+ }+ },+ "node_modules/safe-buffer": {+ "version": "5.2.1",+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",+ "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",+ "funding": [+ {+ "type": "github",+ "url": "https://github.com/sponsors/feross"+ },+ {+ "type": "patreon",+ "url": "https://www.patreon.com/feross"+ },+ {+ "type": "consulting",+ "url": "https://feross.org/support"+ }+ ],+ "license": "MIT"+ },+ "node_modules/stream-chain": {+ "version": "2.2.5",+ "resolved": "https://registry.npmjs.org/stream-chain/-/stream-chain-2.2.5.tgz",+ "integrity": "sha512-1TJmBx6aSWqZ4tx7aTpBDXK0/e2hhcNSTV8+CbFJtDjbb+I1mZ8lHit0Grw9GRT+6JbIrrDd8esncgBi8aBXGA==",+ "license": "BSD-3-Clause"+ },+ "node_modules/stream-json": {+ "version": "1.9.1",+ "resolved": "https://registry.npmjs.org/stream-json/-/stream-json-1.9.1.tgz",+ "integrity": "sha512-uWkjJ+2Nt/LO9Z/JyKZbMusL8Dkh97uUBTv3AJQ74y07lVahLY4eEFsPsE97pxYBwr8nnjMAIch5eqI0gPShyw==",+ "license": "BSD-3-Clause",+ "dependencies": {+ "stream-chain": "^2.2.5"+ }+ },+ "node_modules/superstruct": {+ "version": "2.0.2",+ "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-2.0.2.tgz",+ "integrity": "sha512-uV+TFRZdXsqXTL2pRvujROjdZQ4RAlBUS5BTh9IGm+jTqQntYThciG/qu57Gs69yjnVUSqdxF9YLmSnpupBW9A==",+ "license": "MIT",+ "engines": {+ "node": ">=14.0.0"+ }+ },+ "node_modules/text-encoding-utf-8": {+ "version": "1.0.2",+ "resolved": "https://registry.npmjs.org/text-encoding-utf-8/-/text-encoding-utf-8-1.0.2.tgz",+ "integrity": "sha512-8bw4MY9WjdsD2aMtO0OzOCY3pXGYNx2d2FfHRVUKkiCPDWjKuOlhLVASS+pD7VkLTVjW268LYJHwsnPFlBpbAg=="+ },+ "node_modules/tr46": {+ "version": "0.0.3",+ "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",+ "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==",+ "license": "MIT"+ },+ "node_modules/tslib": {+ "version": "2.8.1",+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",+ "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",+ "license": "0BSD"+ },+ "node_modules/typescript": {+ "version": "7.0.2",+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-7.0.2.tgz",+ "integrity": "sha512-8FYau96o3NKOhbjKi/qNvG/W5jhzxkbdm5sj9AbZ/5T5sWqn3hJgLfGx27sRKZWTvyzCP8dLRBTf5tBTSRVUNA==",+ "license": "Apache-2.0",+ "peer": true,+ "bin": {+ "tsc": "bin/tsc"+ },+ "engines": {+ "node": ">=16.20.0"+ },+ "optionalDependencies": {+ "@typescript/typescript-aix-ppc64": "7.0.2",+ "@typescript/typescript-darwin-arm64": "7.0.2",+ "@typescript/typescript-darwin-x64": "7.0.2",+ "@typescript/typescript-freebsd-arm64": "7.0.2",+ "@typescript/typescript-freebsd-x64": "7.0.2",+ "@typescript/typescript-linux-arm": "7.0.2",+ "@typescript/typescript-linux-arm64": "7.0.2",+ "@typescript/typescript-linux-loong64": "7.0.2",+ "@typescript/typescript-linux-mips64el": "7.0.2",+ "@typescript/typescript-linux-ppc64": "7.0.2",+ "@typescript/typescript-linux-riscv64": "7.0.2",+ "@typescript/typescript-linux-s390x": "7.0.2",+ "@typescript/typescript-linux-x64": "7.0.2",+ "@typescript/typescript-netbsd-arm64": "7.0.2",+ "@typescript/typescript-netbsd-x64": "7.0.2",+ "@typescript/typescript-openbsd-arm64": "7.0.2",+ "@typescript/typescript-openbsd-x64": "7.0.2",+ "@typescript/typescript-sunos-x64": "7.0.2",+ "@typescript/typescript-win32-arm64": "7.0.2",+ "@typescript/typescript-win32-x64": "7.0.2"+ }+ },+ "node_modules/uncrypto": {+ "version": "0.1.3",+ "resolved": "https://registry.npmjs.org/uncrypto/-/uncrypto-0.1.3.tgz",+ "integrity": "sha512-Ql87qFHB3s/De2ClA9e0gsnS6zXG27SkTiSJwjCc9MebbfapQfuPzumMIUMi38ezPZVNFcHI9sUIepeQfw8J8Q==",+ "license": "MIT"+ },+ "node_modules/utf-8-validate": {+ "version": "5.0.10",+ "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz",+ "integrity": "sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==",+ "extraneous": true,+ "hasInstallScript": true,+ "license": "MIT",+ "dependencies": {+ "node-gyp-build": "^4.3.0"+ },+ "engines": {+ "node": ">=6.14.2"+ }+ },+ "node_modules/uuid": {+ "version": "8.3.2",+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",+ "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",+ "deprecated": "uuid@10 and below is no longer supported. For ESM codebases, update to uuid@latest. For CommonJS codebases, use uuid@11 (but be aware this version will likely be deprecated in 2028).",+ "license": "MIT",+ "bin": {+ "uuid": "dist/bin/uuid"+ }+ },+ "node_modules/webidl-conversions": {+ "version": "3.0.1",+ "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",+ "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==",+ "license": "BSD-2-Clause"+ },+ "node_modules/whatwg-url": {+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",+ "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",+ "license": "MIT",+ "dependencies": {+ "tr46": "~0.0.3",+ "webidl-conversions": "^3.0.0"+ }+ },+ "node_modules/ws": {+ "version": "7.5.13",+ "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.13.tgz",+ "integrity": "sha512-rsKI6xDBFVf4r/x8XyChGK04QR/XHroxs/jUcoWvtEZM8TPU/X/uIY9B1CsSzYws9ZJb/6bbBu7dPhFW00CAoA==",+ "license": "MIT",+ "engines": {+ "node": ">=8.3.0"+ },+ "peerDependencies": {+ "bufferutil": "^4.0.1",+ "utf-8-validate": "^5.0.2"+ },+ "peerDependenciesMeta": {+ "bufferutil": {+ "optional": true+ },+ "utf-8-validate": {+ "optional": true+ }+ }+ }+ }+}diff --git a/services/pump-graduations/token-info.js b/services/pump-graduations/token-info.jsnew file mode 100644index 000000000..97955b2ae--- /dev/null+++ b/services/pump-graduations/token-info.js@@ -0,0 +1,158 @@+/**+ * Graduation enrichment: the PumpSwap pool a graduated mint migrates into, and+ * the mint's on-chain name/symbol.+ *+ * Both are derived or read from chain state rather than guessed out of the+ * graduation transaction. The `complete` event fires when the bonding curve+ * fills; the PumpSwap pool is created in a LATER migration transaction, so the+ * graduation tx's account list never contains the pool and cannot be mined for+ * it. The pool address is fully deterministic instead.+ */++import { PublicKey } from '@solana/web3.js';++const PUMP_PROGRAM_ID = new PublicKey('6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P');+const PUMP_AMM_PROGRAM_ID = new PublicKey('pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA');+const WRAPPED_SOL_MINT = new PublicKey('So11111111111111111111111111111111111111112');+const METAPLEX_METADATA_PROGRAM_ID = new PublicKey('metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s');++// Every pump.fun migration creates the pool at index 0 for its mint.+const CANONICAL_POOL_INDEX = 0;++function u16le(n) {+ const b = Buffer.alloc(2);+ b.writeUInt16LE(n);+ return b;+}++/**+ * The canonical PumpSwap pool for a graduated mint.+ *+ * Mirrors `canonicalPumpPoolPda` from `@pump-fun/pump-swap-sdk` (verified to+ * produce identical addresses) without pulling that SDK and its Anchor tree+ * into this service's image.+ *+ * @param {string|PublicKey} mint+ * @returns {string} base58 pool address+ */+export function canonicalPumpPoolAddress(mint) {+ const mintPk = mint instanceof PublicKey ? mint : new PublicKey(mint);+ const [poolAuthority] = PublicKey.findProgramAddressSync(+ [Buffer.from('pool-authority'), mintPk.toBuffer()],+ PUMP_PROGRAM_ID,+ );+ const [pool] = PublicKey.findProgramAddressSync(+ [+ Buffer.from('pool'),+ u16le(CANONICAL_POOL_INDEX),+ poolAuthority.toBuffer(),+ mintPk.toBuffer(),+ WRAPPED_SOL_MINT.toBuffer(),+ ],+ PUMP_AMM_PROGRAM_ID,+ );+ return pool.toBase58();+}++/** Metaplex metadata account for a mint (pre-Token-2022 pump launches). */+export function metaplexMetadataAddress(mint) {+ const mintPk = mint instanceof PublicKey ? mint : new PublicKey(mint);+ const [pda] = PublicKey.findProgramAddressSync(+ [+ Buffer.from('metadata'),+ METAPLEX_METADATA_PROGRAM_ID.toBuffer(),+ mintPk.toBuffer(),+ ],+ METAPLEX_METADATA_PROGRAM_ID,+ );+ return pda;+}++function readBorshString(data, offset) {+ if (offset + 4 > data.length) return null;+ const len = data.readUInt32LE(offset);+ const end = offset + 4 + len;+ if (len > data.length || end > data.length) return null;+ // Metaplex pads its strings to a fixed capacity with NULs; trim them off.+ const value = data.subarray(offset + 4, end).toString('utf8').replace(/\0+$/, '');+ return { value, next: end };+}++// SPL Token-2022 mint layout: 82-byte base, padded to 165, one account-type+// byte, then type-length-value extension entries.+const TLV_START = 166;+const TOKEN_METADATA_EXTENSION = 19;++/**+ * Decode name/symbol from a Token-2022 mint carrying the TokenMetadata+ * extension. Every pump.fun mint since the Token-2022 switch stores its+ * metadata inline this way rather than in a Metaplex account.+ *+ * @param {Buffer} data raw mint account data+ * @returns {{name: string, symbol: string}|null}+ */+export function decodeToken2022Metadata(data) {+ if (!data || data.length <= TLV_START) return null;+ let off = TLV_START;+ while (off + 4 <= data.length) {+ const type = data.readUInt16LE(off);+ const len = data.readUInt16LE(off + 2);+ const valueStart = off + 4;+ if (valueStart + len > data.length) return null;+ if (type === TOKEN_METADATA_EXTENSION) {+ // updateAuthority(32) mint(32) then borsh name, symbol, uri.+ const name = readBorshString(data, valueStart + 64);+ if (!name) return null;+ const symbol = readBorshString(data, name.next);+ if (!symbol) return null;+ return { name: name.value, symbol: symbol.value };+ }+ off = valueStart + len;+ }+ return null;+}++/**+ * Decode name/symbol from a Metaplex token-metadata account.+ * Layout: key(1) updateAuthority(32) mint(32) name symbol uri.+ *+ * @param {Buffer} data raw metadata account data+ * @returns {{name: string, symbol: string}|null}+ */+export function decodeMetaplexMetadata(data) {+ if (!data || data.length < 1 + 32 + 32 + 4) return null;+ const name = readBorshString(data, 1 + 32 + 32);+ if (!name) return null;+ const symbol = readBorshString(data, name.next);+ if (!symbol) return null;+ return { name: name.value, symbol: symbol.value };+}++/**+ * Read a mint's name and symbol from chain, trying the Token-2022 inline+ * extension first and falling back to the Metaplex metadata account for older+ * launches. Returns nulls rather than throwing: a graduation is still worth+ * publishing when its metadata read fails.+ *+ * @param {import('@solana/web3.js').Connection} connection+ * @param {string} mint+ * @returns {Promise<{name: string|null, symbol: string|null}>}+ */+export async function fetchTokenMetadata(connection, mint) {+ const mintPk = new PublicKey(mint);+ try {+ const info = await connection.getAccountInfo(mintPk);+ const inline = info && decodeToken2022Metadata(info.data);+ if (inline?.symbol) return { name: inline.name || null, symbol: inline.symbol };+ } catch (err) {+ console.error('[pump-graduations] mint read failed for %s:', mint, err?.message || err);+ }+ try {+ const info = await connection.getAccountInfo(metaplexMetadataAddress(mintPk));+ const legacy = info && decodeMetaplexMetadata(info.data);+ if (legacy?.symbol) return { name: legacy.name || null, symbol: legacy.symbol };+ } catch (err) {+ console.error('[pump-graduations] metadata read failed for %s:', mint, err?.message || err);+ }+ return { name: null, symbol: null };+}diff --git a/tests/pump-graduations.test.js b/tests/pump-graduations.test.jsnew file mode 100644index 000000000..e489ef4e4--- /dev/null+++ b/tests/pump-graduations.test.js@@ -0,0 +1,279 @@+import { describe, it, expect, vi } from 'vitest';+import bs58 from 'bs58';+import { PublicKey } from '@solana/web3.js';+import { canonicalPumpPoolPda } from '@pump-fun/pump-swap-sdk';+import {+ COMPLETE_EVENT_DISCRIMINATOR,+ PUMP_PROGRAM_ID,+ SeenSignatures,+ isCandidateEntry,+ parseCompleteEvent,+} from '../services/pump-graduations/graduation-event.js';+import {+ canonicalPumpPoolAddress,+ decodeMetaplexMetadata,+ decodeToken2022Metadata,+ fetchTokenMetadata,+ metaplexMetadataAddress,+} from '../services/pump-graduations/token-info.js';+import {+ DEFAULT_LIST_KEY,+ buildGraduationRecord,+ createGraduationHandler,+ pushGraduation,+} from '../services/pump-graduations/index.js';++// $THREE, the platform's own coin and a real graduated pump.fun mint. Used as+// the fixture so the committed test never names a third-party project.+const THREE_MINT = 'FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump';+const THREE_MINT_BYTES = Buffer.from(bs58.decode(THREE_MINT));+const SIG = 'testSig1111111111111111111111111111111111111111111111111111111111';+const TS = 1_700_000_000;++/** Build the exact `Program data:` line Pump emits for a CompleteEvent. */+function completeEventEntry({ mintBytes = THREE_MINT_BYTES, ts = TS, signature = SIG } = {}) {+ const buf = Buffer.alloc(8 + 32 + 32 + 32 + 8);+ COMPLETE_EVENT_DISCRIMINATOR.copy(buf, 0);+ mintBytes.copy(buf, 8 + 32);+ buf.writeBigInt64LE(BigInt(ts), 8 + 32 + 32 + 32);+ return { signature, err: null, logs: [`Program data: ${buf.toString('base64')}`] };+}++/** A Token-2022 mint carrying the inline TokenMetadata extension (type 19). */+function token2022Mint({ name, symbol, uri = 'https://example.invalid/m.json' }) {+ const str = (s) => {+ const b = Buffer.from(s, 'utf8');+ const out = Buffer.alloc(4 + b.length);+ out.writeUInt32LE(b.length);+ b.copy(out, 4);+ return out;+ };+ const value = Buffer.concat([+ Buffer.alloc(64), // updateAuthority(32) + mint(32)+ str(name),+ str(symbol),+ str(uri),+ Buffer.alloc(4), // empty additionalMetadata vec+ ]);+ const header = Buffer.alloc(4);+ header.writeUInt16LE(19, 0);+ header.writeUInt16LE(value.length, 2);+ return Buffer.concat([Buffer.alloc(166), header, value]);+}++/** In-memory stand-in for the Upstash REST client's list + pubsub commands. */+function recordingRedis() {+ const lists = new Map();+ const published = [];+ return {+ lists,+ published,+ async lpush(key, value) {+ const arr = lists.get(key) || [];+ arr.unshift(value);+ lists.set(key, arr);+ return arr.length;+ },+ async ltrim(key, start, stop) {+ lists.set(key, (lists.get(key) || []).slice(start, stop + 1));+ return 'OK';+ },+ async publish(channel, message) {+ published.push({ channel, message });+ return 1;+ },+ };+}++describe('parseCompleteEvent', () => {+ it('decodes the CompleteEvent layout off a real-shaped log line', () => {+ const ev = parseCompleteEvent(SIG, completeEventEntry().logs);+ expect(ev).toEqual({+ signature: SIG,+ mint: THREE_MINT,+ user: bs58.encode(Buffer.alloc(32)),+ bondingCurve: bs58.encode(Buffer.alloc(32)),+ timestamp: TS,+ });+ });++ it('returns null for a Program data line with a different discriminator', () => {+ const buf = Buffer.alloc(112);+ buf.writeUInt8(0xff, 0);+ expect(parseCompleteEvent(SIG, [`Program data: ${buf.toString('base64')}`])).toBeNull();+ });++ it('returns null when the payload is truncated below the event size', () => {+ const buf = Buffer.alloc(40);+ COMPLETE_EVENT_DISCRIMINATOR.copy(buf, 0);+ expect(parseCompleteEvent(SIG, [`Program data: ${buf.toString('base64')}`])).toBeNull();+ });++ it('returns null when no Program data line is present', () => {+ expect(parseCompleteEvent(SIG, ['Program log: instruction: Buy'])).toBeNull();+ });+});++describe('isCandidateEntry', () => {+ it('accepts a successful entry carrying an event line', () => {+ expect(isCandidateEntry(completeEventEntry())).toBe(true);+ });++ it('rejects failed transactions', () => {+ expect(isCandidateEntry({ ...completeEventEntry(), err: { InstructionError: [0, 'Custom'] } })).toBe(false);+ });++ it('rejects entries with no event line', () => {+ expect(isCandidateEntry({ signature: SIG, err: null, logs: ['Program log: hi'] })).toBe(false);+ });+});++describe('SeenSignatures', () => {+ it('admits a signature once', () => {+ const seen = new SeenSignatures();+ expect(seen.add(SIG)).toBe(true);+ expect(seen.add(SIG)).toBe(false);+ });++ it('evicts the oldest quarter at the limit instead of clearing outright', () => {+ const seen = new SeenSignatures(8);+ for (let i = 0; i < 9; i++) seen.add(`sig-${i}`);+ expect(seen.size).toBe(7); // 9 added, oldest 2 dropped+ expect(seen.add('sig-0')).toBe(true); // evicted, so it is new again+ expect(seen.add('sig-8')).toBe(false); // most recent, still deduped+ });+});++describe('canonicalPumpPoolAddress', () => {+ it('matches canonicalPumpPoolPda from @pump-fun/pump-swap-sdk', () => {+ expect(canonicalPumpPoolAddress(THREE_MINT)).toBe(+ canonicalPumpPoolPda(new PublicKey(THREE_MINT)).toBase58(),+ );+ });++ it('derives the live PumpSwap pool for $THREE', () => {+ // Verified on mainnet: this account exists and is owned by+ // pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA.+ expect(canonicalPumpPoolAddress(THREE_MINT)).toBe('5ByL7MZoLABYnwMPZKPKjf4MGkZ7FeBzrAnos19Pre2z');+ });+});++describe('token metadata decoding', () => {+ it('reads name and symbol out of a Token-2022 TokenMetadata extension', () => {+ expect(decodeToken2022Metadata(token2022Mint({ name: 'three.ws', symbol: 'three' }))).toEqual({+ name: 'three.ws',+ symbol: 'three',+ });+ });++ it('returns null for a mint with no extensions', () => {+ expect(decodeToken2022Metadata(Buffer.alloc(82))).toBeNull();+ });++ it('reads NUL-padded name and symbol out of a Metaplex metadata account', () => {+ const data = Buffer.alloc(1 + 32 + 32 + 4 + 32 + 4 + 10);+ let off = 1 + 32 + 32;+ data.writeUInt32LE(32, off); off += 4;+ Buffer.from('three.ws', 'utf8').copy(data, off); off += 32;+ data.writeUInt32LE(10, off); off += 4;+ Buffer.from('three', 'utf8').copy(data, off);+ expect(decodeMetaplexMetadata(data)).toEqual({ name: 'three.ws', symbol: 'three' });+ });++ it('falls back to the Metaplex account when the mint carries no extension', async () => {+ const metaPda = metaplexMetadataAddress(THREE_MINT).toBase58();+ const legacy = Buffer.alloc(1 + 32 + 32 + 4 + 8 + 4 + 5);+ let off = 1 + 32 + 32;+ legacy.writeUInt32LE(8, off); off += 4;+ Buffer.from('three.ws', 'utf8').copy(legacy, off); off += 8;+ legacy.writeUInt32LE(5, off); off += 4;+ Buffer.from('three', 'utf8').copy(legacy, off);++ const connection = {+ getAccountInfo: vi.fn(async (pk) =>+ pk.toBase58() === metaPda ? { data: legacy } : { data: Buffer.alloc(82) },+ ),+ };+ await expect(fetchTokenMetadata(connection, THREE_MINT)).resolves.toEqual({+ name: 'three.ws',+ symbol: 'three',+ });+ });++ it('returns nulls rather than throwing when both reads fail', async () => {+ const connection = { getAccountInfo: vi.fn(async () => { throw new Error('rpc down'); }) };+ await expect(fetchTokenMetadata(connection, THREE_MINT)).resolves.toEqual({+ name: null,+ symbol: null,+ });+ });+});++describe('graduation core path', () => {+ const connectionWithMetadata = () => ({+ getAccountInfo: vi.fn(async () => ({ data: token2022Mint({ name: 'three.ws', symbol: 'three' }) })),+ });++ it('builds the record shape api/_lib/pumpfun-mcp.js reads', async () => {+ const record = await buildGraduationRecord(connectionWithMetadata(), {+ signature: SIG,+ mint: THREE_MINT,+ timestamp: TS,+ });+ expect(record).toEqual({+ signature: SIG,+ mint: THREE_MINT,+ tokenName: 'three.ws',+ tokenSymbol: 'three',+ poolAddress: '5ByL7MZoLABYnwMPZKPKjf4MGkZ7FeBzrAnos19Pre2z',+ timestamp: TS,+ });+ });++ it('stamps the current time when the event carries no timestamp', async () => {+ const before = Math.floor(Date.now() / 1000);+ const record = await buildGraduationRecord(connectionWithMetadata(), { signature: SIG, mint: THREE_MINT });+ expect(record.timestamp).toBeGreaterThanOrEqual(before);+ });++ it('lpushes, trims and publishes on the documented keys', async () => {+ const redis = recordingRedis();+ const record = { signature: SIG, mint: THREE_MINT, timestamp: TS };+ await pushGraduation(redis, record, { listKey: 'pf:test', maxLen: 2 });+ await pushGraduation(redis, { ...record, signature: 'b' }, { listKey: 'pf:test', maxLen: 2 });+ await pushGraduation(redis, { ...record, signature: 'c' }, { listKey: 'pf:test', maxLen: 2 });++ const list = redis.lists.get('pf:test');+ expect(list).toHaveLength(2);+ expect(JSON.parse(list[0]).signature).toBe('c');+ expect(redis.published).toHaveLength(3);+ expect(redis.published[0].channel).toBe('pf:test:pub');+ expect(JSON.parse(redis.published[0].message).mint).toBe(THREE_MINT);+ });++ it('runs log line to Redis end to end and dedupes replays', async () => {+ const redis = recordingRedis();+ const handler = createGraduationHandler({ connection: connectionWithMetadata(), redis });+ const entry = completeEventEntry();++ expect(isCandidateEntry(entry)).toBe(true);+ const parsed = parseCompleteEvent(entry.signature, entry.logs);+ const record = await handler(parsed);+ expect(await handler(parsed)).toBeNull(); // replayed signature++ expect(record.tokenSymbol).toBe('three');+ expect(redis.lists.get(DEFAULT_LIST_KEY)).toHaveLength(1);+ expect(redis.published).toHaveLength(1);+ expect(JSON.parse(redis.lists.get(DEFAULT_LIST_KEY)[0])).toEqual(record);+ });++ it('swallows a Redis failure so one bad push cannot kill the subscription', async () => {+ const redis = { ...recordingRedis(), lpush: async () => { throw new Error('redis unreachable'); } };+ const handler = createGraduationHandler({ connection: connectionWithMetadata(), redis });+ await expect(handler({ signature: SIG, mint: THREE_MINT, timestamp: TS })).resolves.toBeNull();+ });++ it('subscribes to the Pump program id', () => {+ expect(PUMP_PROGRAM_ID.toBase58()).toBe('6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P');+ });+});