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(discover): show an agent's on-chain history on its detail page

nirholas207e87f440c0
diff --git a/docs/x402-revenue.md b/docs/x402-revenue.md
index c3feb2179..7a088c056 100644
--- a/docs/x402-revenue.md
+++ b/docs/x402-revenue.md
@@ -39,6 +39,51 @@ revenue mirror of the [Money Pulse](https://three.ws/pulse) and reads the public
unauthenticated `GET /api/x402-revenue` (operational fields like IP and user agent
are never exposed — only the on-chain-public route, amount, payer, and tx).
+### The public API: `GET /api/x402-revenue`
+
+No key, no auth, CORS open. Four views:
+
+| Request | Returns |
+| --- | --- |
+| `?view=stats&period=24h\|7d\|30d\|all` | totals, fee splits, per-endpoint, per-network, hourly/daily series, momentum vs the prior window, settlement health |
+| `?view=feed&limit=30&cursor=<iso>` | recent settlements, newest first, keyset-paged |
+| `?since=<iso>` | delta poll: only settlements newer than the cursor, never cached |
+| `?view=export&period=24h` | CSV of the window (max 5000 rows) |
+
+`?endpoint=<slug>` and `?network=<chain>` filter the feed and the export.
+
+**Chain values are CAIP-2, filters are chain families.** The ledger stores
+`solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp` and `eip155:8453`, so every settlement
+also carries a folded family slug and a readable label
+([`api/_lib/x402/revenue-networks.js`](../api/_lib/x402/revenue-networks.js)):
+
+```jsonc
+{
+ "route": "/api/x402/token-intel",
+ "network": "eip155:8453", // raw ledger value, unchanged
+ "network_family": "base", // what ?network= filters by
+ "network_label": "Base", // what the UI renders
+ "amount_usd": 0.001,
+ "tx_url": "https://basescan.org/tx/0x…" // that chain's explorer, null if unknown
+}
+```
+
+`?network=` accepts the family slug (`solana`, `base`, `bsc`), a legacy bare name,
+or a full CAIP-2 id: all three select the same rows, and an unrecognised value
+drops the filter instead of returning an empty feed. `by_network` in the stats
+view is folded the same way, one row per family with the raw ids it covers:
+
+```bash
+curl -s "https://three.ws/api/x402-revenue?view=stats&period=24h" | jq '.data.by_network'
+# [ { "network": "solana", "label": "Solana", "count": 414, "gross_usd": 8.508,
+# "caip": ["solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"] } ]
+
+curl -s "https://three.ws/api/x402-revenue?view=feed&limit=5&network=base" | jq '.data.count'
+```
+
+CSV columns: `timestamp,endpoint,network,chain,amount_usd,asset,payer,tx_hash,tx_url`
+(`network` is the raw CAIP-2 id, `chain` its readable label).
+
---
## The settlement flow
@@ -75,7 +120,7 @@ CREATE TABLE x402_audit_log (
route TEXT NOT NULL, -- e.g. '/api/x402/token-intel'
resource_url TEXT,
payer TEXT, -- wallet address
- network TEXT, -- e.g. 'solana' | 'base' | 'bsc'
+ network TEXT, -- CAIP-2 id, e.g. 'solana:5eykt4Us…' | 'eip155:8453'
amount_atomics TEXT, -- USDC atomics (6 decimals): '10000' = $0.01
asset TEXT,
tx_hash TEXT,
diff --git a/public/discover/detail.html b/public/discover/detail.html
index 91e584fe2..3ce39afd6 100644
--- a/public/discover/detail.html
+++ b/public/discover/detail.html
@@ -91,6 +91,17 @@
<dl class="detail-dl" data-role="onchain-dl"></dl>
</div>
+ <!-- On-chain history, from the platform's own cross-chain index
+ (agent_onchain_events). Solana and EVM both land here. -->
+ <div class="detail-panel detail-panel--full" data-role="history-panel" hidden>
+ <div class="detail-panel-head">
+ <span class="detail-panel-title" data-i18n="discover_detail.on_chain_history">On-chain history</span>
+ <span class="detail-panel-badge" data-role="history-count">0</span>
+ </div>
+ <ol class="detail-history" data-role="history"></ol>
+ <p class="detail-history-foot" data-role="history-foot"></p>
+ </div>
+
<!-- Avatar details (avatar only) -->
<div class="detail-panel" data-role="avatar-panel" hidden>
<div class="detail-panel-head">
diff --git a/src/agent-detail.js b/src/agent-detail.js
index 5cec8272c..202435af7 100644
--- a/src/agent-detail.js
+++ b/src/agent-detail.js
@@ -314,7 +314,7 @@ if (typeof window !== 'undefined') {
}, { once: true });
}
-function destroyCoinStatus() {
+export function destroyCoinStatus() {
while (coinStatusHandles.length) {
const h = coinStatusHandles.pop();
try {
@@ -547,7 +547,7 @@ function launchTimeAgo(iso) {
return new Date(t).toLocaleDateString(undefined, { month: 'short', day: 'numeric' });
}
-async function renderLaunchHistory(container, agent) {
+export async function renderLaunchHistory(container, agent) {
if (!agent.id) return;
let coins = [];
try {
@@ -601,18 +601,23 @@ async function renderLaunchHistory(container, agent) {
'aria-label': `${coin.symbol || coin.name || 'coin'} on three.ws`,
});
box.appendChild(row);
- if (isDevnet) {
- // Devnet mints have no pump.fun market data — render the static row.
- row.append(
- el('span', { class: 'ad-launch-symbol', text: coin.symbol ? `$${coin.symbol}` : coin.name || '—' }),
- el('span', { class: 'ad-mono ad-launch-mint', text: shortAddr(coin.mint) }),
- el('span', { class: 'ad-launch-time', text: launchTimeAgo(coin.created_at) }),
- );
- } else {
- // Live market cap + time stream in through the shared widget — one
- // /api/pump/coin fetch per row, mapped and formatted in one place.
- coinStatusHandles.push(mountCoinStatus(row, coin.mint, { variant: 'row' }));
- }
+ // Live market cap + graduation stream in through the shared widget —
+ // one fetch per row, mapped and formatted in one place. A mainnet coin
+ // reads from pump.fun's indexer (falling back to its bonding curve
+ // while the indexer catches up); a devnet coin reads its curve off the
+ // cluster and renders in SOL, so a rehearsal launch shows real market
+ // state here instead of a lifeless symbol-and-address row.
+ coinStatusHandles.push(
+ mountCoinStatus(row, coin.mint, {
+ variant: 'row',
+ network: isDevnet ? 'devnet' : 'mainnet',
+ meta: {
+ symbol: coin.symbol || '',
+ name: coin.name || '',
+ createdAt: coin.created_at ? Date.parse(coin.created_at) || null : null,
+ },
+ }),
+ );
}
}
@@ -1436,20 +1441,25 @@ function render(agent) {
$('ad-token-body').classList.remove('ad-muted');
$('ad-token-body').textContent = '';
// Live token chip — symbol · price · market cap · graduation %, streamed
- // and formatted by the shared coin-status widget. Devnet tokens (no
- // pump.fun market data) fall back to a static symbol + mint row.
- if (agent.token.cluster === 'devnet') {
- $('ad-token-body').appendChild(
- el('div', { class: 'ad-row ad-row-split' }, [
- el('span', { text: agent.token.symbol || 'TOKEN' }),
- el('span', { class: 'ad-mono', text: shortAddr(agent.token.mint) }),
- ]),
- );
- } else {
- const chipBox = el('div', { class: 'ad-token-chip' });
- $('ad-token-body').appendChild(chipBox);
- coinStatusHandles.push(mountCoinStatus(chipBox, agent.token.mint, { variant: 'chip' }));
- }
+ // and formatted by the shared coin-status widget. A devnet token has no
+ // pump.fun indexer behind it, so the widget reads its bonding curve
+ // straight off the cluster and prices it in SOL: the rehearsal launch is
+ // as legible on the profile as a mainnet one, without pretending a devnet
+ // coin is worth dollars.
+ const chipBox = el('div', { class: 'ad-token-chip' });
+ $('ad-token-body').appendChild(chipBox);
+ coinStatusHandles.push(
+ mountCoinStatus(chipBox, agent.token.mint, {
+ variant: 'chip',
+ network: agent.token.cluster === 'devnet' ? 'devnet' : 'mainnet',
+ meta: {
+ symbol: agent.token.symbol || '',
+ name: agent.token.name || '',
+ image: agent.token.image || '',
+ createdAt: agent.token.launched_at ? Date.parse(agent.token.launched_at) || null : null,
+ },
+ }),
+ );
const dashLink =
agent.token.pumpfun_url ||
(agent.token.cluster === 'devnet'
diff --git a/src/x402-revenue.css b/src/x402-revenue.css
index 36fb536c5..bb52bf680 100644
--- a/src/x402-revenue.css
+++ b/src/x402-revenue.css
@@ -717,6 +717,13 @@
color: var(--ink-bright, #fff);
border-color: color-mix(in srgb, var(--xr-accent) 40%, var(--stroke, #2a2a2a));
}
+.xr-more:focus-visible {
+ outline: 2px solid var(--xr-accent);
+ outline-offset: 2px;
+}
+.xr-more:active {
+ transform: translateY(1px);
+}
/* feed empty + skeleton */
.xr-feed-empty {
@@ -857,6 +864,10 @@
.xr-top-row.active {
outline: 1px solid color-mix(in srgb, var(--xr-accent) 50%, transparent);
}
+.xr-top-row:focus-visible {
+ outline: 2px solid var(--xr-accent);
+ outline-offset: 1px;
+}
.xr-top-row + .xr-top-row {
margin-top: 2px;
}