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.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
fix(crypto-api): keep the holder and safety reads answering when the free Solana lanes stall
nirholas735f319d2303
diff --git a/api/_lib/solana/connection.js b/api/_lib/solana/connection.jsindex 4de2e5360..f0ec2cded 100644--- a/api/_lib/solana/connection.js+++ b/api/_lib/solana/connection.js@@ -1044,6 +1044,36 @@ export function isTransientRpcError(err) {);}+/**+ * What a THROWN attempt says about the lane, and therefore what to charge it.+ * Three genuinely different events reach the same catch, and collapsing them cost+ * us the free chain's primary lane:+ *+ * 'ignore': the CALLER's budget expired. Rotation is over either way+ * and this attempt learned nothing about the endpoint, so+ * charging it would bench a healthy node for the caller's deadline.+ * 'demote-method': the lane accepted the request and never answered within+ * the attempt bound. Measured 2026-08-12: PublicNode hangs+ * indefinitely on getTokenLargestAccounts (no response at 35s)+ * while answering getAccountInfo in milliseconds, which is a+ * silent per-shape refusal. Cooling the whole lane for it benched+ * the primary free lane for every other method, and that is how+ * one unanswerable shape starved /api/crypto/holders and the+ * holder half of /api/crypto/security. markMethodDemotion's+ * breadth guard still benches a lane that hangs on everything.+ * 'cool-lane': a genuine transport failure (DNS, refused connection,+ * socket hang up), or a hang on a request whose call shapes we+ * could not read. Brief cooldown, as before.+ *+ * @param {{ callerAborted: boolean, attemptTimedOut: boolean, hasMethods: boolean }} signals+ * @returns {'ignore'|'demote-method'|'cool-lane'}+ */+export function throwDisposition({ callerAborted, attemptTimedOut, hasMethods }) {+ if (callerAborted) return 'ignore';+ if (attemptTimedOut && hasMethods) return 'demote-method';+ return 'cool-lane';+}+// Rotating fetch backing a Connection. It NEVER surfaces a rotate-worthy status// (401/403/429/5xx) to @solana/web3.js — it either returns a healthy response or// throws — so web3.js's internal 429 backoff loop ("Server responded with 429 …@@ -1152,25 +1182,16 @@ export function makeRotatingFetch(endpoints) {}),};} catch (err) {- // The CALLER's budget ran out, not the lane's patience. Rotation is over- // either way, and this attempt learned nothing about the endpoint, so- // penalising it here would bench a healthy node for the caller's deadline.- if (init?.signal?.aborted) return { error: err };- // The lane accepted the request and never answered within the attempt- // bound. Measured 2026-08-12: PublicNode hangs indefinitely on- // getTokenLargestAccounts (no response at 35s) while answering- // getAccountInfo in milliseconds, a silent per-shape refusal. Cooling the- // whole lane for it benched the primary free lane for every other method,- // which is how one unanswerable shape starved the holder and security- // readers. Demote the shape instead; markMethodDemotion's breadth guard- // still benches a lane that hangs on everything.- if (attemptSignal.aborted && methods.length) {+ const disposition = throwDisposition({+ callerAborted: init?.signal?.aborted === true,+ attemptTimedOut: attemptSignal.aborted,+ hasMethods: methods.length > 0,+ });+ if (disposition === 'demote-method') {penalise(url, 504, '', true, `no answer within ${Math.round(ATTEMPT_TIMEOUT_MS / 1000)}s`);- return { error: err };+ } else if (disposition === 'cool-lane') {+ _endpointCooldown.set(url, Date.now() + NETWORK_COOLDOWN_MS);}- // A thrown fetch is a transient network/DNS blip, not a quota signal —- // cool only briefly so a healthy provider isn't parked for long.- _endpointCooldown.set(url, Date.now() + NETWORK_COOLDOWN_MS);return { error: err };}};diff --git a/api/crypto/bonding.js b/api/crypto/bonding.jsindex 0e5f2e39b..ae3aa3fe1 100644--- a/api/crypto/bonding.js+++ b/api/crypto/bonding.js@@ -1,15 +1,15 @@-// GET /api/crypto/bonding — free, keyless bonding-curve / graduation status for a+// GET /api/crypto/bonding: free, keyless bonding-curve / graduation status for a// pump.fun token.//// Agent use-case: an agent holding or watching a pump.fun coin needs to know-// exactly where it sits on the bonding curve — % to graduation, SOL in the curve,+// exactly where it sits on the bonding curve: % to graduation, SOL in the curve,// and whether it has already migrated to Raydium / PumpSwap. Timing entries and// exits around graduation is a core meme-trading move, and this is the one read// that answers it. Pairs with /api/crypto/launches (discover fresh mints) and// /api/crypto/whales.//// Part of the free Crypto Data API (/api/crypto/*). Plain-handler pattern: no-// account, no key, generous per-IP limit. Real data only — the pump.fun public+// account, no key, generous per-IP limit. Real data only, the pump.fun public// frontend feed via api/_lib/pump-bonding.js.import { cors, method, wrap, error, json, rateLimited } from '../_lib/http.js';@@ -35,7 +35,7 @@ export default wrap(async (req, res) => {res,400,'missing_mint',- 'query param `mint` is required — pass a pump.fun token mint, e.g. ?mint=<base58-mint>',+ 'query param `mint` is required. Pass a pump.fun token mint, e.g. ?mint=<base58-mint>',);}if (!MINT_RE.test(mint)) {@@ -43,7 +43,7 @@ export default wrap(async (req, res) => {res,400,'invalid_mint',- '`mint` must be a base58 Solana address (32–44 chars)',+ '`mint` must be a base58 Solana address (32-44 chars)',{ mint },);}@@ -52,18 +52,18 @@ export default wrap(async (req, res) => {const ts = new Date().toISOString();// Not a pump.fun-indexed mint (never launched on pump.fun, or not a bonding-curve- // token) — a client error, so 400 with a pointer to discovery.+ // token) is a client error, so 400 with a pointer to discovery.if (result.kind === 'not_found') {return error(res,400,'not_pumpfun_mint',- `${mint} is not a pump.fun bonding-curve token — it never launched on pump.fun or isn't indexed. Discover live pump.fun mints at /api/crypto/launches.`,+ `${mint} is not a pump.fun bonding-curve token: it never launched on pump.fun or isn't indexed. Discover live pump.fun mints at /api/crypto/launches.`,{ mint },);}- // pump.fun feed temporarily unreachable (network / timeout / 5xx). Never 500 —+ // pump.fun feed temporarily unreachable (network / timeout / 5xx). Never 500:// answer 503 + Retry-After so the agent backs off and retries, per the free-API// contract.if (result.kind === 'upstream_down') {@@ -72,7 +72,7 @@ export default wrap(async (req, res) => {503,{error: 'upstream_unavailable',- error_description: 'pump.fun data source is temporarily unreachable — retry shortly',+ error_description: 'pump.fun data source is temporarily unreachable, retry shortly',mint,retry_after: 15,ts,diff --git a/api/crypto/holders.js b/api/crypto/holders.jsindex 3f4567cee..542b16434 100644--- a/api/crypto/holders.js+++ b/api/crypto/holders.js@@ -1,21 +1,21 @@-// GET /api/crypto/holders — free holder distribution / concentration for a+// GET /api/crypto/holders: free holder distribution / concentration for a// Solana token.//// Agent use-case: an agent sizing a position needs holder distribution before-// it commits — how many holders exist, what share the top wallets control, and+// it commits: how many holders exist, what share the top wallets control, and// whether the dev/insiders still dominate. High concentration = exit risk. One// keyless call answers it with real on-chain data.//// Part of the free Crypto Data API (/api/crypto/*). Plain-handler pattern: no// account, no key, generous per-IP limit. Two real paths (never a mock): a// Helius owner-aggregated walk when the deployment has a key (exact holder-// count within its cap), else the keyless RPC truth — the chain's 20 largest+// count within its cap), else the keyless RPC truth, the chain's 20 largest// token accounts with owners resolved, marked as such in `sources`/`note`.//// Query:// address = <Solana mint> (required)// chain = solana (optional; only 'solana'/'sol' accepted)-// limit = 1..50 (default 10) — how many top holders to return+// limit = 1..50 (default 10), how many top holders to return//// Response: { address, chain, holderCount, top: [{ owner, amount, pct }],// top10Pct, concentration: low|medium|high|unknown, ts, sources[], note? }@@ -44,18 +44,18 @@ export default wrap(async (req, res) => {const limit = Math.min(MAX_LIMIT, Math.max(1, Number.isFinite(rawLimit) ? Math.floor(rawLimit) : DEFAULT_LIMIT));if (!address) {- return error(res, 400, 'missing_address', 'query param `address` is required — pass a Solana token mint', {+ return error(res, 400, 'missing_address', 'query param `address` is required. Pass a Solana token mint', {example: EXAMPLE,});}// Solana-only, honestly: SPL token accounts have no EVM equivalent here.if (isValidEvmAddress(address) || (rawChain && rawChain !== 'solana' && rawChain !== 'sol')) {- return error(res, 400, 'unsupported_chain', 'this endpoint reads Solana holder distribution only — pass a base58 Solana mint address', {+ return error(res, 400, 'unsupported_chain', 'this endpoint reads Solana holder distribution only. Pass a base58 Solana mint address', {example: EXAMPLE,});}if (!isValidSolanaAddress(address)) {- return error(res, 400, 'invalid_address', '`address` must be a base58 Solana mint address (32–44 chars)', {+ return error(res, 400, 'invalid_address', '`address` must be a base58 Solana mint address (32-44 chars)', {address,example: EXAMPLE,});@@ -65,14 +65,14 @@ export default wrap(async (req, res) => {const ts = new Date().toISOString();if (result.status === 'not_found') {- return error(res, 400, 'token_not_found', `${address} is not an on-chain token mint — check the address, or discover live tokens at /api/crypto/trending`, {+ return error(res, 400, 'token_not_found', `${address} is not an on-chain token mint. Check the address, or discover live tokens at /api/crypto/trending`, {address,});}if (result.status === 'upstream_down') {return json(res, 503, {error: 'upstream_unavailable',- error_description: 'holder data sources are temporarily unreachable — retry shortly',+ error_description: 'holder data sources are temporarily unreachable, retry shortly',address,retry_after: 15,ts,diff --git a/api/crypto/index.js b/api/crypto/index.jsindex 074e07010..2f44534e0 100644--- a/api/crypto/index.js+++ b/api/crypto/index.js@@ -1,14 +1,14 @@// @ts-check-// GET /api/crypto — the front door to the free, keyless Crypto Data API bundle.+// GET /api/crypto: the front door to the free, keyless Crypto Data API bundle.//// One URL an agent (or a human wiring one up) hits to discover the entire API:// every endpoint, its inputs/outputs, and a live example. This is what makes the// bundle feel like one product instead of a handful of loose routes. The list is// assembled at request time from the catalog (api/_lib/crypto-catalog), so a new-// sibling endpoint appears here the moment it ships — nothing to wire by hand.+// sibling endpoint appears here the moment it ships, with nothing to wire by hand.//// Content negotiation: `Accept: text/html` gets a browsable page; everything-// else (the agent path) gets JSON. Free means free — keyless, no account, a+// else (the agent path) gets JSON. Free means free: keyless, no account, a// generous per-IP limit that only blunts abuse.import { wrap, cors, method, json, text, rateLimited } from '../_lib/http.js';@@ -38,7 +38,7 @@ export default wrap(async (req, res) => {version: VERSION,endpoints,count: endpoints.length,- // Zero entries is a valid state, not an error — say so plainly.+ // Zero entries is a valid state, not an error, so say so plainly....(endpoints.length === 0? {note: 'Endpoints are coming soon. They list here automatically as they ship.',@@ -108,7 +108,7 @@ function renderHtml(p, origin) {<head><meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />- <title>three.ws Crypto Data API — free & keyless</title>+ <title>three.ws Crypto Data API: free & keyless</title><meta name="description" content="A free, keyless crypto data bundle for AI agents. One URL to discover every endpoint." /><style>:root {@@ -175,7 +175,7 @@ function renderHtml(p, origin) {<span class="badge">Keyless</span><span class="badge">v${esc(p.version)}</span></div>- <p class="lede">One URL to discover the entire bundle — every endpoint, its inputs and outputs, and a live example. No account, no API key.</p>+ <p class="lede">One URL to discover the entire bundle: every endpoint, its inputs and outputs, and a live example. No account, no API key.</p><p class="meta">${p.count} endpoint${p.count === 1 ? '' : 's'} ·<a href="/api/crypto/openapi.json">OpenAPI 3.1</a> ·diff --git a/api/crypto/launches.js b/api/crypto/launches.jsindex 6c64a90cb..1393516e5 100644--- a/api/crypto/launches.js+++ b/api/crypto/launches.js@@ -1,14 +1,14 @@-// GET /api/crypto/launches — free, keyless live feed of the freshest pump.fun+// GET /api/crypto/launches: free, keyless live feed of the freshest pump.fun// launches.//// Agent use-case: a sniper/discovery agent polls for brand-new pump.fun mints-// with enough signal to filter — name, symbol, age, market cap, bonding-curve-// progress, dev wallet — then hands the interesting ones to /api/crypto/bonding+// with enough signal to filter (name, symbol, age, market cap, bonding-curve+// progress, dev wallet), then hands the interesting ones to /api/crypto/bonding// (watch the curve) and /api/crypto/whales (watch the money). A free live feed// is exactly what agents poll.//// Part of the free Crypto Data API (/api/crypto/*). Plain-handler pattern: no-// account, no key, generous per-IP limit. Real data only — the pump.fun public+// account, no key, generous per-IP limit. Real data only, the pump.fun public// frontend feed via api/_lib/pump-launch-feed.js; curve math shared with// /api/crypto/bonding via api/_lib/pump-bonding.js.@@ -95,7 +95,7 @@ export default wrap(async (req, res) => {count: 0,ts,source: 'pumpfun:unavailable',- note: 'pump.fun feed is temporarily unreachable — empty sweep, retry shortly',+ note: 'pump.fun feed is temporarily unreachable: empty sweep, retry shortly',},{ 'cache-control': 'no-store' },);@@ -107,7 +107,7 @@ export default wrap(async (req, res) => {.map((c) => toLaunch(c, now)).sort((a, b) => (b.createdAt || '').localeCompare(a.createdAt || ''));- // A coin whose cap/age is unknown can't prove it clears the bar — filters drop+ // A coin whose cap/age is unknown can't prove it clears the bar, so filters drop// it rather than guess.if (minMarketCap != null) {launches = launches.filter((l) => l.marketCapUsd != null && l.marketCapUsd >= minMarketCap);@@ -119,7 +119,7 @@ export default wrap(async (req, res) => {const body = { launches, count: launches.length, ts, source: 'pumpfun' };if (!launches.length) {- body.note = 'no launches match the current filters — relax minMarketCap / maxAgeMin or retry';+ body.note = 'no launches match the current filters. Relax minMarketCap / maxAgeMin or retry';}return json(res,diff --git a/api/crypto/openapi.js b/api/crypto/openapi.jsindex a2cbf645f..05a172609 100644--- a/api/crypto/openapi.js+++ b/api/crypto/openapi.js@@ -1,11 +1,11 @@// @ts-check-// GET /api/crypto/openapi.json — the machine-readable spec for the free Crypto+// GET /api/crypto/openapi.json: the machine-readable spec for the free Crypto// Data API bundle, generated live from the catalog (api/_lib/crypto-catalog).//// Served at `/api/crypto/openapi.json` via the rewrite in vercel.json; this file// also answers `/api/crypto/openapi` directly. An agent points its OpenAPI// toolchain (openapi-generator, LangChain's OpenAPIToolkit, Swagger UI) at this-// URL and gets typed clients / callable tools for every endpoint — no key, no+// URL and gets typed clients / callable tools for every endpoint, with no key and no// account. The doc is never hand-written: paths, params, and response schemas// all derive from the catalog entries, so it can't drift from `/api/crypto`.@@ -28,7 +28,7 @@ export default wrap(async (req, res) => {const entries = await loadCatalog();const doc = buildOpenApiDoc(entries, { origin: env.APP_ORIGIN, version: VERSION });- // Catalog changes only on deploy — safe to CDN-cache briefly.+ // Catalog changes only on deploy, so it is safe to CDN-cache briefly.return json(res, 200, doc, {'cache-control': 'public, s-maxage=300, stale-while-revalidate=600',});diff --git a/api/crypto/security.js b/api/crypto/security.jsindex cc195575e..ce1602ff0 100644--- a/api/crypto/security.js+++ b/api/crypto/security.js@@ -1,14 +1,14 @@-// GET /api/crypto/security — free, keyless token safety / rug-signal check.+// GET /api/crypto/security: free, keyless token safety / rug-signal check.//// Agent use-case: before an agent buys or LPs into a token, it needs a fast-// "is this a honeypot / rug?" read — mint & freeze authority, holder+// "is this a honeypot / rug?" read: mint & freeze authority, holder// concentration, liquidity depth, metadata mutability, LP custody. This is the// single most-requested pre-trade check in crypto agent workflows; one keyless-// GET answers it with on-chain FACTS and a documented, deterministic riskLevel —+// GET answers it with on-chain FACTS and a documented, deterministic riskLevel,// never an LLM opinion, never a guessed "safe".//// Part of the free Crypto Data API (/api/crypto/*). Plain-handler pattern: no-// account, no key, generous per-IP limit. Real data only — Solana RPC (failover+// account, no key, generous per-IP limit. Real data only, from Solana RPC (failover// chain), DexScreener, pump.fun public records, Metaplex metadata. Solana-only// by design: the checks (SPL authorities, getTokenLargestAccounts) are Solana// concepts; an EVM address gets an honest 400, not a half-built passthrough.@@ -20,7 +20,7 @@// Response: { address, chain, checks: { mintAuthorityRevoked,// freezeAuthorityRevoked, metadataMutable, lpBurnedOrLocked, liquidityUsd,// topHolderPctFlag }, riskLevel: low|medium|high|unknown, reasons[], ts,-// sources[] } — unknowns are null/'unknown', never guessed.+// sources[] }. Unknowns are null/'unknown', never guessed.import { cors, method, wrap, error, json, rateLimited } from '../_lib/http.js';import { limits, clientIp } from '../_lib/rate-limit.js';@@ -43,7 +43,7 @@ export default wrap(async (req, res) => {const rawChain = (url.searchParams.get('chain') || '').trim().toLowerCase();if (!address) {- return error(res, 400, 'missing_address', 'query param `address` is required — pass a Solana token mint', {+ return error(res, 400, 'missing_address', 'query param `address` is required. Pass a Solana token mint', {example: EXAMPLE,});}@@ -51,12 +51,12 @@ export default wrap(async (req, res) => {// mint/freeze authorities and getTokenLargestAccounts have no EVM equivalent// here, and a half-answered EVM check would read as a fake "safe".if (isValidEvmAddress(address) || (rawChain && rawChain !== 'solana' && rawChain !== 'sol')) {- return error(res, 400, 'unsupported_chain', 'this endpoint checks Solana tokens only — pass a base58 Solana mint address', {+ return error(res, 400, 'unsupported_chain', 'this endpoint checks Solana tokens only. Pass a base58 Solana mint address', {example: EXAMPLE,});}if (!isValidSolanaAddress(address)) {- return error(res, 400, 'invalid_address', '`address` must be a base58 Solana mint address (32–44 chars)', {+ return error(res, 400, 'invalid_address', '`address` must be a base58 Solana mint address (32-44 chars)', {address,example: EXAMPLE,});@@ -65,20 +65,20 @@ export default wrap(async (req, res) => {const result = await composeTokenSecurity({ address });const ts = new Date().toISOString();- // Valid mint shape, but neither the chain nor any market/pump source knows it —+ // Valid mint shape, but neither the chain nor any market/pump source knows it:// client input, matching the bundle's /token and /bonding conventions.if (result.status === 'not_found') {- return error(res, 400, 'token_not_found', `${address} is not a token any live source can resolve — check the mint, or discover live tokens at /api/crypto/trending`, {+ return error(res, 400, 'token_not_found', `${address} is not a token any live source can resolve. Check the mint, or discover live tokens at /api/crypto/trending`, {address,});}- // Every source unreachable — never 500, and never a fabricated verdict; 503 ++ // Every source unreachable: never 500, and never a fabricated verdict; 503 +// Retry-After so the agent backs off and retries.if (result.status === 'upstream_down') {return json(res, 503, {error: 'upstream_unavailable',- error_description: 'security data sources are temporarily unreachable — retry shortly; no verdict is fabricated while sources are down',+ error_description: 'security data sources are temporarily unreachable, retry shortly; no verdict is fabricated while sources are down',address,retry_after: 15,ts,diff --git a/api/crypto/symbol.js b/api/crypto/symbol.jsindex be2627cab..f1541ebe2 100644--- a/api/crypto/symbol.js+++ b/api/crypto/symbol.js@@ -9,11 +9,11 @@// Agent use-case: an agent about to launch a token wants to check candidate// tickers for collisions (exact name clashes + look-alikes that dilute search)// before minting. A free batch check is the natural top-of-funnel for the paid-// Pump Launcher (/api/x402/pump-launch) — clear the name here, launch there.+// Pump Launcher (/api/x402/pump-launch): clear the name here, launch there.//// Data source: DexScreener's keyless search API (every chain it indexes),// deduped by mint and scored locally with a pg_trgm-style trigram Jaccard-// similarity — the same exact-plus-fuzzy collision model the retired paid route+// similarity, the same exact-plus-fuzzy collision model the retired paid route// (api/x402/symbol-availability.js) ran against three.ws's own mint index, but// broadened to the whole market and made free. No key, no account.@@ -48,7 +48,7 @@ function trigrams(str) {return set;}-// Jaccard similarity over trigram sets — the same measure Postgres' pg_trgm+// Jaccard similarity over trigram sets, the same measure Postgres' pg_trgm// `similarity()` uses (|intersection| / |union|), so the free route's fuzzy// scoring matches what the paid route returned. 1.0 == identical, 0 == disjoint.export function symbolSimilarity(a, b) {@@ -104,15 +104,15 @@ async function checkOne(symbol, chain, fetchImpl) {candidates = await searchTokens(symbol, chain, fetchImpl);} catch {// Registry source down for this symbol: degrade, never fail the batch.- // `available: null` signals "could not verify" — distinct from a hard- // available/taken — so a caller never reads an outage as a green light.+ // `available: null` signals "could not verify", distinct from a hard+ // available/taken, so a caller never reads an outage as a green light.return {symbol,available: null,exactCollisions: [],fuzzyCollisions: [],degraded: true,- note: 'collision source unavailable — could not verify this symbol; retry shortly',+ note: 'collision source unavailable: could not verify this symbol; retry shortly',};}@@ -142,7 +142,7 @@ async function checkOne(symbol, chain, fetchImpl) {};}-// Core batch check — pure enough to unit-test with an injected `fetchImpl`.+// Core batch check, pure enough to unit-test with an injected `fetchImpl`.// De-duplicates the input case-insensitively (checking "MOON" and "moon" twice// wastes an upstream call and skews the counts).export async function checkSymbols({ symbols, chain, fetchImpl = fetch }) {@@ -217,7 +217,7 @@ export default wrap(async (req, res) => {res,400,'missing_symbols',- `provide 1–${SYMBOL_CAP} ticker symbols via ?symbols=A,B,C (GET) or { "symbols": [...] } (POST)`,+ `provide 1 to ${SYMBOL_CAP} ticker symbols via ?symbols=A,B,C (GET) or { "symbols": [...] } (POST)`,{ cap: SYMBOL_CAP, example: { symbols: ['MOON', 'ROCKET', 'FROG'], chain: 'solana' } },);}@@ -226,7 +226,7 @@ export default wrap(async (req, res) => {res,400,'too_many_symbols',- `at most ${SYMBOL_CAP} symbols per request — you sent ${cleaned.length}`,+ `at most ${SYMBOL_CAP} symbols per request, you sent ${cleaned.length}`,{ cap: SYMBOL_CAP },);}diff --git a/api/crypto/token.js b/api/crypto/token.jsindex b56c17592..5f0a172e8 100644--- a/api/crypto/token.js+++ b/api/crypto/token.js@@ -1,24 +1,24 @@-// GET /api/crypto/token — free, keyless token market snapshot for AI agents.+// GET /api/crypto/token: free, keyless token market snapshot for AI agents.//// Agent use-case: a trading/research agent holds a contract address and needs the// token's current market state in ONE call before deciding to buy, alert, or// ignore. Without this it juggles DexScreener + an RPC + a price API; here one// free read returns identity, price, 24 h change, market cap, FDV, liquidity,-// volume, and the venue link — with honest nulls for anything unresolvable.+// volume, and the venue link, with honest nulls for anything unresolvable.//// Part of the free Crypto Data API (/api/crypto/*). Plain-handler pattern: no-// account, no key, generous per-IP limit. Real data only — DexScreener for the+// account, no key, generous per-IP limit. Real data only, DexScreener for the// market read (any chain it indexes), pump.fun's public coin record as the// keyless fallback for fresh Solana launches with no DEX pair yet, Helius DAS// name/symbol enrichment when a key exists (else those fields stay null).//// Query:// address = <Solana mint | EVM 0x contract> (required)-// chain = solana | ethereum | base | bsc | … (optional — inferred from the+// chain = solana | ethereum | base | bsc | … (optional, inferred from the// address shape when omitted; for multi-chain EVM deployments it// pins the read to one chain instead of the deepest pool overall)//-// Response (stable schema — every key always present, unresolved = null):+// Response (stable schema, every key always present, unresolved = null):// { address, chain, name, symbol, priceUsd, change24h, marketCapUsd,// liquidityUsd, volume24hUsd, fdvUsd, pairCreatedAt, dexId, url, ts,// sources[], note? }@@ -48,7 +48,7 @@ export default wrap(async (req, res) => {const chain = rawChain ? (CHAIN_ALIASES[rawChain] || rawChain) : null;if (!address) {- return error(res, 400, 'missing_address', 'query param `address` is required — pass a token contract address (Solana mint or EVM 0x)', {+ return error(res, 400, 'missing_address', 'query param `address` is required. Pass a token contract address (Solana mint or EVM 0x)', {example: EXAMPLE,});}@@ -57,13 +57,13 @@ export default wrap(async (req, res) => {// 0x40-hex → EVM, anything else is a fast 400 instead of a wasted round-trip.const family = chainOf(address);if (!family) {- return error(res, 400, 'invalid_address', 'not a token contract address — expected a base58 Solana mint or a 0x EVM contract', {+ return error(res, 400, 'invalid_address', 'not a token contract address. Expected a base58 Solana mint or a 0x EVM contract', {address,example: EXAMPLE,});}- // A chain that contradicts the address shape can never resolve — say so now.+ // A chain that contradicts the address shape can never resolve, so say so now.if (chain && ((chain === 'solana') !== (family === 'solana'))) {return error(res, 400, 'chain_mismatch', `address is a ${family === 'solana' ? 'Solana mint' : '0x EVM contract'} but \`chain=${rawChain}\` is ${family === 'solana' ? 'an EVM chain' : 'solana'}`, {address,@@ -74,21 +74,21 @@ export default wrap(async (req, res) => {const result = await composeTokenSnapshot({ address, chain });const ts = new Date().toISOString();- // Valid address shape, but no live source knows it on the requested chain —+ // Valid address shape, but no live source knows it on the requested chain:// a client-input miss, not a fault (matches the bundle's /bonding convention).if (result.status === 'not_found') {- return error(res, 400, 'token_not_found', `${address} is not a token any live source can resolve${chain ? ` on ${chain}` : ''} — check the address${chain ? ' and chain' : ''}, or discover live tokens at /api/crypto/trending`, {+ return error(res, 400, 'token_not_found', `${address} is not a token any live source can resolve${chain ? ` on ${chain}` : ''}. Check the address${chain ? ' and chain' : ''}, or discover live tokens at /api/crypto/trending`, {address,...(chain ? { chain } : {}),});}- // Every consulted source is unreachable — never 500; 503 + Retry-After so the+ // Every consulted source is unreachable: never 500; 503 + Retry-After so the// agent backs off and retries, per the free-API contract.if (result.status === 'upstream_down') {return json(res, 503, {error: 'upstream_unavailable',- error_description: 'token data sources are temporarily unreachable — retry shortly',+ error_description: 'token data sources are temporarily unreachable, retry shortly',address,retry_after: 15,ts,diff --git a/data/changelog.json b/data/changelog.jsonindex f82ace279..ba445fd92 100644--- a/data/changelog.json+++ b/data/changelog.json@@ -1,6 +1,26 @@{"$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-08-12",+ "title": "Token holder and safety checks stop failing when the free data lanes are busy",+ "summary": "The free crypto API's holder distribution read (/api/crypto/holders) and the holder half of its token safety check (/api/crypto/security) both ask the Solana network for a token's largest accounts. Most of the public nodes we fall back on either refuse that question, answer it with an internal error, or accept it and never reply, and the router treated the last two as real answers, so the call gave up instead of trying the next node. It now moves on from an internal error, charges a silent no-reply to that one question rather than benching an otherwise healthy node, and has one more free node in the rotation that answers it. In a live check the holder read went from succeeding on roughly one call in three to eight out of eight. The error messages across the free crypto endpoints were reworded to match the rest of the platform's plain style at the same time.",+ "tags": [+ "fix",+ "infra"+ ],+ "link": "/docs/crypto-api"+ },+ {+ "date": "2026-08-12",+ "title": "The DeFi market pages stop hammering their data source when they get busy",+ "summary": "The /defi, /chains, /yields, /stablecoins, /fees, /dex-volumes and /hacks pages, plus the protocol, chain and stablecoin detail pages, all read live data from DeFiLlama and hold it in memory for a few minutes. The moment that held copy expired, every request that arrived at once went and fetched its own fresh copy instead of sharing one. Ten simultaneous visitors to the DEX volume board meant ten downloads of the same two megabytes, and the protocol leaderboard's feed is closer to eight. That burst lands precisely when the page is busiest, and when the source pushed back, the page showed an error even though the data behind it was perfectly good. Now the first request through fetches, and everyone else waiting shares that one result. A chain profile also reuses a single copy of the protocol list rather than pulling it again for every chain. If a fetch does fail, the failure is no longer held on to, so the next visitor gets a real retry instead of the same error for the rest of the window. One cosmetic fix rode along: a pool whose name is missing on /yields now reads \"Unknown\" instead of a bare dash.",+ "tags": [+ "fix",+ "improvement"+ ],+ "link": "/defi"+ },{"date": "2026-08-12","title": "Claiming the CZ agent works again",diff --git a/docs/ops/solana-rpc-lanes.md b/docs/ops/solana-rpc-lanes.mdindex 0eecb0a5c..0ab877e7c 100644--- a/docs/ops/solana-rpc-lanes.md+++ b/docs/ops/solana-rpc-lanes.md@@ -111,6 +111,44 @@ Three lanes that a naive latency ranking would promote are traps:method demotion parks it. Putting it in front of those readers takes the feature downwhile every dashboard still reads green.+### `getTokenLargestAccounts`: the shape with no free primary (measured 2026-08-12)++Holder distribution reads that shape and nothing else can substitute for it:+[api/\_lib/crypto-token-holders.js](../../api/_lib/crypto-token-holders.js) behind+`/api/crypto/holders`, and the concentration half of `/api/crypto/security`. With+Helius at `max usage reached` and Alchemy at `Monthly capacity limit exceeded` on+the same day, the keyless tail had to carry it, and every lane in front failed in a+different way:++| Lane | `getTokenLargestAccounts` |+|---|---|+| PublicNode | hangs forever (no answer at 35s) |+| `api.mainnet-beta.solana.com` | HTTP 429 |+| Leo RPC | `-32603 Internal JSON-RPC error.` on every call |+| Solana Vibe Station `public.rpc.solanavibestation.com` | serves it; throttles to a few requests, then `-32005` |+| Tatum (both hosts) | serves it, at 5 requests/minute |++Three fixes landed together, and the endpoint went from roughly one success in three+to 8/8 on a warmed instance:++- **`-32603` is now a failover signal** ([classifyRpcBody](../../api/_lib/solana/connection.js)).+ It is the JSON-RPC spec's "internal error", the node's own fault rather than a+ deterministic verdict, so unlike `-32601`/`-32602` the next lane may well serve it.+ Unclassified, Leo's envelope was handed back as though it were the chain's answer+ and the lanes that do serve the shape were never tried.+- **A hang past the attempt bound demotes the (lane, method) pair**, not the lane+ (`throwDisposition`). Charging PublicNode's silent refusal to the whole lane benched+ the free chain's primary for every other method. This is the behaviour this runbook+ already described; before 2026-08-12 the code cooled the lane instead.+- **Solana Vibe Station joined `FREE_KEYLESS_MAINNET`**, behind Leo and ahead of the+ Tatum pair. Verified real mainnet (genesis `5eykt4Us...`, slot within 1 of+ mainnet-beta). Its throttle answers `-32005`, which the capacity classifier already+ parks correctly, so it is depth rather than a primary.++The standing cost is unchanged and is a billing decision, not a code one: while both+metered lanes sit at their monthly ceiling, this shape is served only by throttled+free nodes, so it stays the first read to degrade.+A balance read that cannot reach a lane must never be recorded as a balance of zero.[scripts/audit-service-wallets.mjs](../../scripts/audit-service-wallets.mjs) reports anunreadable wallet as `‼ unreadable`, anddiff --git a/prompts/swarm-100/api-crypto-01.md b/prompts/swarm-100/api-crypto-01.mddeleted file mode 100644index c54480198..000000000--- a/prompts/swarm-100/api-crypto-01.md+++ /dev/null@@ -1,110 +0,0 @@-# API audit: api/crypto batch 01 (10 files)--How to run: paste this file's repo path into a fresh Claude Code chat in this-repository and say "run this work order". This file is fully self-contained:-it depends on no other prompt file anywhere. If neighboring files in-prompts/swarm-100/ are gone, that work is done; if present, ignore them.-Every claim below rots; step 0 re-measures, and what you measure wins.--## Operating clause (binding)--- Read CLAUDE.md first. Its rules override everything, including this file.-- Finish 100% in this session. Never end the turn with a question, an option- list, or an unexecuted plan. A judgment call goes in one line of the final- report; it never becomes a question that halts work.-- The only permitted stops are the CLAUDE.md stop-and-ask gates: spending real- funds or any irreversible on-chain write, git push or a production deploy,- committing content that references a crypto project other than $THREE, and- destroying unrecoverable data.-- No mocks, no fake data, no placeholder stubs, no unfinished-work markers, no- commented-out code. Real APIs and real integrations only.-- The em-dash and en-dash characters are banned in everything you write.-- Concurrent agents share this worktree: stage explicit paths only (never a- bare add-everything), and commit finished work promptly.-- Before committing, run: npm run check:rules -- --paths <files you touched>.- It must exit 0.--## Step 0: re-derive the current state--1. Confirm each file below still exists; deleted ones are done, skip them.-2. For each, decide routability: grep its path in vercel.json and read how- server/index.mjs maps filesystem handlers. Routed files get an endpoint- audit; internal modules get a code and test audit.-3. Start a local server for endpoint checks: node server/index.mjs with .env- loaded, on a free PORT if 3000 is busy.--## Task: audit these api files, then fix everything found--Files in this batch:--- api/crypto/airdrops.js-- api/crypto/bonding.js-- api/crypto/holders.js-- api/crypto/index.js-- api/crypto/launches.js-- api/crypto/openapi.js-- api/crypto/portfolio.js-- api/crypto/security.js-- api/crypto/symbol.js-- api/crypto/token.js--For every routed handler:--1. Exercise it with curl against the local server: the success path returns- real data with the correct status; malformed input returns a 4xx JSON- error, never a stack trace or an HTML error page; auth is enforced where- the code intends it; CORS matches neighboring handlers.-2. Hard-rule scan: no mock fallbacks, no fake-data arrays, no stubbed- responses, no unfinished markers. Errors are handled at the boundary and- internal code trusts itself.-3. Do not spend funds or sign anything on-chain while probing. Payment and- trading handlers get their validation and error paths exercised, never a- live settlement.--For every internal (non-routed) module:--4. Something must import it; if nothing does, delete it as dead code (verify- with a repo-wide grep first).-5. Its main path and one failure path must be covered in tests/; add the- missing test if not.--## Definition of done--- [ ] Every listed file has recorded evidence: a curl transcript for routed- handlers, a passing test or a deletion for internal modules.-- [ ] Zero hard-rule violations remain in these files.-- [ ] vitest run passes; npm run check:rules -- --paths <touched files>- exits 0.--## Never blocked--| Blocker | Resolution (act, do not ask) |-|---|---|-| Missing env var or credential | Check .env and .env.local, then the Cloud Run service env, then Secret Manager (the CLAUDE.md self-unblock playbook has the exact commands). If it truly exists nowhere, wire the code fully behind the env var, prove the wiring with a dry run, and name the single missing var in the report. |-| gcloud not on PATH | Run: export PATH="$HOME/google-cloud-sdk/bin:$PATH" |-| Dev server port 3000 busy | Another agent may be serving this repo; probe it and reuse if so. Otherwise start your own on a free port: npx vite --port 3101 |-| Playwright browser missing | npx playwright install chromium |-| A surface needs a signed-in user | Register a fresh account through the real /register flow against the real API and use it. Never mock the session. |-| A defect sits in code you did not touch | Fix it if it blocks a Definition of done line (root cause it, never mask it). Otherwise note it in the report and continue. |-| An unrelated test is red | Same rule. Never pipe npm test through tail; it masks exit codes. |--## Close out (required)--1. Verify every Definition of done line with the actual command output in- front of you. Never claim a line you did not verify.-2. Commit with explicit paths and a subject that describes the diff (house- style: type(scope): what changed and why a reader cares).-3. Delete this prompt file in that same commit:-- git rm prompts/swarm-100/api-crypto-01.md-- The shrinking directory is this campaign's only progress ledger; there is- no progress log to update.-4. Final report: what step 0 measured, what changed (file list), evidence per- Definition of done line, and any one-line judgment calls. No trailing- questions, no unexecuted plans.--If a line genuinely cannot pass inside this session (an external party must-respond, or an owner-gated action is the final step), finish everything else,-leave this file in place, and state exactly which line remains and who owns-it. Never delete this file on a partial.diff --git a/tests/solana-rpc-method-capability.test.js b/tests/solana-rpc-method-capability.test.jsindex 125f7d811..2d982b0a9 100644--- a/tests/solana-rpc-method-capability.test.js+++ b/tests/solana-rpc-method-capability.test.js@@ -8,6 +8,7 @@ import {rpcMethodsFromBody,rpcMethodDemotions,classifyRpcBody,+ throwDisposition,} from '../api/_lib/solana/connection.js';// Lanes are not interchangeable, and the router used to pretend they were.@@ -335,3 +336,77 @@ describe('makeRotatingFetch: a method refusal demotes the method, never the laneexpect(isMethodDemoted(blocked, 'getTokenAccountsByOwner')).toBe(false);});});++// Leo RPC answers EVERY getTokenLargestAccounts with the JSON-RPC spec's -32603+// "Internal error" while serving getAccountInfo and getMultipleAccounts normally+// (measured live 2026-08-12). Unclassified, -32603 was not a failover signal at+// all: the error envelope was handed back as though it were the chain's answer,+// so /api/crypto/holders returned 503 and /api/crypto/security reported+// riskLevel "unknown" on live mints while lanes that DO serve the method sat+// untried further down the chain.+const LEO_INTERNAL_ERROR = {+ jsonrpc: '2.0',+ id: 1,+ error: { code: -32603, message: 'Internal JSON-RPC error.' },+};++describe('classifyRpcBody: a node internal error is a per-shape failover, not an answer', () => {+ it('fails a -32603 envelope over and demotes the shape rather than the lane', () => {+ const bad = classifyRpcBody(JSON.stringify(LEO_INTERNAL_ERROR));+ expect(bad).toBeTruthy();+ expect(bad.methodBlock).toBe(true);+ expect(bad.reason).toBe('node internal error');+ });++ // The line that separates -32603 from the deterministic family next to it: a+ // method that does not exist gives the same answer on every lane, so rotating+ // on it would just retry a guaranteed failure down the whole chain.+ it('leaves the deterministic -32601/-32602 family alone', () => {+ expect(classifyRpcBody(JSON.stringify({ jsonrpc: '2.0', id: 1, error: { code: -32601, message: 'Method not found' } }))).toBeNull();+ expect(classifyRpcBody(JSON.stringify({ jsonrpc: '2.0', id: 1, error: { code: -32602, message: 'Invalid params' } }))).toBeNull();+ });++ it('rotates a -32603 lane onto one that serves the shape, without cooling it', async () => {+ const faulting = 'https://cap-k1.test/';+ const serving = 'https://cap-k2.test/';+ global.fetch = vi.fn(async (url, init) =>+ url === faulting && JSON.parse(init.body).method === 'getTokenLargestAccounts'+ ? resp(LEO_INTERNAL_ERROR)+ : resp(OK),+ );+ const rf = makeRotatingFetch([faulting, serving]);++ const r = await rf(null, rpc('getTokenLargestAccounts', ['MintPlaceholder1111111111111111111111111111']));+ await expect(r.json()).resolves.toEqual(OK);+ expect(isMethodDemoted(faulting, 'getTokenLargestAccounts')).toBe(true);+ expect(isEndpointCooling(faulting)).toBe(false);++ // The lane is still the primary for everything it does serve.+ await rf(null, rpc('getAccountInfo'));+ expect(global.fetch.mock.calls.at(-1)[0]).toBe(faulting);+ });+});++// PublicNode accepts a getTokenLargestAccounts and then never answers it: no+// response at 35 s, while getAccountInfo comes back in milliseconds. Charging+// that hang to the LANE parked the free chain's primary for every method, on one+// shape it silently refuses. throwDisposition is the policy, split out so the+// three events that reach the same catch can be pinned without waiting on a real+// 10 s attempt bound.+describe('throwDisposition: what a thrown attempt charges the lane', () => {+ it('charges nothing when the CALLER aborted, whatever else is true', () => {+ expect(throwDisposition({ callerAborted: true, attemptTimedOut: true, hasMethods: true })).toBe('ignore');+ expect(throwDisposition({ callerAborted: true, attemptTimedOut: false, hasMethods: false })).toBe('ignore');+ });++ it('demotes the call shape when the lane hung past the attempt bound', () => {+ expect(throwDisposition({ callerAborted: false, attemptTimedOut: true, hasMethods: true })).toBe('demote-method');+ });++ // No readable call shape means no shape to demote; fall back to the brief lane+ // cooldown rather than guessing which method to strike off.+ it('cools the lane for a transport failure, or a hang whose shape we cannot read', () => {+ expect(throwDisposition({ callerAborted: false, attemptTimedOut: false, hasMethods: true })).toBe('cool-lane');+ expect(throwDisposition({ callerAborted: false, attemptTimedOut: true, hasMethods: false })).toBe('cool-lane');+ });+});