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
Pump curve API and bonding curve widget updates
nirholas3b7ed437c452
diff --git a/api/pump/curve.js b/api/pump/curve.jsindex 3e5d90e7f..bd967c3a2 100644--- a/api/pump/curve.js+++ b/api/pump/curve.js@@ -26,6 +26,11 @@ const NON_CURVE_MINTS = new Set(['So11111111111111111111111111111111111111112', // wrapped SOL]);+// pump.fun mints a fixed total supply of exactly 1B tokens, the whole of which+// is sold through the curve and then seeded into the AMM pool on graduation. For+// these tokens fully-diluted value therefore equals market cap.+const PUMP_TOTAL_SUPPLY = 1_000_000_000;+// Every pump.fun mint keypair is ground to end in the literal suffix "pump". A// mint that does not end in "pump" (or that is a known settlement token) has no// bonding curve and never will — so we can reject it without touching RPC.@@ -97,6 +102,35 @@ export default wrap(async (req, res) => {});if (!result.curve) {+ // No on-chain bonding curve account. Two cases to disambiguate:+ // 1. Graduated coin — the curve account is closed once a coin migrates+ // to its AMM pool, but the token still trades with a live DEX price.+ // Fall back to Jupiter and return a 200 "graduated" view so callers+ // render the real price instead of a dead 404. (Our own $THREE lives+ // here post-migration.)+ // 2. A mint that never had a curve — Jupiter has nothing either, so the+ // 404 stands and the client's stop-on-404 path fires as before.+ const graduatedPrice = await jupiterPriceFallback(mint);+ if (graduatedPrice) {+ // pump.fun mints a fixed 1B supply entirely into the curve/pool, so+ // fully-diluted value equals market cap. Compute it once here so every+ // consumer gets a meaningful market cap without re-deriving supply.+ const marketCapUsd = graduatedPrice.priceUsd * PUMP_TOTAL_SUPPLY;+ return json(+ res,+ 200,+ {+ mint,+ network,+ curve: null,+ graduated: true,+ price: null,+ graduation: { isGraduated: true, progressBps: 10_000 },+ graduatedPrice: { ...graduatedPrice, marketCapUsd },+ },+ { 'cache-control': 'public, max-age=15, s-maxage=30, stale-while-revalidate=60' },+ );+ }return error(res, 404, 'no_curve', 'no bonding curve found for that mint');}diff --git a/src/widgets/bonding-curve.js b/src/widgets/bonding-curve.jsindex da1d34a88..670c59e15 100644--- a/src/widgets/bonding-curve.js+++ b/src/widgets/bonding-curve.js@@ -155,6 +155,31 @@ export function areaPathFor(progress, samples = CURVE_SAMPLES, vb = VB) {* @param {number|null} solUsd SOL price in USD, or null when unavailable.*/export function computeView(data, solUsd = null) {+ // Graduated coin whose on-chain curve account is gone (closed on migration to+ // the AMM). There's no curve to chart, but the token still has a real DEX+ // price — render a 100% "Graduated" state with that live price rather than the+ // empty "no curve" card. The endpoint enriches market cap from fixed supply.+ if (data && data.graduated && !data.curve) {+ const gp = data.graduatedPrice || {};+ const priceUsd = Number(gp.priceUsd);+ const marketCapUsd = Number(gp.marketCapUsd);+ const hasUsd = Number.isFinite(priceUsd) && priceUsd > 0;+ return {+ status: 'graduated',+ progress: 1,+ progressPct: 100,+ marketCapSol: 0,+ marketCapUsd: Number.isFinite(marketCapUsd) && marketCapUsd > 0 ? marketCapUsd : null,+ raisedSol: null, // the raise completed and the curve closed — N/A now+ raisedUsd: null,+ priceSol: 0,+ priceUsd: hasUsd ? priceUsd : null,+ isMayhem: false,+ network: data.network === 'devnet' ? 'devnet' : 'mainnet',+ mint: data.mint || '',+ hasUsd,+ };+ }if (!data || !data.curve) {return { status: 'empty', progress: 0, hasUsd: false };}@@ -488,12 +513,15 @@ export function mountBondingCurve(rootEl, opts = {}) {setText(els.status, v.status === 'graduated' ? 'Graduated' : 'Bonding');if (v.hasUsd) {- setText(els.mc, fmtUsd(v.marketCapUsd));- setText(els.raised, `${fmtSol(v.raisedSol)} · ${fmtUsd(v.raisedUsd)}`);+ setText(els.mc, v.marketCapUsd == null ? '—' : fmtUsd(v.marketCapUsd));+ setText(+ els.raised,+ v.raisedSol == null ? '—' : `${fmtSol(v.raisedSol)} · ${fmtUsd(v.raisedUsd)}`,+ );setText(els.price, fmtPrice(v.priceUsd, { usd: true }));} else {setText(els.mc, fmtSol(v.marketCapSol));- setText(els.raised, fmtSol(v.raisedSol));+ setText(els.raised, v.raisedSol == null ? '—' : fmtSol(v.raisedSol));setText(els.price, fmtPrice(v.priceSol));}animateTo(v.progress);