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
<!DOCTYPE html>
<html lang="en">
<head>
<script>/* three.ws theme boot — no-flash; runtime in /theme-switcher.js */(function(){try{var m=localStorage.getItem('twx_theme');var l=m==='auto'?(window.matchMedia&&window.matchMedia('(prefers-color-scheme: light)').matches):m==='light';document.documentElement.setAttribute('data-theme',l?'light':'dark');}catch(e){document.documentElement.setAttribute('data-theme','dark');}})();</script>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" href="/favicon.ico" sizes="any" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
<link rel="manifest" href="/manifest.webmanifest" />
<title data-i18n="pump_live.meta_title">Pump.fun Live Feed · three.ws</title>
<meta name="description" content="Watch every pump.fun launch on Solana the moment it happens: live market caps, Oracle conviction scores, and a 3D agent that reacts to each new coin." data-i18n-attr="content:pump_live.meta_description">
<link rel="canonical" href="https://three.ws/pump-live">
<script type="importmap">
{
"imports": {
"three": "https://unpkg.com/[email protected]/build/three.module.js",
"three/addons/": "https://unpkg.com/[email protected]/examples/jsm/"
}
}
</script>
<style>
:root {
--green: #00ff41;
--dark-grey: var(--bg-1);
--medium-grey: #2a2a2a;
--light-grey: #3a3a3a;
--text-color: #e0e0e0;
--glow-color: rgba(0, 255, 65, 0.5);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
background: var(--bg-0);
color: var(--text-color);
font-family: 'Roboto Mono', 'Courier New', monospace;
font-size: 14px;
line-height: 1.6;
}
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }
/* ── Main Layout ──────────────────────────────────────────
The kiosk row (3D viewer + token feed) gets a viewport-sized
height so it fills the screen on first paint, then the site
footer scrolls in below it. Mobile breakpoint stacks the row
vertically — see media query at the bottom of this block. */
#main-container {
display: flex;
min-height: 0;
height: calc(100svh - 130px);
}
#viewer-container {
flex: 1;
min-width: 0;
position: relative;
border-right: 1px solid var(--dark-grey);
}
#feed-container {
width: 450px;
display: flex;
flex-direction: column;
background: #0f0f0f;
}
/* ── Header ────────────────────────────────────────── */
#header {
background: #111;
border-bottom: 1px solid var(--dark-grey);
padding: 12px 20px;
display: flex;
align-items: center;
gap: 16px;
flex-wrap: wrap;
z-index: 10;
}
#header h1 {
font-size: 18px;
color: var(--green);
text-shadow: 0 0 8px var(--glow-color);
}
#header .status {
font-size: 12px;
color: #666;
}
#header .status.connected { color: var(--green); }
#header .status.error { color: #ff4141; }
#header .header-links {
margin-left: auto;
display: flex;
gap: 18px;
font-size: 13px;
}
#header .header-links a { color: var(--green); }
#header .header-links a:hover { text-decoration: underline; }
#header .header-links a:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; border-radius: 4px; }
/* ── Stats bar ───────────────────────────────────── */
#stats-bar {
display: flex;
gap: 0;
background: #0d0d0d;
border-bottom: 1px solid var(--dark-grey);
}
.stat {
flex: 1;
/* Without this the flex items refuse to shrink below their longest label,
so at 320px the four stats sum to 321px and the last one hangs a pixel
past the viewport. Labels wrap instead. */
min-width: 0;
padding: 10px 16px;
border-right: 1px solid var(--dark-grey);
display: flex;
flex-direction: column;
gap: 2px;
}
.stat:last-child { border-right: none; }
/* The prime-scored stat is also the shortcut into the prime filter, so it is
a real <button>. These rules undo the UA button chrome and keep it visually
identical to the plain stats beside it. */
.stat-filter {
font-family: inherit;
text-align: left;
background: none;
border: none;
border-right: 1px solid var(--dark-grey);
cursor: pointer;
transition: background var(--duration-fast);
}
.stat-filter:last-child { border-right: none; }
.stat-filter:hover { background: rgba(192, 132, 252, 0.07); }
.stat-filter:active { background: rgba(192, 132, 252, 0.12); }
.stat-label {
font-size: 10px;
letter-spacing: 0.08em;
text-transform: uppercase;
color: #666;
}
.stat-value {
font-size: 18px;
font-weight: bold;
color: var(--green);
font-variant-numeric: tabular-nums;
transition: color var(--duration-base);
}
.stat-value.flash { color: #fff; }
/* ── Feed ────────────────────────────────────────── */
#feed-header {
padding: 12px;
border-bottom: 1px solid var(--dark-grey);
background: #131313;
}
#feed {
flex: 1;
overflow-y: auto;
padding: 8px;
}
.token-card {
background: var(--dark-grey);
border: 1px solid var(--medium-grey);
border-radius: 8px;
margin-bottom: 8px;
padding: 12px;
display: flex;
gap: 12px;
animation: fadeIn 0.5s ease;
transition: transform var(--duration-base), box-shadow var(--duration-base);
}
.token-card:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.token-card img {
width: 50px;
height: 50px;
border-radius: 50%;
border: 1px solid var(--light-grey);
}
.token-info { flex: 1; min-width: 0; }
.token-name {
font-size: 16px;
font-weight: bold;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.token-symbol { color: var(--ink-dim); font-size: 12px; }
.token-mcap { margin-top: 4px; font-size: 14px; color: var(--green); }
.token-meta { margin-top: 2px; font-size: 11px; color: #777; }
.token-links { margin-top: 8px; font-size: 11px; display: flex; gap: 10px; align-items: center; }
.token-watch { background: none; border: 1px solid var(--medium-grey); border-radius: 6px; color: #666;
font-size: 14px; line-height: 1; padding: 2px 7px; cursor: pointer; transition: color var(--duration-fast), border-color var(--duration-fast); }
.token-watch.watched { color: #7c83ff; border-color: #7c83ff; }
.token-watch:hover { color: #fff; border-color: #aaa; }
.pl-oracle-badge { margin-left: auto; flex-shrink: 0; }
.pl-ob-link {
display: inline-flex; align-items: center; gap: 4px;
background: rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.1);
border-radius: 6px; padding: 2px 7px; text-decoration: none;
transition: background var(--duration-fast), border-color var(--duration-fast);
}
.pl-ob-link:hover { background: rgba(255,255,255,0.07); border-color: rgba(255,255,255,0.22); }
.pl-ob-score { font: 700 11px/1 monospace; font-variant-numeric: tabular-nums; }
.pl-ob-tier { font: 600 8px/1 monospace; text-transform: uppercase; letter-spacing: .06em; opacity: .8; }
/* ── Conviction filter bar ────────────────────────────────── */
#filter-bar {
display: flex;
align-items: center;
gap: 6px;
padding: 8px 12px;
border-bottom: 1px solid var(--dark-grey);
background: #0c0c0c;
flex-wrap: wrap;
}
#filter-bar .fb-label {
font-size: 10px;
text-transform: uppercase;
letter-spacing: .08em;
color: #555;
margin-right: 2px;
white-space: nowrap;
}
.fb-btn {
padding: 3px 10px;
border-radius: 999px;
border: 1px solid #2a2a2a;
background: transparent;
color: #666;
font-size: 11px;
font-family: inherit;
cursor: pointer;
transition: color var(--duration-fast), border-color var(--duration-fast), background var(--duration-fast);
white-space: nowrap;
}
.fb-btn:hover { color: #aaa; border-color: #444; }
.fb-btn.active { color: #e0e0e0; border-color: #555; background: #1c1c1c; }
.fb-btn.active.tier-prime { color: #c084fc; border-color: rgba(192,132,252,.45); background: rgba(192,132,252,.06); }
.fb-btn.active.tier-strong { color: #34d399; border-color: rgba(52,211,153,.45); background: rgba(52,211,153,.05); }
#filter-count {
font-size: 10px;
color: #444;
white-space: nowrap;
font-variant-numeric: tabular-nums;
text-align: right;
}
.token-card.pl-filtered { display: none; }
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
/* ── Skeleton (empty / waiting state) ──────────────── */
.skeleton-card {
background: var(--dark-grey);
border: 1px solid var(--medium-grey);
border-radius: 8px;
margin-bottom: 8px;
padding: 12px;
display: flex;
gap: 12px;
}
.skeleton-card .sk-avatar {
width: 50px; height: 50px; border-radius: 50%;
flex-shrink: 0;
}
.skeleton-card .sk-lines { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.sk-line { height: 12px; border-radius: 4px; }
.sk-line.w70 { width: 70%; }
.sk-line.w40 { width: 40%; }
.sk-line.w55 { width: 55%; }
.sk-avatar, .sk-line {
background: linear-gradient(90deg, var(--skeleton-base) 25%, var(--skeleton-sheen) 50%, var(--skeleton-base) 75%);
background-size: 200% 100%;
animation: shimmer 1.4s ease-in-out infinite;
}
@keyframes shimmer {
0% { background-position: 200% 0; }
100% { background-position: -200% 0; }
}
.feed-empty-hint {
text-align: center;
color: #666;
font-size: 12px;
padding: 4px 0 12px;
}
/* ── Reconnecting banner ───────────────────────────────
Auto-reconnect can spend minutes in backoff before it gives up, so the
disconnect is surfaced (and made recoverable) the moment it happens
instead of only in the terminal panel below. Sits above the feed so an
already-populated list is never wiped out by a transient outage. */
#feed-notice {
display: flex;
align-items: center;
gap: 8px;
padding: 8px 12px;
background: rgba(255, 138, 138, 0.07);
border-bottom: 1px solid #4a2323;
font-size: 11px;
color: #ffb4b4;
}
#feed-notice[hidden] { display: none; }
#feed-notice .fn-dot {
width: 7px; height: 7px; border-radius: 50%;
background: #ff8a8a; flex-shrink: 0;
animation: fn-pulse 1.4s ease-in-out infinite;
}
@keyframes fn-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
#feed-notice .fn-text { flex: 1; min-width: 0; }
#feed-notice #fn-countdown { font-variant-numeric: tabular-nums; }
#fn-retry {
background: transparent;
border: 1px solid rgba(255, 138, 138, 0.5);
border-radius: 999px;
color: #ffb4b4;
font-family: inherit;
font-size: 11px;
padding: 3px 12px;
cursor: pointer;
white-space: nowrap;
transition: color var(--duration-fast), border-color var(--duration-fast), background var(--duration-fast);
}
#fn-retry:hover { color: #fff; border-color: #ffb4b4; background: rgba(255, 138, 138, 0.12); }
#fn-retry:active { transform: translateY(1px); }
/* Every control on this page gets the same visible keyboard ring:
the feed is dense and a lost focus position is unrecoverable without one. */
.fb-btn:focus-visible,
#fn-retry:focus-visible,
.stat-filter:focus-visible,
.token-watch:focus-visible,
.token-links a:focus-visible,
.pl-ob-link:focus-visible {
outline: 2px solid var(--green);
outline-offset: 2px;
border-radius: 6px;
}
/* ── Stopped / dead-feed state ─────────────────────────
Distinct from the transient "reconnecting…" status (amber, in the
header). This is the terminal state after auto-reconnect gives up:
a heavier, unmistakable panel so the user knows the stream is fully
stopped and only a manual reconnect will revive it. */
.feed-error {
margin: 16px 8px;
padding: 24px 18px;
border: 1px solid #6b2a2a;
background: linear-gradient(180deg, rgba(255, 65, 65, 0.10), rgba(255, 65, 65, 0.04));
border-radius: 10px;
text-align: center;
box-shadow: 0 0 0 1px rgba(255, 65, 65, 0.08) inset;
}
.feed-error .fe-icon {
font-size: 26px;
line-height: 1;
margin-bottom: 10px;
display: block;
filter: grayscale(0.15);
}
.feed-error h3 {
color: #ff6b6b;
font-size: 15px;
margin-bottom: 8px;
letter-spacing: 0.01em;
}
.feed-error p { color: #aaa; font-size: 12px; margin-bottom: 16px; line-height: 1.55; }
.feed-error p .fe-attempts { color: #ff8a8a; font-variant-numeric: tabular-nums; }
.feed-error button {
background: var(--green);
color: var(--bg-0);
border: none;
border-radius: 6px;
padding: 10px 22px;
font-family: inherit;
font-size: 13px;
font-weight: bold;
cursor: pointer;
transition: transform var(--duration-fast), box-shadow var(--duration-fast), filter var(--duration-fast);
}
.feed-error button:hover { filter: brightness(1.1); box-shadow: 0 0 14px var(--glow-color); }
.feed-error button:active { transform: translateY(1px); }
.feed-error button:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.feed-error button[disabled] { filter: grayscale(0.6) brightness(0.8); cursor: progress; box-shadow: none; }
/* ── SOL-price loading hint ────────────────────────────
Shown in the header until /api/pump/helius-stats returns a USD price.
Until then market caps render in SOL — this label flags that so the
numbers never silently look stale. It clears the moment price lands. */
#price-hint {
display: none;
align-items: center;
gap: 6px;
font-size: 11px;
color: #c9a227;
background: rgba(201, 162, 39, 0.08);
border: 1px solid rgba(201, 162, 39, 0.22);
border-radius: 999px;
padding: 2px 10px;
white-space: nowrap;
cursor: help;
}
#price-hint.visible { display: inline-flex; }
#price-hint .ph-dot {
width: 7px; height: 7px; border-radius: 50%;
background: #c9a227;
box-shadow: 0 0 0 0 rgba(201, 162, 39, 0.6);
animation: phPulse 1.6s ease-in-out infinite;
flex-shrink: 0;
}
@keyframes phPulse {
0% { box-shadow: 0 0 0 0 rgba(201, 162, 39, 0.5); }
70% { box-shadow: 0 0 0 6px rgba(201, 162, 39, 0); }
100% { box-shadow: 0 0 0 0 rgba(201, 162, 39, 0); }
}
@media (prefers-reduced-motion: reduce) {
#price-hint .ph-dot { animation: none; }
}
/* ── Scrollbar ─────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #0f0f0f; }
::-webkit-scrollbar-thumb { background: var(--medium-grey); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--light-grey); }
/* ── Responsive ──────────────────────────────────────
Below 900px the kiosk row stacks vertically: the reacting 3D agent on
top, the live feed (with its own scroll region) beneath it. */
@media (max-width: 900px) {
#main-container { flex-direction: column; }
#viewer-container { height: 45vh; min-height: 240px; border-right: none; border-bottom: 1px solid var(--dark-grey); }
#feed-container { width: 100%; flex: 1; min-height: 0; }
}
</style>
<link rel="stylesheet" href="/nav.css" />
<link rel="stylesheet" href="/footer.css" />
<link rel="stylesheet" href="/mobile.css" />
<script defer src="/footer-newsletter.js"></script>
<meta property="og:type" content="website">
<meta property="og:site_name" content="three.ws">
<meta property="og:title" content="Pump Live · three.ws" data-i18n-attr="content:pump_live.meta_og_title">
<meta property="og:description" content="Real-time feed of every pump.fun launch as it happens, with a 3D agent that reacts live." data-i18n-attr="content:pump_live.meta_og_description">
<meta property="og:url" content="https://three.ws/pump-live">
<meta property="og:image" content="https://three.ws/api/page-og?s=crypto&t=Pump+Live&d=Real-time+feed+of+every+pump.fun+launch+as+it+happens%2C+with+a+3D+agent+that+reacts+live.&p=%2Fpump-live">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="Pump Live · three.ws" data-i18n-attr="content:pump_live.meta_twitter_title">
<meta name="twitter:description" content="Real-time feed of every pump.fun launch as it happens, with a 3D agent that reacts live." data-i18n-attr="content:pump_live.meta_twitter_description">
<meta name="twitter:image" content="https://three.ws/api/page-og?s=crypto&t=Pump+Live&d=Real-time+feed+of+every+pump.fun+launch+as+it+happens%2C+with+a+3D+agent+that+reacts+live.&p=%2Fpump-live">
<script type="application/ld+json">{"@context":"https://schema.org","@type":"WebPage","name":"Pump Live","description":"Real-time feed of every pump.fun launch as it happens, with a 3D agent that reacts live.","url":"https://three.ws/pump-live","isPartOf":{"@type":"WebSite","name":"three.ws","url":"https://three.ws"}}</script>
<meta name="robots" content="index, follow, max-image-preview:large, max-snippet:-1">
<meta property="og:locale" content="en_US">
<meta property="og:image:alt" content="Pump Live — three.ws">
<meta name="twitter:site" content="@trythreews">
</head>
<body>
<header><div id="nav-container"></div></header>
<script src="/nav.js"></script>
<div id="header">
<h1 data-i18n="pump_live.3d_agent_live_feed">🚀 3D Agent Live Feed</h1>
<div class="status" id="status">● Connecting...</div>
<span id="price-hint" role="status" aria-live="polite"
title="Live SOL→USD price is loading. Market caps show in SOL until it arrives, then switch to USD." data-i18n-html="pump_live.caps_in_sol_loading_usd_price" data-i18n-attr="title:pump_live.live_sol_usd_price_is_loadin_title">
<span class="ph-dot" aria-hidden="true"></span>
<span>Caps in SOL — loading USD price…</span>
</span>
<nav class="header-links" aria-label="Explore the launchpad">
<a href="/launches" data-i18n="pump_live.all_launches">All launches →</a>
<a href="/pump-visualizer" data-i18n="pump_live.visualizer">Visualizer →</a>
</nav>
</div>
<div id="main-container">
<div id="viewer-container"></div>
<div id="feed-container">
<div id="stats-bar" role="group" aria-label="Live launch statistics">
<div class="stat">
<span class="stat-label" data-i18n="pump_live.tokens_launched">Tokens launched</span>
<span class="stat-value" id="stat-launched" aria-live="polite">0</span>
</div>
<div class="stat">
<span class="stat-label" data-i18n="pump_live.initial_buy_volume">Initial-buy volume</span>
<span class="stat-value" id="stat-volume" aria-live="polite">$0</span>
</div>
<div class="stat">
<span class="stat-label" data-i18n="pump_live.last_launch">Last launch</span>
<span class="stat-value" id="stat-age" aria-live="polite">—</span>
</div>
<button type="button" class="stat stat-filter" id="stat-prime-filter" title="Filter to prime coins" data-i18n-attr="title:pump_live.filter_to_prime_coins_title">
<span class="stat-label" data-i18n="pump_live.prime_scored">🔮 Prime scored</span>
<span class="stat-value" id="stat-prime" aria-live="polite" style="color:#c084fc">0</span>
</button>
</div>
<div id="feed-header">
<h2 data-i18n="pump_live.new_tokens_on_pump_fun">New Tokens on Pump.fun</h2>
</div>
<div id="filter-bar" role="group" aria-label="Filter by Oracle conviction">
<span class="fb-label" data-i18n="pump_live.oracle">Oracle</span>
<button class="fb-btn active" data-ftier="all" aria-pressed="true" data-i18n="pump_live.all">All</button>
<button class="fb-btn tier-strong" data-ftier="strong" aria-pressed="false" data-i18n="pump_live.strong">Strong+</button>
<button class="fb-btn tier-prime" data-ftier="prime" aria-pressed="false" data-i18n="pump_live.prime">Prime</button>
<span id="filter-count" style="flex:1;text-align:right" aria-live="polite"></span>
<button class="fb-btn" id="fb-pause" aria-pressed="false" title="Pause / resume the live feed" data-i18n="pump_live.pause" data-i18n-attr="title:pump_live.pause_resume_the_live_feed_title">⏸ Pause</button>
</div>
<div id="feed-notice" role="status" aria-live="polite" hidden>
<span class="fn-dot" aria-hidden="true"></span>
<span class="fn-text">Live feed disconnected. Retrying in <span id="fn-countdown">…</span></span>
<button type="button" id="fn-retry" title="Reconnect to the pump.fun launch stream now">Retry now</button>
</div>
<div id="feed"></div>
</div>
</div>
<script type="module">
// ════════════════════════════════════════════════════════════════════
// PumpFun Live Token Feed — the primary content.
//
// This module imports nothing heavy (no three.js), so it executes the instant
// it parses and the WebSocket feed connects immediately. The 3D agent viewer
// lives in a SEPARATE module below and only reacts to the `pumplive:token`
// event this module dispatches — the feed therefore never waits on (and never
// breaks with) WebGL, the GLB download, or a slow CDN.
// ════════════════════════════════════════════════════════════════════
// ════════════════════════════════════════════════════════════════════
// SOL price — drives real USD market caps. Sourced from the same-origin
// /api/pump/helius-stats endpoint (CoinGecko-backed, cached server-side).
// Refreshed every 60s; never blocks rendering. No hardcoded price.
// ════════════════════════════════════════════════════════════════════
const WATCH_KEY = 'ld_watchlist';
function isWatched(mint) {
try { return JSON.parse(localStorage.getItem(WATCH_KEY) || '[]').includes(mint); } catch { return false; }
}
function toggleWatch(mint) {
try {
const list = JSON.parse(localStorage.getItem(WATCH_KEY) || '[]');
const idx = list.indexOf(mint);
if (idx >= 0) list.splice(idx, 1); else list.unshift(mint);
localStorage.setItem(WATCH_KEY, JSON.stringify(list.slice(0, 200)));
return idx < 0;
} catch { return false; }
}
let solPrice = 0;
// While solPrice is 0 the header shows a "caps in SOL — loading USD price"
// hint so the SOL-denominated figures never silently read as stale USD. The
// hint clears the instant a real price lands, and any cards already on screen
// upgrade their market cap to USD in place.
function setPriceHint(loading) {
const hint = document.getElementById('price-hint');
if (hint) hint.classList.toggle('visible', loading);
}
// Re-render the market-cap line on every card from its stored SOL value, so a
// price refresh retroactively converts SOL → USD without re-fetching tokens.
function rehydrateMarketCaps() {
document.querySelectorAll('#feed .token-card[data-mcap-sol]').forEach((card) => {
const mcEl = card.querySelector('.token-mcap');
if (!mcEl) return;
const mcSol = parseFloat(card.dataset.mcapSol);
if (!Number.isFinite(mcSol)) return;
mcEl.textContent = formatMcap(mcSol);
});
}
async function refreshSolPrice() {
try {
const r = await fetch('/api/pump/helius-stats', { headers: { accept: 'application/json' } });
if (!r.ok) return;
const d = await r.json();
if (typeof d.sol_price === 'number' && d.sol_price > 0) {
const wasUnpriced = solPrice === 0;
solPrice = d.sol_price;
setPriceHint(false);
if (wasUnpriced) { rehydrateMarketCaps(); renderStats(); }
}
} catch { /* keep last known price; cards fall back to SOL-denominated MC */ }
}
// ════════════════════════════════════════════════════════════════════
// PumpFun Live Token Feed
//
// PumpPortal `subscribeNewToken` envelope (verified against the live feed):
// { txType:'create', mint, name, symbol, uri, marketCapSol, solAmount,
// traderPublicKey, signature, bondingCurveKey, ... }
// - `uri` is a metadata JSON URL; the real image lives at its `.image`.
// - there is NO `imageUri` field (the old renderer read a phantom field).
// ════════════════════════════════════════════════════════════════════
const RPC_ENDPOINT = 'wss://pumpportal.fun/api/data';
const MAX_FEED_ITEMS = 100;
// Reconnect backoff: 2s → 4s → 8s → 16s → 32s → cap 60s, reset on open.
// After MAX_RECONNECT_ATTEMPTS consecutive failures we stop auto-retrying
// and surface a manual Retry button (permanent-outage error state).
const BASE_BACKOFF_MS = 2000;
const MAX_BACKOFF_MS = 60000;
const MAX_RECONNECT_ATTEMPTS = 8;
const $log = document.getElementById('feed');
const $status = document.getElementById('status');
const $statLaunched = document.getElementById('stat-launched');
const $statVolume = document.getElementById('stat-volume');
const $statAge = document.getElementById('stat-age');
const $notice = document.getElementById('feed-notice');
const $countdown = document.getElementById('fn-countdown');
let ws = null;
let reconnectTimer = null;
let reconnectAttempts = 0;
let hasRenderedToken = false;
const seenMints = new Set();
// ── Conviction filter ─────────────────────────────────────────────────────
// 'all' = show everything, 'strong' = strong + prime, 'prime' = prime only.
// Unenriched cards (no badge yet) are always shown when filtering — we can't
// judge them until Oracle scores them. After enrichment, applyCardFilter()
// revisits each card and hides those that fall below the threshold.
let filterTier = 'all';
let primeCount = 0;
const TIER_RANK = { avoid: 0, watch: 1, lean: 2, strong: 3, prime: 4 };
const MIN_RANK = { all: 0, strong: 3, prime: 4 };
function cardTier(card) {
const badge = card.querySelector('[data-oracle-mint]');
if (!badge || !badge.hasChildNodes()) return null;
const link = badge.querySelector('.pl-ob-link');
if (!link) return null;
return link.querySelector('.pl-ob-tier')?.textContent?.trim() || null;
}
function applyCardFilter(card) {
if (filterTier === 'all') { card.classList.remove('pl-filtered'); return; }
const tier = cardTier(card);
if (!tier) { card.classList.remove('pl-filtered'); return; } // not yet enriched — keep visible
const rank = TIER_RANK[tier] ?? -1;
card.classList.toggle('pl-filtered', rank < MIN_RANK[filterTier]);
}
function applyAllFilters() {
const cards = $log.querySelectorAll('.token-card');
cards.forEach(applyCardFilter);
updateFilterCount();
}
function updateFilterCount() {
const countEl = document.getElementById('filter-count');
if (!countEl) return;
if (filterTier === 'all') { countEl.textContent = ''; return; }
const all = $log.querySelectorAll('.token-card').length;
const hidden = $log.querySelectorAll('.token-card.pl-filtered').length;
const shown = all - hidden;
countEl.textContent = `${shown} of ${all} shown`;
}
// ── Pause toggle ──────────────────────────────────────────────────────────
let feedPaused = false;
let pauseQueue = [];
document.getElementById('fb-pause').addEventListener('click', () => {
feedPaused = !feedPaused;
const btn = document.getElementById('fb-pause');
btn.textContent = feedPaused ? '▶ Resume' : '⏸ Pause';
btn.classList.toggle('active', feedPaused);
btn.setAttribute('aria-pressed', String(feedPaused));
if (!feedPaused && pauseQueue.length) {
pauseQueue.forEach((token) => renderToken(token));
pauseQueue = [];
}
});
// The "Prime scored" stat doubles as a shortcut into the prime filter.
document.getElementById('stat-prime-filter').addEventListener('click', () => {
document.querySelector('#filter-bar [data-ftier="prime"]')?.click();
});
// Wire conviction filter buttons
document.getElementById('filter-bar').addEventListener('click', (e) => {
const btn = e.target.closest('[data-ftier]');
if (!btn) return;
filterTier = btn.dataset.ftier;
document.querySelectorAll('#filter-bar [data-ftier]').forEach((b) => {
const on = b === btn;
b.classList.toggle('active', on);
b.setAttribute('aria-pressed', on ? 'true' : 'false');
});
applyAllFilters();
});
// Live stats — accumulated only from real create events. Volume is kept in
// SOL and converted with the current SOL price at render time so a price
// refresh retroactively corrects the USD figure without double-counting.
let launchedCount = 0;
let volumeSol = 0;
let lastLaunchAt = 0;
const usd = (n) => '$' + n.toLocaleString(undefined, { maximumFractionDigits: n < 1000 ? 2 : 0 });
const isHttpUrl = (u) => typeof u === 'string' && /^https?:\/\//i.test(u);
// Market-cap label from a SOL value — USD once the SOL price has loaded,
// otherwise the real SOL figure (never a fabricated or placeholder USD).
function formatMcap(mcSol) {
if (mcSol == null || !Number.isFinite(mcSol)) return 'Market Cap: —';
return solPrice > 0
? 'Market Cap: ' + usd(mcSol * solPrice)
: 'Market Cap: ' + mcSol.toFixed(2) + ' SOL';
}
// ── Reconnecting banner ───────────────────────────────────────────────────
// The header status already names the state, but the header is far from the
// feed and offers no way out: with eight attempts and a 60s backoff cap the
// terminal panel is minutes away. This banner appears on the first dropped
// connection, counts the retry down, and lets the user force it immediately.
let retryAt = 0;
let countdownTimer = null;
function tickCountdown() {
const left = Math.max(0, Math.ceil((retryAt - Date.now()) / 1000));
$countdown.textContent = left + 's';
}
function showReconnectNotice(delayMs) {
retryAt = Date.now() + delayMs;
$notice.hidden = false;
tickCountdown();
if (!countdownTimer) countdownTimer = setInterval(tickCountdown, 1000);
// The skeleton's "waiting for launches" line would contradict this banner.
const hint = document.getElementById('feed-empty-hint');
if (hint) hint.hidden = true;
}
function hideReconnectNotice() {
$notice.hidden = true;
if (countdownTimer) { clearInterval(countdownTimer); countdownTimer = null; }
const hint = document.getElementById('feed-empty-hint');
if (hint) hint.hidden = false;
}
document.getElementById('fn-retry').addEventListener('click', () => {
hideReconnectNotice();
connect();
});
function showSkeleton() {
$log.innerHTML = '';
for (let i = 0; i < 4; i++) {
const sk = document.createElement('div');
sk.className = 'skeleton-card';
sk.setAttribute('aria-hidden', 'true');
sk.innerHTML =
'<div class="sk-avatar"></div>' +
'<div class="sk-lines">' +
'<div class="sk-line w70"></div>' +
'<div class="sk-line w40"></div>' +
'<div class="sk-line w55"></div>' +
'</div>';
$log.appendChild(sk);
}
const hint = document.createElement('div');
hint.className = 'feed-empty-hint';
hint.id = 'feed-empty-hint';
hint.textContent = 'Waiting for new launches…';
hint.hidden = !$notice.hidden; // a reconnect is in progress: the banner speaks
$log.appendChild(hint);
}
function clearSkeleton() {
$log.querySelectorAll('.skeleton-card, #feed-empty-hint, .feed-error').forEach((el) => el.remove());
}
// Terminal "feed stopped" panel — shown only after auto-reconnect has
// exhausted all MAX_RECONNECT_ATTEMPTS tries. This is deliberately heavier and
// more explicit than the transient amber "Reconnecting…" header status: the
// stream is fully stopped and will not recover on its own. A prominent manual
// Reconnect button restarts the backoff cycle from scratch.
function showError() {
hideReconnectNotice();
$log.innerHTML = '';
const box = document.createElement('div');
box.className = 'feed-error';
box.setAttribute('role', 'alert');
const icon = document.createElement('span');
icon.className = 'fe-icon';
icon.setAttribute('aria-hidden', 'true');
icon.textContent = '🛑';
const h = document.createElement('h3');
h.textContent = 'Live feed stopped';
const p = document.createElement('p');
p.append(
'Auto-reconnect gave up after ',
Object.assign(document.createElement('span'), {
className: 'fe-attempts',
textContent: `${MAX_RECONNECT_ATTEMPTS} attempts`,
}),
'. The pump.fun launch stream (PumpPortal) is unreachable right now. New launches won’t appear until you reconnect.',
);
const btn = document.createElement('button');
btn.type = 'button';
btn.textContent = 'Reconnect';
btn.addEventListener('click', () => {
if (btn.disabled) return;
btn.disabled = true;
btn.textContent = 'Reconnecting…';
reconnectAttempts = 0;
showSkeleton(); // replaces the stopped panel with the waiting state
connect();
});
box.append(icon, h, p, btn);
$log.appendChild(box);
}
function flash(el) {
el.classList.add('flash');
setTimeout(() => el.classList.remove('flash'), 320);
}
function renderStats() {
$statLaunched.textContent = launchedCount.toLocaleString();
$statVolume.textContent = solPrice > 0
? usd(volumeSol * solPrice)
: volumeSol.toFixed(2) + ' SOL';
}
function formatAgo(ts) {
if (!ts) return '—';
const s = Math.max(0, Math.floor((Date.now() - ts) / 1000));
if (s < 60) return s + 's ago';
const m = Math.floor(s / 60);
if (m < 60) return m + 'm ago';
return Math.floor(m / 60) + 'h ago';
}
// The "Last launch" stat re-formats a real timestamp once a second — it is a
// relative-time label over actual event data, not a fabricated ticker.
setInterval(() => {
$statAge.textContent = formatAgo(lastLaunchAt);
}, 1000);
function connect() {
if (reconnectTimer) { clearTimeout(reconnectTimer); reconnectTimer = null; }
setStatus('● Connecting…', '');
if (!hasRenderedToken) showSkeleton();
ws = new WebSocket(RPC_ENDPOINT);
ws.onopen = () => {
reconnectAttempts = 0;
hideReconnectNotice();
setStatus('● Live', 'connected');
ws.send(JSON.stringify({ method: 'subscribeNewToken' }));
};
ws.onmessage = (event) => {
let token;
try {
token = JSON.parse(event.data);
} catch (error) {
console.error('[pump-live] bad frame:', error);
return;
}
// Subscription acks ("Successfully subscribed…") have no mint — ignore.
if (!token || !token.mint || token.txType !== 'create') return;
if (seenMints.has(token.mint)) return;
seenMints.add(token.mint);
if (feedPaused) {
pauseQueue.push(token);
const pauseBtn = document.getElementById('fb-pause');
if (pauseBtn) pauseBtn.textContent = `▶ Resume (${pauseQueue.length})`;
return;
}
renderToken(token);
};
ws.onclose = () => {
if (reconnectAttempts >= MAX_RECONNECT_ATTEMPTS) {
setStatus('● Offline', 'error');
showError();
return;
}
const delay = Math.min(BASE_BACKOFF_MS * 2 ** reconnectAttempts, MAX_BACKOFF_MS);
reconnectAttempts++;
setStatus(`● Reconnecting in ${Math.round(delay / 1000)}s…`, 'error');
showReconnectNotice(delay);
reconnectTimer = setTimeout(connect, delay);
};
ws.onerror = (error) => {
console.error('[pump-live] WebSocket error:', error?.message || error);
try { ws.close(); } catch { /* onclose drives reconnect */ }
};
}
function renderToken(token) {
if (!hasRenderedToken) {
hasRenderedToken = true;
clearSkeleton();
}
// Update live stats from the real event.
launchedCount++;
if (typeof token.solAmount === 'number' && token.solAmount > 0) volumeSol += token.solAmount;
lastLaunchAt = Date.now();
renderStats();
flash($statLaunched);
$statAge.textContent = formatAgo(lastLaunchAt);
const name = (token.name && String(token.name).trim()) || 'Unnamed Token';
const symbol = token.symbol ? '$' + String(token.symbol).trim() : '';
const mcSol = typeof token.marketCapSol === 'number' ? token.marketCapSol : null;
const mcapText = formatMcap(mcSol);
const card = document.createElement('article');
card.className = 'token-card';
card.dataset.mint = token.mint;
// Stored so rehydrateMarketCaps() can convert SOL → USD in place once the
// live SOL price lands, without re-fetching the token.
if (mcSol != null) card.dataset.mcapSol = String(mcSol);
// Real token art via the same-origin image proxy. /api/img resolves the
// creator metadata JSON server-side (no client CORS), follows IPFS gateway
// fallbacks, and always returns a valid image — on-brand placeholder art
// (seeded by symbol) when the source is missing or unreachable.
const img = document.createElement('img');
img.loading = 'lazy';
img.decoding = 'async';
img.width = 50;
img.height = 50;
img.alt = `${name} token art`;
const seed = token.symbol || token.name || token.mint || 'token';
img.src = isHttpUrl(token.uri)
? `/api/img?meta=${encodeURIComponent(token.uri)}&seed=${encodeURIComponent(seed)}`
: `/api/img?seed=${encodeURIComponent(seed)}`;
const info = document.createElement('div');
info.className = 'token-info';
const nameEl = document.createElement('div');
nameEl.className = 'token-name';
nameEl.textContent = name; // textContent → no HTML injection
nameEl.title = name;
const symEl = document.createElement('div');
symEl.className = 'token-symbol';
symEl.textContent = symbol;
const mcapEl = document.createElement('div');
mcapEl.className = 'token-mcap';
mcapEl.textContent = mcapText;
const links = document.createElement('div');
links.className = 'token-links';
// On-platform coin profile — keeps traders inside three.ws instead of
// bouncing straight to pump.fun/solscan.
const profileLink = document.createElement('a');
profileLink.href = '/launches/' + encodeURIComponent(token.mint);
profileLink.textContent = 'Profile';
profileLink.setAttribute('aria-label', `Open the three.ws profile for ${token.symbol || token.name || 'this coin'}`);
const pumpLink = document.createElement('a');
pumpLink.href = 'https://pump.fun/' + encodeURIComponent(token.mint);
pumpLink.target = '_blank';
pumpLink.rel = 'noopener noreferrer';
pumpLink.textContent = 'Pump.fun';
const solscanLink = document.createElement('a');
solscanLink.href = 'https://solscan.io/token/' + encodeURIComponent(token.mint);
solscanLink.target = '_blank';
solscanLink.rel = 'noopener noreferrer';
solscanLink.textContent = 'Solscan';
const watchBtn = document.createElement('button');
watchBtn.className = `token-watch${isWatched(token.mint) ? ' watched' : ''}`;
watchBtn.type = 'button';
watchBtn.textContent = isWatched(token.mint) ? '★' : '☆';
watchBtn.title = isWatched(token.mint) ? 'Remove from watchlist' : 'Add to watchlist';
watchBtn.setAttribute('aria-label', watchBtn.title);
watchBtn.setAttribute('aria-pressed', String(isWatched(token.mint)));
watchBtn.addEventListener('click', (e) => {
e.stopPropagation();
const nowWatched = toggleWatch(token.mint);
watchBtn.textContent = nowWatched ? '★' : '☆';
watchBtn.classList.toggle('watched', nowWatched);
const lbl = nowWatched ? 'Remove from watchlist' : 'Add to watchlist';
watchBtn.title = lbl;
watchBtn.setAttribute('aria-label', lbl);
watchBtn.setAttribute('aria-pressed', String(nowWatched));
});
const oracleBadge = document.createElement('span');
oracleBadge.className = 'pl-oracle-badge';
oracleBadge.dataset.oracleMint = token.mint;
links.append(profileLink, pumpLink, solscanLink, watchBtn, oracleBadge);
info.append(nameEl, symEl, mcapEl, links);
card.append(img, info);
$log.prepend(card);
while ($log.children.length > MAX_FEED_ITEMS) $log.removeChild($log.lastChild);
// Notify the 3D viewer module (decoupled — it may not be loaded yet).
window.dispatchEvent(new CustomEvent('pumplive:token', { detail: { symbol: token.symbol || '' } }));
}
function setStatus(text, className) {
$status.textContent = text;
$status.className = `status ${className}`;
}
// Bootstrap. The feed opens first and never waits on anything else — the SOL
// price hydrates in the background. Until the first price lands, market caps
// render in SOL (real data) and upgrade to USD on the next paint; cards are
// never blocked behind a price.
renderStats();
setPriceHint(true); // caps render in SOL until the first price lands
connect();
refreshSolPrice();
setInterval(refreshSolPrice, 60000);
// ── Oracle conviction badges ────────────────────────────────────────────
// Newly-launched coins are too fresh to have conviction scores; batch-poll
// every 30s so cards that get scored while on screen upgrade automatically.
const TIER_COLOR = { prime: '#c084fc', strong: '#34d399', lean: '#fbbf24', watch: '#94a3b8', avoid: '#f87171' };
const BATCH_MAX = 20;
const ORACLE_RETRIES = 2; // attempts after the first, with backoff
const ORACLE_RETRY_BASE_MS = 600; // 600ms → 1200ms
const sleep = (ms) => new Promise((res) => setTimeout(res, ms));
// Fetch one chunk's conviction scores, retrying a bounded number of times on a
// transient non-OK / network error so badges populate when the endpoint
// recovers. Returns the parsed `results` map, or null if every attempt failed
// (caller leaves the badges gracefully empty — no error spam). The single
// surviving warn fires only after the last attempt, never per-attempt.
async function fetchOracleChunk(chunk) {
const url = `/api/oracle/batch?mints=${chunk.map(encodeURIComponent).join(',')}&network=mainnet`;
for (let attempt = 0; attempt <= ORACLE_RETRIES; attempt++) {
try {
const r = await fetch(url);
if (r.ok) {
const { results = {} } = await r.json();
return results;
}
if (attempt < ORACLE_RETRIES) {
await sleep(ORACLE_RETRY_BASE_MS * 2 ** attempt);
continue;
}
console.warn(`[pump-live] oracle batch failed (HTTP ${r.status}) after ${ORACLE_RETRIES + 1} attempts; badges stay empty this pass`);
} catch (err) {
if (attempt < ORACLE_RETRIES) {
await sleep(ORACLE_RETRY_BASE_MS * 2 ** attempt);
continue;
}
console.warn(`[pump-live] oracle batch error after ${ORACLE_RETRIES + 1} attempts:`, err?.message || err);
}
}
return null;
}
async function enrichOracleBadges() {
const badges = $log.querySelectorAll('[data-oracle-mint]');
if (!badges.length) return;
// Collect unscored mints only (badge is still empty)
const pending = [];
for (const b of badges) {
if (!b.hasChildNodes()) pending.push(b.dataset.oracleMint);
}
if (!pending.length) return;
// Chunk into batches of ≤20
for (let i = 0; i < pending.length; i += BATCH_MAX) {
const chunk = pending.slice(i, i + BATCH_MAX);
const results = await fetchOracleChunk(chunk);
if (!results) continue; // exhausted retries — leave these badges empty
for (const mint of chunk) {
const d = results[mint];
if (!d || d.score == null) continue;
const badge = $log.querySelector(`[data-oracle-mint="${CSS.escape(mint)}"]`);
if (!badge || badge.hasChildNodes()) continue;
const color = TIER_COLOR[d.tier] || '#94a3b8';
const a = document.createElement('a');
a.className = 'pl-ob-link';
a.href = `/oracle/coin/${encodeURIComponent(mint)}`;
a.title = `Oracle conviction: ${d.score} (${d.tier})`;
a.setAttribute('aria-label', `Oracle ${d.tier} — score ${d.score}`);
a.innerHTML = `<span class="pl-ob-score" style="color:${color}">${d.score}</span><span class="pl-ob-tier" style="color:${color}">${d.tier}</span>`;
badge.appendChild(a);
// Re-evaluate filter for this card now that it has a conviction score.
const card = badge.closest('.token-card');
if (card) applyCardFilter(card);
// Increment the session prime counter.
if (d.tier === 'prime') {
primeCount++;
const el = document.getElementById('stat-prime');
if (el) el.textContent = primeCount;
}
}
}
updateFilterCount();
}
// First pass after 30s (new coins need time to get scored), then every 30s
setTimeout(enrichOracleBadges, 30_000);
setInterval(enrichOracleBadges, 30_000);
</script>
<script type="module">
// ════════════════════════════════════════════════════════════════════
// 3D Agent Viewer — loaded independently of the feed. It imports three.js
// (heavy), so isolating it here means its download never delays the live
// feed above. It listens for `pumplive:token` and waves on each new launch.
// If WebGL is unavailable (no-GPU / locked-down browser) the whole init
// fails soft: the feed keeps working, the avatar pane just stays empty.
// ════════════════════════════════════════════════════════════════════
import { LoopOnce, LoopRepeat } from 'three';
import { Viewer } from '/src/viewer.js';
let viewer = null;
function playAnimation(animationName, { loop = false } = {}) {
if (!viewer || !viewer.mixer) return;
const clip = viewer.clips.find((c) => c.name === animationName);
if (!clip) return;
const action = viewer.mixer.clipAction(clip);
action.reset();
action.setLoop(loop ? LoopRepeat : LoopOnce, loop ? Infinity : 1);
action.clampWhenFinished = !loop;
action.play();
}
// React to launches even while the GLB is still loading — once `viewer` is
// set the next event animates; events before that simply no-op.
window.addEventListener('pumplive:token', () => playAnimation('Wave', { loop: false }));
try {
const viewerEl = document.getElementById('viewer-container');
const v = new Viewer(viewerEl, { kiosk: true });
await v.load('/animations/robotexpressive.glb', '', new Map());
const idleClip = v.clips.find((c) => /^idle$/i.test(c.name)) || v.clips[0];
if (idleClip && v.mixer) v.mixer.clipAction(idleClip).play();
viewer = v; // expose only once fully loaded so playAnimation() is safe
window.viewer = v;
} catch (err) {
console.warn('[pump-live] 3D viewer unavailable, feed continues without it:', err?.message || err);
viewer = null;
}
</script>
<div id="footer-container"></div>
<script src="/footer.js"></script>
<script src="/brand.js" defer></script>
<!-- Runtime i18n: detects locale, swaps annotated copy, mounts <lang-switcher>. -->
<script type="module" src="/i18n.js"></script>
</body>
</html>