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(sniper): treat a wallet under the operational floor as dry at every trade size
nirholas5124a5cc11a6
diff --git a/api/_lib/agent-trade-guards.js b/api/_lib/agent-trade-guards.jsindex d27a6c564..b8c4db03f 100644--- a/api/_lib/agent-trade-guards.js+++ b/api/_lib/agent-trade-guards.js@@ -579,13 +579,18 @@ export function resolveEntrySize(walletLamports, wantLamports, minTradeLamports)const wallet = BigInt(walletLamports);const want = BigInt(wantLamports);const minTrade = BigInt(minTradeLamports);- const headroom = checkSolHeadroom(wallet, want, ENTRY_HEADROOM_LAMPORTS);- if (!headroom) return { sizeLamports: want };- // Short for the configured size. Shrinking is allowed (learning > profit), but- // only from a wallet that can still run the pre-broadcast simulations.+ // The operational floor applies to EVERY entry, full size included. It used to+ // be checked only on the shrink path, so a small configured size let a wallet+ // under the floor through at full size: a 0.002 SOL arm on a 0.00999 SOL wallet+ // read "funded" on /api/sniper/status while /api/sniper/experiments (and every+ // real attempt) found it dry.if (wallet < BigInt(Math.round(MIN_OPERATIONAL_WALLET_SOL * 1e9))) {- return { skip: headroom.reason };+ return { skip: 'insufficient_sol' };}+ const headroom = checkSolHeadroom(wallet, want, ENTRY_HEADROOM_LAMPORTS);+ if (!headroom) return { sizeLamports: want };+ // Short for the configured size. Shrinking is allowed (learning > profit) from a+ // wallet that can still run the pre-broadcast simulations (checked above).const dustCapable = wallet - ENTRY_HEADROOM_LAMPORTS;if (dustCapable < minTrade) return { skip: headroom.reason };return { sizeLamports: dustCapable };diff --git a/tests/agent-entry-size.test.js b/tests/agent-entry-size.test.jsindex c79cd6921..0651c3004 100644--- a/tests/agent-entry-size.test.js+++ b/tests/agent-entry-size.test.js@@ -60,6 +60,14 @@ describe('resolveEntrySize', () => {expect(got.skip).toBe('insufficient_sol');});+ it('sits out below the operational floor even when the size itself fits', () => {+ // The production case: a 0.002 SOL arm on a 0.00999 SOL wallet covers size ++ // headroom, but cannot afford the firewall round-trip and CU simulation.+ const got = resolveEntrySize(sol(0.00999497), sol(0.002), MIN_TRADE);+ expect(got.skip).toBe('insufficient_sol');+ expect(resolveEntrySize(OPERATIONAL, sol(0.002), MIN_TRADE).sizeLamports).toBe(sol(0.002));+ });+it('accepts number and string balances, not just bigint', () => {const want = sol(0.05);const wallet = want + ENTRY_HEADROOM_LAMPORTS;