import {ArrowUpRight, Coins, Flame, Lock, Users, Wallet} from "lucide-react"; import { TOKEN_CONTRACT_ADDRESS, TOKEN_CREATOR_ADDRESS, TOKEN_SOLSCAN_URL, TOKEN_TICKER, } from "@/lib/constants"; import {getTokenStats, type TokenStats} from "@/lib/token-stats"; // ── formatters ─────────────────────────────────────────────────────────────── function compact(n: number | null): string { if (n == null) return "—"; const abs = Math.abs(n); if (abs >= 1_000_000_000) return `${(n / 1_000_000_000).toFixed(2)}B`; if (abs >= 1_000_000) return `${(n / 1_000_000).toFixed(2)}M`; if (abs >= 1_000) return `${(n / 1_000).toFixed(1)}K`; return n.toLocaleString("en-US", {maximumFractionDigits: 0}); } function pct(n: number | null): string { if (n == null) return "—"; if (n > 0 && n < 0.01) return "<0.01%"; return `${n.toFixed(2)}%`; } function usdPrice(n: number | null): string { if (n == null) return "—"; if (n < 0.000001) return `$${n.toExponential(2)}`; if (n < 1) return `$${n.toPrecision(3)}`; return `$${n.toLocaleString("en-US", {maximumFractionDigits: 2})}`; } function usdBig(n: number | null): string { if (n == null) return "—"; if (n >= 1_000_000) return `$${(n / 1_000_000).toFixed(2)}M`; if (n >= 1_000) return `$${(n / 1_000).toFixed(1)}K`; return `$${n.toLocaleString("en-US", {maximumFractionDigits: 0})}`; } function sol(n: number | null): string { if (n == null) return "—"; return `${n.toLocaleString("en-US", {maximumFractionDigits: 2})} SOL`; } function shortAddr(a: string): string { return a.length > 12 ? `${a.slice(0, 4)}…${a.slice(-4)}` : a; } function solscanAccount(a: string): string { return `https://solscan.io/account/${a}`; } function timeAgo(ts: number): string { const secs = Math.max(0, Math.round((Date.now() - ts) / 1000)); if (secs < 60) return "just now"; const mins = Math.round(secs / 60); if (mins < 60) return `${mins}m ago`; const hrs = Math.round(mins / 60); return `${hrs}h ago`; } export async function TokenStatsSection() { const stats = await getTokenStats(); return ; } // Hidden for now — flip to true to bring the "fees earned for development" // card back. The data is still fetched; it's just not rendered. const SHOW_CREATOR_REWARDS = false; function TokenStatsView({stats}: {stats: TokenStats}) { const cards = [ { icon: Flame, label: "Burned", value: compact(stats.burned), sub: stats.burnedPct != null ? `${pct(stats.burnedPct)} of initial supply` : "Removed from supply forever", }, { icon: Lock, label: "Locked", value: stats.locked != null ? compact(stats.locked) : "Not configured", sub: stats.lockedPct != null ? `${pct(stats.lockedPct)} of supply` : "Liquidity & vesting locks", }, { icon: Wallet, label: "Dev / treasury", value: stats.devBalance != null ? compact(stats.devBalance) : "Not configured", sub: stats.devPct != null ? `${pct(stats.devPct)} of supply` : "Team-held tokens", }, { icon: Users, label: "Holders", value: stats.holders != null ? `${stats.holdersCapped ? "" : ""}${stats.holders.toLocaleString("en-US")}` : "—", sub: stats.holdersCapped ? "counted (capped)" : "unique wallets", }, ]; return (
{/* Header */}
Live on-chain stats

Every number, straight from the chain.

Supply, holders, burns, locks and team holdings for {TOKEN_TICKER}, read live from Solana.

{/* Supply + market headline */}
{/* Stat cards */}
{cards.map((c) => { const Icon = c.icon; return (
{c.label}
{c.value}
{c.sub}
); })}
{/* Creator rewards — pump.fun creator fees, the funding story */} {SHOW_CREATOR_REWARDS && stats.creatorRewardsSol != null && (
Fees earned for development
{sol(stats.creatorRewardsSol)}
{stats.creatorRewardsUsd != null && (
≈ {usdBig(stats.creatorRewardsUsd)}
)}

Lifetime {TOKEN_TICKER} trading fees — the funding that pays for full-time work on Voicebox.{" "} Verify

)} {/* Locked breakdown (only if any configured) */} {stats.lockedBreakdown.length > 0 && (
Locked & vesting
    {stats.lockedBreakdown.map((l) => (
  • {l.label} {l.unlocksAt && ( · {l.unlocksAt} )} {compact(l.amount)}
  • ))}
)} {/* Top holders */} {stats.topHolders.length > 0 && (
Top holders
All holders
)} {/* Footer: provenance + freshness */}
{stats.live ? ( <>Updated {timeAgo(stats.updatedAt)} · data via Helius & Jupiter ) : ( <>Live stats unavailable right now — verify on Solscan. )} {shortAddr(TOKEN_CONTRACT_ADDRESS)} Inspect on Solscan
); } function HeadlineStat({ label, value, sub, }: { label: string; value: string; sub?: string; }) { return (
{label}
{value}
{sub &&
{sub}
}
); }