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.

fix(rpc): add a free lane that actually serves getTokenLargestAccounts

nirholas6e472cf1201c
diff --git a/api/_lib/solana/connection.js b/api/_lib/solana/connection.js
index 478453068..7c728d4e6 100644
--- a/api/_lib/solana/connection.js
+++ b/api/_lib/solana/connection.js
@@ -250,10 +250,21 @@ const PUBLIC_DEVNET = 'https://api.devnet.solana.com';
// throttled provider escalated into "all N endpoints failed this request"
// (2026-08-07). They stay in the chain as last-resort depth for the methods they
// do serve; the classifyRpcBody guard still fails them over on garbage.
+//
+// Solana Vibe Station's public lane was added 2026-08-12 for one measured reason:
+// getTokenLargestAccounts, the call behind /api/crypto/holders and the holder half
+// of /api/crypto/security, had NO healthy free lane left. PublicNode hangs on it
+// forever, mainnet-beta 429s it, Leo answers -32603, and the Tatum pair serves it
+// but at 5 requests per minute, so with Helius and Alchemy both at monthly
+// capacity the read 503'd on most calls. Vibe Station answers it on real mainnet
+// (genesis 5eykt4Us…, slot within 1 of mainnet-beta) and throttles to a handful of
+// requests before -32005, which the capacity classifier already parks correctly.
+// It sits behind Leo because that throttle makes it depth, not a primary.
const FREE_KEYLESS_MAINNET = [
'https://solana-rpc.publicnode.com',
PUBLIC_MAINNET,
'https://solana.leorpc.com/?api_key=FREE',
+ 'https://public.rpc.solanavibestation.com',
'https://api.tatum.io/v3/blockchain/node/solana-mainnet',
'https://solana-mainnet.gateway.tatum.io',
];
diff --git a/api/defi/yields.js b/api/defi/yields.js
index bf2f65b04..2aeda3a39 100644
--- a/api/defi/yields.js
+++ b/api/defi/yields.js
@@ -18,6 +18,7 @@
import { cors, json, method, wrap, error, rateLimited } from '../_lib/http.js';
import { limits, clientIp } from '../_lib/rate-limit.js';
+import { createCache, cached } from '../_lib/mem-cache.js';
const POOLS_UPSTREAM = 'https://yields.llama.fi/pools';
const CHART_UPSTREAM = 'https://yields.llama.fi/chart/';
@@ -39,8 +40,10 @@ const finite = (n) => (Number.isFinite(n) ? n : null);
// ── Pools cache ─────────────────────────────────────────────────────────────
-let _pools = null; // { value: { pools, facets, stats, updated_at }, expiresAt }
-let _poolsInflight = null; // dedupe concurrent multi-MB upstream fetches
+// Single-entry cache with single-flight de-dup, so concurrent misses share one
+// fetch of this multi-MB pool dump instead of each pulling their own copy.
+const _pools = createCache({ max: 1, ttlMs: POOLS_TTL_MS });
+const POOLS_KEY = 'pools';
function slimPool(p) {
const tvl = Number(p?.tvlUsd);
@@ -48,7 +51,10 @@ function slimPool(p) {
pool: p.pool,
chain: typeof p.chain === 'string' ? p.chain : 'Unknown',
project: typeof p.project === 'string' ? p.project : 'unknown',
- symbol: typeof p.symbol === 'string' ? p.symbol : '—',
+ // Matches the 'Unknown' fallback the sibling fields use. This value is
+ // rendered verbatim as the pool's name on /yields, so it has to read as a
+ // real label rather than a punctuation placeholder.
+ symbol: typeof p.symbol === 'string' && p.symbol ? p.symbol : 'Unknown',
tvl_usd: tvl,
apy: finite(Number(p.apy)),
apy_base: finite(Number(p.apyBase)),
@@ -89,18 +95,14 @@ function buildFacets(pools, key, topN) {
.map(([name, { count }]) => ({ name, pool_count: count }));
}
-// Exported for the paid datapoint fabric (api/_lib/market-data/datapoints.js)
-// — per-pool datapoint endpoints resolve a uuid against this cached full set.
+// Exported for the paid datapoint fabric (api/_lib/market-data/datapoints.js),
+// per-pool datapoint endpoints resolve a uuid against this cached full set.
export async function loadYieldPools() {
return loadPools();
}
async function loadPools() {
- const now = Date.now();
- if (_pools && _pools.expiresAt > now) return _pools.value;
- if (_poolsInflight) return _poolsInflight;
-
- _poolsInflight = (async () => {
+ return cached(_pools, POOLS_KEY, async () => {
const resp = await fetch(POOLS_UPSTREAM, {
headers: { accept: 'application/json', 'user-agent': 'three.ws/1.0' },
signal: AbortSignal.timeout(20_000),
@@ -125,7 +127,7 @@ async function loadPools() {
.map((p) => p.apy)
.sort((a, b) => a - b);
- const value = {
+ return {
pools,
facets: {
chains: buildFacets(pools, 'chain', FACET_CHAINS),
@@ -138,15 +140,7 @@ async function loadPools() {
},
updated_at: Date.now(),
};
- _pools = { value, expiresAt: Date.now() + POOLS_TTL_MS };
- return value;
- })();
-
- try {
- return await _poolsInflight;
- } finally {
- _poolsInflight = null;
- }
+ });
}
// ── List mode ───────────────────────────────────────────────────────────────