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: add live Crypto Fear & Greed Index gauge and historical chart

fudjiaa58be01df514
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 17f1f0dbb..1c602e72c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,11 +7,15 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
## 2026-07-07
- **3D API** (`/3d`) — Free, keyless 3D API for AI agents: turn a text prompt into a real GLB model and validate/optimize any glTF/GLB, all from one URL with a live OpenAPI 3.1 spec. Free draft generation and inspection graduate to paid Forge Pro quality tiers and animation-ready Rigged Avatars. No key, no account.
+- **Compare Crypto Side by Side** (`/compare`) — Compare cryptocurrencies head to head — overlay normalized price performance and line up market cap, volume, FDV, supply, and all-time-high stats for up to four coins at once. The selection is saved to the URL so any matchup is shareable.
- **Crypto Data API** (`/crypto`) — Free, keyless crypto data for AI agents in one API: token snapshots, security/rug signals, holder concentration, live pump.fun launches, bonding-curve status, whale activity, trending tokens, wallet portfolios and ticker-availability checks. No key, no account, no paywall.
+- **Crypto Fear & Greed Index** (`/fear-greed`) — The Crypto Fear & Greed Index — live market sentiment from 0 (Extreme Fear) to 100 (Extreme Greed), shown on a gauge with a week-over-week delta, a full interactive history chart, and a labelled scale explaining what each reading means.
+- **Crypto Market Heatmap** (`/heatmap`) — A live market heatmap of the top cryptocurrencies: every tile is a coin, sized by market cap and colored by its 24h or 7d price move. See where money is flowing across the whole market at a glance, then click any tile for its full profile.
- **Docs · Crypto Data API** (`/docs/crypto-api`) — Developer reference for the free, keyless Crypto Data API bundle: the one-call discovery endpoint (GET /api/crypto), the generated OpenAPI 3.1 spec, and every endpoint's inputs, outputs, states, and curl examples — token snapshots, bonding status, whales, trending, wallet portfolios, and symbol availability.
- **Docs · Pump Launcher** (`/docs/pump-launcher`) — Deploy a brand-new pump.fun token in one paid call — no SOL, no wallet, no account. Inputs, outputs, pricing, correctness guarantees, and the free symbol-check → launch → launch-feed funnel.
- **Docs · Trust Primitives** (`/docs/trust-primitives`) — Cross-chain Agent Reputation — score any wallet, mint, or agent id (Solana or EVM) 0–100 from real on-chain evidence before your agent pays, trades, or delegates.
- **Docs · x402 Developer Tools** (`/docs/x402-dev-tools`) — A free test bench for x402 developers — echo your payment envelope, debug a failed 402 exchange, and verify a receipt's attestation and settlement against a live server, all without spending anything.
+- **Ethereum Gas Tracker** (`/gas`) — Live Ethereum gas fees straight from the chain — slow, standard, and fast tiers in gwei with USD cost estimates for transfers, token sends, DEX swaps, and NFT mints. Real on-chain fee history, refreshed automatically, no API key required.
- **3D model inspection is now free** — Validating and optimizing a glTF/GLB no longer costs anything. The new free, keyless /api/3d/inspect takes a model URL (or a raw upload) and returns whether it's spec-valid, its full structural stats — vertices, triangles, materials, textures, animations, extensions — and a severity-ranked list of exactly what to fix to make it smaller and faster for the web. It runs the official Khronos glTF-Validator plus the same inspection core the platform's paid pipelines use. This capability used to be a paid x402 endpoint (model-check); a validation utility should be free — it builds trust and points agents at the paid Forge Pro, Rigged Avatar, and optimization tiers when they need the heavy lifting done for them. `[feature, improvement]`
- **3D Studio tools can now be paid on X Layer via the OKX Agent Payments Protocol** — Agents on the OKX.AI marketplace can now pay for our 3D tools the way that marketplace expects: our payment challenge now offers X Layer (chain 196) in the USD₮0 stablecoin alongside the existing USDC-on-Base/Solana options, and speaks the OKX buyer flow end to end — it verifies the payment on-chain before doing any work and only charges after the tool succeeds. Existing customers paying on Base or Solana are unaffected; this simply adds a rail. It's the integration OKX asked us to complete before re-listing our 3D Studio agent. `[feature, infra]`
- **Agent reputation now scores any wallet or agent on any chain** — The paid Agent Reputation endpoint no longer only works on three.ws agents — pass ANY counterparty and get a deterministic 0–100 trust score before you pay, trade, or delegate to it. It auto-detects the type — a Solana wallet, an EVM 0x address, a pump.fun mint, an ERC-8004 agent id, or a three.ws agent_id — and scores it from real on-chain evidence: transaction history, account age, distinct counterparties, holdings, settlement reliability, prior settled agent payments, and ERC-8004 feedback. Every score comes with the underlying evidence links and a clear list of what couldn't be read; an unknown or unscannable subject returns score:null, never a fabricated number. A new batch mode scores up to 25 counterparties in one call. It's a genuine pre-transaction trust primitive that works across chains, not just on our own platform. (`/docs/trust-primitives`) `[feature, improvement]`
@@ -33,6 +37,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **Free x402 developer toolkit — echo, debug, and verify a receipt against a live server** — Building an x402 integration against three.ws just got easier. Three new free, keyless tools: echo shows you exactly what the server sees when you send a payment — the decoded envelope with every signature redacted, plus a local valid/invalid verdict without charging you. debug turns a failed 402 exchange into an ordered fix list keyed to the real reasons a payment gets rejected (wrong version, shorthand network, decimal amounts, underpayment). verify-receipt recomputes a paid response's SHA-256 attestation to prove it wasn't altered, and confirms a settlement transaction on-chain. A new docs page ties all six developer tools together. (`/docs/x402-dev-tools`) `[feature, docs]`
- **Give your assistant a living 3D body that lip-syncs and emotes in the chat** — Turn any generated avatar into a persistent, named agent body that renders right inside ChatGPT or Claude. It lip-syncs each reply, shows the matching expression and gesture, idles between turns, and comes back as the same body when you return to it — no account needed. Three new free 3D Studio tools drive it: save an avatar as a persona, make it speak a reply, and reload it by id in a later session. A rig with no facial morphs still animates its mouth from the jaw, and a non-humanoid model falls back to a gentle idle instead of a broken pose. `[feature]`
- **Hire and pay another agent, transparently — the live agent-to-agent commerce loop** — Your agent can now discover a specialist agent, check its on-chain reputation, pay it in USDC, hand off the task, and get the result back with a full receipt — who it hired, the reputation behind the choice, exactly what it cost, and the on-chain settlement reference. The agent_hire_discover tool ranks candidates by task fit, ERC-8004 reputation and real engagement; agent_hire runs the whole thing end to end and renders an inline provenance receipt card. Hard spend guardrails protect you throughout: a per-call cap, a per-session budget, and a confirmation prompt for anything above a threshold — and a blocked or failed hire is never charged. Discovery no longer comes up empty on a plain-language request, and paid hires now complete against a live agent. `[feature, improvement]`
+- **Markets grows a full toolkit — Heatmap, Fear & Greed, Gas Tracker, and Compare** — The Markets surface is now four tools bigger. Heatmap shows the whole market in one view — every coin a tile sized by market cap and colored by its price move. Fear & Greed puts market sentiment on a live gauge with full history. The Gas Tracker reads Ethereum fees straight from the chain, in gwei and in dollars, for transfers, swaps, and NFT mints. Compare lines up to four coins head to head — overlaying performance and every key stat, with a shareable URL. All live data, all free, all cross-linked from the markets table. (`/heatmap`) `[feature]`
- **Mint a generated 3D avatar as an on-chain Solana NFT — with a live 3D viewer as its media** — You can now turn a generated or owned avatar into real, ownable on-chain property. The new mint_3d_asset tool mints your rigged GLB as a Solana NFT whose media is a live, interactive 3D viewer — not a flat picture — with the model, a rendered thumbnail, and its full provenance (who made it, the prompt, the model, its lineage) travelling with it. Creator royalties are enforced on every resale, capped at 10%. A companion get_3d_asset_onchain tool resolves any mint back to its current holder, live viewer, provenance, and royalty terms. Minting defaults to devnet for safe testing; mainnet is an explicit opt-in. It's idempotent, so a retried mint never creates a duplicate. `[feature, sdk]`
- **New: three.ws Crypto Data API docs** — One page now documents the whole free, keyless Crypto Data API for AI agents — live at /crypto. It lays out all nine reads an agent needs mid-trade (token snapshot, security/rug signals, holders & concentration, live pump.fun launches, bonding-curve status, whale activity, symbol availability, wallet portfolio, trending) with a copy-paste quickstart in curl, JavaScript and Python, a real request/response example for each, and a live 'Try it' console right in the browser. Every endpoint is free with no key and no account. The page probes production in real time and marks each endpoint Live or Coming soon, so it stays honest as the API rolls out — and points you to the paid uniques (Pump Launcher, Vanity, Forge) when your agent is ready to act on the data. (`/crypto`) `[feature, docs]`
- **On-chain identity verification now works cross-platform for any claim** — The Identity Verifier is no longer three.ws-only. Give it any claim that an identity controls an address — an ENS name (vitalik.eth), an SNS name (bonfida.sol), an EVM or Solana wallet, an ERC-8004 agent id, or a three.ws agent_id — and it returns real on-chain evidence the link is genuine: ENS/SNS resolution, a contract's deploy transaction and deployer, a token's mint and metadata authorities, an ERC-8004 registry entry, or the three.ws deploy record. Every verdict is true, false, or unverifiable — and it never reports true without concrete on-chain proof, so an insufficient read is honestly labeled instead of guessed. An agent can now verify whoever it's about to pay, trade, or delegate to, whatever platform they came from. Pair it with cross-chain Agent Reputation: verify who they are, then score whether to trust them. Full evidence model at /docs/trust-primitives. (`/docs/trust-primitives`) `[feature, improvement]`
@@ -48,6 +53,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **The 3D asset pipeline is now purchasable stage-by-stage** — Every working stage of the platform's 3D pipeline is now its own pay-per-call x402 endpoint, so an agent can buy exactly the step it needs and get a finished asset URL back in one call — no account, no API key. Rig a static model into an animation-ready one ($0.05), remesh or retopologize to a clean topology ($0.03), make a mesh game-ready to a poly budget ($0.03), geometrically restyle it — voxel, brick, voronoi, low-poly ($0.03), or strip an image's background to a transparent PNG for image→3D ($0.01). Each call validates your input, runs the real worker, checks the output is a valid asset, and hands back a durable first-party URL — and if anything fails, you're never charged. Nobody else in the x402 ecosystem sells a 3D asset pipeline. (`/docs/3d-pipeline`) `[feature]`
- **The animation library API now pages, so it stays fast as the catalog grows** — The motion library is heading past its current 2,800+ clips as we add generatively-produced animations. Its public API (GET /api/animations/library) can now return the catalog in bounded pages — pass ?limit and ?offset and page until there's no next_offset — so a single response never balloons no matter how large the library gets. The /animations gallery already fetches the catalog this way. Calling it with no parameters still returns the whole list exactly as before, so nothing built on the old behavior breaks. (`/animations`) `[improvement, infra]`
- **The free 3D Studio in ChatGPT stays up even when our rate-limiter has a blip** — The free 3D Studio generates entirely on no-cost engines, so there's no spend to protect by shutting it off. We fixed a case where a hiccup in the rate-limiting backend could make the studio refuse every generation with a "try again shortly" — an outage of a free feature for no reason. Its usage caps now stay enforced when everything is healthy but step aside during a backend blip, so a prompt still returns your model. Nothing about paid features changed: those still stop safely if the same backend is unavailable. `[fix]`
+- **The tour guide now turns to face wherever it walks** — The guide avatar in the product tour used to only tilt slightly left or right. Now it turns in every direction — facing left, right, toward you, or away — as it walks across the page to point at each feature, the same all-directions turning the robot already had in Walk, Stroll, and Platformer modes. It reads as a character genuinely walking to its next spot instead of sliding there. (`/tour`) `[improvement]`
- **three.ws 3D API: free text→3D + inspection for AI agents, with pro tiers** — One URL now discovers the whole free, keyless 3D API for agents. GET /api/3d returns every free endpoint — turn a text prompt into a real GLB (/api/3d/generate) and validate/optimize any glTF/GLB (/api/3d/inspect) — with a live example each, plus the paid ladder it graduates to. GET /api/3d/openapi.json is a real OpenAPI 3.1 spec generated straight from the catalog, so LangChain, openapi-generator, and Swagger UI get typed tools with no key and no account. A new docs page at /3d shows a hero, a live endpoint table, a runnable quickstart with a "run it live" inspection console, an embedded 3D viewer of a real model, and a clear free→paid path: free draft + inspect → Forge Pro quality tiers → animation-ready Rigged Avatars. No other agent-payments platform gives away 3D generation and inspection. (`/3d`) `[feature, docs]`
- **three.ws 3D Studio for the GPT Store — generate 3D models in ChatGPT, free** — You can now turn a text prompt into a real, downloadable 3D model right inside ChatGPT. The three.ws 3D Studio custom GPT is backed by a free, keyless REST endpoint — describe something like "a low-poly fox" or "a ceramic robot figurine" and get back a GLB you can open in Blender, Unity, Godot, or three.js, plus a browser viewer link. No account, no key, no cost. Every prompt is screened by a content-safety filter so it stays appropriate for all ages, and the model file is served from a public URL so it's easy to download and share. `[feature]`
- **three.ws 3D Studio prepped for the OpenAI ChatGPT App Directory** — We assembled the submission package for our free 3D Studio as a ChatGPT app: text-to-3D, avatars, and one-step rigged characters that render in an interactive viewer right in the chat — no account, no key, no payment. A full policy audit confirmed the app is crypto-free, collects no personal data, ships correct tool labels, and stays age-appropriate with a content-safety filter on every generation. `[docs, security]`
diff --git a/STRUCTURE.md b/STRUCTURE.md
index 4f1bd3046..3eae7661a 100644
--- a/STRUCTURE.md
+++ b/STRUCTURE.md
@@ -62,6 +62,7 @@ bottom.
| Trading Copilot (conversational) | client [src/agent-copilot.js](src/agent-copilot.js), hub tab [src/agent-wallet-hub/tabs/copilot.js](src/agent-wallet-hub/tabs/copilot.js), server [api/agents/copilot.js](api/agents/copilot.js) `→ POST /api/agents/:id/copilot` (SSE) | In-repo | Owner-only chat over an agent's Solana wallet: text/voice in, markdown replies, live **data cards** (portfolio, firewall, quote, smart-money, intel) and **confirm-before-execute** trade/limits cards. Read-only tools run server-side; state-changing intents return as proposals the browser re-quotes and runs through the existing spend guards + firewall + custody audit. Slash commands, copy/regenerate, localStorage persistence. See [docs/trading-copilot.md](docs/trading-copilot.md) |
| Real-funds risk acknowledgment | gate [public/risk-ack.js](public/risk-ack.js) `→ /legal/risk`, app wrapper [src/shared/risk-ack.js](src/shared/risk-ack.js), record endpoint [api/legal/risk-ack.js](api/legal/risk-ack.js), disclosure [public/legal/risk.html](public/legal/risk.html) | In-repo | Versioned, once-per-browser acceptance dialog every money-committing surface awaits before executing (trade, snipe, withdraw, swap, launch, x402, onramp — devnet exempt). Acceptances persist in `audit_log` (`risk-ack-accept`). See [docs/risk-acknowledgment.md](docs/risk-acknowledgment.md) |
| Global markets + coin detail pages | [pages/coins.html](pages/coins.html) + [src/coins-index.js](src/coins-index.js) `→ /coins`, [pages/coin.html](pages/coin.html) + [src/coin-page.js](src/coin-page.js) `→ /coin/:id`, backend [api/coin/](api/coin) (detail, ohlc, markets, news, global over [api/_lib/coingecko.js](api/_lib/coingecko.js)) | In-repo | CoinGecko-style markets index (global stats bar, sortable top-coins table, search, sparklines) + a rich detail page per coin (interactive chart, stats grid, related news, links). Design adopted from cryptocurrency.cv; accepts CoinGecko slugs or Solana mints. Docs: [docs/coin-pages.md](docs/coin-pages.md) |
+| Market tools (heatmap, sentiment, gas, compare) | [pages/heatmap.html](pages/heatmap.html) + [src/heatmap.js](src/heatmap.js) `→ /heatmap`, [pages/fear-greed.html](pages/fear-greed.html) + [src/fear-greed.js](src/fear-greed.js) `→ /fear-greed`, [pages/gas.html](pages/gas.html) + [src/gas.js](src/gas.js) `→ /gas`, [pages/compare.html](pages/compare.html) + [src/compare.js](src/compare.js) `→ /compare`; backend [api/coin/fear-greed.js](api/coin/fear-greed.js), [api/coin/gas.js](api/coin/gas.js) | In-repo | Four tools extending Markets, same design system: treemap heatmap (market-cap-sized tiles), Fear & Greed gauge + history, live Ethereum gas tracker (keyless `eth_feeHistory`), and up-to-4-coin compare (overlay perf + stats). All real key-free data; cross-linked from the markets table. Docs: [docs/coin-pages.md](docs/coin-pages.md) |
## npm workspaces
diff --git a/api/coin/fear-greed.js b/api/coin/fear-greed.js
new file mode 100644
index 000000000..435db5f44
--- /dev/null
+++ b/api/coin/fear-greed.js
@@ -0,0 +1,93 @@
+// GET /api/coin/fear-greed?limit=<1..365>
+// ---------------------------------------------------------------------------
+// The Crypto Fear & Greed index — current reading plus history for the
+// /fear-greed page. Proxies alternative.me /fng (the standard free source,
+// already used by /api/coin/global) and returns the latest value with its
+// classification, plus a chronological [{ ts, value, label }] history for the
+// chart. Cached 5 min in-memory + CDN.
+
+import { cors, json, method, wrap, error, rateLimited } from '../_lib/http.js';
+import { limits, clientIp } from '../_lib/rate-limit.js';
+
+const FNG_BASE = 'https://api.alternative.me/fng/';
+
+// One tiny per-instance cache keyed by limit shields the upstream from
+// concurrent cold-instance misses; CDN absorbs the rest.
+const _cache = new Map(); // limit → { value, expiresAt }
+const TTL_MS = 300_000;
+
+function classify(v) {
+ if (v <= 25) return 'Extreme Fear';
+ if (v <= 45) return 'Fear';
+ if (v <= 55) return 'Neutral';
+ if (v <= 75) return 'Greed';
+ return 'Extreme Greed';
+}
+
+async function fetchFng(limit) {
+ const now = Date.now();
+ const hit = _cache.get(limit);
+ if (hit && hit.expiresAt > now) return hit.value;
+
+ const resp = await fetch(`${FNG_BASE}?limit=${limit}&format=json`, {
+ headers: { accept: 'application/json', 'user-agent': 'three.ws/1.0' },
+ signal: AbortSignal.timeout(8000),
+ });
+ if (!resp.ok) {
+ const err = new Error(`fng ${resp.status}`);
+ err.status = resp.status;
+ throw err;
+ }
+ const raw = await resp.json();
+ const rows = Array.isArray(raw?.data) ? raw.data : [];
+ // alternative.me returns newest-first; the chart wants oldest→newest.
+ const history = rows
+ .map((d) => {
+ const value = Number(d.value);
+ const ts = Number(d.timestamp) * 1000;
+ if (!Number.isFinite(value) || !Number.isFinite(ts)) return null;
+ return { ts, value, label: d.value_classification || classify(value) };
+ })
+ .filter(Boolean)
+ .sort((a, b) => a.ts - b.ts);
+ if (!history.length) throw new Error('empty fng payload');
+
+ const latest = history[history.length - 1];
+ // A 7-day-ago comparison point powers the "vs last week" delta.
+ const weekAgo = history.length > 7 ? history[Math.max(0, history.length - 8)] : history[0];
+ const value = {
+ current: { value: latest.value, label: latest.label, ts: latest.ts },
+ previous_week: weekAgo
+ ? { value: weekAgo.value, label: weekAgo.label, ts: weekAgo.ts }
+ : null,
+ history,
+ };
+ _cache.set(limit, { value, expiresAt: now + TTL_MS });
+ if (_cache.size > 8) _cache.delete(_cache.keys().next().value);
+ return value;
+}
+
+export default wrap(async (req, res) => {
+ if (cors(req, res, { methods: 'GET,OPTIONS', origins: '*' })) return;
+ if (!method(req, res, ['GET'])) return;
+
+ const rl = await limits.publicIp(clientIp(req));
+ if (!rl.success) return rateLimited(res, rl);
+
+ const params = new URL(req.url, 'http://x').searchParams;
+ const limit = Math.min(Math.max(1, parseInt(params.get('limit') || '90', 10) || 90), 365);
+
+ try {
+ const payload = await fetchFng(limit);
+ return json(res, 200, payload, {
+ 'cache-control': 'public, max-age=120, s-maxage=300, stale-while-revalidate=900',
+ });
+ } catch {
+ return error(
+ res,
+ 502,
+ 'upstream_error',
+ 'the Fear & Greed index is unavailable right now — retry shortly',
+ );
+ }
+});
diff --git a/api/coin/gas.js b/api/coin/gas.js
new file mode 100644
index 000000000..84e2ca293
--- /dev/null
+++ b/api/coin/gas.js
@@ -0,0 +1,159 @@
+// GET /api/coin/gas
+// ---------------------------------------------------------------------------
+// Live Ethereum gas oracle for the /gas page. Computes three fee tiers
+// (slow / standard / fast) from real on-chain data — no third-party gas API,
+// no key. It reads eth_feeHistory over the last ~20 blocks from a public RPC
+// (with failover) and derives each tier as base fee + a priority-fee
+// percentile (25th / 50th / 90th). Adds USD cost estimates for common actions
+// using the live ETH price from CoinGecko. Cached 15s in-memory + CDN.
+
+import { cors, json, method, wrap, error, rateLimited } from '../_lib/http.js';
+import { limits, clientIp } from '../_lib/rate-limit.js';
+import { geckoFetch } from '../_lib/coingecko.js';
+
+// Keyless public JSON-RPC endpoints, tried in order until one answers.
+const RPCS = [
+ 'https://ethereum-rpc.publicnode.com',
+ 'https://eth.llamarpc.com',
+ 'https://rpc.ankr.com/eth',
+ 'https://cloudflare-eth.com',
+];
+
+// Gas units for the actions we price. Transfer is exact (21000); the rest are
+// representative typical costs so the USD figures are grounded, not invented.
+const ACTIONS = [
+ { key: 'transfer', label: 'ETH transfer', gas: 21_000 },
+ { key: 'erc20', label: 'Token transfer', gas: 65_000 },
+ { key: 'swap', label: 'DEX swap', gas: 150_000 },
+ { key: 'nft', label: 'NFT mint', gas: 200_000 },
+];
+
+let _cache = null; // { value, expiresAt }
+const TTL_MS = 15_000;
+
+const hexToNum = (h) => (typeof h === 'string' ? parseInt(h, 16) : Number(h));
+const weiToGwei = (wei) => wei / 1e9;
+
+async function rpc(url, method, params) {
+ const resp = await fetch(url, {
+ method: 'POST',
+ headers: { 'content-type': 'application/json', accept: 'application/json' },
+ body: JSON.stringify({ jsonrpc: '2.0', id: 1, method, params }),
+ signal: AbortSignal.timeout(6000),
+ });
+ if (!resp.ok) throw new Error(`rpc ${resp.status}`);
+ const body = await resp.json();
+ if (body.error) throw new Error(body.error.message || 'rpc error');
+ return body.result;
+}
+
+// Try each RPC until one returns a fee history; the first healthy provider wins.
+async function feeHistory() {
+ let lastErr;
+ for (const url of RPCS) {
+ try {
+ // 20 blocks, priority-fee percentiles for slow/standard/fast tiers.
+ const fh = await rpc(url, 'eth_feeHistory', ['0x14', 'latest', [25, 50, 90]]);
+ if (fh?.baseFeePerGas?.length && fh?.reward?.length) return fh;
+ } catch (err) {
+ lastErr = err;
+ }
+ }
+ throw lastErr || new Error('all RPCs failed');
+}
+
+function computeTiers(fh) {
+ const baseFees = fh.baseFeePerGas.map(hexToNum).filter(Number.isFinite);
+ // Pending block's projected base fee is the last entry feeHistory returns.
+ const baseFee = baseFees[baseFees.length - 1];
+
+ // Median each percentile column across the sampled blocks — resistant to a
+ // single spiky block skewing a tier.
+ const cols = [[], [], []];
+ for (const row of fh.reward) {
+ if (!Array.isArray(row)) continue;
+ row.forEach((v, i) => {
+ const n = hexToNum(v);
+ if (Number.isFinite(n) && i < 3) cols[i].push(n);
+ });
+ }
+ const median = (arr) => {
+ if (!arr.length) return 0;
+ const s = [...arr].sort((a, b) => a - b);
+ const m = Math.floor(s.length / 2);
+ return s.length % 2 ? s[m] : (s[m - 1] + s[m]) / 2;
+ };
+ const priorities = cols.map(median);
+
+ const tiers = ['slow', 'standard', 'fast'].map((key, i) => {
+ const priority = priorities[i];
+ const total = baseFee + priority;
+ return {
+ key,
+ base_fee_gwei: weiToGwei(baseFee),
+ priority_fee_gwei: weiToGwei(priority),
+ gas_price_gwei: weiToGwei(total),
+ gas_price_wei: total,
+ };
+ });
+ return { baseFeeGwei: weiToGwei(baseFee), tiers };
+}
+
+async function build() {
+ const now = Date.now();
+ if (_cache && _cache.expiresAt > now) return _cache.value;
+
+ const [fhResult, priceResult] = await Promise.allSettled([
+ feeHistory(),
+ geckoFetch('/simple/price?ids=ethereum&vs_currencies=usd', { ttlMs: 60_000 }),
+ ]);
+ if (fhResult.status !== 'fulfilled') throw fhResult.reason || new Error('no fee history');
+
+ const { baseFeeGwei, tiers } = computeTiers(fhResult.value);
+ const ethUsd =
+ priceResult.status === 'fulfilled' ? Number(priceResult.value?.ethereum?.usd) : null;
+ const ethPrice = Number.isFinite(ethUsd) ? ethUsd : null;
+
+ // Cost per action = gasPrice(gwei) × 1e-9 ETH/gwei × gasUnits × ETH price.
+ const withCosts = tiers.map((t) => ({
+ ...t,
+ actions: ACTIONS.map((a) => ({
+ key: a.key,
+ label: a.label,
+ gas: a.gas,
+ usd: ethPrice != null ? t.gas_price_gwei * 1e-9 * a.gas * ethPrice : null,
+ })),
+ }));
+
+ const value = {
+ tiers: withCosts,
+ base_fee_gwei: baseFeeGwei,
+ eth_price_usd: ethPrice,
+ actions: ACTIONS.map((a) => ({ key: a.key, label: a.label, gas: a.gas })),
+ updated_at: now,
+ };
+ _cache = { value, expiresAt: now + TTL_MS };
+ return value;
+}
+
+export default wrap(async (req, res) => {
+ if (cors(req, res, { methods: 'GET,OPTIONS', origins: '*' })) return;
+ if (!method(req, res, ['GET'])) return;
+
+ const rl = await limits.publicIp(clientIp(req));
+ if (!rl.success) return rateLimited(res, rl);
+
+ try {
+ const payload = await build();
+ return json(res, 200, payload, {
+ 'cache-control': 'public, max-age=10, s-maxage=15, stale-while-revalidate=60',
+ });
+ } catch {
+ return error(
+ res,
+ 502,
+ 'upstream_error',
+ 'gas data is unavailable right now — retry shortly',
+ );
+ }
+});
diff --git a/data/changelog.json b/data/changelog.json
index be608a1ae..ad204297a 100644
--- a/data/changelog.json
+++ b/data/changelog.json
@@ -1,6 +1,24 @@
{
"$comment": "Curated changelog entries for three.ws — the editorial layer of the public changelog. New PAGE launches are tracked automatically via the `added` field in data/pages.json; this file is for everything else holders care about: improvements, fixes, SDK releases, trading/payments capabilities, security work. scripts/build-page-index.mjs merges both sources into CHANGELOG.md, public/changelog.json, and public/changelog.xml. Newest first. Allowed tags: feature, improvement, fix, sdk, infra, docs, security. `link` is optional and must be a live three.ws path.",
"entries": [
+ {
+ "date": "2026-07-07",
+ "title": "Markets grows a full toolkit — Heatmap, Fear & Greed, Gas Tracker, and Compare",
+ "summary": "The Markets surface is now four tools bigger. Heatmap shows the whole market in one view — every coin a tile sized by market cap and colored by its price move. Fear & Greed puts market sentiment on a live gauge with full history. The Gas Tracker reads Ethereum fees straight from the chain, in gwei and in dollars, for transfers, swaps, and NFT mints. Compare lines up to four coins head to head — overlaying performance and every key stat, with a shareable URL. All live data, all free, all cross-linked from the markets table.",
+ "tags": [
+ "feature"
+ ],
+ "link": "/heatmap"
+ },
+ {
+ "date": "2026-07-07",
+ "title": "The tour guide now turns to face wherever it walks",
+ "summary": "The guide avatar in the product tour used to only tilt slightly left or right. Now it turns in every direction — facing left, right, toward you, or away — as it walks across the page to point at each feature, the same all-directions turning the robot already had in Walk, Stroll, and Platformer modes. It reads as a character genuinely walking to its next spot instead of sliding there.",
+ "tags": [
+ "improvement"
+ ],
+ "link": "/tour"
+ },
{
"date": "2026-07-07",
"title": "three.ws moved to Google Cloud — faster, sturdier, and shutdown-proof",
diff --git a/data/pages.json b/data/pages.json
index f5c003d4c..b3ed24c51 100644
--- a/data/pages.json
+++ b/data/pages.json
@@ -1130,6 +1130,38 @@
"changefreq": "hourly",
"added": "2026-07-04"
},
+ {
+ "path": "/heatmap",
+ "title": "Crypto Market Heatmap",
+ "description": "A live market heatmap of the top cryptocurrencies: every tile is a coin, sized by market cap and colored by its 24h or 7d price move. See where money is flowing across the whole market at a glance, then click any tile for its full profile.",
+ "priority": 0.7,
+ "changefreq": "hourly",
+ "added": "2026-07-07"
+ },
+ {
+ "path": "/fear-greed",
+ "title": "Crypto Fear & Greed Index",
+ "description": "The Crypto Fear & Greed Index — live market sentiment from 0 (Extreme Fear) to 100 (Extreme Greed), shown on a gauge with a week-over-week delta, a full interactive history chart, and a labelled scale explaining what each reading means.",
+ "priority": 0.7,
+ "changefreq": "daily",
+ "added": "2026-07-07"
+ },
+ {
+ "path": "/gas",
+ "title": "Ethereum Gas Tracker",
+ "description": "Live Ethereum gas fees straight from the chain — slow, standard, and fast tiers in gwei with USD cost estimates for transfers, token sends, DEX swaps, and NFT mints. Real on-chain fee history, refreshed automatically, no API key required.",
+ "priority": 0.7,
+ "changefreq": "always",
+ "added": "2026-07-07"
+ },
+ {
+ "path": "/compare",
+ "title": "Compare Crypto Side by Side",
+ "description": "Compare cryptocurrencies head to head — overlay normalized price performance and line up market cap, volume, FDV, supply, and all-time-high stats for up to four coins at once. The selection is saved to the URL so any matchup is shareable.",
+ "priority": 0.7,
+ "changefreq": "hourly",
+ "added": "2026-07-07"
+ },
{
"path": "/constellation",
"title": "watsonx Constellation",
diff --git a/docs/api-reference.md b/docs/api-reference.md
index a23c3f2a3..373ef01af 100644
--- a/docs/api-reference.md
+++ b/docs/api-reference.md
@@ -1493,6 +1493,65 @@ half may be `null` if its upstream is briefly unavailable.
---
+### Fear & Greed index
+
+```
+GET /api/coin/fear-greed?limit=<1..365>
+```
+
+Powers the `/fear-greed` page. `limit` (default 90) sets how many days of
+history to return.
+
+**Response**
+
+```json
+{
+ "current": { "value": 0, "label": "…", "ts": 0 },
+ "previous_week": { "value": 0, "label": "…", "ts": 0 },
+ "history": [{ "ts": 0, "value": 0, "label": "…" }]
+}
+```
+
+`history` is chronological (oldest → newest); `value` is 0–100 and `label` is
+one of Extreme Fear / Fear / Neutral / Greed / Extreme Greed. Source:
+alternative.me. Cached 5 min.
+
+---
+
+### Ethereum gas
+
+```
+GET /api/coin/gas
+```
+
+Powers the `/gas` page. Reads `eth_feeHistory` over the last ~20 blocks from a
+public Ethereum RPC (failover across four providers) and derives three fee tiers
+plus USD cost estimates from the live ETH price.
+
+**Response**
+
+```json
+{
+ "tiers": [
+ {
+ "key": "slow|standard|fast",
+ "base_fee_gwei": 0, "priority_fee_gwei": 0,
+ "gas_price_gwei": 0, "gas_price_wei": 0,
+ "actions": [{ "key": "transfer", "label": "ETH transfer", "gas": 21000, "usd": 0 }]
+ }
+ ],
+ "base_fee_gwei": 0,
+ "eth_price_usd": 0,
+ "actions": [{ "key": "transfer", "label": "ETH transfer", "gas": 21000 }],
+ "updated_at": 0
+}
+```
+
+`usd` is `null` if the ETH price is briefly unavailable (gwei figures stay
+live). Cached 15 s — no API key required.
+
+---
+
### Related news
```
diff --git a/docs/coin-pages.md b/docs/coin-pages.md
index 9d06915ff..575567ae2 100644
--- a/docs/coin-pages.md
+++ b/docs/coin-pages.md
@@ -46,6 +46,48 @@ editorial serif headings, hairline borders, mono numerals, light/dark themes.
Unknown ids, upstream outages, loading, and empty news all have designed
states — the page never renders a blank void.
+## The market tools
+
+Four more surfaces extend Markets, all sharing the same design system
+([`src/coin-pages.css`](../src/coin-pages.css)) and real, key-free data. Every
+one cross-links back into the markets table and the coin detail pages.
+
+### `/heatmap` — market heatmap
+
+Every top coin as a tile in a squarified treemap, **sized by market cap** and
+**colored by its price move** (green up, red down, brightness scaling with the
+move). Toggle the color between 24h and 7d, and the set between top 50 and top
+100. Hover any tile for a price · 24h · 7d · market-cap tooltip; click it to open
+the coin's detail page. The layout is computed client-side from the existing
+`/api/coin/markets` feed — no extra endpoint.
+
+### `/fear-greed` — Fear & Greed index
+
+The market's mood as a single 0–100 score on a live semicircle **gauge**, with a
+week-over-week delta and its classification (Extreme Fear → Extreme Greed). Below
+it, an **interactive history chart** (30D / 90D / 1Y) with a crosshair tooltip,
+and a labelled scale. Data is the alternative.me index — the same source the
+`/coins` stats bar uses — served through `/api/coin/fear-greed`.
+
+### `/gas` — Ethereum gas tracker
+
+Live Ethereum gas in three tiers (**slow / standard / fast**), each in gwei with
+a USD cost estimate, plus a cost-by-action table (ETH transfer, token transfer,
+DEX swap, NFT mint). The page auto-refreshes every 15s and pauses when the tab is
+hidden. Fees are read straight from the chain — `/api/coin/gas` calls
+`eth_feeHistory` on a public RPC (with failover across four providers) and prices
+each tier with the live ETH price. No third-party gas API, no key.
+
+### `/compare` — side-by-side comparison
+
+Up to four coins head to head: an **overlay chart** of normalized price
+performance (% change from the window start) over 7D / 30D / 90D / 1Y with a
+multi-series crosshair, and a **stats table** lining up price, 24h/7d/30d change,
+market cap, volume, FDV, supply, and all-time high — the best value per row
+highlighted. Add coins with the search type-ahead; the selection is mirrored to
+`?ids=…` so any matchup is a shareable link. Reuses `/api/coin/markets` (search),
+`/api/coin/detail`, and `/api/coin/ohlc` — no new endpoint.
+
## Where the data comes from
All data is real and fetched at runtime — nothing is hardcoded or sampled:
@@ -56,6 +98,8 @@ All data is real and fetched at runtime — nothing is hardcoded or sampled:
| `/api/coin/ohlc` | CoinGecko `/coins/{id}/market_chart` | 120 s |
| `/api/coin/markets` | CoinGecko `/coins/markets`, `/search` | 60 s / 300 s |
| `/api/coin/global` | CoinGecko `/global` + alternative.me Fear & Greed | 120 s |
+| `/api/coin/fear-greed` | alternative.me `/fng` (current + history) | 300 s |
+| `/api/coin/gas` | public Ethereum RPC `eth_feeHistory` + CoinGecko ETH price | 15 s |
| `/api/coin/news` | cryptocurrency.cv aggregator → first-party RSS fallback | 300 s |
Full request/response shapes: [api-reference.md → Coin Market Data API](api-reference.md#coin-market-data-api).
@@ -73,11 +117,15 @@ text before they reach the client.
|---|---|
| Markets page | [`pages/coins.html`](../pages/coins.html) + [`src/coins-index.js`](../src/coins-index.js) |
| Detail page | [`pages/coin.html`](../pages/coin.html) + [`src/coin-page.js`](../src/coin-page.js) |
+| Heatmap | [`pages/heatmap.html`](../pages/heatmap.html) + [`src/heatmap.js`](../src/heatmap.js) |
+| Fear & Greed | [`pages/fear-greed.html`](../pages/fear-greed.html) + [`src/fear-greed.js`](../src/fear-greed.js) |
+| Gas tracker | [`pages/gas.html`](../pages/gas.html) + [`src/gas.js`](../src/gas.js) |
+| Compare | [`pages/compare.html`](../pages/compare.html) + [`src/compare.js`](../src/compare.js) |
| Shared design system | [`src/coin-pages.css`](../src/coin-pages.css) (Source Serif 4 self-hosted in `public/fonts/`) |
| Shared formatters | [`src/shared/coin-format.js`](../src/shared/coin-format.js) — unit-tested in [`tests/coin-format.test.js`](../tests/coin-format.test.js) |
-| API proxies | [`api/coin/`](../api/coin) — `detail.js`, `ohlc.js`, `markets.js`, `global.js`, `news.js` |
+| API proxies | [`api/coin/`](../api/coin) — `detail.js`, `ohlc.js`, `markets.js`, `global.js`, `fear-greed.js`, `gas.js`, `news.js` |
-Routing: `vercel.json` rewrites `/coins` and `/coin/<id>` to the two pages in
-production; the Vite dev server mirrors both (including the dynamic
-`/coin/:id` path). The pre-existing `/coin` (no id) redirect to `/demo/coin`
-is untouched.
+Routing: `vercel.json` rewrites `/coins`, `/coin/<id>`, `/heatmap`,
+`/fear-greed`, `/gas`, and `/compare` to their pages in production; the Vite dev
+server mirrors each (including the dynamic `/coin/:id` path). The pre-existing
+`/coin` (no id) redirect to `/demo/coin` is untouched.
diff --git a/pages/compare.html b/pages/compare.html
new file mode 100644
index 000000000..ff0b993a0
--- /dev/null
+++ b/pages/compare.html
@@ -0,0 +1,128 @@
+<!doctype html>
+<html lang="en" class="cv-page">
+ <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" />
+ <title>Compare Coins · three.ws</title>
+ <meta
+ name="description"
+ content="Compare cryptocurrencies side by side — overlay price performance and line up market cap, volume, supply, and all-time-high stats for up to four coins at once."
+ />
+ <meta property="og:type" content="website" />
+ <meta property="og:site_name" content="three.ws" />
+ <meta property="og:url" content="https://three.ws/compare" />
+ <meta property="og:title" content="Compare Coins · three.ws" />
+ <meta
+ property="og:description"
+ content="Overlay price performance and line up market cap, volume, supply, and ATH stats for up to four coins at once."
+ />
+ <meta
+ property="og:image"
+ content="https://three.ws/api/page-og?s=crypto&amp;t=Compare+Crypto+Side+by+Side&amp;d=Overlay+price+performance+and+line+up+market+cap%2C+volume%2C+supply%2C+and+ATH+stats+for+up+to+four+coins.&amp;p=%2Fcompare"
+ />
+ <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:site" content="@trythreews" />
+ <meta name="twitter:title" content="Compare Coins · three.ws" />
+ <meta
+ name="twitter:description"
+ content="Overlay price performance and line up market cap, volume, supply, and ATH stats for up to four coins at once."
+ />
+ <meta
+ name="twitter:image"
+ content="https://three.ws/api/page-og?s=crypto&amp;t=Compare+Crypto+Side+by+Side&amp;d=Overlay+price+performance+and+line+up+market+cap%2C+volume%2C+supply%2C+and+ATH+stats+for+up+to+four+coins.&amp;p=%2Fcompare"
+ />
+ <meta name="theme-color" content="#09090b" />
+ <link rel="icon" href="/favicon.ico" sizes="any" />
+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
+ <link rel="apple-touch-icon" href="/apple-touch-icon.png" />
+ <link rel="manifest" href="/site.webmanifest" />
+ <link rel="stylesheet" href="/fonts/fonts.css" />
+ <link rel="stylesheet" href="/nav.css" />
+ <link rel="stylesheet" href="/src/coin-pages.css" />
+ <link rel="stylesheet" href="/footer.css" />
+ <link rel="canonical" href="https://three.ws/compare" />
+ <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="Compare Crypto Side by Side — three.ws" />
+ </head>
+ <body>
+ <header><div id="nav-container"></div></header>
+ <script src="/nav.js"></script>
+
+ <main class="cv-container">
+ <nav class="cv-crumbs" aria-label="Breadcrumb">
+ <a href="/coins">Markets</a><span class="sep">/</span
+ ><span class="here">Compare</span>
+ </nav>
+ <h1 class="cv-h1">Compare Coins</h1>
+ <p class="cv-sub">
+ Put up to four coins head to head — overlay how they've performed and line up the
+ numbers that matter. Add coins with the search box; the URL updates so you can share
+ the matchup.
+ </p>
+
+ <div class="cmp-picker">
+ <div class="cv-search" id="cmp-search" style="max-width: 24rem">
+ <span class="mag" aria-hidden="true">
+ <svg
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ stroke-width="2"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ >
+ <circle cx="11" cy="11" r="8" />
+ <path d="m21 21-4.3-4.3" />
+ </svg>
+ </span>
+ <input
+ id="cmp-search-input"
+ type="search"
+ placeholder="Add a coin to compare…"
+ autocomplete="off"
+ spellcheck="false"
+ role="combobox"
+ aria-expanded="false"
+ aria-controls="cmp-search-pop"
+ aria-label="Search coins to add to the comparison"
+ />
+ <div id="cmp-search-pop" class="cv-search-pop" role="listbox" hidden></div>
+ </div>
+ <div class="cmp-chips" id="cmp-chips" aria-label="Selected coins"></div>
+ </div>
+
+ <!-- Overlay performance chart. Hydrated by src/compare.js. -->
+ <section
+ id="cmp-chart"
+ class="cv-section"
+ aria-label="Performance comparison"
+ ></section>
+
+ <!-- Side-by-side stats table. Hydrated by src/compare.js. -->
+ <section id="cmp-table" class="cv-section" aria-label="Statistics comparison"></section>
+ </main>
+
+ <script type="module" src="/src/compare.js"></script>
+ <script src="/brand.js" defer></script>
+ <div id="footer-container"></div>
+ <script src="/footer.js"></script>
+ </body>
+</html>
diff --git a/pages/fear-greed.html b/pages/fear-greed.html
new file mode 100644
index 000000000..00bb8c7bb
--- /dev/null
+++ b/pages/fear-greed.html
@@ -0,0 +1,100 @@
+<!doctype html>
+<html lang="en" class="cv-page">
+ <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" />
+ <title>Fear &amp; Greed Index · three.ws</title>
+ <meta
+ name="description"
+ content="The Crypto Fear & Greed Index — live market sentiment from 0 (Extreme Fear) to 100 (Extreme Greed), with a full historical chart and what each reading means."
+ />
+ <meta property="og:type" content="website" />
+ <meta property="og:site_name" content="three.ws" />
+ <meta property="og:url" content="https://three.ws/fear-greed" />
+ <meta property="og:title" content="Fear &amp; Greed Index · three.ws" />
+ <meta
+ property="og:description"
+ content="Live crypto market sentiment from 0 (Extreme Fear) to 100 (Extreme Greed), with a full historical chart."
+ />
+ <meta
+ property="og:image"
+ content="https://three.ws/api/page-og?s=crypto&amp;t=Crypto+Fear+%26+Greed+Index&amp;d=Live+market+sentiment+from+0+%28Extreme+Fear%29+to+100+%28Extreme+Greed%29+with+a+full+historical+chart.&amp;p=%2Ffear-greed"
+ />
+ <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:site" content="@trythreews" />
+ <meta name="twitter:title" content="Fear &amp; Greed Index · three.ws" />
+ <meta
+ name="twitter:description"
+ content="Live crypto market sentiment from 0 (Extreme Fear) to 100 (Extreme Greed), with a full historical chart."
+ />
+ <meta
+ name="twitter:image"
+ content="https://three.ws/api/page-og?s=crypto&amp;t=Crypto+Fear+%26+Greed+Index&amp;d=Live+market+sentiment+from+0+%28Extreme+Fear%29+to+100+%28Extreme+Greed%29+with+a+full+historical+chart.&amp;p=%2Ffear-greed"
+ />
+ <meta name="theme-color" content="#09090b" />
+ <link rel="icon" href="/favicon.ico" sizes="any" />
+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
+ <link rel="apple-touch-icon" href="/apple-touch-icon.png" />
+ <link rel="manifest" href="/site.webmanifest" />
+ <link rel="stylesheet" href="/fonts/fonts.css" />
+ <link rel="stylesheet" href="/nav.css" />
+ <link rel="stylesheet" href="/src/coin-pages.css" />
+ <link rel="stylesheet" href="/footer.css" />
+ <link rel="canonical" href="https://three.ws/fear-greed" />
+ <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="Crypto Fear & Greed Index — three.ws" />
+ </head>
+ <body>
+ <header><div id="nav-container"></div></header>
+ <script src="/nav.js"></script>
+
+ <main class="cv-container">
+ <nav class="cv-crumbs" aria-label="Breadcrumb">
+ <a href="/coins">Markets</a><span class="sep">/</span
+ ><span class="here">Fear &amp; Greed</span>
+ </nav>
+ <h1 class="cv-h1">Fear &amp; Greed Index</h1>
+ <p class="cv-sub">
+ One number for the mood of the crypto market — from 0 (Extreme Fear) to 100 (Extreme
+ Greed). Built from volatility, momentum, volume, social sentiment, and Bitcoin
+ dominance.
+ </p>
+
+ <!-- Current gauge + deltas. Hydrated by src/fear-greed.js. -->
+ <section
+ id="fg-now"
+ class="cv-section"
+ aria-label="Current Fear & Greed reading"
+ ></section>
+
+ <!-- Historical chart. Hydrated by src/fear-greed.js. -->
+ <section id="fg-chart" class="cv-section" aria-label="Fear & Greed history"></section>
+
+ <!-- Scale legend + explanation. -->
+ <section id="fg-legend" class="cv-section" aria-label="How to read the index"></section>
+ </main>
+
+ <script type="module" src="/src/fear-greed.js"></script>
+ <script src="/brand.js" defer></script>
+ <div id="footer-container"></div>
+ <script src="/footer.js"></script>
+ </body>
+</html>
diff --git a/pages/gas.html b/pages/gas.html
new file mode 100644
index 000000000..c2069c2ec
--- /dev/null
+++ b/pages/gas.html
@@ -0,0 +1,99 @@
+<!doctype html>
+<html lang="en" class="cv-page">
+ <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" />
+ <title>Ethereum Gas Tracker · three.ws</title>
+ <meta
+ name="description"
+ content="Live Ethereum gas fees — slow, standard, and fast tiers in gwei with USD cost estimates for transfers, swaps, and NFT mints. Real on-chain data, no API key."
+ />
+ <meta property="og:type" content="website" />
+ <meta property="og:site_name" content="three.ws" />
+ <meta property="og:url" content="https://three.ws/gas" />
+ <meta property="og:title" content="Ethereum Gas Tracker · three.ws" />
+ <meta
+ property="og:description"
+ content="Live Ethereum gas fees — slow, standard, and fast tiers in gwei with USD cost estimates for common actions."
+ />
+ <meta
+ property="og:image"
+ content="https://three.ws/api/page-og?s=crypto&amp;t=Ethereum+Gas+Tracker&amp;d=Live+gas+fees+in+gwei+with+USD+cost+estimates+for+transfers%2C+swaps%2C+and+NFT+mints.&amp;p=%2Fgas"
+ />
+ <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:site" content="@trythreews" />
+ <meta name="twitter:title" content="Ethereum Gas Tracker · three.ws" />
+ <meta
+ name="twitter:description"
+ content="Live Ethereum gas fees — slow, standard, and fast tiers in gwei with USD cost estimates for common actions."
+ />
+ <meta
+ name="twitter:image"
+ content="https://three.ws/api/page-og?s=crypto&amp;t=Ethereum+Gas+Tracker&amp;d=Live+gas+fees+in+gwei+with+USD+cost+estimates+for+transfers%2C+swaps%2C+and+NFT+mints.&amp;p=%2Fgas"
+ />
+ <meta name="theme-color" content="#09090b" />
+ <link rel="icon" href="/favicon.ico" sizes="any" />
+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
+ <link rel="apple-touch-icon" href="/apple-touch-icon.png" />
+ <link rel="manifest" href="/site.webmanifest" />
+ <link rel="stylesheet" href="/fonts/fonts.css" />
+ <link rel="stylesheet" href="/nav.css" />
+ <link rel="stylesheet" href="/src/coin-pages.css" />
+ <link rel="stylesheet" href="/footer.css" />
+ <link rel="canonical" href="https://three.ws/gas" />
+ <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="Ethereum Gas Tracker — three.ws" />
+ </head>
+ <body>
+ <header><div id="nav-container"></div></header>
+ <script src="/nav.js"></script>
+
+ <main class="cv-container">
+ <nav class="cv-crumbs" aria-label="Breadcrumb">
+ <a href="/coins">Markets</a><span class="sep">/</span><span class="here">Gas</span>
+ </nav>
+ <h1 class="cv-h1">Ethereum Gas Tracker</h1>
+ <p class="cv-sub">
+ Live gas prices straight from the chain — pick a speed, see what it costs. Fees
+ update every few seconds; the USD figures use the current ETH price.
+ </p>
+
+ <div class="gas-base" id="gas-base"></div>
+
+ <!-- Tier cards. Hydrated by src/gas.js. -->
+ <section id="gas-tiers" class="cv-section" aria-label="Gas fee tiers"></section>
+
+ <!-- Cost-by-action table. Hydrated by src/gas.js. -->
+ <section
+ id="gas-actions"
+ class="cv-section"
+ aria-label="Estimated cost by action"
+ ></section>
+
+ <p class="cv-updated" id="gas-updated"></p>
+ </main>
+
+ <script type="module" src="/src/gas.js"></script>
+ <script src="/brand.js" defer></script>
+ <div id="footer-container"></div>
+ <script src="/footer.js"></script>
+ </body>
+</html>
diff --git a/pages/heatmap.html b/pages/heatmap.html
new file mode 100644
index 000000000..2fedc097f
--- /dev/null
+++ b/pages/heatmap.html
@@ -0,0 +1,104 @@
+<!doctype html>
+<html lang="en" class="cv-page">
+ <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" />
+ <title>Crypto Heatmap · three.ws</title>
+ <meta
+ name="description"
+ content="A live market heatmap of the top cryptocurrencies — each tile sized by market cap and colored by its 24h or 7d move. See where money is flowing at a glance."
+ />
+ <meta property="og:type" content="website" />
+ <meta property="og:site_name" content="three.ws" />
+ <meta property="og:url" content="https://three.ws/heatmap" />
+ <meta property="og:title" content="Crypto Heatmap · three.ws" />
+ <meta
+ property="og:description"
+ content="A live market heatmap — each coin sized by market cap and colored by its price move. See where money is flowing at a glance."
+ />
+ <meta
+ property="og:image"
+ content="https://three.ws/api/page-og?s=crypto&amp;t=Crypto+Market+Heatmap&amp;d=Each+coin+sized+by+market+cap+and+colored+by+its+24h+move.+See+where+money+is+flowing+at+a+glance.&amp;p=%2Fheatmap"
+ />
+ <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:site" content="@trythreews" />
+ <meta name="twitter:title" content="Crypto Heatmap · three.ws" />
+ <meta
+ name="twitter:description"
+ content="A live market heatmap — each coin sized by market cap and colored by its price move."
+ />
+ <meta
+ name="twitter:image"
+ content="https://three.ws/api/page-og?s=crypto&amp;t=Crypto+Market+Heatmap&amp;d=Each+coin+sized+by+market+cap+and+colored+by+its+24h+move.+See+where+money+is+flowing+at+a+glance.&amp;p=%2Fheatmap"
+ />
+ <meta name="theme-color" content="#09090b" />
+ <link rel="icon" href="/favicon.ico" sizes="any" />
+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
+ <link rel="apple-touch-icon" href="/apple-touch-icon.png" />
+ <link rel="manifest" href="/site.webmanifest" />
+ <link rel="stylesheet" href="/fonts/fonts.css" />
+ <link rel="stylesheet" href="/nav.css" />
+ <link rel="stylesheet" href="/src/coin-pages.css" />
+ <link rel="stylesheet" href="/footer.css" />
+ <link rel="canonical" href="https://three.ws/heatmap" />
+ <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="Crypto Market Heatmap — three.ws" />
+ </head>
+ <body>
+ <header><div id="nav-container"></div></header>
+ <script src="/nav.js"></script>
+
+ <main class="cv-container">
+ <nav class="cv-crumbs" aria-label="Breadcrumb">
+ <a href="/coins">Markets</a><span class="sep">/</span
+ ><span class="here">Heatmap</span>
+ </nav>
+ <h1 class="cv-h1">Market Heatmap</h1>
+ <p class="cv-sub">
+ The whole market in one view — every tile is a coin, sized by market cap and colored
+ by its price move. Green is up, red is down. Click any tile for its full profile.
+ </p>
+
+ <div class="hm-toolbar">
+ <div class="hm-seg" role="group" aria-label="Color by timeframe" id="hm-timeframe">
+ <button type="button" data-key="change_24h" aria-pressed="true">24h</button>
+ <button type="button" data-key="change_7d" aria-pressed="false">7d</button>
+ </div>
+ <div class="hm-seg" role="group" aria-label="Number of coins" id="hm-count">
+ <button type="button" data-count="50" aria-pressed="true">Top 50</button>
+ <button type="button" data-count="100" aria-pressed="false">Top 100</button>
+ </div>
+ <div class="hm-legend" aria-hidden="true">
+ <span>−</span><span class="bar"></span><span>+</span>
+ </div>
+ </div>
+
+ <!-- Treemap. Hydrated by src/heatmap.js. -->
+ <section id="hm-grid" class="hm-grid" aria-label="Market heatmap"></section>
+ <p class="cv-updated" id="hm-updated"></p>
+ </main>
+
+ <script type="module" src="/src/heatmap.js"></script>
+ <script src="/brand.js" defer></script>
+ <div id="footer-container"></div>
+ <script src="/footer.js"></script>
+ </body>
+</html>
diff --git a/public/changelog.json b/public/changelog.json
index 625b2a3c0..0323904e0 100644
--- a/public/changelog.json
+++ b/public/changelog.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-07-07T17:59:25.742Z",
+ "generated_at": "2026-07-07T18:56:28.010Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json",
"site": {
"name": "three.ws",
@@ -16,6 +16,16 @@
"launch"
]
},
+ {
+ "date": "2026-07-07",
+ "type": "launch",
+ "title": "Compare Crypto Side by Side",
+ "summary": "Compare cryptocurrencies head to head — overlay normalized price performance and line up market cap, volume, FDV, supply, and all-time-high stats for up to four coins at once. The selection is saved to the URL so any matchup is shareable.",
+ "link": "/compare",
+ "tags": [
+ "launch"
+ ]
+ },
{
"date": "2026-07-07",
"type": "launch",
@@ -26,6 +36,26 @@
"launch"
]
},
+ {
+ "date": "2026-07-07",
+ "type": "launch",
+ "title": "Crypto Fear & Greed Index",
+ "summary": "The Crypto Fear & Greed Index — live market sentiment from 0 (Extreme Fear) to 100 (Extreme Greed), shown on a gauge with a week-over-week delta, a full interactive history chart, and a labelled scale explaining what each reading means.",
+ "link": "/fear-greed",
+ "tags": [
+ "launch"
+ ]
+ },
+ {
+ "date": "2026-07-07",
+ "type": "launch",
+ "title": "Crypto Market Heatmap",
+ "summary": "A live market heatmap of the top cryptocurrencies: every tile is a coin, sized by market cap and colored by its 24h or 7d price move. See where money is flowing across the whole market at a glance, then click any tile for its full profile.",
+ "link": "/heatmap",
+ "tags": [
+ "launch"
+ ]
+ },
{
"date": "2026-07-07",
"type": "launch",
@@ -66,6 +96,16 @@
"launch"
]
},
+ {
+ "date": "2026-07-07",
+ "type": "launch",
+ "title": "Ethereum Gas Tracker",
+ "summary": "Live Ethereum gas fees straight from the chain — slow, standard, and fast tiers in gwei with USD cost estimates for transfers, token sends, DEX swaps, and NFT mints. Real on-chain fee history, refreshed automatically, no API key required.",
+ "link": "/gas",
+ "tags": [
+ "launch"
+ ]
+ },
{
"date": "2026-07-07",
"type": "update",
@@ -286,6 +326,16 @@
"improvement"
]
},
+ {
+ "date": "2026-07-07",
+ "type": "update",
+ "title": "Markets grows a full toolkit — Heatmap, Fear & Greed, Gas Tracker, and Compare",
+ "summary": "The Markets surface is now four tools bigger. Heatmap shows the whole market in one view — every coin a tile sized by market cap and colored by its price move. Fear & Greed puts market sentiment on a live gauge with full history. The Gas Tracker reads Ethereum fees straight from the chain, in gwei and in dollars, for transfers, swaps, and NFT mints. Compare lines up to four coins head to head — overlaying performance and every key stat, with a shareable URL. All live data, all free, all cross-linked from the markets table.",
+ "link": "/heatmap",
+ "tags": [
+ "feature"
+ ]
+ },
{
"date": "2026-07-07",
"type": "update",
@@ -442,6 +492,16 @@
"fix"
]
},
+ {
+ "date": "2026-07-07",
+ "type": "update",
+ "title": "The tour guide now turns to face wherever it walks",
+ "summary": "The guide avatar in the product tour used to only tilt slightly left or right. Now it turns in every direction — facing left, right, toward you, or away — as it walks across the page to point at each feature, the same all-directions turning the robot already had in Walk, Stroll, and Platformer modes. It reads as a character genuinely walking to its next spot instead of sliding there.",
+ "link": "/tour",
+ "tags": [
+ "improvement"
+ ]
+ },
{
"date": "2026-07-07",
"type": "update",
diff --git a/public/changelog.xml b/public/changelog.xml
index d30c41fb3..5008c1322 100644
--- a/public/changelog.xml
+++ b/public/changelog.xml
@@ -14,6 +14,14 @@
<category>launch</category>
<description>Free, keyless 3D API for AI agents: turn a text prompt into a real GLB model and validate/optimize any glTF/GLB, all from one URL with a live OpenAPI 3.1 spec. Free draft generation and inspection graduate to paid Forge Pro quality tiers and animation-ready Rigged Avatars. No key, no account.</description>
</item>
+ <item>
+ <title>Compare Crypto Side by Side</title>
+ <link>https://three.ws/compare</link>
+ <guid isPermaLink="false">2026-07-07:Compare Crypto Side by Side</guid>
+ <pubDate>Tue, 07 Jul 2026 12:00:00 GMT</pubDate>
+ <category>launch</category>
+ <description>Compare cryptocurrencies head to head — overlay normalized price performance and line up market cap, volume, FDV, supply, and all-time-high stats for up to four coins at once. The selection is saved to the URL so any matchup is shareable.</description>
+ </item>
<item>
<title>Crypto Data API</title>
<link>https://three.ws/crypto</link>
@@ -22,6 +30,22 @@
<category>launch</category>
<description>Free, keyless crypto data for AI agents in one API: token snapshots, security/rug signals, holder concentration, live pump.fun launches, bonding-curve status, whale activity, trending tokens, wallet portfolios and ticker-availability checks. No key, no account, no paywall.</description>
</item>
+ <item>
+ <title>Crypto Fear &amp; Greed Index</title>
+ <link>https://three.ws/fear-greed</link>
+ <guid isPermaLink="false">2026-07-07:Crypto Fear &amp; Greed Index</guid>
+ <pubDate>Tue, 07 Jul 2026 12:00:00 GMT</pubDate>
+ <category>launch</category>
+ <description>The Crypto Fear &amp; Greed Index — live market sentiment from 0 (Extreme Fear) to 100 (Extreme Greed), shown on a gauge with a week-over-week delta, a full interactive history chart, and a labelled scale explaining what each reading means.</description>
+ </item>
+ <item>
+ <title>Crypto Market Heatmap</title>
+ <link>https://three.ws/heatmap</link>
+ <guid isPermaLink="false">2026-07-07:Crypto Market Heatmap</guid>
+ <pubDate>Tue, 07 Jul 2026 12:00:00 GMT</pubDate>
+ <category>launch</category>
+ <description>A live market heatmap of the top cryptocurrencies: every tile is a coin, sized by market cap and colored by its 24h or 7d price move. See where money is flowing across the whole market at a glance, then click any tile for its full profile.</description>
+ </item>
<item>
<title>Docs · Crypto Data API</title>
<link>https://three.ws/docs/crypto-api</link>
@@ -54,6 +78,14 @@
<category>launch</category>
<description>A free test bench for x402 developers — echo your payment envelope, debug a failed 402 exchange, and verify a receipt's attestation and settlement against a live server, all without spending anything.</description>
</item>
+ <item>
+ <title>Ethereum Gas Tracker</title>
+ <link>https://three.ws/gas</link>
+ <guid isPermaLink="false">2026-07-07:Ethereum Gas Tracker</guid>
+ <pubDate>Tue, 07 Jul 2026 12:00:00 GMT</pubDate>
+ <category>launch</category>
+ <description>Live Ethereum gas fees straight from the chain — slow, standard, and fast tiers in gwei with USD cost estimates for transfers, token sends, DEX swaps, and NFT mints. Real on-chain fee history, refreshed automatically, no API key required.</description>
+ </item>
<item>
<title>3D model inspection is now free</title>
<link>https://three.ws/changelog</link>
@@ -222,6 +254,14 @@
<category>feature</category>
<description>Your agent can now discover a specialist agent, check its on-chain reputation, pay it in USDC, hand off the task, and get the result back with a full receipt — who it hired, the reputation behind the choice, exactly what it cost, and the on-chain settlement reference. The agent_hire_discover tool ranks candidates by task fit, ERC-8004 reputation and real engagement; agent_hire runs the whole thing end to end and renders an inline provenance receipt card. Hard spend guardrails protect you throughout: a per-call cap, a per-session budget, and a confirmation prompt for anything above a threshold — and a blocked or failed hire is never charged. Discovery no longer comes up empty on a plain-language request, and paid hires now complete against a live agent.</description>
</item>
+ <item>
+ <title>Markets grows a full toolkit — Heatmap, Fear &amp; Greed, Gas Tracker, and Compare</title>
+ <link>https://three.ws/heatmap</link>
+ <guid isPermaLink="false">2026-07-07:Markets grows a full toolkit — Heatmap, Fear &amp; Greed, Gas Tracker, and Compare</guid>
+ <pubDate>Tue, 07 Jul 2026 12:00:00 GMT</pubDate>
+ <category>feature</category>
+ <description>The Markets surface is now four tools bigger. Heatmap shows the whole market in one view — every coin a tile sized by market cap and colored by its price move. Fear &amp; Greed puts market sentiment on a live gauge with full history. The Gas Tracker reads Ethereum fees straight from the chain, in gwei and in dollars, for transfers, swaps, and NFT mints. Compare lines up to four coins head to head — overlaying performance and every key stat, with a shareable URL. All live data, all free, all cross-linked from the markets table.</description>
+ </item>
<item>
<title>Mint a generated 3D avatar as an on-chain Solana NFT — with a live 3D viewer as its media</title>
<link>https://three.ws/changelog</link>
@@ -342,6 +382,14 @@
<category>fix</category>
<description>The free 3D Studio generates entirely on no-cost engines, so there's no spend to protect by shutting it off. We fixed a case where a hiccup in the rate-limiting backend could make the studio refuse every generation with a &quot;try again shortly&quot; — an outage of a free feature for no reason. Its usage caps now stay enforced when everything is healthy but step aside during a backend blip, so a prompt still returns your model. Nothing about paid features changed: those still stop safely if the same backend is unavailable.</description>
</item>
+ <item>
+ <title>The tour guide now turns to face wherever it walks</title>
+ <link>https://three.ws/tour</link>
+ <guid isPermaLink="false">2026-07-07:The tour guide now turns to face wherever it walks</guid>
+ <pubDate>Tue, 07 Jul 2026 12:00:00 GMT</pubDate>
+ <category>improvement</category>
+ <description>The guide avatar in the product tour used to only tilt slightly left or right. Now it turns in every direction — facing left, right, toward you, or away — as it walks across the page to point at each feature, the same all-directions turning the robot already had in Walk, Stroll, and Platformer modes. It reads as a character genuinely walking to its next spot instead of sliding there.</description>
+ </item>
<item>
<title>three.ws 3D API: free text→3D + inspection for AI agents, with pro tiers</title>
<link>https://three.ws/3d</link>
diff --git a/public/features.json b/public/features.json
index a540f9293..d33bc226f 100644
--- a/public/features.json
+++ b/public/features.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-07-07T17:59:25.728Z",
+ "generated_at": "2026-07-07T18:56:27.998Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json",
"site": {
"name": "three.ws",
@@ -1386,6 +1386,46 @@
"tags": [],
"showcase": false
},
+ {
+ "path": "/heatmap",
+ "title": "Crypto Market Heatmap",
+ "description": "A live market heatmap of the top cryptocurrencies: every tile is a coin, sized by market cap and colored by its 24h or 7d price move. See where money is flowing across the whole market at a glance, then click any tile for its full profile.",
+ "added": "2026-07-07",
+ "auth": null,
+ "indexable": true,
+ "tags": [],
+ "showcase": false
+ },
+ {
+ "path": "/fear-greed",
+ "title": "Crypto Fear & Greed Index",
+ "description": "The Crypto Fear & Greed Index — live market sentiment from 0 (Extreme Fear) to 100 (Extreme Greed), shown on a gauge with a week-over-week delta, a full interactive history chart, and a labelled scale explaining what each reading means.",
+ "added": "2026-07-07",
+ "auth": null,
+ "indexable": true,
+ "tags": [],
+ "showcase": false
+ },
+ {
+ "path": "/gas",
+ "title": "Ethereum Gas Tracker",
+ "description": "Live Ethereum gas fees straight from the chain — slow, standard, and fast tiers in gwei with USD cost estimates for transfers, token sends, DEX swaps, and NFT mints. Real on-chain fee history, refreshed automatically, no API key required.",
+ "added": "2026-07-07",
+ "auth": null,
+ "indexable": true,
+ "tags": [],
+ "showcase": false
+ },
+ {
+ "path": "/compare",
+ "title": "Compare Crypto Side by Side",
+ "description": "Compare cryptocurrencies head to head — overlay normalized price performance and line up market cap, volume, FDV, supply, and all-time-high stats for up to four coins at once. The selection is saved to the URL so any matchup is shareable.",
+ "added": "2026-07-07",
+ "auth": null,
+ "indexable": true,
+ "tags": [],
+ "showcase": false
+ },
{
"path": "/constellation",
"title": "watsonx Constellation",
diff --git a/public/llms-full.txt b/public/llms-full.txt
index 582d6727d..7465e4f93 100644
--- a/public/llms-full.txt
+++ b/public/llms-full.txt
@@ -843,6 +843,30 @@ URL: https://three.ws/coins
Live global cryptocurrency market data: total market cap, dominance, Fear & Greed, and the top coins with prices, 24h/7d moves, and 7d sparklines. Every coin links to a rich /coin/:id detail page with an interactive chart, market stats, related news, and official links.
+### Crypto Market Heatmap
+
+URL: https://three.ws/heatmap
+
+A live market heatmap of the top cryptocurrencies: every tile is a coin, sized by market cap and colored by its 24h or 7d price move. See where money is flowing across the whole market at a glance, then click any tile for its full profile.
+
+### Crypto Fear & Greed Index
+
+URL: https://three.ws/fear-greed
+
+The Crypto Fear & Greed Index — live market sentiment from 0 (Extreme Fear) to 100 (Extreme Greed), shown on a gauge with a week-over-week delta, a full interactive history chart, and a labelled scale explaining what each reading means.
+
+### Ethereum Gas Tracker
+
+URL: https://three.ws/gas
+
+Live Ethereum gas fees straight from the chain — slow, standard, and fast tiers in gwei with USD cost estimates for transfers, token sends, DEX swaps, and NFT mints. Real on-chain fee history, refreshed automatically, no API key required.
+
+### Compare Crypto Side by Side
+
+URL: https://three.ws/compare
+
+Compare cryptocurrencies head to head — overlay normalized price performance and line up market cap, volume, FDV, supply, and all-time-high stats for up to four coins at once. The selection is saved to the URL so any matchup is shareable.
+
### watsonx Constellation
URL: https://three.ws/constellation
diff --git a/public/llms.txt b/public/llms.txt
index a5afb756c..74fbbf2d7 100644
--- a/public/llms.txt
+++ b/public/llms.txt
@@ -156,6 +156,10 @@ On-chain features: pay-per-call, token launches, vanity wallets.
- [Pump Visualizer](https://three.ws/pump-visualizer): 3D visualizer of trending pump.fun tokens — live market data rendered as an interactive scene.
- [Coin Intelligence](https://three.ws/coin-intel): Every pump.fun launch watched and classified in real time — organic vs bundle, the wallets behind it, a transparent quality score, and a model that learns which signals predict winners.
- [Markets — Live Crypto Prices](https://three.ws/coins): Live global cryptocurrency market data: total market cap, dominance, Fear & Greed, and the top coins with prices, 24h/7d moves, and 7d sparklines. Every coin links to a rich /coin/:id detail page with an interactive chart, market stats, related news, and official links.
+- [Crypto Market Heatmap](https://three.ws/heatmap): A live market heatmap of the top cryptocurrencies: every tile is a coin, sized by market cap and colored by its 24h or 7d price move. See where money is flowing across the whole market at a glance, then click any tile for its full profile.
+- [Crypto Fear & Greed Index](https://three.ws/fear-greed): The Crypto Fear & Greed Index — live market sentiment from 0 (Extreme Fear) to 100 (Extreme Greed), shown on a gauge with a week-over-week delta, a full interactive history chart, and a labelled scale explaining what each reading means.
+- [Ethereum Gas Tracker](https://three.ws/gas): Live Ethereum gas fees straight from the chain — slow, standard, and fast tiers in gwei with USD cost estimates for transfers, token sends, DEX swaps, and NFT mints. Real on-chain fee history, refreshed automatically, no API key required.
+- [Compare Crypto Side by Side](https://three.ws/compare): Compare cryptocurrencies head to head — overlay normalized price performance and line up market cap, volume, FDV, supply, and all-time-high stats for up to four coins at once. The selection is saved to the URL so any matchup is shareable.
- [watsonx Constellation](https://three.ws/constellation): Live Solana tokens in a 3D galaxy, positioned in semantic space by IBM Granite embeddings on watsonx.ai. Click a star for a live IBM Granite analysis.
- [x402 Bazaar](https://three.ws/bazaar): Search and browse the x402 facilitator catalog. Filter by network, price, and extensions. Pay any service in one click.
- [x402 Live Demo (IBM × three.ws)](https://three.ws/ibm/x402-demo): A self-contained x402 micropayment demo: pay $0.001 USDC from your own wallet — MetaMask on Base or Phantom on Solana — to call a real three.ws data API. Watch the live HTTP 402 challenge, sign a gasless authorization, and see the on-chain settlement receipt. No backend, no account; built as the public face of the IBM × three.ws partnership.
diff --git a/public/nav-data.js b/public/nav-data.js
index f656b25c9..7fd99713c 100644
--- a/public/nav-data.js
+++ b/public/nav-data.js
@@ -312,6 +312,26 @@ export const NAV_GROUPS = [
href: '/coins',
desc: 'Live global market data — top coins, prices, and a rich detail page for every asset',
},
+ {
+ title: 'Heatmap',
+ href: '/heatmap',
+ desc: 'The whole market in one view — tiles sized by market cap, colored by price move',
+ },
+ {
+ title: 'Fear & Greed',
+ href: '/fear-greed',
+ desc: 'Live market sentiment from Extreme Fear to Extreme Greed, with full history',
+ },
+ {
+ title: 'Gas Tracker',
+ href: '/gas',
+ desc: 'Live Ethereum gas fees in gwei with USD cost estimates for common actions',
+ },
+ {
+ title: 'Compare',
+ href: '/compare',
+ desc: 'Put up to four coins head to head — overlay performance and line up the stats',
+ },
{
title: 'Coin Intelligence',
href: '/coin-intel',
diff --git a/public/sitemap/index.html b/public/sitemap/index.html
index 53c694f93..369a92b2b 100644
--- a/public/sitemap/index.html
+++ b/public/sitemap/index.html
@@ -65,7 +65,7 @@
<main class="sm-wrap">
<div class="sm-hero">
<h1>Sitemap</h1>
- <p>All 388 pages on three.ws, grouped by purpose. Looking for the machine-readable versions?</p>
+ <p>All 392 pages on three.ws, grouped by purpose. Looking for the machine-readable versions?</p>
<div class="sm-formats">
<a href="/sitemap.xml"><code>sitemap.xml</code> · for search engines</a>
<a href="/llms.txt"><code>llms.txt</code> · for AI agents</a>
@@ -77,7 +77,7 @@
</div>
<div class="sm-filter">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m21 21-4.3-4.3"/></svg>
- <input id="sm-filter-input" type="search" placeholder="Filter 388 pages by name, path, or description…" aria-label="Filter pages" autocomplete="off" spellcheck="false" />
+ <input id="sm-filter-input" type="search" placeholder="Filter 392 pages by name, path, or description…" aria-label="Filter pages" autocomplete="off" spellcheck="false" />
<kbd aria-hidden="true">/</kbd>
</div>
<p class="sm-filter-count" id="sm-filter-count" role="status" aria-live="polite"></p>
@@ -697,7 +697,7 @@
<section class="sm-section" id="crypto">
<header>
- <h2>Crypto<span class="sm-count" data-count>82</span></h2>
+ <h2>Crypto<span class="sm-count" data-count>86</span></h2>
<p class="sm-section-desc">On-chain features: pay-per-call, token launches, vanity wallets.</p>
</header>
<ul class="sm-list">
@@ -1072,6 +1072,34 @@
<span class="sm-desc">Live global cryptocurrency market data: total market cap, dominance, Fear &amp; Greed, and the top coins with prices, 24h/7d moves, and 7d sparklines. Every coin links to a rich /coin/:id detail page with an interactive chart, market stats, related news, and official links.</span>
</a>
</li>
+ <li>
+ <a href="/heatmap">
+ <span class="sm-title">Crypto Market Heatmap</span>
+ <span class="sm-path">/heatmap</span>
+ <span class="sm-desc">A live market heatmap of the top cryptocurrencies: every tile is a coin, sized by market cap and colored by its 24h or 7d price move. See where money is flowing across the whole market at a glance, then click any tile for its full profile.</span>
+ </a>
+ </li>
+ <li>
+ <a href="/fear-greed">
+ <span class="sm-title">Crypto Fear &amp; Greed Index</span>
+ <span class="sm-path">/fear-greed</span>
+ <span class="sm-desc">The Crypto Fear &amp; Greed Index — live market sentiment from 0 (Extreme Fear) to 100 (Extreme Greed), shown on a gauge with a week-over-week delta, a full interactive history chart, and a labelled scale explaining what each reading means.</span>
+ </a>
+ </li>
+ <li>
+ <a href="/gas">
+ <span class="sm-title">Ethereum Gas Tracker</span>
+ <span class="sm-path">/gas</span>
+ <span class="sm-desc">Live Ethereum gas fees straight from the chain — slow, standard, and fast tiers in gwei with USD cost estimates for transfers, token sends, DEX swaps, and NFT mints. Real on-chain fee history, refreshed automatically, no API key required.</span>
+ </a>
+ </li>
+ <li>
+ <a href="/compare">
+ <span class="sm-title">Compare Crypto Side by Side</span>
+ <span class="sm-path">/compare</span>
+ <span class="sm-desc">Compare cryptocurrencies head to head — overlay normalized price performance and line up market cap, volume, FDV, supply, and all-time-high stats for up to four coins at once. The selection is saved to the URL so any matchup is shareable.</span>
+ </a>
+ </li>
<li>
<a href="/constellation">
<span class="sm-title">watsonx Constellation</span>
diff --git a/src/coin-pages.css b/src/coin-pages.css
index 21b46ff86..ed85536de 100644
--- a/src/coin-pages.css
+++ b/src/coin-pages.css
@@ -539,3 +539,146 @@ html.cv-page, .cv-page body {
.cv-skel::after, .cv-spinner { animation: none; }
.cv-news-card, .cv-stat-card, .cv-range-btn { transition: none; }
}
+
+/* ═══════════════════════════════════════════════════════════════════════════
+ Market tools — /fear-greed, /heatmap, /gas, /compare
+ Shared with the coin pages above (same tokens, fonts, card system).
+ ═══════════════════════════════════════════════════════════════════════════ */
+
+/* ── Fear & Greed ───────────────────────────────────────────────────────── */
+
+.fg-now-card {
+ display: flex; flex-wrap: wrap; align-items: center; gap: 2rem;
+ background: var(--cv-surface); border: 1px solid var(--cv-border);
+ border-radius: var(--cv-radius-xl); box-shadow: var(--cv-shadow-card);
+ padding: 1.75rem;
+}
+.fg-gauge { position: relative; width: 320px; max-width: 100%; flex: 0 0 auto; }
+.fg-gauge-svg { width: 100%; height: auto; display: block; }
+.fg-gauge-center {
+ position: absolute; left: 0; right: 0; bottom: 0.5rem;
+ display: flex; flex-direction: column; align-items: center; text-align: center;
+ pointer-events: none;
+}
+.fg-value { font-family: var(--cv-font-mono); font-size: 3rem; font-weight: 700; line-height: 1; }
+.fg-label { font-size: 0.9375rem; font-weight: 600; margin-top: 0.25rem; }
+.fg-now-meta { flex: 1 1 14rem; min-width: 0; }
+.fg-now-title { margin: 0 0 0.5rem; font-size: 1rem; font-weight: 600; color: var(--cv-text); }
+.fg-delta { margin: 0 0 0.5rem; font-size: 0.9375rem; font-weight: 500; }
+.fg-delta .dim { color: var(--cv-text-3); font-weight: 400; }
+.fg-cross { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
+.fg-legend-card { padding: 1.5rem; }
+.fg-bands { display: grid; gap: 0.5rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin: 1rem 0 1.25rem; }
+.fg-band { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8125rem; }
+.fg-band .swatch { width: 0.875rem; height: 0.875rem; border-radius: 3px; flex: 0 0 auto; }
+.fg-band .range { color: var(--cv-text-3); }
+.fg-band .name { color: var(--cv-text-2); }
+
+/* ── Heatmap ────────────────────────────────────────────────────────────── */
+
+.hm-toolbar {
+ display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem;
+ margin-bottom: 1rem;
+}
+.hm-seg { display: inline-flex; border: 1px solid var(--cv-border); border-radius: var(--cv-radius); overflow: hidden; }
+.hm-seg button {
+ appearance: none; border: 0; background: var(--cv-surface); color: var(--cv-text-2);
+ font: inherit; font-size: 0.8125rem; padding: 0.375rem 0.75rem; cursor: pointer;
+ border-right: 1px solid var(--cv-border); transition: background 0.15s, color 0.15s;
+}
+.hm-seg button:last-child { border-right: 0; }
+.hm-seg button:hover { background: var(--cv-surface-2); color: var(--cv-text); }
+.hm-seg button[aria-pressed='true'] { background: var(--cv-accent); color: #fff; }
+.hm-seg button:focus-visible { outline: 2px solid var(--cv-accent); outline-offset: -2px; }
+.hm-legend { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; font-size: 0.75rem; color: var(--cv-text-3); }
+.hm-legend .bar { width: 120px; height: 8px; border-radius: 999px; background: linear-gradient(90deg, #dc2626, #6b7280, #16a34a); }
+.hm-grid {
+ position: relative; width: 100%; height: 560px;
+ border: 1px solid var(--cv-border); border-radius: var(--cv-radius-xl);
+ background: var(--cv-surface-2); overflow: hidden;
+}
+.hm-tile {
+ position: absolute; overflow: hidden; text-decoration: none;
+ border: 1px solid rgba(0, 0, 0, 0.28); color: #fff;
+ display: flex; flex-direction: column; justify-content: center; align-items: center;
+ padding: 2px; transition: filter 0.12s, transform 0.12s; contain: strict;
+}
+.hm-tile:hover, .hm-tile:focus-visible { filter: brightness(1.12); z-index: 3; outline: none; }
+.hm-tile:focus-visible { box-shadow: inset 0 0 0 2px #fff; }
+.hm-tile .sym { font-weight: 700; line-height: 1.05; text-shadow: 0 1px 2px rgba(0,0,0,0.4); }
+.hm-tile .chg { line-height: 1.05; opacity: 0.95; text-shadow: 0 1px 2px rgba(0,0,0,0.4); font-variant-numeric: tabular-nums; }
+.hm-tile.tiny .chg { display: none; }
+.hm-tip {
+ position: fixed; z-index: 40; pointer-events: none;
+ background: var(--cv-surface); border: 1px solid var(--cv-border);
+ border-radius: var(--cv-radius); box-shadow: var(--cv-shadow-dropdown);
+ padding: 0.5rem 0.625rem; font-size: 0.75rem; color: var(--cv-text-2);
+ max-width: 220px;
+}
+.hm-tip .t { font-weight: 600; color: var(--cv-text); margin: 0 0 0.125rem; }
+.hm-tip .r { margin: 0.0625rem 0; display: flex; justify-content: space-between; gap: 1rem; }
+.hm-tip .r span:last-child { font-family: var(--cv-font-mono); color: var(--cv-text); }
+
+/* ── Gas tracker ────────────────────────────────────────────────────────── */
+
+.gas-tiers { display: grid; gap: 1rem; grid-template-columns: repeat(3, 1fr); }
+.gas-tier {
+ background: var(--cv-surface); border: 1px solid var(--cv-border);
+ border-radius: var(--cv-radius-xl); box-shadow: var(--cv-shadow-card);
+ padding: 1.25rem; text-align: center; position: relative;
+}
+.gas-tier.standard { border-color: var(--cv-accent); box-shadow: var(--cv-shadow-card), 0 0 0 1px var(--cv-accent); }
+.gas-tier .tier-name { font-size: 0.8125rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--cv-text-3); margin: 0; }
+.gas-tier .tier-name.slow { color: var(--cv-red); }
+.gas-tier .tier-name.standard { color: var(--cv-accent); }
+.gas-tier .tier-name.fast { color: var(--cv-green); }
+.gas-tier .gwei { font-family: var(--cv-font-mono); font-size: 2.25rem; font-weight: 700; color: var(--cv-text); line-height: 1; margin: 0.5rem 0 0.125rem; }
+.gas-tier .gwei .unit { font-size: 0.875rem; color: var(--cv-text-3); font-weight: 500; }
+.gas-tier .tier-sub { font-size: 0.75rem; color: var(--cv-text-3); margin: 0; }
+.gas-tier .tier-cost { margin: 0.75rem 0 0; font-size: 0.9375rem; font-weight: 600; color: var(--cv-text); font-family: var(--cv-font-mono); }
+.gas-actions-card { padding: 1.25rem 1.5rem; }
+.gas-actions-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
+.gas-actions-table th, .gas-actions-table td { padding: 0.5rem 0.5rem; border-bottom: 1px solid var(--cv-border); text-align: right; }
+.gas-actions-table th:first-child, .gas-actions-table td:first-child { text-align: left; }
+.gas-actions-table th { font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--cv-text-3); font-weight: 600; }
+.gas-actions-table td { font-family: var(--cv-font-mono); color: var(--cv-text-2); }
+.gas-actions-table td:first-child { font-family: var(--cv-font-sans); color: var(--cv-text); }
+.gas-actions-table tbody tr:last-child td { border-bottom: 0; }
+.gas-base { display: flex; flex-wrap: wrap; gap: 1.5rem; align-items: baseline; margin: 0 0 1.25rem; }
+.gas-base .k { font-size: 0.75rem; color: var(--cv-text-3); }
+.gas-base .v { font-family: var(--cv-font-mono); font-weight: 600; color: var(--cv-text); }
+
+@media (max-width: 720px) {
+ .gas-tiers { grid-template-columns: 1fr; }
+ .hm-grid { height: 460px; }
+}
+
+/* ── Compare ────────────────────────────────────────────────────────────── */
+
+.cmp-picker { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-start; margin-bottom: 1.5rem; }
+.cmp-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
+.cmp-chip {
+ display: inline-flex; align-items: center; gap: 0.5rem;
+ background: var(--cv-surface-2); border: 1px solid var(--cv-border);
+ border-radius: 999px; padding: 0.3125rem 0.375rem 0.3125rem 0.625rem; font-size: 0.8125rem;
+}
+.cmp-chip img { width: 18px; height: 18px; border-radius: 50%; }
+.cmp-chip .dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
+.cmp-chip button {
+ appearance: none; border: 0; background: transparent; color: var(--cv-text-3);
+ cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 0.25rem; border-radius: 50%;
+}
+.cmp-chip button:hover { color: var(--cv-red); }
+.cmp-table-wrap { overflow-x: auto; border: 1px solid var(--cv-border); border-radius: var(--cv-radius-xl); background: var(--cv-surface); }
+.cmp-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; min-width: 480px; }
+.cmp-table th, .cmp-table td { padding: 0.75rem 0.875rem; border-bottom: 1px solid var(--cv-border); text-align: right; }
+.cmp-table th:first-child, .cmp-table td:first-child { text-align: left; color: var(--cv-text-3); font-weight: 500; }
+.cmp-table thead th { font-size: 0.8125rem; }
+.cmp-table thead th .coin { display: inline-flex; align-items: center; gap: 0.375rem; }
+.cmp-table thead th img { width: 20px; height: 20px; border-radius: 50%; }
+.cmp-table td { font-family: var(--cv-font-mono); color: var(--cv-text); font-variant-numeric: tabular-nums; }
+.cmp-table tbody tr:last-child td { border-bottom: 0; }
+.cmp-table td.best { color: var(--cv-green); font-weight: 600; }
+.cmp-legend { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 0.75rem; font-size: 0.8125rem; }
+.cmp-legend .li { display: inline-flex; align-items: center; gap: 0.375rem; color: var(--cv-text-2); }
+.cmp-legend .dot { width: 12px; height: 3px; border-radius: 2px; }
diff --git a/src/compare.js b/src/compare.js
new file mode 100644
index 000000000..98eb0fe90
--- /dev/null
+++ b/src/compare.js
@@ -0,0 +1,500 @@
+// /compare — side-by-side coin comparison, adopted from the cryptocurrency.cv
+// compare surface: an overlay of normalized price performance plus a stats
+// table for up to four coins. Reuses the existing /api/coin proxies (search,
+// detail, ohlc) — all data is real and cached, never mocked. The selection is
+// mirrored to the URL (?ids=…) so a matchup is shareable.
+
+import {
+ formatUsd,
+ formatPrice,
+ formatPercent,
+ formatSupply,
+ formatDateShort,
+ formatChartTick,
+ escapeHtml as esc,
+} from './shared/coin-format.js';
+
+const $ = (id) => document.getElementById(id);
+const MAX_COINS = 4;
+const COLORS = ['#3b82f6', '#f59e0b', '#22c55e', '#a855f7'];
+
+async function getJson(url) {
+ const res = await fetch(url, { headers: { accept: 'application/json' } });
+ if (!res.ok) {
+ const err = new Error(`fetch ${url} → ${res.status}`);
+ err.status = res.status;
+ throw err;
+ }
+ return res.json();
+}
+
+// state.coins: [{ id, color, detail, series }]
+const state = { coins: [], days: 30, loadingChart: false };
+
+const RANGES = [
+ { label: '7D', days: 7 },
+ { label: '30D', days: 30 },
+ { label: '90D', days: 90 },
+ { label: '1Y', days: 365 },
+];
+
+function idsFromUrl() {
+ const raw = new URL(location.href).searchParams.get('ids') || '';
+ const ids = raw
+ .split(',')
+ .map((s) => s.trim().toLowerCase())
+ .filter((s) => /^[a-z0-9][a-z0-9_-]{0,99}$/.test(s));
+ const seen = new Set();
+ const unique = ids.filter((id) => (seen.has(id) ? false : (seen.add(id), true)));
+ return unique.slice(0, MAX_COINS);
+}
+
+function syncUrl() {
+ const ids = state.coins.map((c) => c.id).join(',');
+ const url = new URL(location.href);
+ if (ids) url.searchParams.set('ids', ids);
+ else url.searchParams.delete('ids');
+ history.replaceState(null, '', url);
+}
+
+function nextColor() {
+ const used = new Set(state.coins.map((c) => c.color));
+ return COLORS.find((c) => !used.has(c)) || COLORS[state.coins.length % COLORS.length];
+}
+
+// ── Add / remove ──────────────────────────────────────────────────────────────
+
+async function addCoin(id) {
+ id = id.toLowerCase();
+ if (state.coins.length >= MAX_COINS) return;
+ if (state.coins.find((c) => c.id === id)) return;
+ const entry = { id, color: nextColor(), detail: null, series: null, error: false };
+ state.coins.push(entry);
+ renderChips();
+ syncUrl();
+ try {
+ const { coin } = await getJson(`/api/coin/detail?id=${encodeURIComponent(id)}`);
+ entry.detail = coin;
+ } catch {
+ entry.error = true;
+ }
+ renderChips();
+ renderTable();
+ await loadSeries(entry);
+ renderChart();
+}
+
+function removeCoin(id) {
+ state.coins = state.coins.filter((c) => c.id !== id);
+ renderChips();
+ renderTable();
+ renderChart();
+ syncUrl();
+}
+
+// ── Chips ─────────────────────────────────────────────────────────────────────
+
+function renderChips() {
+ const el = $('cmp-chips');
+ el.innerHTML = state.coins
+ .map((c) => {
+ const d = c.detail;
+ const name = d ? `${esc(d.name)}` : esc(c.id);
+ const img = d?.image
+ ? `<img src="${esc(d.image)}" alt="" width="18" height="18" data-no-dark-filter />`
+ : `<span class="dot" style="background:${c.color}"></span>`;
+ return `<span class="cmp-chip" style="border-color:${c.color}55">
+ <span class="dot" style="background:${c.color}"></span>
+ ${img}
+ <span>${name}${d?.symbol ? ` <span style="color:var(--cv-text-3)">${esc(d.symbol)}</span>` : ''}</span>
+ <button type="button" data-remove="${esc(c.id)}" aria-label="Remove ${name}">×</button>
+ </span>`;
+ })
+ .join('');
+ el.querySelectorAll('button[data-remove]').forEach((b) =>
+ b.addEventListener('click', () => removeCoin(b.dataset.remove)),
+ );
+}
+
+// ── Overlay chart ─────────────────────────────────────────────────────────────
+
+const CW = 760;
+const CH = 300;
+const PAD = { top: 16, right: 56, bottom: 26, left: 16 };
+
+async function loadSeries(entry) {
+ entry.series = null;
+ try {
+ const { data } = await getJson(
+ `/api/coin/ohlc?id=${encodeURIComponent(entry.id)}&days=${state.days}`,
+ );
+ // Normalize to % change from the first point.
+ const base = data[0]?.[1];
+ entry.series = base
+ ? data
+ .map(([ts, p]) => [ts, ((p - base) / base) * 100])
+ .filter((d) => Number.isFinite(d[1]))
+ : [];
+ } catch {
+ entry.series = [];
+ }
+}
+
+async function reloadAllSeries() {
+ state.loadingChart = true;
+ renderChart();
+ await Promise.all(state.coins.map(loadSeries));
+ state.loadingChart = false;
+ renderChart();
+}
+
+function chartGeometry() {
+ const withData = state.coins.filter((c) => c.series && c.series.length >= 2);
+ if (!withData.length) return null;
+ let tMin = Infinity,
+ tMax = -Infinity,
+ vMin = Infinity,
+ vMax = -Infinity;
+ for (const c of withData) {
+ for (const [t, v] of c.series) {
+ if (t < tMin) tMin = t;
+ if (t > tMax) tMax = t;
+ if (v < vMin) vMin = v;
+ if (v > vMax) vMax = v;
+ }
+ }
+ const span = tMax - tMin || 1;
+ const pad = (vMax - vMin) * 0.08 || 1;
+ vMin -= pad;
+ vMax += pad;
+ const range = vMax - vMin || 1;
+ const w = CW - PAD.left - PAD.right;
+ const h = CH - PAD.top - PAD.bottom;
+ const xOf = (t) => PAD.left + ((t - tMin) / span) * w;
+ const yOf = (v) => PAD.top + h - ((v - vMin) / range) * h;
+ return { withData, tMin, tMax, vMin, vMax, w, h, xOf, yOf };
+}
+
+function renderChart() {
+ const el = $('cmp-chart');
+ const rangeBtns = RANGES.map(
+ (r) =>
+ `<button type="button" class="cv-range-btn" data-days="${r.days}" aria-pressed="${r.days === state.days}">${r.label}</button>`,
+ ).join('');
+
+ let body;
+ if (!state.coins.length) {
+ body = '<div class="cv-chart-state">Add a coin above to start comparing.</div>';
+ } else if (state.loadingChart) {
+ body =
+ '<div class="cv-chart-state"><span class="cv-spinner" aria-hidden="true"></span>Loading performance…</div>';
+ } else {
+ const g = chartGeometry();
+ if (!g) {
+ body =
+ '<div class="cv-chart-state">Performance data unavailable for the current selection.</div>';
+ } else {
+ const h = CH - PAD.top - PAD.bottom;
+ const steps = 4;
+ const yLabels = Array.from({ length: steps + 1 }, (_, i) => {
+ const v = g.vMin + (g.vMax - g.vMin) * (i / steps);
+ const y = PAD.top + h - (i / steps) * h;
+ return `<g><line x1="${PAD.left}" y1="${y}" x2="${CW - PAD.right}" y2="${y}" stroke="var(--cv-border)" stroke-width="0.5" stroke-dasharray="4 4" opacity="0.5"/><text x="${CW - PAD.right + 6}" y="${y + 3}" font-size="10" fill="var(--cv-text-3)">${v >= 0 ? '+' : ''}${v.toFixed(0)}%</text></g>`;
+ }).join('');
+ // Zero baseline (start-of-window) emphasized.
+ const zeroY = g.yOf(0);
+ const zeroLine =
+ g.vMin < 0 && g.vMax > 0
+ ? `<line x1="${PAD.left}" y1="${zeroY}" x2="${CW - PAD.right}" y2="${zeroY}" stroke="var(--cv-text-3)" stroke-width="0.75" opacity="0.5"/>`
+ : '';
+ const paths = g.withData
+ .map((c) => {
+ const d = c.series
+ .map(
+ ([t, v], i) =>
+ `${i === 0 ? 'M' : 'L'}${g.xOf(t).toFixed(1)},${g.yOf(v).toFixed(1)}`,
+ )
+ .join(' ');
+ return `<path d="${d}" fill="none" stroke="${c.color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>`;
+ })
+ .join('');
+ body = `
+ <div class="cv-chart-area">
+ <svg viewBox="0 0 ${CW} ${CH}" role="img" aria-label="Normalized performance comparison over ${state.days} days">
+ ${yLabels}
+ ${zeroLine}
+ ${paths}
+ <g id="cmp-cross" hidden>
+ <line id="cmp-cross-line" x1="0" y1="${PAD.top}" x2="0" y2="${CH - PAD.bottom}" stroke="var(--cv-text-3)" stroke-width="0.5" stroke-dasharray="3 3"/>
+ </g>
+ </svg>
+ <div class="cv-chart-tip" id="cmp-tip" hidden></div>
+ </div>`;
+ }
+ }
+
+ const legend = state.coins.length
+ ? `<div class="cmp-legend">${state.coins
+ .map(
+ (c) =>
+ `<span class="li"><span class="dot" style="background:${c.color}"></span>${esc(c.detail?.symbol || c.id)}</span>`,
+ )
+ .join('')}</div>`
+ : '';
+
+ el.innerHTML = `
+ <div class="cv-chart-panel">
+ <div class="cv-chart-bar">
+ <div class="left"><span class="title">Performance (% change)</span></div>
+ <div class="cv-ranges" role="group" aria-label="Chart time range">${rangeBtns}</div>
+ </div>
+ ${body}
+ ${legend}
+ </div>`;
+
+ el.querySelectorAll('.cv-range-btn').forEach((btn) => {
+ btn.addEventListener('click', () => {
+ const d = Number(btn.dataset.days);
+ if (d === state.days) return;
+ state.days = d;
+ reloadAllSeries();
+ });
+ });
+ wireChartPointer();
+}
+
+function wireChartPointer() {
+ const svg = $('cmp-chart').querySelector('svg');
+ const tip = $('cmp-tip');
+ const g = chartGeometry();
+ if (!svg || !tip || !g) return;
+ const cross = svg.querySelector('#cmp-cross');
+ const line = svg.querySelector('#cmp-cross-line');
+
+ const nearest = (series, t) => {
+ let best = series[0];
+ let bd = Infinity;
+ for (const p of series) {
+ const d = Math.abs(p[0] - t);
+ if (d < bd) {
+ bd = d;
+ best = p;
+ }
+ }
+ return best;
+ };
+
+ function show(clientX) {
+ const rect = svg.getBoundingClientRect();
+ const mx = ((clientX - rect.left) / rect.width) * CW;
+ const frac = Math.max(0, Math.min(1, (mx - PAD.left) / g.w));
+ const t = g.tMin + frac * (g.tMax - g.tMin);
+ const x = g.xOf(t);
+ cross.removeAttribute('hidden');
+ line.setAttribute('x1', x);
+ line.setAttribute('x2', x);
+ const rows = g.withData
+ .map((c) => {
+ const [, v] = nearest(c.series, t);
+ return `<p class="r" style="display:flex;justify-content:space-between;gap:1rem;margin:0.0625rem 0"><span style="color:${c.color}">${esc(c.detail?.symbol || c.id)}</span><span class="cv-mono" style="color:var(--cv-text)">${v >= 0 ? '+' : ''}${v.toFixed(2)}%</span></p>`;
+ })
+ .join('');
+ tip.hidden = false;
+ tip.innerHTML = `<p class="d" style="margin:0 0 0.25rem">${esc(formatChartTick(t, state.days))}</p>${rows}`;
+ tip.style.left = `${(x / CW) * 100}%`;
+ }
+ function hide() {
+ cross.setAttribute('hidden', '');
+ tip.hidden = true;
+ }
+ svg.addEventListener('pointermove', (e) => show(e.clientX));
+ svg.addEventListener('pointerleave', hide);
+ svg.addEventListener('pointerdown', (e) => show(e.clientX));
+}
+
+// ── Stats table ───────────────────────────────────────────────────────────────
+
+const ROWS = [
+ { label: 'Price', get: (m) => m.price, fmt: formatPrice },
+ {
+ label: '24h %',
+ get: (m) => m.change_pct?.h24,
+ fmt: formatPercent,
+ best: 'max',
+ signed: true,
+ },
+ { label: '7d %', get: (m) => m.change_pct?.d7, fmt: formatPercent, best: 'max', signed: true },
+ {
+ label: '30d %',
+ get: (m) => m.change_pct?.d30,
+ fmt: formatPercent,
+ best: 'max',
+ signed: true,
+ },
+ { label: 'Market Cap', get: (m) => m.market_cap, fmt: formatUsd, best: 'max' },
+ { label: '24h Volume', get: (m) => m.volume_24h, fmt: formatUsd, best: 'max' },
+ { label: 'FDV', get: (m) => m.fdv, fmt: formatUsd },
+ { label: 'Circ. Supply', get: (m) => m.circulating, fmt: formatSupply },
+ { label: 'All-Time High', get: (m) => m.ath, fmt: formatPrice },
+ {
+ label: 'From ATH',
+ get: (m) => m.ath_change_pct,
+ fmt: formatPercent,
+ best: 'max',
+ signed: true,
+ },
+];
+
+function renderTable() {
+ const el = $('cmp-table');
+ const ready = state.coins.filter((c) => c.detail);
+ if (!state.coins.length) {
+ el.innerHTML = '';
+ return;
+ }
+ if (!ready.length) {
+ el.innerHTML = '<div class="cv-skel" style="height:16rem"></div>';
+ return;
+ }
+
+ const head = ready
+ .map(
+ (c) =>
+ `<th><a class="coin" href="/coin/${encodeURIComponent(c.id)}" style="text-decoration:none;color:inherit">
+ ${c.detail.image ? `<img src="${esc(c.detail.image)}" alt="" data-no-dark-filter />` : ''}
+ <span style="color:${c.color}">${esc(c.detail.symbol || c.detail.name)}</span>
+ </a></th>`,
+ )
+ .join('');
+
+ const body = ROWS.map((row) => {
+ const vals = ready.map((c) => row.get(c.detail.market));
+ let bestIdx = -1;
+ if (row.best === 'max') {
+ let bv = -Infinity;
+ vals.forEach((v, i) => {
+ if (Number.isFinite(v) && v > bv) {
+ bv = v;
+ bestIdx = i;
+ }
+ });
+ }
+ const cells = vals
+ .map((v, i) => {
+ const cls = [];
+ if (i === bestIdx && ready.length > 1) cls.push('best');
+ if (row.signed && Number.isFinite(v)) cls.push(v >= 0 ? 'cv-up' : 'cv-down');
+ return `<td class="${cls.join(' ')}">${esc(row.fmt(v))}</td>`;
+ })
+ .join('');
+ return `<tr><td>${esc(row.label)}</td>${cells}</tr>`;
+ }).join('');
+
+ el.innerHTML = `
+ <div class="cmp-table-wrap">
+ <table class="cmp-table">
+ <thead><tr><th></th>${head}</tr></thead>
+ <tbody>${body}</tbody>
+ </table>
+ </div>`;
+}
+
+// ── Search type-ahead (mirrors the /coins picker) ─────────────────────────────
+
+function wireSearch() {
+ const input = $('cmp-search-input');
+ const pop = $('cmp-search-pop');
+ let timer = null;
+ let items = [];
+ let active = -1;
+ let lastQuery = '';
+
+ const close = () => {
+ pop.hidden = true;
+ input.setAttribute('aria-expanded', 'false');
+ active = -1;
+ };
+
+ function renderPop() {
+ if (!items.length) {
+ pop.innerHTML = `<div class="none">No coins match “${esc(lastQuery)}”.</div>`;
+ } else {
+ pop.innerHTML = items
+ .map(
+ (c, i) => `
+ <a href="#" role="option" data-id="${esc(c.id)}" data-active="${i === active ? 1 : 0}" aria-selected="${i === active}">
+ ${c.thumb ? `<img src="${esc(c.thumb)}" alt="" width="20" height="20" data-no-dark-filter />` : ''}
+ <span>${esc(c.name)}</span>
+ <span class="sym">${esc(c.symbol)}</span>
+ ${c.rank != null ? `<span class="rk">#${c.rank}</span>` : ''}
+ </a>`,
+ )
+ .join('');
+ pop.querySelectorAll('a[data-id]').forEach((a) =>
+ a.addEventListener('click', (e) => {
+ e.preventDefault();
+ pick(a.dataset.id);
+ }),
+ );
+ }
+ pop.hidden = false;
+ input.setAttribute('aria-expanded', 'true');
+ }
+
+ function pick(id) {
+ addCoin(id);
+ input.value = '';
+ close();
+ input.focus();
+ }
+
+ input.addEventListener('input', () => {
+ clearTimeout(timer);
+ const q = input.value.trim();
+ if (!q) return close();
+ timer = setTimeout(async () => {
+ try {
+ const { coins } = await getJson(`/api/coin/markets?q=${encodeURIComponent(q)}`);
+ lastQuery = q;
+ items = coins.filter((c) => !state.coins.find((s) => s.id === c.id));
+ active = -1;
+ renderPop();
+ } catch {
+ close();
+ }
+ }, 250);
+ });
+
+ input.addEventListener('keydown', (e) => {
+ if (pop.hidden) return;
+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
+ e.preventDefault();
+ const dir = e.key === 'ArrowDown' ? 1 : -1;
+ active = (active + dir + items.length) % Math.max(items.length, 1);
+ renderPop();
+ } else if (e.key === 'Enter' && active >= 0 && items[active]) {
+ e.preventDefault();
+ pick(items[active].id);
+ } else if (e.key === 'Escape') {
+ close();
+ }
+ });
+
+ document.addEventListener('click', (e) => {
+ if (!e.target.closest('#cmp-search')) close();
+ });
+}
+
+// ── Boot ──────────────────────────────────────────────────────────────────────
+
+async function init() {
+ wireSearch();
+ renderChips();
+ renderChart();
+ // Default matchup so the page is never an empty void; overridable via ?ids=.
+ const initial = idsFromUrl();
+ const ids = initial.length ? initial : ['bitcoin', 'ethereum', 'solana'];
+ for (const id of ids) await addCoin(id);
+}
+
+init();
diff --git a/src/fear-greed.js b/src/fear-greed.js
new file mode 100644
index 000000000..3922966f9
--- /dev/null
+++ b/src/fear-greed.js
@@ -0,0 +1,308 @@
+// /fear-greed — the Crypto Fear & Greed Index, adopted from the
+// cryptocurrency.cv sentiment surface: a live semicircle gauge with the current
+// reading, a "vs last week" delta, an interactive historical chart, and a
+// labelled scale. Data is the alternative.me index via /api/coin/fear-greed —
+// real and cached, never mocked.
+
+import { formatChartTick, formatDateShort, escapeHtml as esc } from './shared/coin-format.js';
+
+const $ = (id) => document.getElementById(id);
+
+async function getJson(url) {
+ const res = await fetch(url, { headers: { accept: 'application/json' } });
+ if (!res.ok) {
+ const err = new Error(`fetch ${url} → ${res.status}`);
+ err.status = res.status;
+ throw err;
+ }
+ return res.json();
+}
+
+// Five sentiment bands, low→high. Colors read on both themes.
+const BANDS = [
+ { min: 0, max: 25, label: 'Extreme Fear', color: '#ef4444' },
+ { min: 25, max: 45, label: 'Fear', color: '#f97316' },
+ { min: 45, max: 55, label: 'Neutral', color: '#eab308' },
+ { min: 55, max: 75, label: 'Greed', color: '#84cc16' },
+ { min: 75, max: 100, label: 'Extreme Greed', color: '#22c55e' },
+];
+
+function bandFor(v) {
+ return BANDS.find((b) => v >= b.min && v <= b.max) || BANDS[Math.min(BANDS.length - 1, 0)];
+}
+
+// ── Gauge ─────────────────────────────────────────────────────────────────────
+// A 180° arc from 0 (left) to 100 (right); the value maps to an angle and the
+// needle points at it. Arc is drawn as five colored band segments.
+
+function polar(cx, cy, r, deg) {
+ const rad = (deg * Math.PI) / 180;
+ return { x: cx + r * Math.cos(rad), y: cy + r * Math.sin(rad) };
+}
+
+// value 0→100 maps to angle 180°→360° (left→right across the top semicircle).
+function valueAngle(v) {
+ return 180 + (Math.max(0, Math.min(100, v)) / 100) * 180;
+}
+
+function arcPath(cx, cy, r, startVal, endVal, width) {
+ const a0 = valueAngle(startVal);
+ const a1 = valueAngle(endVal);
+ const outer0 = polar(cx, cy, r, a0);
+ const outer1 = polar(cx, cy, r, a1);
+ const inner1 = polar(cx, cy, r - width, a1);
+ const inner0 = polar(cx, cy, r - width, a0);
+ const large = a1 - a0 > 180 ? 1 : 0;
+ return (
+ `M ${outer0.x.toFixed(2)} ${outer0.y.toFixed(2)} ` +
+ `A ${r} ${r} 0 ${large} 1 ${outer1.x.toFixed(2)} ${outer1.y.toFixed(2)} ` +
+ `L ${inner1.x.toFixed(2)} ${inner1.y.toFixed(2)} ` +
+ `A ${r - width} ${r - width} 0 ${large} 0 ${inner0.x.toFixed(2)} ${inner0.y.toFixed(2)} Z`
+ );
+}
+
+function gaugeSvg(value) {
+ const W = 320;
+ const H = 190;
+ const cx = W / 2;
+ const cy = 170;
+ const r = 140;
+ const width = 26;
+ const segs = BANDS.map(
+ (b) =>
+ `<path d="${arcPath(cx, cy, r, b.min, b.max, width)}" fill="${b.color}" opacity="0.92" />`,
+ ).join('');
+ const needleAngle = valueAngle(value);
+ const tip = polar(cx, cy, r - width - 6, needleAngle);
+ const band = bandFor(value);
+ return `
+ <svg viewBox="0 0 ${W} ${H}" class="fg-gauge-svg" role="img"
+ aria-label="Fear & Greed gauge at ${value}, ${esc(band.label)}">
+ ${segs}
+ <line x1="${cx}" y1="${cy}" x2="${tip.x.toFixed(2)}" y2="${tip.y.toFixed(2)}"
+ stroke="var(--cv-text)" stroke-width="3" stroke-linecap="round" />
+ <circle cx="${cx}" cy="${cy}" r="7" fill="var(--cv-text)" />
+ <text x="14" y="${cy + 4}" font-size="12" fill="var(--cv-text-3)">0</text>
+ <text x="${W - 26}" y="${cy + 4}" font-size="12" fill="var(--cv-text-3)">100</text>
+ </svg>`;
+}
+
+function renderNow(cur, prev) {
+ const band = bandFor(cur.value);
+ let delta = '';
+ if (prev && Number.isFinite(prev.value)) {
+ const d = cur.value - prev.value;
+ const up = d >= 0;
+ delta =
+ d === 0
+ ? `<p class="fg-delta">Unchanged from last week</p>`
+ : `<p class="fg-delta ${up ? 'cv-up' : 'cv-down'}"><span aria-hidden="true">${up ? '▲' : '▼'}</span> ${Math.abs(d)} pts vs last week <span class="dim">(was ${prev.value})</span></p>`;
+ }
+ $('fg-now').innerHTML = `
+ <div class="fg-now-card">
+ <div class="fg-gauge">${gaugeSvg(cur.value)}
+ <div class="fg-gauge-center">
+ <span class="fg-value" style="color:${band.color}">${cur.value}</span>
+ <span class="fg-label" style="color:${band.color}">${esc(band.label)}</span>
+ </div>
+ </div>
+ <div class="fg-now-meta">
+ <p class="fg-now-title">Current market sentiment</p>
+ ${delta}
+ <p class="cv-updated">Updated ${esc(formatDateShort(new Date(cur.ts).toISOString()))} · source: alternative.me</p>
+ <div class="fg-cross">
+ <a class="cv-pill" href="/coins">Markets ↗</a>
+ <a class="cv-pill" href="/heatmap">Heatmap ↗</a>
+ </div>
+ </div>
+ </div>`;
+}
+
+// ── History chart ─────────────────────────────────────────────────────────────
+
+const CHART_W = 760;
+const CHART_H = 260;
+const PAD = { top: 16, right: 16, bottom: 26, left: 34 };
+const RANGES = [
+ { label: '30D', limit: 30 },
+ { label: '90D', limit: 90 },
+ { label: '1Y', limit: 365 },
+];
+const chartState = { limit: 90, history: [], loading: true, error: null };
+
+function chartGeometry(history) {
+ const w = CHART_W - PAD.left - PAD.right;
+ const h = CHART_H - PAD.top - PAD.bottom;
+ const pts = history.map((d, i) => ({
+ x: PAD.left + (i / Math.max(1, history.length - 1)) * w,
+ y: PAD.top + h - (Math.max(0, Math.min(100, d.value)) / 100) * h,
+ d,
+ }));
+ const line = pts
+ .map((p, i) => `${i === 0 ? 'M' : 'L'}${p.x.toFixed(1)},${p.y.toFixed(1)}`)
+ .join(' ');
+ const area = `${line} L${pts[pts.length - 1].x.toFixed(1)},${PAD.top + h} L${pts[0].x.toFixed(1)},${PAD.top + h} Z`;
+ return { pts, line, area, w, h };
+}
+
+function renderChart() {
+ const el = $('fg-chart');
+ const { history, loading, error, limit } = chartState;
+ const rangeBtns = RANGES.map(
+ (r) =>
+ `<button type="button" class="cv-range-btn" data-limit="${r.limit}" aria-pressed="${r.limit === limit}">${r.label}</button>`,
+ ).join('');
+
+ let body;
+ if (loading) {
+ body =
+ '<div class="cv-chart-state"><span class="cv-spinner" aria-hidden="true"></span>Loading history…</div>';
+ } else if (error || history.length < 2) {
+ body = '<div class="cv-chart-state">History unavailable right now.</div>';
+ } else {
+ const g = chartGeometry(history);
+ // Horizontal band-threshold guides at 25/45/55/75.
+ const h = CHART_H - PAD.top - PAD.bottom;
+ const guides = [25, 45, 55, 75]
+ .map((v) => {
+ const y = PAD.top + h - (v / 100) * h;
+ return `<line x1="${PAD.left}" y1="${y}" x2="${CHART_W - PAD.right}" y2="${y}" stroke="var(--cv-border)" stroke-width="0.5" stroke-dasharray="4 4" opacity="0.6"/><text x="${PAD.left - 6}" y="${y + 3}" font-size="9" fill="var(--cv-text-3)" text-anchor="end">${v}</text>`;
+ })
+ .join('');
+ body = `
+ <div class="cv-chart-area">
+ <svg viewBox="0 0 ${CHART_W} ${CHART_H}" role="img" aria-label="Fear & Greed index over ${limit} days">
+ <defs>
+ <linearGradient id="fg-grad" x1="0" x2="0" y1="0" y2="1">
+ <stop offset="0%" stop-color="var(--cv-accent)" stop-opacity="0.22"/>
+ <stop offset="100%" stop-color="var(--cv-accent)" stop-opacity="0.02"/>
+ </linearGradient>
+ </defs>
+ ${guides}
+ <path d="${g.area}" fill="url(#fg-grad)"/>
+ <path d="${g.line}" fill="none" stroke="var(--cv-accent)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
+ <g id="fg-cross" hidden>
+ <line id="fg-cross-line" x1="0" y1="${PAD.top}" x2="0" y2="${CHART_H - PAD.bottom}" stroke="var(--cv-text-3)" stroke-width="0.5" stroke-dasharray="3 3"/>
+ <circle id="fg-cross-dot" r="4" fill="var(--cv-accent)" stroke="var(--cv-surface)" stroke-width="2"/>
+ </g>
+ </svg>
+ <div class="cv-chart-tip" id="fg-tip" hidden>
+ <p class="p cv-mono" id="fg-tip-val"></p>
+ <p class="d" id="fg-tip-date"></p>
+ </div>
+ </div>`;
+ }
+
+ el.innerHTML = `
+ <div class="cv-chart-panel">
+ <div class="cv-chart-bar">
+ <div class="left"><span class="title">Index history</span></div>
+ <div class="cv-ranges" role="group" aria-label="History time range">${rangeBtns}</div>
+ </div>
+ ${body}
+ </div>`;
+
+ el.querySelectorAll('.cv-range-btn').forEach((btn) => {
+ btn.addEventListener('click', () => {
+ const l = Number(btn.dataset.limit);
+ if (l === chartState.limit) return;
+ chartState.limit = l;
+ loadChart();
+ });
+ });
+ wireChartPointer();
+}
+
+function wireChartPointer() {
+ const svg = $('fg-chart').querySelector('svg');
+ const tip = $('fg-tip');
+ if (!svg || !tip || chartState.history.length < 2) return;
+ const g = chartGeometry(chartState.history);
+ const cross = svg.querySelector('#fg-cross');
+ const line = svg.querySelector('#fg-cross-line');
+ const dot = svg.querySelector('#fg-cross-dot');
+
+ function show(clientX) {
+ const rect = svg.getBoundingClientRect();
+ const mx = ((clientX - rect.left) / rect.width) * CHART_W;
+ const n = chartState.history.length;
+ const i = Math.max(0, Math.min(n - 1, Math.round(((mx - PAD.left) / g.w) * (n - 1))));
+ const p = g.pts[i];
+ const band = bandFor(p.d.value);
+ cross.removeAttribute('hidden');
+ line.setAttribute('x1', p.x);
+ line.setAttribute('x2', p.x);
+ dot.setAttribute('cx', p.x);
+ dot.setAttribute('cy', p.y);
+ dot.setAttribute('fill', band.color);
+ tip.hidden = false;
+ tip.style.left = `${(p.x / CHART_W) * 100}%`;
+ $('fg-tip-val').textContent = `${p.d.value} · ${band.label}`;
+ $('fg-tip-date').textContent = formatChartTick(p.d.ts, chartState.limit);
+ }
+ function hide() {
+ cross.setAttribute('hidden', '');
+ tip.hidden = true;
+ }
+ svg.addEventListener('pointermove', (e) => show(e.clientX));
+ svg.addEventListener('pointerleave', hide);
+ svg.addEventListener('pointerdown', (e) => show(e.clientX));
+}
+
+async function loadChart() {
+ chartState.loading = true;
+ chartState.error = null;
+ renderChart();
+ try {
+ const { history } = await getJson(`/api/coin/fear-greed?limit=${chartState.limit}`);
+ chartState.history = Array.isArray(history) ? history : [];
+ chartState.loading = false;
+ } catch (err) {
+ chartState.loading = false;
+ chartState.error = err;
+ chartState.history = [];
+ }
+ renderChart();
+}
+
+// ── Legend ────────────────────────────────────────────────────────────────────
+
+function renderLegend() {
+ const rows = BANDS.map(
+ (b) => `
+ <div class="fg-band">
+ <span class="swatch" style="background:${b.color}"></span>
+ <span class="range cv-mono">${b.min}–${b.max}</span>
+ <span class="name">${esc(b.label)}</span>
+ </div>`,
+ ).join('');
+ $('fg-legend').innerHTML = `
+ <div class="cv-card fg-legend-card">
+ <h2 class="cv-h2">How to read it</h2>
+ <div class="fg-bands">${rows}</div>
+ <div class="cv-prose">
+ <p>The index distils market emotion into a single 0–100 score. Extreme fear can signal
+ that investors are over-sold and a buying opportunity may be near; extreme greed often
+ means the market is due for a correction. It is a sentiment gauge, not financial advice —
+ pair it with the <a href="/coins">markets table</a> and the
+ <a href="/heatmap">heatmap</a> before acting.</p>
+ </div>
+ </div>`;
+}
+
+// ── Boot ──────────────────────────────────────────────────────────────────────
+
+async function init() {
+ $('fg-now').innerHTML = '<div class="cv-skel" style="height:14rem"></div>';
+ renderLegend();
+ loadChart(); // history + current both live here for the initial 90d window
+ try {
+ const { current, previous_week } = await getJson('/api/coin/fear-greed?limit=90');
+ renderNow(current, previous_week);
+ } catch {
+ $('fg-now').innerHTML =
+ '<div class="cv-empty">The Fear &amp; Greed index is unavailable right now. Please try again shortly.</div>';
+ }
+}
+
+init();
diff --git a/src/feature-tour/guide-avatar.js b/src/feature-tour/guide-avatar.js
index f4d31db7f..34807623c 100644
--- a/src/feature-tour/guide-avatar.js
+++ b/src/feature-tour/guide-avatar.js
@@ -39,6 +39,11 @@ const WALK_SPEED = 460;
const GRAVITY = -14;
const SPAWN_DROP = 0.32;
+// How snappily the guide's facing follows its movement direction, mirrored from
+// the walk world's TURN_LERP (src/walk.js) so the tour guide turns with the same
+// weight as the walk/stroll robot.
+const TURN_LERP = 0.18;
+
// The platform's recurring default character — "Ava", the photoreal full-body
// humanoid (/avatars/realistic-female.glb). The same rig stands in as the guide
// NPC in the walk world, so the tour guide matches her by default.
@@ -346,7 +351,14 @@ export class GuideAvatar {
const x = clamp(pos.x, MARGIN, window.innerWidth - s.w - MARGIN);
const y = clamp(pos.y, MARGIN, window.innerHeight - s.h - MARGIN);
const dx = x - this._pos.x;
- if (Math.abs(dx) > 1) this._targetYaw = clamp((dx / window.innerWidth) * 2, -0.7, 0.7);
+ const dy = y - this._pos.y;
+ // Full 360° facing from the actual travel vector — the same omnidirectional
+ // turn the walk/stroll robot uses (src/walk.js: yaw = atan2(moveX, moveZ)).
+ // Screen +x maps to world +X (right); screen +y (downward, toward the viewer)
+ // maps to world +Z (toward the fixed front camera, the rig's yaw=0 forward),
+ // so atan2(dx, dy) turns the guide to face wherever it walks — left, right,
+ // toward the camera, or away — instead of the old ±40° horizontal tilt.
+ if (Math.hypot(dx, dy) > 1) this._targetYaw = Math.atan2(dx, dy);
this.controller?.setState(running ? 'run' : 'walk');
this._walking = true;
clearTimeout(this._settleTimer);
@@ -375,7 +387,11 @@ export class GuideAvatar {
_faceRect(rect) {
const avatarCx = this._pos.x + CANVAS_W / 2;
- this._targetYaw = clamp((rect.cx - avatarCx) / window.innerWidth, -0.6, 0.6);
+ const avatarCy = this._pos.y + CANVAS_H / 2;
+ // Turn to fully face the highlighted target, matching the walk robot's
+ // all-directions facing rather than the old ±34° horizontal clamp. Same
+ // screen→world axis mapping as place() (dx→X, dy→Z toward the camera).
+ this._targetYaw = Math.atan2(rect.cx - avatarCx, rect.cy - avatarCy);
}
// Approximate screen position of the avatar's head — origin for the pointer
@@ -416,7 +432,10 @@ export class GuideAvatar {
if (!this.host) return;
this.clock.update();
const dt = Math.min(this.clock.getDelta(), 0.05);
- this._yaw += (this._targetYaw - this._yaw) * 0.12;
+ // Shortest-arc turn toward the target facing. With full 360° targets the
+ // naïve (target - current) lerp would spin the long way across the ±π seam;
+ // wrapping the delta into [-π, π] keeps every turn taking the near side.
+ this._yaw += shortestAngle(this._targetYaw - this._yaw) * TURN_LERP;
if (this.rig) {
this.rig.rotation.y = this._yaw;
// Gravity: integrate velocity, land on the ground plane, hold there —
@@ -472,6 +491,10 @@ export class GuideAvatar {
function clamp(n, lo, hi) {
return Math.min(hi, Math.max(lo, n));
}
+// Wrap an angle delta into [-π, π] so a yaw lerp always rotates the short way.
+function shortestAngle(d) {
+ return Math.atan2(Math.sin(d), Math.cos(d));
+}
function lsGet(key) {
try {
return localStorage.getItem(key);
diff --git a/src/gas.js b/src/gas.js
new file mode 100644
index 000000000..8e887eade
--- /dev/null
+++ b/src/gas.js
@@ -0,0 +1,148 @@
+// /gas — live Ethereum gas tracker, adopted from the cryptocurrency.cv gas
+// surface: three speed tiers in gwei with USD cost estimates for common
+// actions. Data is real on-chain fee history via /api/coin/gas (public RPC +
+// live ETH price) — auto-refreshing, never mocked.
+
+import { escapeHtml as esc } from './shared/coin-format.js';
+
+const $ = (id) => document.getElementById(id);
+const REFRESH_MS = 15_000;
+
+async function getJson(url) {
+ const res = await fetch(url, { headers: { accept: 'application/json' } });
+ if (!res.ok) {
+ const err = new Error(`fetch ${url} → ${res.status}`);
+ err.status = res.status;
+ throw err;
+ }
+ return res.json();
+}
+
+const TIER_META = {
+ slow: { name: 'Slow', sub: 'Lowest fee · may wait', cls: 'slow' },
+ standard: { name: 'Standard', sub: 'Confirms in a few blocks', cls: 'standard' },
+ fast: { name: 'Fast', sub: 'Front of the queue', cls: 'fast' },
+};
+
+function gwei(n) {
+ if (n == null || !Number.isFinite(n)) return '—';
+ return n >= 100 ? n.toFixed(0) : n.toFixed(n >= 10 ? 1 : 2);
+}
+
+function usd(n) {
+ if (n == null || !Number.isFinite(n)) return '—';
+ if (n < 0.01) return '<$0.01';
+ if (n < 1) return `$${n.toFixed(3)}`;
+ if (n < 100) return `$${n.toFixed(2)}`;
+ return `$${n.toLocaleString('en-US', { maximumFractionDigits: 0 })}`;
+}
+
+function renderTiers(data) {
+ const byKey = Object.fromEntries(data.tiers.map((t) => [t.key, t]));
+ const order = ['slow', 'standard', 'fast'];
+ $('gas-tiers').innerHTML = `
+ <div class="gas-tiers">
+ ${order
+ .map((key) => {
+ const t = byKey[key];
+ const m = TIER_META[key];
+ // Headline cost = a plain ETH transfer at this tier.
+ const transfer = t?.actions?.find((a) => a.key === 'transfer');
+ return `
+ <div class="gas-tier ${m.cls}">
+ <p class="tier-name ${m.cls}">${esc(m.name)}</p>
+ <p class="gwei">${esc(gwei(t?.gas_price_gwei))}<span class="unit"> gwei</span></p>
+ <p class="tier-sub">${esc(m.sub)}</p>
+ <p class="tier-cost">${transfer && transfer.usd != null ? esc(usd(transfer.usd)) + ' · transfer' : `+${esc(gwei(t?.priority_fee_gwei))} tip`}</p>
+ </div>`;
+ })
+ .join('')}
+ </div>`;
+}
+
+function renderActions(data) {
+ const order = ['slow', 'standard', 'fast'];
+ const byKey = Object.fromEntries(data.tiers.map((t) => [t.key, t]));
+ const hasUsd = data.eth_price_usd != null;
+ const rows = data.actions
+ .map((a) => {
+ const cells = order
+ .map((key) => {
+ const act = byKey[key]?.actions?.find((x) => x.key === a.key);
+ return `<td>${act && act.usd != null ? esc(usd(act.usd)) : '—'}</td>`;
+ })
+ .join('');
+ return `<tr><td>${esc(a.label)} <span style="color:var(--cv-text-3)">· ${a.gas.toLocaleString('en-US')} gas</span></td>${cells}</tr>`;
+ })
+ .join('');
+ $('gas-actions').innerHTML = `
+ <div class="cv-card gas-actions-card">
+ <h2 class="cv-h2" style="margin-top:0">Estimated cost by action</h2>
+ <div style="overflow-x:auto">
+ <table class="gas-actions-table">
+ <thead><tr><th>Action</th><th>Slow</th><th>Standard</th><th>Fast</th></tr></thead>
+ <tbody>${rows}</tbody>
+ </table>
+ </div>
+ ${hasUsd ? '' : '<p class="cv-updated" style="margin-top:0.75rem">USD estimates paused — ETH price unavailable. Gwei figures are live.</p>'}
+ </div>`;
+}
+
+function renderBase(data) {
+ const eth =
+ data.eth_price_usd != null
+ ? `$${data.eth_price_usd.toLocaleString('en-US', { maximumFractionDigits: 2 })}`
+ : '—';
+ $('gas-base').innerHTML = `
+ <div><span class="k">Base fee</span> <span class="v">${esc(gwei(data.base_fee_gwei))} gwei</span></div>
+ <div><span class="k">ETH price</span> <span class="v">${esc(eth)}</span></div>
+ <div><span class="k">Network</span> <span class="v">Ethereum mainnet</span></div>`;
+}
+
+function renderSkeleton() {
+ $('gas-base').innerHTML =
+ '<div class="cv-skel" style="height:1.25rem;width:24rem;max-width:100%"></div>';
+ $('gas-tiers').innerHTML =
+ '<div class="gas-tiers">' +
+ Array.from({ length: 3 }, () => '<div class="cv-skel" style="height:9rem"></div>').join(
+ '',
+ ) +
+ '</div>';
+ $('gas-actions').innerHTML = '<div class="cv-skel" style="height:12rem"></div>';
+}
+
+function renderError() {
+ $('gas-base').innerHTML = '';
+ $('gas-tiers').innerHTML =
+ '<div class="cv-empty">Live gas data is unavailable right now. It refreshes automatically — please try again shortly.</div>';
+ $('gas-actions').innerHTML = '';
+}
+
+let timer = null;
+async function refresh(initial = false) {
+ if (initial) renderSkeleton();
+ try {
+ const data = await getJson('/api/coin/gas');
+ renderBase(data);
+ renderTiers(data);
+ renderActions(data);
+ $('gas-updated').textContent =
+ `Updated ${new Date(data.updated_at || Date.now()).toLocaleTimeString('en-US')} · auto-refreshing · source: public Ethereum RPC`;
+ } catch {
+ if (initial) renderError();
+ // On a mid-session failure, keep the last-good values on screen.
+ }
+}
+
+refresh(true);
+// Pause polling when the tab is hidden; resume + refresh when it returns.
+function schedule() {
+ clearInterval(timer);
+ timer = setInterval(() => {
+ if (!document.hidden) refresh(false);
+ }, REFRESH_MS);
+}
+schedule();
+document.addEventListener('visibilitychange', () => {
+ if (!document.hidden) refresh(false);
+});
diff --git a/src/heatmap.js b/src/heatmap.js
new file mode 100644
index 000000000..d455fcbbd
--- /dev/null
+++ b/src/heatmap.js
@@ -0,0 +1,235 @@
+// /heatmap — a live market treemap adopted from the cryptocurrency.cv heatmap:
+// every top coin is a tile sized by market cap and colored by its price move.
+// Data is the real /api/coin/markets feed (same source as /coins) — the layout
+// is a squarified treemap computed client-side. No mock data.
+
+import { formatUsd, formatPrice, formatPercent, escapeHtml as esc } from './shared/coin-format.js';
+
+const $ = (id) => document.getElementById(id);
+
+async function getJson(url) {
+ const res = await fetch(url, { headers: { accept: 'application/json' } });
+ if (!res.ok) {
+ const err = new Error(`fetch ${url} → ${res.status}`);
+ err.status = res.status;
+ throw err;
+ }
+ return res.json();
+}
+
+const state = { coins: [], key: 'change_24h', count: 50, loading: true };
+
+// ── Squarified treemap (Bruls, Huizing & van Wijk) ────────────────────────────
+
+function squarify(nodes, width, height) {
+ const total = nodes.reduce((s, n) => s + n.value, 0) || 1;
+ const scale = (width * height) / total;
+ const items = nodes.map((n) => ({ node: n, area: n.value * scale }));
+ const out = [];
+ let rect = { x: 0, y: 0, w: width, h: height };
+ let row = [];
+
+ const worst = (r, shorter) => {
+ if (!r.length) return Infinity;
+ const sum = r.reduce((a, b) => a + b.area, 0);
+ const max = Math.max(...r.map((x) => x.area));
+ const min = Math.min(...r.map((x) => x.area));
+ const s2 = sum * sum;
+ const w2 = shorter * shorter;
+ return Math.max((w2 * max) / s2, s2 / (w2 * min));
+ };
+
+ const layoutRow = (r) => {
+ const sum = r.reduce((a, b) => a + b.area, 0);
+ const horizontal = rect.w >= rect.h;
+ if (horizontal) {
+ const colW = sum / rect.h;
+ let y = rect.y;
+ for (const it of r) {
+ const cellH = it.area / colW;
+ out.push({ node: it.node, x: rect.x, y, w: colW, h: cellH });
+ y += cellH;
+ }
+ rect = { x: rect.x + colW, y: rect.y, w: rect.w - colW, h: rect.h };
+ } else {
+ const rowH = sum / rect.w;
+ let x = rect.x;
+ for (const it of r) {
+ const cellW = it.area / rowH;
+ out.push({ node: it.node, x, y: rect.y, w: cellW, h: rowH });
+ x += cellW;
+ }
+ rect = { x: rect.x, y: rect.y + rowH, w: rect.w, h: rect.h - rowH };
+ }
+ };
+
+ let i = 0;
+ while (i < items.length) {
+ const next = items[i];
+ const shorter = Math.min(rect.w, rect.h);
+ if (row.length === 0 || worst(row, shorter) >= worst([...row, next], shorter)) {
+ row.push(next);
+ i++;
+ } else {
+ layoutRow(row);
+ row = [];
+ }
+ }
+ if (row.length) layoutRow(row);
+ return out;
+}
+
+// ── Color ─────────────────────────────────────────────────────────────────────
+
+const NEUTRAL = [82, 82, 91];
+const UP = [22, 163, 74];
+const DOWN = [220, 38, 38];
+
+function lerp(a, b, t) {
+ return a.map((v, i) => Math.round(v + (b[i] - v) * t));
+}
+
+function colorFor(pct) {
+ if (pct == null || !Number.isFinite(pct)) return `rgb(${NEUTRAL.join(',')})`;
+ const t = Math.min(1, Math.abs(pct) / 10); // full saturation at ±10%
+ const c = lerp(NEUTRAL, pct >= 0 ? UP : DOWN, t);
+ return `rgb(${c.join(',')})`;
+}
+
+// ── Render ────────────────────────────────────────────────────────────────────
+
+function render() {
+ const el = $('hm-grid');
+ if (state.loading) {
+ el.innerHTML =
+ '<div class="cv-skel" style="position:absolute;inset:0;border-radius:inherit"></div>';
+ return;
+ }
+ const coins = state.coins
+ .filter((c) => Number.isFinite(c.market_cap) && c.market_cap > 0)
+ .slice(0, state.count);
+ if (!coins.length) {
+ el.innerHTML =
+ '<div class="cv-empty" style="position:absolute;inset:0;display:flex;align-items:center;justify-content:center;border:0">Market data is temporarily unavailable. Please try again shortly.</div>';
+ return;
+ }
+
+ const W = el.clientWidth || 900;
+ const H = el.clientHeight || 560;
+ const nodes = coins.map((c) => ({ value: c.market_cap, coin: c }));
+ const tiles = squarify(nodes, W, H);
+
+ el.innerHTML = tiles
+ .map(({ node, x, y, w, h }) => {
+ const c = node.coin;
+ const pct = c[state.key];
+ const bg = colorFor(pct);
+ const symFont = Math.max(8, Math.min(34, Math.min(w, h) / 4.2));
+ const tiny = Math.min(w, h) < 34;
+ const href = `/coin/${encodeURIComponent(c.id)}`;
+ return `<a class="hm-tile${tiny ? ' tiny' : ''}" href="${esc(href)}"
+ style="left:${x.toFixed(2)}px;top:${y.toFixed(2)}px;width:${w.toFixed(2)}px;height:${h.toFixed(2)}px;background:${bg}"
+ data-id="${esc(c.id)}"
+ aria-label="${esc(c.name)} ${esc(formatPercent(pct))}">
+ <span class="sym" style="font-size:${symFont.toFixed(1)}px">${esc(c.symbol)}</span>
+ <span class="chg" style="font-size:${(symFont * 0.5).toFixed(1)}px">${esc(formatPercent(pct))}</span>
+ </a>`;
+ })
+ .join('');
+
+ wireTooltip(coins);
+}
+
+let tipEl = null;
+function wireTooltip(coins) {
+ const el = $('hm-grid');
+ const byId = new Map(coins.map((c) => [c.id, c]));
+ if (!tipEl) {
+ tipEl = document.createElement('div');
+ tipEl.className = 'hm-tip';
+ tipEl.hidden = true;
+ document.body.appendChild(tipEl);
+ }
+ const move = (e) => {
+ const tile = e.target.closest('.hm-tile');
+ if (!tile) {
+ tipEl.hidden = true;
+ return;
+ }
+ const c = byId.get(tile.dataset.id);
+ if (!c) return;
+ tipEl.innerHTML = `
+ <p class="t">${esc(c.name)} <span style="color:var(--cv-text-3)">${esc(c.symbol)}</span></p>
+ <p class="r"><span>Price</span><span>${esc(formatPrice(c.price))}</span></p>
+ <p class="r"><span>24h</span><span class="${(c.change_24h ?? 0) >= 0 ? 'cv-up' : 'cv-down'}">${esc(formatPercent(c.change_24h))}</span></p>
+ <p class="r"><span>7d</span><span class="${(c.change_7d ?? 0) >= 0 ? 'cv-up' : 'cv-down'}">${esc(formatPercent(c.change_7d))}</span></p>
+ <p class="r"><span>Mkt Cap</span><span>${esc(formatUsd(c.market_cap))}</span></p>`;
+ tipEl.hidden = false;
+ const pad = 14;
+ let left = e.clientX + pad;
+ let top = e.clientY + pad;
+ const r = tipEl.getBoundingClientRect();
+ if (left + r.width > window.innerWidth - 8) left = e.clientX - r.width - pad;
+ if (top + r.height > window.innerHeight - 8) top = e.clientY - r.height - pad;
+ tipEl.style.left = `${Math.max(8, left)}px`;
+ tipEl.style.top = `${Math.max(8, top)}px`;
+ };
+ el.onpointermove = move;
+ el.onpointerleave = () => {
+ tipEl.hidden = true;
+ };
+}
+
+// ── Controls + boot ───────────────────────────────────────────────────────────
+
+function wireControls() {
+ $('hm-timeframe').addEventListener('click', (e) => {
+ const btn = e.target.closest('button');
+ if (!btn) return;
+ state.key = btn.dataset.key;
+ $('hm-timeframe')
+ .querySelectorAll('button')
+ .forEach((b) => b.setAttribute('aria-pressed', String(b === btn)));
+ render();
+ });
+ $('hm-count').addEventListener('click', async (e) => {
+ const btn = e.target.closest('button');
+ if (!btn) return;
+ state.count = Number(btn.dataset.count);
+ $('hm-count')
+ .querySelectorAll('button')
+ .forEach((b) => b.setAttribute('aria-pressed', String(b === btn)));
+ if (state.count > state.coins.length) await ensureCoins(state.count);
+ render();
+ });
+
+ let raf = null;
+ window.addEventListener('resize', () => {
+ if (raf) cancelAnimationFrame(raf);
+ raf = requestAnimationFrame(render);
+ });
+}
+
+async function ensureCoins(min) {
+ // /coins markets returns 100 max per page — top 100 covers both count options.
+ if (state.coins.length >= min) return;
+ try {
+ const { coins } = await getJson('/api/coin/markets?page=1&per_page=100');
+ state.coins = coins;
+ } catch {
+ /* keep what we have */
+ }
+}
+
+async function init() {
+ wireControls();
+ render(); // skeleton
+ await ensureCoins(100);
+ state.loading = false;
+ render();
+ $('hm-updated').textContent = state.coins.length
+ ? `Sized by market cap · colored by price move · live from CoinGecko`
+ : '';
+}
+
+init();
diff --git a/tour-sdk/src/guide-avatar.js b/tour-sdk/src/guide-avatar.js
index 022cc2714..2ca577d18 100644
--- a/tour-sdk/src/guide-avatar.js
+++ b/tour-sdk/src/guide-avatar.js
@@ -40,6 +40,11 @@ const WALK_SPEED = 460;
const GRAVITY = -14;
const SPAWN_DROP = 0.32;
+// How snappily the guide's facing follows its movement direction, mirrored from
+// the walk world's TURN_LERP (src/walk.js) so the tour guide turns with the same
+// weight as the walk/stroll robot.
+const TURN_LERP = 0.18;
+
export class GuideAvatar {
constructor(tourConfig = {}) {
// Feed the host's avatar settings into the walk SDK's config resolver, which
@@ -259,7 +264,14 @@ export class GuideAvatar {
const x = clamp(pos.x, MARGIN, window.innerWidth - s.w - MARGIN);
const y = clamp(pos.y, MARGIN, window.innerHeight - s.h - MARGIN);
const dx = x - this._pos.x;
- if (Math.abs(dx) > 1) this._targetYaw = clamp((dx / window.innerWidth) * 2, -0.7, 0.7);
+ const dy = y - this._pos.y;
+ // Full 360° facing from the actual travel vector — the same omnidirectional
+ // turn the walk/stroll robot uses (src/walk.js: yaw = atan2(moveX, moveZ)).
+ // Screen +x maps to world +X (right); screen +y (downward, toward the viewer)
+ // maps to world +Z (toward the fixed front camera, the rig's yaw=0 forward),
+ // so atan2(dx, dy) turns the guide to face wherever it walks — left, right,
+ // toward the camera, or away — instead of the old ±40° horizontal tilt.
+ if (Math.hypot(dx, dy) > 1) this._targetYaw = Math.atan2(dx, dy);
this.controller?.setState('walk');
this._walking = true;
clearTimeout(this._settleTimer);
@@ -288,7 +300,11 @@ export class GuideAvatar {
_faceRect(rect) {
const avatarCx = this._pos.x + CANVAS_W / 2;
- this._targetYaw = clamp((rect.cx - avatarCx) / window.innerWidth, -0.6, 0.6);
+ const avatarCy = this._pos.y + CANVAS_H / 2;
+ // Turn to fully face the highlighted target, matching the walk robot's
+ // all-directions facing rather than the old ±34° horizontal clamp. Same
+ // screen→world axis mapping as place() (dx→X, dy→Z toward the camera).
+ this._targetYaw = Math.atan2(rect.cx - avatarCx, rect.cy - avatarCy);
}
// Approximate screen position of the avatar's head — origin for the pointer
@@ -327,7 +343,10 @@ export class GuideAvatar {
if (!this.host) return;
this.clock.update();
const dt = Math.min(this.clock.getDelta(), 0.05);
- this._yaw += (this._targetYaw - this._yaw) * 0.12;
+ // Shortest-arc turn toward the target facing. With full 360° targets the
+ // naïve (target - current) lerp would spin the long way across the ±π seam;
+ // wrapping the delta into [-π, π] keeps every turn taking the near side.
+ this._yaw += shortestAngle(this._targetYaw - this._yaw) * TURN_LERP;
if (this.rig) {
this.rig.rotation.y = this._yaw;
// Gravity: integrate velocity, land on the ground plane, hold there —
@@ -374,6 +393,10 @@ export class GuideAvatar {
function clamp(n, lo, hi) {
return Math.min(hi, Math.max(lo, n));
}
+// Wrap an angle delta into [-π, π] so a yaw lerp always rotates the short way.
+function shortestAngle(d) {
+ return Math.atan2(Math.sin(d), Math.cos(d));
+}
function lsGet(key) {
try {
return localStorage.getItem(key);
diff --git a/vercel.json b/vercel.json
index 22013c5a5..e00b2f43f 100644
--- a/vercel.json
+++ b/vercel.json
@@ -914,6 +914,22 @@
"src": "/coins/?",
"dest": "/coins.html"
},
+ {
+ "src": "/fear-greed/?",
+ "dest": "/fear-greed.html"
+ },
+ {
+ "src": "/heatmap/?",
+ "dest": "/heatmap.html"
+ },
+ {
+ "src": "/gas/?",
+ "dest": "/gas.html"
+ },
+ {
+ "src": "/compare/?",
+ "dest": "/compare.html"
+ },
{
"src": "/coin/([a-zA-Z0-9][a-zA-Z0-9_-]{0,99})/?",
"dest": "/coin.html"
diff --git a/vite.config.js b/vite.config.js
index e2aefc0ee..0d57fa8ff 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -444,6 +444,10 @@ const appConfig = {
'coin-intel': resolve(__dirname, 'pages/coin-intel.html'),
coins: resolve(__dirname, 'pages/coins.html'),
coin: resolve(__dirname, 'pages/coin.html'),
+ 'fear-greed': resolve(__dirname, 'pages/fear-greed.html'),
+ heatmap: resolve(__dirname, 'pages/heatmap.html'),
+ gas: resolve(__dirname, 'pages/gas.html'),
+ compare: resolve(__dirname, 'pages/compare.html'),
trending: resolve(__dirname, 'pages/trending.html'),
compose: resolve(__dirname, 'pages/compose.html'),
'create-next': resolve(__dirname, 'pages/create-next.html'),
@@ -938,6 +942,14 @@ support: resolve(__dirname, 'pages/support.html'),
'/coin-intel/': resolve(root, 'pages/coin-intel.html'),
'/coins': resolve(root, 'pages/coins.html'),
'/coins/': resolve(root, 'pages/coins.html'),
+ '/fear-greed': resolve(root, 'pages/fear-greed.html'),
+ '/fear-greed/': resolve(root, 'pages/fear-greed.html'),
+ '/heatmap': resolve(root, 'pages/heatmap.html'),
+ '/heatmap/': resolve(root, 'pages/heatmap.html'),
+ '/gas': resolve(root, 'pages/gas.html'),
+ '/gas/': resolve(root, 'pages/gas.html'),
+ '/compare': resolve(root, 'pages/compare.html'),
+ '/compare/': resolve(root, 'pages/compare.html'),
'/compose': resolve(root, 'pages/compose.html'),
'/compose/': resolve(root, 'pages/compose.html'),
'/create/next': resolve(root, 'pages/create-next.html'),