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(robinhood): echo the sort that actually ran instead of the caller's unknown value
nirholasb140db36258e
diff --git a/api/v1/robinhood/coins.js b/api/v1/robinhood/coins.jsindex 72a8b6773..748f45b3e 100644--- a/api/v1/robinhood/coins.js+++ b/api/v1/robinhood/coins.js@@ -19,6 +19,7 @@ const CATEGORIES = {'stocks-ecosystem': 'robinhood-chain-stocks-ecosystem',ecosystem: 'robinhood-ecosystem',};+const SORTS = ['market_cap', 'volume', 'gainers', 'losers'];export default defineEndpoint({name: 'v1.robinhood.coins',@@ -29,7 +30,10 @@ export default defineEndpoint({if (!rl.success) return rateLimited(res, rl, 'Robinhood Chain data is capped at 60 requests/min per IP');const catKey = CATEGORIES[String(query.category || 'meme')] ? String(query.category || 'meme') : 'meme';- const sort = String(query.sort || 'market_cap');+ // Both selectors fall back to the default rather than 400ing a screener+ // read, but the response echoes what was ACTUALLY applied: echoing the+ // caller's unknown value back told them a sort had run that never did.+ const sort = SORTS.includes(String(query.sort || '')) ? String(query.sort) : 'market_cap';const order = sort === 'volume' ? 'volume_desc' : 'market_cap_desc';const raw = await coingeckoCategory(CATEGORIES[catKey], { order, perPage: 100 });diff --git a/api/v1/robinhood/stocks.js b/api/v1/robinhood/stocks.jsindex 6f183d5d8..1314ae3eb 100644--- a/api/v1/robinhood/stocks.js+++ b/api/v1/robinhood/stocks.js@@ -66,18 +66,30 @@ export default defineEndpoint({// Optional filters/sorting for the board.const q = String(query.q || '').trim().toLowerCase();if (q) rows = rows.filter((r) => r.symbol.toLowerCase().includes(q) || r.name.toLowerCase().includes(q));- const sort = String(query.sort || 'symbol');- const dir = query.dir === 'asc' ? 1 : -1;- const key = { volume: 'volume24hUsd', liquidity: 'liquidityUsd', premium: 'premiumPct', price: 'navPriceUsd', symbol: 'symbol' }[sort] || 'symbol';+ const SORT_KEYS = { symbol: 'symbol', volume: 'volume24hUsd', liquidity: 'liquidityUsd', premium: 'premiumPct', price: 'navPriceUsd' };+ const sort = SORT_KEYS[String(query.sort || 'symbol')] ? String(query.sort || 'symbol') : 'symbol';+ const key = SORT_KEYS[sort];+ // Numeric columns read highest-first by default (the useful view of a+ // board); ?dir=asc flips them. Symbol reads A-Z by default. A row with no+ // value for the column (no DEX pair, no NAV feed) sorts last in BOTH+ // directions instead of crowding whichever end a sentinel would land on.+ const asc = query.dir === 'asc';rows.sort((a, b) => {if (key === 'symbol') return a.symbol.localeCompare(b.symbol) * (query.dir === 'desc' ? -1 : 1);- return ((b[key] ?? -Infinity) - (a[key] ?? -Infinity)) * dir;+ const av = a[key];+ const bv = b[key];+ if (av == null && bv == null) return a.symbol.localeCompare(b.symbol);+ if (av == null) return 1;+ if (bv == null) return -1;+ return asc ? av - bv : bv - av;});res.setHeader('cache-control', CACHE_CONTROL);return {stocks: rows,count: rows.length,+ sort,+ dir: key === 'symbol' ? (query.dir === 'desc' ? 'desc' : 'asc') : asc ? 'asc' : 'desc',feedCount: reg.feedCount,disclosure: DISCLOSURE,source: 'chainlink (on-chain) + dexscreener',