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(market): treat a null Tokens API number as unknown instead of zero

nirholas3812f1b7f8b7
diff --git a/api/_lib/tokens-xyz.js b/api/_lib/tokens-xyz.js
index 34cb0d176..742e54ad7 100644
--- a/api/_lib/tokens-xyz.js
+++ b/api/_lib/tokens-xyz.js
@@ -47,7 +47,11 @@ export function tokensXyzConfigured() {
return !!process.env.TOKENS_XYZ_API_KEY;
}
+// Nearly every numeric field in the v1 contract is `number | null`, where null
+// means "not cached yet", not zero. Number(null) is 0, so guard the nullish and
+// empty cases explicitly: rendering an unknown liquidity as $0 would be a lie.
const num = (v) => {
+ if (v === null || v === undefined || v === '') return null;
const n = Number(v);
return Number.isFinite(n) ? n : null;
};