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: enhance iframe communication with explicit origin checks and improve dashboard metadata

nirholas6ac5957d0f6d
diff --git a/public/pumpfun.html b/public/pumpfun.html
index b0439fd16..5711acac5 100644
--- a/public/pumpfun.html
+++ b/public/pumpfun.html
@@ -874,11 +874,14 @@
const dur = reaction.gesture?.duration || REACT_COOLDOWN_MS;
_reactActiveUntil = t + Math.max(REACT_COOLDOWN_MS, dur);
_reactActivePri = pri;
- iframe.contentWindow?.postMessage({
- type: 'pumpfun-feed:react',
- reaction,
- speak: params.narrate,
- }, '*');
+ iframe.contentWindow?.postMessage(
+ {
+ type: 'pumpfun-feed:react',
+ reaction,
+ speak: params.narrate,
+ },
+ location.origin,
+ );
}
function eventMatchesMint(ev) {
@@ -1183,14 +1186,20 @@
$('ctl-mint').addEventListener('input', (e) => {
params.mint = e.target.value.trim();
syncURL();
- iframe.contentWindow?.postMessage({ type: 'pumpfun-feed:focus-mint', mint: params.mint || null }, '*');
+ iframe.contentWindow?.postMessage(
+ { type: 'pumpfun-feed:focus-mint', mint: params.mint || null },
+ location.origin,
+ );
});
$('ctl-narrate').addEventListener('click', (e) => {
params.narrate = e.currentTarget.dataset.on !== '1';
e.currentTarget.dataset.on = params.narrate ? '1' : '0';
syncURL();
- iframe.contentWindow?.postMessage({ type: 'pumpfun-feed:set-narrate', on: params.narrate }, '*');
+ iframe.contentWindow?.postMessage(
+ { type: 'pumpfun-feed:set-narrate', on: params.narrate },
+ location.origin,
+ );
});
let kindTimer;
diff --git a/publish/src/embed-action-bridge.js b/publish/src/embed-action-bridge.js
index 0668d4d47..e911a82a4 100644
--- a/publish/src/embed-action-bridge.js
+++ b/publish/src/embed-action-bridge.js
@@ -45,6 +45,17 @@ export class EmbedActionBridge {
this._running = false;
this._onMessage = this._handleMessage.bind(this);
this._onAction = this._handleAction.bind(this);
+ this._parentOrigin = this._seedParentOrigin();
+ this._parentOriginLocked = false;
+ }
+
+ _seedParentOrigin() {
+ try {
+ if (this._win.parent === this._win) return this._win.location.origin;
+ const ref = this._win.document?.referrer;
+ if (ref) return new URL(ref).origin;
+ } catch {}
+ return null;
}
start() {
@@ -91,11 +102,13 @@ export class EmbedActionBridge {
}
_toParent(msg) {
- // Use '*' as targetOrigin — we don't know the parent's origin at construction time.
- // Incoming messages are validated via _originAllowed before acting on them.
+ if (!this._parentOrigin) {
+ console.warn('[embed-action-bridge] parent origin unknown; dropping', msg.op);
+ return;
+ }
this._win.parent.postMessage(
{ ...msg, v: PROTOCOL_VERSION, source: 'agent-3d', id: msg.id || genId() },
- '*',
+ this._parentOrigin,
);
}
@@ -128,6 +141,13 @@ export class EmbedActionBridge {
if (!msg || msg.v !== PROTOCOL_VERSION || msg.source !== 'agent-host') return;
if (msg.kind !== 'request') return;
+ if (!this._parentOriginLocked) {
+ this._parentOrigin = event.origin;
+ this._parentOriginLocked = true;
+ } else if (event.origin !== this._parentOrigin) {
+ return;
+ }
+
const { op, payload = {} } = msg;
if (op === 'ping') {
diff --git a/publish/src/embed-host-bridge.js b/publish/src/embed-host-bridge.js
index 2a656bc4c..8aa263bc7 100644
--- a/publish/src/embed-host-bridge.js
+++ b/publish/src/embed-host-bridge.js
@@ -33,6 +33,14 @@ export class EmbedHostBridge {
* @param {{ iframe: HTMLIFrameElement, agentId: string, allowedOrigin: string }} opts
*/
constructor({ iframe, agentId, allowedOrigin }) {
+ if (!iframe) throw new Error('EmbedHostBridge: iframe required');
+ if (!agentId) throw new Error('EmbedHostBridge: agentId required');
+ if (!allowedOrigin || allowedOrigin === '*') {
+ throw new Error(
+ 'EmbedHostBridge: allowedOrigin must be an explicit origin (wildcard "*" is not allowed). ' +
+ 'Pass the iframe origin, e.g. new URL(iframe.src).origin.',
+ );
+ }
this._iframe = iframe;
this._agentId = agentId;
this._allowedOrigin = allowedOrigin;
@@ -86,7 +94,7 @@ export class EmbedHostBridge {
_handleMessage(event) {
if (event.source !== this._iframe.contentWindow) return;
- if (this._allowedOrigin !== '*' && event.origin !== this._allowedOrigin) return;
+ if (event.origin !== this._allowedOrigin) return;
const msg = event.data;
if (!msg || msg.v !== PROTOCOL_VERSION || msg.source !== 'agent-3d') return;
diff --git a/pump-dashboard.html b/pump-dashboard.html
index 5b41cfb1e..8418d0626 100644
--- a/pump-dashboard.html
+++ b/pump-dashboard.html
@@ -4,7 +4,9 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>🤖</text></svg>">
-<title>PumpFun Bot Dashboard</title>
+<title>3D-Agent · Pump Dashboard</title>
+<meta name="description" content="Multi-pane Pump.fun dashboard for 3D-Agent — live feed, watch list, claims, scanner, quoting.">
+<link rel="canonical" href="/pump-dashboard.html">
<style>
:root {
--bg: #0a0a0a;
@@ -386,8 +388,9 @@
<!-- ── Sidebar ─────────────────────────── -->
<aside class="sidebar">
<div class="sidebar-header">
- <h1>🤖 PumpBot</h1>
+ <h1>🤖 3D-Agent · Pump</h1>
<div class="version">Dashboard v1.0</div>
+ <div style="margin-top:8px;"><a href="/" style="color:var(--accent); text-decoration:none; font-size:11px;">← back to 3D-Agent</a></div>
</div>
<nav>
<div class="section-label">Overview</div>
diff --git a/pump-live.html b/pump-live.html
index c6a66ce0c..4f1ddc7d9 100644
--- a/pump-live.html
+++ b/pump-live.html
@@ -4,7 +4,9 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>🟢</text></svg>">
-<title>PumpFun Live — New Token Launches</title>
+<title>3D-Agent · PumpFun Live</title>
+<meta name="description" content="Real-time stream of new PumpFun token launches on Solana — embedded in 3D-Agent.">
+<link rel="canonical" href="/pump-live.html">
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
@@ -143,8 +145,9 @@
<div id="header">
<h1>⚡ PumpFun Live</h1>
- <a href="/trades" style="color:#4a9eff; text-decoration:none; font-size:12px; border:1px solid #333; padding:4px 10px; border-radius:3px;">📊 Trades Dashboard</a>
- <a href="/vanity" style="color:#ffcc00; text-decoration:none; font-size:12px; border:1px solid #333; padding:4px 10px; border-radius:3px;">🔑 Vanity Generator</a>
+ <a href="/" style="color:#888; text-decoration:none; font-size:12px; border:1px solid #333; padding:4px 10px; border-radius:3px;">← 3D-Agent</a>
+ <a href="/pump-dashboard.html" style="color:#4a9eff; text-decoration:none; font-size:12px; border:1px solid #333; padding:4px 10px; border-radius:3px;">📊 Dashboard</a>
+ <a href="/pumpfun.html" style="color:#ffcc00; text-decoration:none; font-size:12px; border:1px solid #333; padding:4px 10px; border-radius:3px;">🪙 PumpFun Console</a>
<div class="status" id="status">● Disconnected</div>
<div class="controls">
<input type="text" id="rpc" value="" placeholder="wss:// custom RPC" style="display:none" />
diff --git a/rider/src/components/menu-mode.js b/rider/src/components/menu-mode.js
index 542a64680..37773ee02 100644
--- a/rider/src/components/menu-mode.js
+++ b/rider/src/components/menu-mode.js
@@ -16,6 +16,17 @@ const modeMap = {
viewer2d: 'viewer'
};
+/**
+ * Click target that opens the multiplayer lobby panel.
+ */
+AFRAME.registerComponent('multiplayer-button', {
+ init: function () {
+ this.el.addEventListener('click', () => {
+ this.el.sceneEl.emit('mpopen', null, false);
+ });
+ }
+});
+
AFRAME.registerComponent('menu-mode', {
schema: {
colorScheme: {default: 'default'},
diff --git a/rider/src/components/multiplayer.js b/rider/src/components/multiplayer.js
index b13c64d98..341cde354 100644
--- a/rider/src/components/multiplayer.js
+++ b/rider/src/components/multiplayer.js
@@ -61,7 +61,8 @@ AFRAME.registerComponent('multiplayer', {
sceneEl.addEventListener('beatmiss', this.onBeatMiss);
sceneEl.addEventListener('beatwrong', this.onBeatMiss);
sceneEl.addEventListener('songcomplete', this.onSongComplete);
- sceneEl.addEventListener('playbuttonclick', this.onPlayButtonClick);
+ // Capture phase so we read menuSelectedChallenge before the state handler clears it.
+ sceneEl.addEventListener('playbuttonclick', this.onPlayButtonClick, true);
},
_ensureClient: function () {
diff --git a/rider/src/state/index.js b/rider/src/state/index.js
index fb1997ff9..e13b1b598 100644
--- a/rider/src/state/index.js
+++ b/rider/src/state/index.js
@@ -412,6 +412,9 @@ AFRAME.registerState({
state.menuSelectedChallenge.difficultyId = state.challenge.difficultyId;
state.challenge.id = '';
state.leaderboardQualified = false;
+ if (state.multiplayer.active) {
+ state.multiplayer.lobbyOpen = true;
+ }
},
gamemode: (state, mode) => {
@@ -617,6 +620,138 @@ AFRAME.registerState({
state.optionsMenuOpen = true;
},
+ /**
+ * Multiplayer: open the MP panel from the modes column.
+ */
+ mpopen: state => {
+ state.multiplayer.lobbyOpen = true;
+ state.multiplayer.active = true;
+ state.multiplayer.status = 'idle';
+ state.multiplayer.lastError = '';
+ // MP only makes sense in scored modes; default to classic if currently ride.
+ if (state.gameMode === 'ride') { state.gameMode = 'classic'; }
+ },
+
+ mpclose: state => {
+ state.multiplayer.lobbyOpen = false;
+ state.multiplayer.active = false;
+ state.multiplayer.status = 'idle';
+ },
+
+ mpcodeinput: (state, payload) => {
+ state.multiplayer.joinCodeInput = (payload || '').toUpperCase().slice(0, 4);
+ },
+
+ mpconnecting: state => {
+ state.multiplayer.status = 'connecting';
+ state.multiplayer.lastError = '';
+ },
+
+ mproomjoined: (state, payload) => {
+ state.multiplayer.roomCode = payload.code;
+ state.multiplayer.isHost = !!payload.isHost;
+ state.multiplayer.status = 'lobby';
+ state.multiplayer.lobbyOpen = true;
+ state.multiplayer.active = true;
+ },
+
+ mproomleft: state => {
+ state.multiplayer.roomCode = '';
+ state.multiplayer.isHost = false;
+ state.multiplayer.status = 'idle';
+ state.multiplayer.players.length = 0;
+ state.multiplayer.players.__dirty = true;
+ state.multiplayer.playerCount = 0;
+ state.multiplayer.readyCount = 0;
+ state.multiplayer.everyoneReady = false;
+ state.multiplayer.opponentText = '';
+ state.multiplayer.opponentScores = '';
+ },
+
+ mperror: (state, payload) => {
+ state.multiplayer.lastError = (payload && payload.message) || 'Error';
+ if (state.multiplayer.status === 'connecting') {
+ state.multiplayer.status = 'idle';
+ }
+ },
+
+ /**
+ * Snapshot of room state from network.
+ */
+ mproomupdate: (state, payload) => {
+ state.multiplayer.uid = payload.uid;
+ state.multiplayer.isHost = !!payload.isHost;
+ state.multiplayer.status = payload.status || state.multiplayer.status;
+ state.multiplayer.players.length = 0;
+ state.multiplayer.players.__dirty = true;
+
+ let readyCount = 0;
+ let opponentText = '';
+ let opponentScores = '';
+ let hostName = '';
+
+ for (let i = 0; i < payload.players.length; i++) {
+ const p = payload.players[i];
+ state.multiplayer.players.push(p);
+ if (p.ready) readyCount++;
+ if (p.uid !== payload.uid) {
+ const tag = p.finished ? ' DONE' : '';
+ opponentText += `${truncate(p.name, 14)} (${Math.round(p.accuracy || 0)}%)${tag}\n`;
+ opponentScores += `${p.score | 0}\n`;
+ }
+ if (payload.song && p.uid === (payload.hostUid || '')) hostName = p.name;
+ }
+
+ state.multiplayer.playerCount = payload.players.length;
+ state.multiplayer.readyCount = readyCount;
+ state.multiplayer.everyoneReady =
+ payload.players.length >= 2 && readyCount === payload.players.length;
+ state.multiplayer.opponentText = opponentText;
+ state.multiplayer.opponentScores = opponentScores;
+ state.multiplayer.hostName = hostName;
+ },
+
+ /**
+ * Non-host: host has selected a song. Mirror it into menuSelectedChallenge
+ * so zip-loader will fetch it on play.
+ */
+ mpremotesongselect: (state, song) => {
+ Object.assign(state.menuSelectedChallenge, {
+ id: song.id,
+ difficulty: song.difficulty,
+ beatmapCharacteristic: song.beatmapCharacteristic,
+ difficultyId: song.difficultyId,
+ songName: song.songName,
+ songSubName: song.songSubName,
+ image: song.image,
+ version: song.version,
+ directDownload: song.directDownload,
+ downloads: song.downloads,
+ downloadsText: song.downloadsText,
+ songDuration: song.songDuration,
+ metadata: song.metadata || {}
+ });
+ challengeDataStore[song.id] = state.menuSelectedChallenge;
+ },
+
+ /**
+ * Non-host: host has triggered start; run the equivalent of playbuttonclick
+ * but skip the host-only broadcast that the multiplayer component handles.
+ */
+ mpremoteplaystart: state => {
+ if (!state.menuSelectedChallenge.id) { return; }
+ resetScore(state);
+ Object.assign(state.challenge, state.menuSelectedChallenge);
+ state.menuActive = false;
+ state.multiplayer.lobbyOpen = false;
+ state.menuSelectedChallenge.id = '';
+ state.menuSelectedChallenge.difficulty = '';
+ state.menuSelectedChallenge.beatmapCharacteristic = '';
+ state.isSearching = false;
+ state.isLoading = true;
+ state.loadingText = 'Loading...';
+ },
+
pausegame: state => {
if (!state.isPlaying) { return; }
state.isPaused = true;
@@ -645,6 +780,7 @@ AFRAME.registerState({
// Reset menu.
state.menuActive = false;
+ state.multiplayer.lobbyOpen = false;
state.menuSelectedChallenge.id = '';
state.menuSelectedChallenge.difficulty = '';
state.menuSelectedChallenge.beatmapCharacteristic = '';
@@ -886,6 +1022,31 @@ AFRAME.registerState({
state.gameMode !== 'ride' &&
state.inVR &&
(state.isPlaying || state.isPaused);
+
+ // MP gating — non-host cannot drive song selection or playback.
+ state.mpActive = !!state.multiplayer.active;
+ state.mpHostControl = !state.multiplayer.active || state.multiplayer.isHost;
+ state.mpLobbyVisible =
+ state.multiplayer.lobbyOpen && state.menuActive && !state.isMenuOpening;
+ state.mpHudVisible =
+ state.multiplayer.active &&
+ state.multiplayer.players.length > 1 &&
+ (state.isPlaying || state.isPaused);
+ state.mpResultsVisible =
+ state.multiplayer.active &&
+ state.isVictory &&
+ state.multiplayer.players.length > 1;
+ state.mpRoomCodeText = state.multiplayer.roomCode
+ ? 'ROOM ' + state.multiplayer.roomCode
+ : '';
+ state.mpStatusText = (() => {
+ if (state.multiplayer.lastError) return state.multiplayer.lastError;
+ if (state.multiplayer.status === 'connecting') return 'Connecting...';
+ if (state.multiplayer.status === 'idle') return 'Create or join a room.';
+ if (state.multiplayer.players.length < 2) return 'Waiting for another player...';
+ if (state.multiplayer.isHost) return 'Pick a song and press PLAY.';
+ return 'Waiting for host to pick a song...';
+ })();
}
});
diff --git a/src/agent-skills-pumpfun-watch.js b/src/agent-skills-pumpfun-watch.js
index a9ce2c1c7..56c839232 100644
--- a/src/agent-skills-pumpfun-watch.js
+++ b/src/agent-skills-pumpfun-watch.js
@@ -32,6 +32,9 @@ const _state = {
count: 0,
};
+/** Active whale-trade watchers keyed by mint. Value is the AbortController. */
+const _whaleWatchers = new Map();
+
async function fetchJson(url) {
const r = await fetch(url, { credentials: 'include' });
if (!r.ok) throw new Error(`request failed: ${r.status}`);
diff --git a/src/app.js b/src/app.js
index 496ea0c36..5fe567822 100644
--- a/src/app.js
+++ b/src/app.js
@@ -1089,7 +1089,9 @@ class App {
if (!data || typeof data !== 'object' || typeof data.id !== 'string' || typeof data.action !== 'string') return;
// Only handle our specific action verbs to avoid intercepting unrelated messages.
if (data.action !== 'exportGLB' && data.action !== 'takeScreenshot') return;
- const replyOrigin = event.origin && event.origin !== 'null' ? event.origin : '*';
+ if (!event.origin || event.origin === 'null') return;
+ if (!this._parentOrigin) this._parentOrigin = event.origin;
+ const replyOrigin = event.origin;
const replyTo = event.source || window.parent;
const reply = (result, err) => {
try { replyTo.postMessage(err ? { id: data.id, error: err } : { id: data.id, result }, replyOrigin); } catch (_) {}
@@ -1203,9 +1205,17 @@ class App {
}
_postToParent(msg) {
- if (window.parent && window.parent !== window) {
- window.parent.postMessage(msg, '*');
+ if (!window.parent || window.parent === window) return;
+ if (!this._parentOrigin) {
+ try {
+ if (document.referrer) this._parentOrigin = new URL(document.referrer).origin;
+ } catch {}
+ }
+ if (!this._parentOrigin) {
+ console.warn('[widget] parent origin unknown; dropping', msg?.type);
+ return;
}
+ window.parent.postMessage(msg, this._parentOrigin);
}
_initNichAgent() {
diff --git a/src/embed-host-bridge.js b/src/embed-host-bridge.js
index 9a608af7d..8aa263bc7 100644
--- a/src/embed-host-bridge.js
+++ b/src/embed-host-bridge.js
@@ -94,7 +94,7 @@ export class EmbedHostBridge {
_handleMessage(event) {
if (event.source !== this._iframe.contentWindow) return;
- if (this._allowedOrigin !== '*' && event.origin !== this._allowedOrigin) return;
+ if (event.origin !== this._allowedOrigin) return;
const msg = event.data;
if (!msg || msg.v !== PROTOCOL_VERSION || msg.source !== 'agent-3d') return;
diff --git a/src/widgets/pumpfun-feed.js b/src/widgets/pumpfun-feed.js
index b69a975f0..dbd0c24d6 100644
--- a/src/widgets/pumpfun-feed.js
+++ b/src/widgets/pumpfun-feed.js
@@ -392,15 +392,104 @@ function cap(s) {
function renderGraduation(ev) {
const el = document.createElement('div');
- el.style.cssText = cardStyle('#1a1632');
+ el.style.cssText = cardStyle('#1a1632') + ';position:relative' + (ev.replay ? ';opacity:0.62' : '');
+ const mint = ev.mint || '';
+ const m = encodeURIComponent(mint);
+ const name = ev.name || ev.symbol || mint || '—';
+ const symbol = ev.symbol || '?';
+ const age = ev.age || (ev.created_at ? relTime(ev.created_at) : '');
+ const desc = ev.description ? String(ev.description) : '';
+ const descClip = desc ? escapeHtml(desc.slice(0, 100)) + (desc.length > 100 ? '…' : '') : '';
+
+ const mcInitial = ev.market_cap_usd_initial ?? ev.initial_market_cap_usd ?? ev.market_cap_at_launch;
+ const mcCurrent = ev.usd_market_cap ?? ev.market_cap_usd ?? ev.market_cap;
+ const mcStr = (mcInitial != null && mcCurrent != null)
+ ? `$${num(mcInitial)} ⇨ $${num(mcCurrent)}`
+ : (mcCurrent != null ? `$${num(mcCurrent)}` : '');
+ const ath = ev.ath_market_cap ?? ev.ath_usd ?? null;
+ const athStr = ath != null && ath !== mcCurrent ? `$${num(ath)}` : '';
+
+ const launches = ev.creator_launches;
+ const graduated = ev.creator_graduated;
+ const bestToken = Array.isArray(ev.creator_tokens) && ev.creator_tokens.length
+ ? ev.creator_tokens.slice().sort((a, b) => (b?.mc || 0) - (a?.mc || 0))[0]
+ : null;
+ const bestStr = bestToken
+ ? (bestToken.symbol === symbol
+ ? `best $${escapeHtml(bestToken.symbol)}${bestToken.mc ? ' $' + num(bestToken.mc) : ''} (this)`
+ : `best $${escapeHtml(bestToken.symbol || '?')}${bestToken.mc ? ' $' + num(bestToken.mc) : ''}`)
+ : '';
+ const amountStr = ev.amount_sol != null
+ ? `${Number(ev.amount_sol).toFixed(2)} SOL${ev.amount_usd != null ? ' [$' + num(ev.amount_usd) + ']' : ''}`
+ : '';
+ const launchesPart = launches != null
+ ? (graduated != null ? `${launches} launches · 🎓 ${graduated}` : `${launches} launches`)
+ : '';
+ const devLine = [launchesPart, bestStr, amountStr].filter(Boolean).join(' · ');
+
+ const socials = [
+ ev.twitter ? `<a href="${attrEsc(twitterHref(ev.twitter))}" target="_blank" rel="noopener" style="color:#cbd5e1">𝕏</a>` : '',
+ ev.telegram ? `<a href="${attrEsc(ev.telegram)}" target="_blank" rel="noopener" style="color:#cbd5e1">TG</a>` : '',
+ ev.website ? `<a href="${attrEsc(ev.website)}" target="_blank" rel="noopener" style="color:#cbd5e1">🌐</a>` : '',
+ ].filter(Boolean).join(' ');
+
+ const chartLinks = mint
+ ? `<a href="https://dexscreener.com/solana/${m}" target="_blank" rel="noopener" style="color:#9a8cff">DEX</a>⋅<a href="https://www.defined.fi/sol/${m}" target="_blank" rel="noopener" style="color:#9a8cff">DEF</a>`
+ : '';
+ const toolAbbr = mint
+ ? [
+ ['AXI', `https://axiom.trade/meme/${mint}`],
+ ['GMG', `https://gmgn.ai/sol/token/${mint}`],
+ ['PDR', `https://trade.padre.gg/trade/solana/${mint}`],
+ ['PHO', `https://photon-sol.tinyastro.io/en/r/@bonk/${mint}`],
+ ['BLX', `https://bullx.io/terminal?chainId=1399811149&address=${mint}`],
+ ].map(([l, u]) => `<a href="${attrEsc(u)}" target="_blank" rel="noopener" style="color:#9a8cff">${l}</a>`).join('⋅')
+ : '';
+
+ const sig = ev.signature || ev.tx_signature;
+ const ts = ev.timestamp ?? ev.block_time ?? ev.created_at;
+ const tsStr = ts ? new Date(ts < 1e12 ? ts * 1000 : ts).toISOString().replace('T', ' ').replace(/\..+$/, '') + ' UTC' : '';
+
+ const replayBadge = ev.replay
+ ? `<span style="position:absolute;top:8px;right:10px;font-size:9px;letter-spacing:.08em;text-transform:uppercase;color:#6a6a82;padding:1px 6px;border:1px solid #2a2a3c;border-radius:999px;background:#0e0e16">replay</span>`
+ : '';
+ const thumb = ev.image_uri
+ ? `<img src="${attrEsc(ev.image_uri)}" alt="" loading="lazy" referrerpolicy="no-referrer" onerror="this.style.display='none'" style="width:40px;height:40px;border-radius:6px;object-fit:cover;border:1px solid #2a2a3c;background:#0e0e16;flex:0 0 40px" />`
+ : '';
+
el.innerHTML = `
- <div style="font-size:11px;opacity:0.7">🎓 Graduation</div>
- <div style="font-weight:600;margin-top:4px">${escapeHtml(ev.name || ev.symbol || ev.mint)}</div>
- ${ev.symbol ? `<div style="font-size:12px;opacity:0.85">$${escapeHtml(ev.symbol)}</div>` : ''}
+ ${replayBadge}
+ <div style="display:flex;gap:10px;align-items:flex-start">
+ ${thumb}
+ <div style="flex:1;min-width:0">
+ <div style="font-weight:700">🆕💊 ${escapeHtml(name)} — $${escapeHtml(symbol)}${age ? ' [' + escapeHtml(age) + ']' : ''}</div>
+ ${descClip ? `<div style="opacity:0.78;font-size:11px;margin-top:2px">${descClip}</div>` : ''}
+ ${socials ? `<div style="margin-top:4px;display:flex;gap:6px">${socials}</div>` : ''}
+ </div>
+ </div>
+ ${mcStr ? `<div style="margin-top:6px">💎 MC: ${mcStr}${athStr ? ' · 🏆 ATH: ' + athStr : ''}</div>` : ''}
+ ${devLine ? `<div style="margin-top:4px;font-size:11px;opacity:0.9">👨‍💻 ${devLine}</div>` : ''}
+ ${chartLinks ? `<div style="margin-top:4px;font-size:11px">💹 Chart: ${chartLinks}</div>` : ''}
+ ${toolAbbr ? `<div style="font-size:11px">🧰 ${toolAbbr}</div>` : ''}
+ <div style="font-family:ui-monospace,monospace;font-size:10px;opacity:0.55;margin-top:4px;word-break:break-all">${escapeHtml(mint)}</div>
+ <div style="font-size:10px;opacity:0.55;margin-top:2px;display:flex;gap:8px;flex-wrap:wrap">
+ ${sig ? `🔗 <a href="https://solscan.io/tx/${encodeURIComponent(sig)}" target="_blank" rel="noopener" style="color:#9a8cff">TX</a>` : ''}
+ ${mint ? `· <a href="https://pump.fun/coin/${m}" target="_blank" rel="noopener" style="color:#9a8cff">pump.fun</a>` : ''}
+ ${tsStr ? `· 🕐 ${escapeHtml(tsStr)}` : ''}
+ </div>
`;
return el;
}
+function attrEsc(s) { return escapeHtml(s); }
+function twitterHref(v) {
+ const s = String(v ?? '').trim();
+ if (!s) return '';
+ if (/^https?:\/\//i.test(s)) return s;
+ const handle = s.replace(/^@+/, '').split(/[/?#]/)[0];
+ return `https://x.com/${encodeURIComponent(handle)}`;
+}
+
function cardStyle(bg) {
return [
`background:${bg}`,