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.

refactor(x402): drop no-op SOL fallback in pump volume USD sum

nirholas20a5fd4c3790
diff --git a/api/_lib/x402/pump-volume-anomaly.js b/api/_lib/x402/pump-volume-anomaly.js
index 78eb7b0d2..88935e476 100644
--- a/api/_lib/x402/pump-volume-anomaly.js
+++ b/api/_lib/x402/pump-volume-anomaly.js
@@ -65,15 +65,10 @@ export function summarizeWindowUsd(trades, nowMs, windowSec = DEFAULTS.windowSec
for (const t of trades) {
const tMs = tradeTimeMs(t);
if (tMs == null || tMs < floor || tMs > nowMs) continue;
- // swap-api reports the USD notional on amountUsd; fall back to sol*priceUsd.
- let v = num(t.amountUsd ?? t.usd_amount);
- if (v == null) {
- const sol = num(t.amountSol ?? t.sol_amount);
- const px = num(t.priceUsd ?? t.price_usd);
- // priceUsd is per-base-token; the sol notional already carries the trade
- // size, so only fall back to it when there is no USD figure at all.
- if (sol != null && px != null && sol > 0) v = sol * 0; // avoid wrong-unit math
- }
+ // swap-api reports the per-trade USD notional directly on amountUsd. Only
+ // real USD figures count toward the volume sum — a trade without one is
+ // skipped rather than guessed from mismatched units.
+ const v = num(t.amountUsd ?? t.usd_amount);
if (v == null || v <= 0) continue;
usd += v;
count += 1;