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: update transaction serialization in Solana register prep to use Umi transaction factory
nirholas2da9451ed0be
diff --git a/api/agents/pumpfun-feed.js b/api/agents/pumpfun-feed.jsindex e5616494f..774a44adf 100644--- a/api/agents/pumpfun-feed.js+++ b/api/agents/pumpfun-feed.js@@ -27,10 +27,6 @@ export default wrap(async (req, res) => {if (cors(req, res, { methods: 'GET,OPTIONS', credentials: true })) return;if (!method(req, res, ['GET'])) return;- if (!pumpfunBotEnabled()) {- return error(res, 503, 'unavailable', 'pumpfun feed not configured');- }-const session = await getSessionUser(req);const bearer = session ? null : await authenticateBearer(extractBearer(req));if (!session && !bearer) return error(res, 401, 'unauthorized', 'sign in required');@@ -54,6 +50,15 @@ export default wrap(async (req, res) => {res.setHeader('x-accel-buffering', 'no');res.flushHeaders?.();+ // When the upstream feed isn't provisioned, open the SSE stream and close+ // it cleanly — a 503 here would trigger EventSource auto-reconnect storms.+ if (!pumpfunBotEnabled()) {+ writeSse(res, 'disabled', { reason: 'pumpfun feed not configured' });+ writeSse(res, 'close', { reason: 'not_configured' });+ res.end();+ return;+ }+writeSse(res, 'open', { kind, minTier: minTierParam || null });const seen = new Set();diff --git a/api/agents/pumpfun.js b/api/agents/pumpfun.jsindex 547609096..f58b7d6f3 100644--- a/api/agents/pumpfun.js+++ b/api/agents/pumpfun.js@@ -25,10 +25,6 @@ export default wrap(async (req, res) => {if (cors(req, res, { methods: 'GET,OPTIONS', credentials: true })) return;if (!method(req, res, ['GET'])) return;- if (!pumpfunBotEnabled()) {- return error(res, 503, 'unavailable', 'pumpfun feed not configured');- }-const session = await getSessionUser(req);const bearer = session ? null : await authenticateBearer(extractBearer(req));if (!session && !bearer) return error(res, 401, 'unauthorized', 'sign in required');@@ -44,6 +40,13 @@ export default wrap(async (req, res) => {const op = url.searchParams.get('op') || 'claims';const limit = clamp(Number(url.searchParams.get('limit')) || 10, 1, 50);+ // Soft-degrade to empty data when the upstream feed isn't configured —+ // callers get a usable 200 rather than a noisy 503 on every poll.+ if (!pumpfunBotEnabled()) {+ const empty = op === 'token' || op === 'creator' ? {} : { items: [] };+ return json(res, 200, empty);+ }+let result;switch (op) {case 'claims':diff --git a/api/agents/solana-register-prep.js b/api/agents/solana-register-prep.jsindex 54843a0c7..728b88570 100644--- a/api/agents/solana-register-prep.js+++ b/api/agents/solana-register-prep.js@@ -16,7 +16,6 @@ import {publicKey as umiPublicKey,signerIdentity,createNoopSigner,- transactionBuilder,} from '@metaplex-foundation/umi';import { sql } from '../_lib/db.js';import { getSessionUser } from '../_lib/auth.js';@@ -125,9 +124,11 @@ export default wrap(async (req, res) => {// No collection — standalone asset for agent identity});- // Serialize the transaction as base64 (without signatures) for the frontend.- const txBytes = await builder.buildAndSign(umi);- const txBase64 = Buffer.from(txBytes).toString('base64');+ // Serialize the transaction as base64 for the frontend. buildAndSign returns+ // a Transaction object — use the Umi transaction factory to get raw bytes.+ const tx = await builder.buildAndSign(umi);+ const txBytes = umi.transactions.serialize(tx);+ const txBase64 = Buffer.from(txBytes).toString('base64');// Store prep record.const prepId = await randomToken(24);diff --git a/api/cron/pumpfun-monitor.js b/api/cron/pumpfun-monitor.jsindex 0293c86af..1400c98f9 100644--- a/api/cron/pumpfun-monitor.js+++ b/api/cron/pumpfun-monitor.js@@ -34,7 +34,9 @@ export default wrap(async (req, res) => {}if (!process.env.ATTEST_AGENT_SECRET_KEY) {- return error(res, 503, 'not_configured', 'ATTEST_AGENT_SECRET_KEY unset');+ // Skip cleanly when the attester key isn't provisioned — returning 503+ // every 3 min would mark the cron job as failing in the dashboard.+ return json(res, 200, { skipped: true, reason: 'attester_not_configured' });}// Pull the latest stats joined with the agent's Metaplex Core asset anddiff --git a/tests/api/solana-register-prep.test.js b/tests/api/solana-register-prep.test.jsindex 7ba90681e..4dd2ae7d3 100644--- a/tests/api/solana-register-prep.test.js+++ b/tests/api/solana-register-prep.test.js@@ -34,13 +34,22 @@ vi.mock('../../api/_lib/env.js', () => ({}));// Metaplex / Umi: stub out so the handler doesn't try to hit a real RPC.+const FAKE_TX = { __tag: 'fake-tx' };vi.mock('@metaplex-foundation/umi-bundle-defaults', () => ({- createUmi: vi.fn(() => ({ use: function () { return this; } })),+ createUmi: vi.fn(() => ({+ use: function () { return this; },+ transactions: {+ serialize: vi.fn((tx) => {+ if (tx !== FAKE_TX) throw new Error('serialize called with unexpected tx');+ return new Uint8Array([1, 2, 3, 4]);+ }),+ },+ })),}));vi.mock('@metaplex-foundation/mpl-core', () => ({mplCore: vi.fn(() => () => {}),createV1: vi.fn(() => ({- buildAndSign: vi.fn(async () => new Uint8Array([1, 2, 3, 4])),+ buildAndSign: vi.fn(async () => FAKE_TX),})),fetchAsset: vi.fn(),}));@@ -49,7 +58,6 @@ vi.mock('@metaplex-foundation/umi', () => ({publicKey: vi.fn((s) => s),signerIdentity: vi.fn(() => () => {}),createNoopSigner: vi.fn((pk) => ({ publicKey: pk })),- transactionBuilder: vi.fn(),}));const { default: handler } = await import('../../api/agents/solana-register-prep.js');diff --git a/vite.config.js b/vite.config.jsindex 5fae79fcf..7a552446e 100644--- a/vite.config.js+++ b/vite.config.js@@ -20,6 +20,12 @@ const appConfig = {jsxFragment: '"div"',jsxDev: false,},+ resolve: {+ // Force a single Three.js instance — addons (GLTFLoader, OrbitControls,+ // etc.) must share the same `three` module as the app, otherwise+ // Three's module-scoped registry warns "Multiple instances of Three.js".+ dedupe: ['three'],+ },build: {chunkSizeWarningLimit: 1000,rollupOptions: {