Skip to content

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.

feat(three-token): show $THREE's pump.fun verification, read live from pump.fun

nirholasc16c9fad0dda
diff --git a/api/_lib/pump-verification.js b/api/_lib/pump-verification.js
new file mode 100644
index 000000000..2fd686533
--- /dev/null
+++ b/api/_lib/pump-verification.js
@@ -0,0 +1,75 @@
+// pump.fun verification status for a single mint.
+//
+// pump.fun marks a coin as an officially verified project on its own record;
+// the badge is the platform's public statement that the coin belongs to the
+// project it claims to be. That claim is worth surfacing on our own $THREE
+// surfaces (the token page header, the OG card), but ONLY as a live read of
+// what pump.fun currently publishes: a badge we hardcode is a badge that keeps
+// rendering after the upstream flag flips, which is exactly the failure mode a
+// verification badge exists to prevent.
+//
+// So this module never stores a verdict. It reads the `verified` field off the
+// same public coin record `pump-bonding.js` already fetches (frontend-api-v3,
+// keyless) and caches it briefly. Three states, all distinct:
+//
+// verified: true pump.fun publishes the badge → render it
+// verified: false pump.fun publishes no badge → render nothing
+// verified: null upstream down / unknown mint → render nothing
+//
+// `false` and `null` render identically today, but a caller that wants to say
+// "we could not check" (an ops panel, a monitor) can tell them apart.
+
+import { createCache, cached } from './mem-cache.js';
+import { fetchPumpCoin } from './pump-bonding.js';
+
+// Verification changes on a human timescale (a project applies, pump.fun
+// grants it), so a 5-minute window costs nothing and keeps a hot token page off
+// the upstream on every render.
+const TTL_MS = 5 * 60_000;
+const _cache = createCache({ max: 128, ttlMs: TTL_MS });
+
+/** Canonical pump.fun coin URL for a mint. */
+export const pumpCoinUrl = (mint) => `https://pump.fun/coin/${encodeURIComponent(String(mint || ''))}`;
+
+/**
+ * Map a raw pump.fun coin object → verification shape. Pure; no network.
+ *
+ * A missing `verified` field is `null` (unknown), not `false`: an older cached
+ * record or a route that does not carry the field must not be reported as a
+ * negative verdict.
+ *
+ * @param {object|null} coin Raw pump.fun frontend coin object.
+ * @param {string} [mint] Mint to attribute the result to when `coin` is null.
+ * @returns {{ mint: string|null, verified: boolean|null, url: string|null, source: string }}
+ */
+export function mapVerification(coin, mint = null) {
+ const address = coin?.mint || mint || null;
+ const raw = coin?.verified;
+ const verified = typeof raw === 'boolean' ? raw : null;
+ return {
+ mint: address,
+ verified,
+ url: address ? pumpCoinUrl(address) : null,
+ source: 'pumpfun',
+ };
+}
+
+/**
+ * Read a mint's pump.fun verification status. Cached for 5 minutes and
+ * single-flighted, so concurrent page loads share one upstream call.
+ *
+ * Never throws: an upstream fault resolves to `verified: null` so a caller can
+ * keep rendering the rest of its payload.
+ *
+ * @param {string} mint
+ * @returns {Promise<{ mint: string|null, verified: boolean|null, url: string|null, source: string, checked_at: number }>}
+ */
+export async function fetchPumpVerification(mint) {
+ const key = String(mint || '');
+ if (!key) return { ...mapVerification(null), checked_at: Date.now() };
+ return cached(_cache, key, async () => {
+ const res = await fetchPumpCoin(key).catch(() => ({ kind: 'upstream_down' }));
+ const coin = res.kind === 'ok' ? res.coin : null;
+ return { ...mapVerification(coin, key), checked_at: Date.now() };
+ });
+}
diff --git a/api/og/three-token-badge.js b/api/og/three-token-badge.js
index b7774055c..91070fa03 100644
--- a/api/og/three-token-badge.js
+++ b/api/og/three-token-badge.js
@@ -26,7 +26,7 @@
*
* Card anatomy (1200×630, dark):
* top, three.ws wordmark + "TOKEN"
- * hero, $THREE glyph mark + symbol + truncated mint
+ * hero, $THREE glyph mark + symbol + pump.fun verified pill + truncated mint
* price, large USD price + 24h change pill (green up / red down)
* stats, market cap · holders · 24h volume · on-chain agents grid
* footer, contract address + "three.ws/three-token"
@@ -36,6 +36,7 @@ import { cors, wrap } from '../_lib/http.js';
import { TOKEN_MINT as THREE_MINT } from '../_lib/token/config.js';
import { fetchTokenMarketData } from '../_lib/market/token-market.js';
import { threeHolderCount } from '../_lib/coin/three-holders.js';
+import { fetchPumpVerification } from '../_lib/pump-verification.js';
import { sql } from '../_lib/db.js';
// Edge-cache the card: 60s fresh, 10m at the CDN, serve-stale-while-revalidate.
@@ -75,18 +76,39 @@ function fmtPrice(n) {
return `$${n.toFixed(decimals).replace(/0+$/, '').replace(/\.$/, '')}`;
}
-// Approximate advance width of a string in the hero face (Inter, weight 800) so
-// the layout can flow around a rendered figure. SVG has no measurement API at
-// render time and the card ships no font metrics, so the widths below are the
-// per-glyph em advances Inter uses: digits and "$" are tabular-wide, separators
-// are narrow. Used to keep the 24h pill clear of the price at any magnitude.
-const EM_ADVANCE = { '.': 0.27, ',': 0.27 };
+// Approximate advance width of a string in the card's bold face, so the layout
+// can flow pills around rendered text. SVG has no measurement API at render
+// time and the card embeds no font, so these are per-glyph em advances.
+//
+// They are calibrated to the FALLBACK face, not to Inter. The card asks for
+// "Inter,system-ui,sans-serif", and almost nothing that rasterizes it has Inter
+// installed: social crawlers, headless renderers, and image proxies all land on
+// a generic bold sans (DejaVu Sans Bold measures 0.696em per digit, 0.38em per
+// separator). Sizing against Inter's narrower metrics is what made the 24h pill
+// sit on top of the price digits in the rendered card. Overestimating merely
+// pushes a pill a few px right on a machine that does have Inter; underestimating
+// overlaps text on every machine that does not.
+const EM_DIGIT = 0.7;
+const EM_SEP = 0.38;
+const EM_UPPER = 0.8;
+const EM_OTHER = 0.65;
function heroTextWidth(s, fontSize) {
let em = 0;
- for (const ch of String(s)) em += EM_ADVANCE[ch] ?? 0.6;
+ for (const ch of String(s)) {
+ if (ch === '.' || ch === ',') em += EM_SEP;
+ else if (ch >= '0' && ch <= '9') em += EM_DIGIT;
+ else if (ch === '$') em += EM_DIGIT;
+ else if (ch >= 'A' && ch <= 'Z') em += EM_UPPER;
+ else em += EM_OTHER;
+ }
return em * fontSize;
}
+// Width of a letter-spaced label at a given size, for pills sized to their text.
+function labelWidth(label, fontSize, letterSpacingEm = 0) {
+ return heroTextWidth(label, fontSize) + label.length * fontSize * letterSpacingEm;
+}
+
// Compact USD for market cap / volume: $1.2M, $640K, $12.3B.
function fmtCompactUsd(n) {
if (n == null || !Number.isFinite(n)) return '-';
@@ -111,7 +133,7 @@ function fmtPct(n) {
// Resolve every datum the card shows from real sources, each independently
// resilient so one failing provider blanks a single figure rather than the card.
async function loadBadgeData() {
- const [market, agentRow, holderCount] = await Promise.all([
+ const [market, agentRow, holderCount, verification] = await Promise.all([
fetchTokenMarketData(THREE_MINT).catch(() => null),
sql`SELECT count(*)::int AS total FROM agent_identities WHERE deleted_at IS NULL`
.catch(() => [{ total: null }]),
@@ -121,6 +143,10 @@ async function loadBadgeData() {
// thing standing between the card and a permanently blank HOLDERS cell.
// Omitting it here is what let the card and the page disagree.
threeHolderCount().catch(() => null),
+ // pump.fun's live verification flag. The card is what unfurls in every
+ // chat where the link gets posted, so it is the highest-leverage place to
+ // show that this mint is the verified one and the lookalikes are not.
+ fetchPumpVerification(THREE_MINT).catch(() => null),
]);
return {
price: market?.price_usd ?? null,
@@ -129,6 +155,7 @@ async function loadBadgeData() {
volume24h: market?.volume_24h ?? null,
holders: market?.holders ?? holderCount ?? null,
agents: agentRow?.[0]?.total ?? null,
+ verified: verification?.verified ?? null,
};
}
@@ -158,6 +185,24 @@ function renderCard(d) {
1128 - pillW,
Math.round(72 + heroTextWidth(priceStr, 84) + 28),
);
+ // pump.fun verification pill, right of the "$THREE" wordmark. Rendered only on
+ // an explicit true: an unreadable upstream (null) must never look like a
+ // verified coin, and the hero simply closes up when it is absent.
+ const verifiedLabel = 'VERIFIED ON PUMP.FUN';
+ // Icon zone + measured label + right padding, so the text can never spill past
+ // the pill's own rounded edge.
+ const vW = Math.round(42 + labelWidth(verifiedLabel, 16, 0.06) + 20);
+ const vX = Math.round(200 + heroTextWidth('$THREE', 64) + 22);
+ const verifiedPill = d.verified === true
+ ? `<rect x="${vX}" y="166" width="${vW}" height="42" rx="21"
+ fill="${UP}" fill-opacity=".12" stroke="${UP}" stroke-opacity=".45" stroke-width="1.5"/>
+ <path d="M${vX + 20} 187 l5 5 l9 -10" fill="none" stroke="${UP}" stroke-width="3"
+ stroke-linecap="round" stroke-linejoin="round"/>
+ <text x="${Math.round(vX + 42)}" y="194" font-family="Inter,system-ui,sans-serif"
+ font-size="16" font-weight="700" letter-spacing=".06em"
+ fill="${UP}">${x(verifiedLabel)}</text>`
+ : '';
+
const changePill = pct
? `<rect x="${pillX}" y="300" width="${pillW}" height="44" rx="22"
fill="${changeColor}" fill-opacity=".12" stroke="${changeColor}" stroke-opacity=".4" stroke-width="1.5"/>
@@ -204,6 +249,7 @@ function renderCard(d) {
font-size="40" font-weight="800" fill="#ffffff">3</text>
<text x="200" y="200" font-family="Inter,system-ui,sans-serif" font-size="64" font-weight="800"
fill="#f9fafb">$THREE</text>
+ ${verifiedPill}
<text x="202" y="240" font-family="ui-monospace,Menlo,monospace" font-size="20"
fill="#6b7280">${x(mintShort)}</text>
diff --git a/api/three-token/[action].js b/api/three-token/[action].js
index 2a38fd9ac..f942bffbf 100644
--- a/api/three-token/[action].js
+++ b/api/three-token/[action].js
@@ -23,6 +23,7 @@ import { fetchTokenMarketData } from '../_lib/market/token-market.js';
import { threeHolderBalances, threeHolderCount } from '../_lib/coin/three-holders.js';
import { buybackStats } from '../_lib/token/buyback.js';
import { microbuyStats } from '../_lib/token/microbuy.js';
+import { fetchPumpVerification } from '../_lib/pump-verification.js';
// Truncate a base58 wallet for display: "FeMb…Jpump".
function shortWallet(addr) {
@@ -115,7 +116,7 @@ export default wrap(async (req, res) => {
const action = parts[2];
if (action === 'stats') {
- const [market, platform, buyback, microbuy, holderCount] = await Promise.all([
+ const [market, platform, buyback, microbuy, holderCount, verification] = await Promise.all([
fetchTokenMarketData(THREE_MINT).catch(() => null),
fetchPlatformMetrics(),
// Programmatic buyback summary (revenue → $THREE bought into treasury).
@@ -128,6 +129,10 @@ export default wrap(async (req, res) => {
// (DexScreener / GeckoTerminal) don't return holders, so without this the
// panel shows "—" whenever Birdeye is rate-limited. Cheap meta read only.
threeHolderCount().catch(() => null),
+ // pump.fun's own verification flag for the mint, read live (5-min cached
+ // upstream). Never hardcoded: the badge our surfaces render has to be
+ // whatever pump.fun publishes right now, or it is decoration.
+ fetchPumpVerification(THREE_MINT).catch(() => null),
]);
return json(
@@ -146,6 +151,11 @@ export default wrap(async (req, res) => {
supply: market?.supply ?? null,
decimals: market?.decimals ?? 6,
source: market?.source ?? null,
+ // true = pump.fun publishes the verified badge for this mint,
+ // false = it does not, null = we could not read it this request.
+ verified: verification?.verified ?? null,
+ verified_source: 'pumpfun',
+ pump_url: verification?.url ?? `https://pump.fun/coin/${THREE_MINT}`,
},
protocol: {
total_agents: platform.total_agents,
diff --git a/docs/listings.md b/docs/listings.md
index 4ac22073a..f63a79bb7 100644
--- a/docs/listings.md
+++ b/docs/listings.md
@@ -64,6 +64,34 @@ The discovery surfaces owned by the AI platforms themselves, where an MCP server
| **Alibaba Cloud Marketplace Blog** | Live | [Editorial feature](https://marketplace.alibabacloud.com/doc/blog/detail/mplace-sgcmfw00036800.html) — Alibaba Cloud Marketplace published an editorial introducing three.ws. Announcement: [three.ws Featured on the Alibaba Cloud Marketplace Blog](/blog/three-ws-featured-on-alibaba-cloud-marketplace-blog) |
| **pump.fun** | Live | [Three Builds With Tech Giants](https://pump.fun/coin/FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump/article): a feature article published on the official $THREE coin page, profiling the platform's browser-native 3D AI agents with onchain identities, the Animations and Poses Studio, the 3D Studio MCP server, and the AWS and IBM milestones. |
+### pump.fun verification
+
+$THREE is a verified project on pump.fun. Verification is pump.fun's own statement that the coin at `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump` belongs to three.ws, which is what separates the real token from the copies that share its name and ticker.
+
+three.ws never hardcodes that claim. `GET /api/three-token/stats` reads pump.fun's public coin record on every (5-minute cached) request and returns the live flag on the token block:
+
+```json
+{
+ "token": {
+ "mint": "FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump",
+ "symbol": "$THREE",
+ "verified": true,
+ "verified_source": "pumpfun",
+ "pump_url": "https://pump.fun/coin/FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump"
+ }
+}
+```
+
+`verified` has three states, and callers should treat them differently:
+
+| Value | Meaning | What the UI does |
+|---|---|---|
+| `true` | pump.fun publishes the badge right now | Render the badge |
+| `false` | pump.fun publishes no badge | Render nothing |
+| `null` | pump.fun could not be reached this request | Render nothing |
+
+The badge itself is one shared component ([src/pump/verified-badge.js](../src/pump/verified-badge.js)), so the public [/three-token](/three-token) page and the [/dashboard/three-token](/dashboard/three-token) holder view can never disagree about whether the coin is verified. If pump.fun ever withdraws verification, the badge disappears on the next stats read with no deploy.
+
HackerNoon is one of the world's largest independent tech publications, read by millions of developers and founders monthly. Every three.ws announcement is pulled automatically from [`three.ws/rss/announcements.xml`](https://three.ws/rss/announcements.xml) into the HackerNoon drafts queue, then published with canonical URLs pointing back to three.ws. See [syndication setup](/docs/syndication#hackernoon) for technical details.
---
diff --git a/src/dashboard-next/pages/three-token.js b/src/dashboard-next/pages/three-token.js
index 1cae049a3..eb45635fe 100644
--- a/src/dashboard-next/pages/three-token.js
+++ b/src/dashboard-next/pages/three-token.js
@@ -16,6 +16,7 @@ import { fetchTokenConfig, fetchTokenPrice } from '../../token-pay.js';
import { fetchAllowanceStatus, grantAllowance, revokeAllowance } from '../../three-allowance.js';
import { terminalLinks } from '../../shared/trading-terminals.js';
import { createThreeTokenData } from '../../pump/three-token-data.js';
+import { paintVerifiedBadge } from '../../pump/verified-badge.js';
import { errorStateHTML, ensureStateKitStyles } from '../../shared/state-kit.js';
import { toast } from '../../shared/toast.js';
@@ -68,7 +69,7 @@ function pctColor(n) {
<div style="display:flex;align-items:center;gap:12px;margin-bottom:4px">
<div style="width:36px;height:36px;border-radius:10px;background:#111116;border:1px solid #232329;display:grid;place-items:center;flex-shrink:0;overflow:hidden"><img loading="lazy" decoding="async" src="/favicon.svg" alt="three.ws" width="26" height="26" style="display:block" /></div>
<div>
- <h1 class="dn-h1" style="margin:0">$THREE</h1>
+ <div style="display:flex;align-items:center;gap:8px;flex-wrap:wrap"><h1 class="dn-h1" style="margin:0">$THREE</h1><span data-verified></span></div>
<p class="dn-h1-sub" style="margin:0">The protocol token powering the three.ws agent economy</p>
</div>
</div>
@@ -120,6 +121,10 @@ function pctColor(n) {
}
const stats = { token: snap.protocol.token, protocol: snap.protocol.protocol };
+
+ // pump.fun verification badge beside the page title. Same live flag and
+ // same badge the public /three-token page renders.
+ paintVerifiedBadge(main.querySelector('[data-verified]'), stats.token);
const revenueShare = snap.revenueShare.status === 'ok' && !snap.revenueShare.unauthenticated
? snap.revenueShare
: null;
diff --git a/src/pump/verified-badge.js b/src/pump/verified-badge.js
new file mode 100644
index 000000000..ac357963e
--- /dev/null
+++ b/src/pump/verified-badge.js
@@ -0,0 +1,88 @@
+// The "Verified on pump.fun" badge.
+//
+// pump.fun verifies a project's coin as officially belonging to that project.
+// Every three.ws surface that puts the $THREE header in front of a user should
+// carry that badge, and all of them must carry the SAME one: a badge that says
+// something different on the token page than on the dashboard is worth less
+// than no badge at all. So the markup, the styles, and the render rule live
+// here, and the surfaces import them.
+//
+// The render rule is deliberately strict: the badge appears only when the live
+// stats payload reports `verified === true`. `/api/three-token/stats` reads
+// that flag straight off pump.fun's public coin record on every (cached)
+// request, so if pump.fun ever withdraws the badge, ours disappears with it.
+// `false` (not verified) and `null` (upstream unreadable this request) both
+// render nothing: silence is the only honest output for both.
+//
+// A surface renders it by importing `paintVerifiedBadge` and handing it a slot
+// element plus the token block from the stats payload; styles inject themselves
+// on first paint, so there is nothing else to wire.
+
+const STYLE_ID = 'tws-pump-verified-badge';
+
+const esc = (s) => String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
+
+const CSS = `
+.pv-badge {
+ display:inline-flex; align-items:center; gap:5px;
+ font-size:11.5px; font-weight:700; letter-spacing:0.01em; line-height:1;
+ color:#4ade80; background:rgba(74,222,128,.10);
+ border:1px solid rgba(74,222,128,.28); border-radius:999px;
+ padding:4px 10px 4px 7px; text-decoration:none; white-space:nowrap;
+ opacity:0; transform:translateY(-2px);
+ transition:opacity .22s ease, transform .22s ease, background .15s, border-color .15s;
+}
+.pv-badge.is-on { opacity:1; transform:none; }
+.pv-badge:hover { background:rgba(74,222,128,.17); border-color:rgba(74,222,128,.5); }
+.pv-badge:focus-visible { outline:2px solid #4ade80; outline-offset:2px; }
+.pv-badge svg { width:13px; height:13px; display:block; flex-shrink:0; }
+@media (prefers-reduced-motion: reduce) { .pv-badge { transition:none; } }
+`;
+
+/** Inject the badge stylesheet once. Idempotent and SSR-safe. */
+export function ensureVerifiedBadgeStyles() {
+ if (typeof document === 'undefined') return;
+ if (document.getElementById(STYLE_ID)) return;
+ const style = document.createElement('style');
+ style.id = STYLE_ID;
+ style.textContent = CSS;
+ (document.head || document.documentElement).appendChild(style);
+}
+
+/**
+ * Badge markup for a `/api/three-token/stats` token block, or '' when the token
+ * is not currently verified (or verification could not be read).
+ *
+ * @param {{ verified?: boolean|null, pump_url?: string|null, mint?: string|null }|null} token
+ * @param {{ label?: string }} [opts]
+ * @returns {string} HTML, or '' to render nothing.
+ */
+export function verifiedBadgeHTML(token, opts = {}) {
+ if (token?.verified !== true) return '';
+ const href = token.pump_url || (token.mint ? `https://pump.fun/coin/${encodeURIComponent(token.mint)}` : 'https://pump.fun');
+ const label = opts.label || 'Verified on pump.fun';
+ return `<a class="pv-badge" href="${esc(href)}" target="_blank" rel="noopener" title="pump.fun has verified this as the official three.ws token">`
+ + `<svg viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path d="M10 1.5l2.1 1.6 2.6-.2.8 2.5 2.2 1.4-1 2.4 1 2.4-2.2 1.4-.8 2.5-2.6-.2L10 18.5l-2.1-1.6-2.6.2-.8-2.5-2.2-1.4 1-2.4-1-2.4 2.2-1.4.8-2.5 2.6.2L10 1.5zm-.9 11.6l4.6-4.6-1.3-1.3-3.3 3.3-1.5-1.5-1.3 1.3 2.8 2.8z"/></svg>`
+ + `${esc(label)}</a>`;
+}
+
+/**
+ * Render the badge into a slot element, fading it in on the snapshot that first
+ * carries verification. Re-rendering with the same token is a no-op, so a 30s
+ * stats poll never restarts the animation.
+ *
+ * @param {Element|null} slot
+ * @param {object|null} token
+ * @param {{ label?: string }} [opts]
+ */
+export function paintVerifiedBadge(slot, token, opts = {}) {
+ if (!slot) return;
+ ensureVerifiedBadgeStyles();
+ const html = verifiedBadgeHTML(token, opts);
+ if (slot.innerHTML === html) return;
+ slot.innerHTML = html;
+ const badge = slot.firstElementChild;
+ if (!badge) return;
+ if (typeof requestAnimationFrame === 'function') requestAnimationFrame(() => badge.classList.add('is-on'));
+ else badge.classList.add('is-on');
+}
diff --git a/src/three-token-page.js b/src/three-token-page.js
index 5fb9c7df3..af68a3a15 100644
--- a/src/three-token-page.js
+++ b/src/three-token-page.js
@@ -11,6 +11,7 @@ import { mountBondingCurve } from './widgets/bonding-curve.js';
import { openSwapModal } from './swap-jupiter.js';
import { trackFunnelStep, ANALYTICS_EVENTS } from './analytics.js';
import { emptyStateHTML, ensureStateKitStyles } from './shared/state-kit.js';
+import { paintVerifiedBadge } from './pump/verified-badge.js';
const SOL_MINT = 'So11111111111111111111111111111111111111112';
const PUMP_URL = `https://pump.fun/coin/${THREE_MINT}`;
@@ -59,6 +60,7 @@ function injectStyles() {
.tk-head { display:flex; align-items:center; gap:14px; margin-bottom:4px; }
.tk-logo { width:46px; height:46px; border-radius:12px; background:#111116; border:1px solid #232329; display:grid; place-items:center; flex-shrink:0; overflow:hidden; }
.tk-logo img { width:32px; height:32px; display:block; }
+ .tk-titlerow { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.tk-title { font-size:26px; font-weight:800; margin:0; letter-spacing:-0.02em; }
.tk-sub { margin:0; color:#9a9aa3; font-size:13px; }
.tk-ca { font-family:ui-monospace,Menlo,monospace; font-size:11.5px; color:#8a8a93; cursor:pointer; border:1px solid #232329; border-radius:8px; padding:3px 8px; background:none; }
@@ -355,7 +357,7 @@ function boot() {
<div class="tk-head">
<div class="tk-logo"><img loading="lazy" decoding="async" src="/favicon.svg" alt="three.ws" width="32" height="32" /></div>
<div style="flex:1;min-width:0">
- <h1 class="tk-title">$THREE</h1>
+ <div class="tk-titlerow"><h1 class="tk-title">$THREE</h1><span data-verified></span></div>
<p class="tk-sub">The protocol token powering the three.ws agent economy</p>
</div>
<button class="tk-ca" data-ca title="Copy contract address">${esc(shortAddr(THREE_MINT))} · copy</button>
@@ -425,12 +427,16 @@ function boot() {
// Header stats from the shared store (price/mcap/volume/holders).
const statsEl = wrap.querySelector('[data-stats]');
+ // pump.fun verification, straight off the live stats payload. Fades in on the
+ // first snapshot that carries it, so the header never flashes.
+ const verifiedEl = wrap.querySelector('[data-verified]');
const store = createThreeTokenData({ pollMs: 30_000, anchorEl: wrap });
store.subscribe((state) => {
const p = state.protocol;
if (p.status === 'ok' && p.token) {
if (p.token.price_usd != null) _lastThreePrice = Number(p.token.price_usd);
statsEl.innerHTML = renderHeaderStats(p.token);
+ paintVerifiedBadge(verifiedEl, p.token);
}
else if (p.status === 'error') statsEl.innerHTML = `<div class="tk-empty" style="grid-column:1/-1">Couldn’t load $THREE market data. <a href="${PUMP_URL}" target="_blank" rel="noopener" style="color:#7CC4FF">View on pump.fun ↗</a></div>`;
});
diff --git a/tests/og-cards.test.js b/tests/og-cards.test.js
index d023605f6..5204cb291 100644
--- a/tests/og-cards.test.js
+++ b/tests/og-cards.test.js
@@ -217,6 +217,40 @@ describe('og/three-token-badge', () => {
expect(pillX).toBeLessThan(1128);
});
+ it('carries the pump.fun verified pill only when pump.fun publishes it', () => {
+ const { renderCard } = badgeInternals;
+ expect(renderCard({ ...FULL, verified: true })).toContain('VERIFIED ON PUMP.FUN');
+ // Unverified and unreadable both render nothing: an upstream blip must never
+ // look like a verified coin on a card that unfurls in every chat.
+ expect(renderCard({ ...FULL, verified: false })).not.toContain('VERIFIED ON PUMP.FUN');
+ expect(renderCard({ ...FULL, verified: null })).not.toContain('VERIFIED ON PUMP.FUN');
+ expect(renderCard(FULL)).not.toContain('VERIFIED ON PUMP.FUN');
+ });
+
+ it('keeps the verified pill clear of the wordmark and inside the canvas', () => {
+ const { renderCard, heroTextWidth } = badgeInternals;
+ const svg = renderCard({ ...FULL, verified: true });
+ const [, xs, ws] = /<rect x="(\d+)" y="166" width="(\d+)"/.exec(svg) || [];
+ const pillX = Number(xs);
+ const pillW = Number(ws);
+ // The wordmark starts at x=200 and is drawn at 64px.
+ expect(pillX).toBeGreaterThan(200 + heroTextWidth('$THREE', 64));
+ expect(pillX + pillW).toBeLessThan(1128);
+ // The label has to fit inside its own pill, or the text spills past the edge.
+ expect(pillW).toBeGreaterThan(42 + heroTextWidth('VERIFIED ON PUMP.FUN', 16));
+ });
+
+ it('sizes text against the fallback face crawlers actually rasterize with', () => {
+ const { heroTextWidth } = badgeInternals;
+ // Inter is not installed on the crawlers and headless renderers that turn
+ // this SVG into an image; they land on a generic bold sans whose digits
+ // advance ~0.696em. Undershooting that is what put the 24h pill on top of
+ // the price. Measured widths must cover the real face, not Inter's.
+ expect(heroTextWidth('0', 100)).toBeGreaterThanOrEqual(69.6);
+ expect(heroTextWidth('$0.002013', 100)).toBeGreaterThanOrEqual(594.8);
+ expect(heroTextWidth('$THREE', 100)).toBeGreaterThanOrEqual(435.1);
+ });
+
it('compacts USD the way the token page does', () => {
const { fmtCompactUsd, fmtInt, fmtPct } = badgeInternals;
expect(fmtCompactUsd(1_843_105)).toBe('$1.84M');
diff --git a/tests/pump-verification.test.js b/tests/pump-verification.test.js
new file mode 100644
index 000000000..5f5de3040
--- /dev/null
+++ b/tests/pump-verification.test.js
@@ -0,0 +1,91 @@
+import { describe, it, expect, vi, afterEach } from 'vitest';
+import { mapVerification, pumpCoinUrl, fetchPumpVerification } from '../api/_lib/pump-verification.js';
+import { verifiedBadgeHTML } from '../src/pump/verified-badge.js';
+
+// $THREE's own CA: the platform's coin, not a third-party mint.
+const THREE_MINT = 'FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump';
+
+// A minimal record that passes isPumpLaunch() so fetchPumpCoin() accepts it.
+const coin = (over = {}) => ({
+ mint: THREE_MINT,
+ bonding_curve: '6JPusJUySKktd56HCeQ54kZ4WUNb7fD4GqAQvyDDqMqy',
+ complete: true,
+ ...over,
+});
+
+afterEach(() => {
+ vi.unstubAllGlobals();
+});
+
+describe('mapVerification', () => {
+ it('reports the badge when pump.fun publishes it', () => {
+ const v = mapVerification(coin({ verified: true }));
+ expect(v.verified).toBe(true);
+ expect(v.url).toBe(`https://pump.fun/coin/${THREE_MINT}`);
+ expect(v.source).toBe('pumpfun');
+ });
+
+ it('reports false when pump.fun publishes no badge', () => {
+ expect(mapVerification(coin({ verified: false })).verified).toBe(false);
+ });
+
+ it('reports null (unknown), not false, when the field is absent', () => {
+ // An older cached record or a route that omits the field must never be
+ // turned into a negative verdict.
+ expect(mapVerification(coin()).verified).toBeNull();
+ });
+
+ it('reports null for a missing coin but still attributes the mint', () => {
+ const v = mapVerification(null, THREE_MINT);
+ expect(v.verified).toBeNull();
+ expect(v.mint).toBe(THREE_MINT);
+ expect(v.url).toBe(pumpCoinUrl(THREE_MINT));
+ });
+
+ it('ignores a non-boolean verified value', () => {
+ expect(mapVerification(coin({ verified: 'yes' })).verified).toBeNull();
+ expect(mapVerification(coin({ verified: 1 })).verified).toBeNull();
+ });
+});
+
+describe('fetchPumpVerification', () => {
+ it('resolves to unknown (never throws) when the upstream is down', async () => {
+ vi.stubGlobal('fetch', vi.fn(() => Promise.reject(new Error('ECONNRESET'))));
+ // A mint not used by the other cases, so the 5-minute cache can't answer it.
+ const v = await fetchPumpVerification('THREEsynthetic1111111111111111111111111111');
+ expect(v.verified).toBeNull();
+ expect(typeof v.checked_at).toBe('number');
+ });
+
+ it('returns unknown for an empty mint without touching the network', async () => {
+ const fetchSpy = vi.fn();
+ vi.stubGlobal('fetch', fetchSpy);
+ expect((await fetchPumpVerification('')).verified).toBeNull();
+ expect(fetchSpy).not.toHaveBeenCalled();
+ });
+});
+
+describe('verifiedBadgeHTML render rule', () => {
+ it('renders the badge only on an explicit true', () => {
+ const html = verifiedBadgeHTML({ verified: true, pump_url: `https://pump.fun/coin/${THREE_MINT}` });
+ expect(html).toContain('Verified on pump.fun');
+ expect(html).toContain(`https://pump.fun/coin/${THREE_MINT}`);
+ expect(html).toContain('rel="noopener"');
+ });
+
+ it('renders nothing when unverified, unknown, or absent', () => {
+ expect(verifiedBadgeHTML({ verified: false })).toBe('');
+ expect(verifiedBadgeHTML({ verified: null })).toBe('');
+ expect(verifiedBadgeHTML({})).toBe('');
+ expect(verifiedBadgeHTML(null)).toBe('');
+ });
+
+ it('falls back to the mint URL when the payload carries no pump_url', () => {
+ expect(verifiedBadgeHTML({ verified: true, mint: THREE_MINT })).toContain(`https://pump.fun/coin/${THREE_MINT}`);
+ });
+
+ it('escapes the href so a hostile payload cannot break out of the attribute', () => {
+ const html = verifiedBadgeHTML({ verified: true, pump_url: '"><script>x()</script>' });
+ expect(html).not.toContain('<script>');
+ });
+});