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
style(api/nft): drop the banned dashes from the base64 and alchemy notes
nirholas92afedcee62b
diff --git a/api/nft/mint-scene-confirm.js b/api/nft/mint-scene-confirm.jsindex 41e81b583..0292ae667 100644--- a/api/nft/mint-scene-confirm.js+++ b/api/nft/mint-scene-confirm.js@@ -5,8 +5,8 @@ import { getSessionUser, authenticateBearer, extractBearer } from '../_lib/auth.import { solanaConnection } from '../_lib/solana/connection.js';import { confirmOrThrow } from '../_lib/solana/confirm.js';-// Base64 with no stray characters. Buffer.from(x, 'base64') never throws — it-// drops anything outside the alphabet — so the only way to reject a malformed+// Base64 with no stray characters. Buffer.from(x, 'base64') never throws: it+// drops anything outside the alphabet, so the only way to reject a malformed// payload up front is to check it before decoding.const BASE64_RE = /^[A-Za-z0-9+/]+={0,2}$/;@@ -62,12 +62,12 @@ export default wrap(async (req, res) => {'confirmed',);} catch (e) {- // A confirmed-but-reverted tx is a hard failure, not an uncertain one — never+ // A confirmed-but-reverted tx is a hard failure, not an uncertain one, never// hand back a soft 200 that reads as success.if (e?.code === 'tx_reverted') {return error(res, 422, 'tx_failed', `Mint transaction reverted on-chain: ${JSON.stringify(e.onChainErr)}`);}- // Return the signature even if confirmation polling times out — the tx may still land.+ // Return the signature even if confirmation polling times out, the tx may still land.return json(res, 200, { signature, warning: `Confirmation uncertain: ${e.message}` });}diff --git a/api/nft/mint-scene.js b/api/nft/mint-scene.jsindex c7388bdef..f61b7fefd 100644--- a/api/nft/mint-scene.js+++ b/api/nft/mint-scene.js@@ -33,10 +33,10 @@ async function uploadToNftStorage(token, bytes, contentType) {}// Strict base64: the scene GLB and its thumbnail arrive base64-encoded, and-// Buffer.from(x, 'base64') never throws — it silently drops every character-// outside the alphabet. A truncated or accidentally-URL-encoded upload therefore-// used to sail through as a shorter, corrupt buffer that we then pinned to IPFS-// on the platform's own storage token and referenced from a real mint.+// Buffer.from(x, 'base64') never throws. It silently drops every character+// outside the alphabet, so a truncated or accidentally-URL-encoded upload used+// to sail through as a shorter, corrupt buffer that we then pinned to IPFS on+// the platform's own storage token and referenced from a real mint.const BASE64_RE = /^[A-Za-z0-9+/]+={0,2}$/;function decodeBase64(value) {@@ -55,7 +55,7 @@ export default wrap(async (req, res) => {const rl = await limits.authIp(clientIp(req));if (!rl.success) return rateLimited(res, rl);- // The uploads below run on the platform's NFT.Storage token — never let an+ // The uploads below run on the platform's NFT.Storage token, never let an// anonymous caller push arbitrary blobs to IPFS on our account.const session = await getSessionUser(req);const bearer = session ? null : await authenticateBearer(extractBearer(req));@@ -64,7 +64,7 @@ export default wrap(async (req, res) => {}// A scene GLB plus its PNG thumbnail, base64-inflated by 4/3, comfortably- // clears readJson's 1 MB default — which rejected every real mint with a 413+ // clears readJson's 1 MB default, which rejected every real mint with a 413// before the handler saw a byte. 8 MB matches server/index.mjs BODY_LIMIT, the// ceiling express enforces ahead of us anyway.const body = await readJson(req, 8 * 1024 * 1024);diff --git a/api/nft/resolve.js b/api/nft/resolve.jsindex d2d6c8d3e..57f4dd4d3 100644--- a/api/nft/resolve.js+++ b/api/nft/resolve.js@@ -5,13 +5,13 @@ import { cacheGet, cacheSet } from '../_lib/cache.js';// NFT metadata is effectively immutable, but the Helius `getAsset` (DAS) and// Alchemy `getNFTMetadata` calls behind this endpoint are billed per request and-// were re-resolved on every call — a bot re-requesting the same mint paid the+// were re-resolved on every call, a bot re-requesting the same mint paid the// upstream every time. Cache the resolved descriptor by chain:id so a given// asset is fetched from the provider at most once per TTL.const RESOLVE_TTL_SECONDS = 6 * 60 * 60; // 6h// Last-known-good copy kept far longer, read ONLY when the upstream provider is// unreachable. NFT metadata is effectively immutable, so serving a long-stale-// descriptor during a Helius/Alchemy outage is correct — far better than a 502.+// descriptor during a Helius/Alchemy outage is correct, far better than a 502.const RESOLVE_STALE_TTL_SECONDS = 30 * 24 * 60 * 60; // 30d// Alchemy NFT API host per EVM chainId. An id of the form@@ -62,7 +62,7 @@ export default wrap(async (req, res) => {const cached = await cacheGet(cacheKey).catch(() => null);if (cached) return json(res, 200, cached);- // Only a cache MISS reaches the billed upstream — gate that on the shared DAS+ // Only a cache MISS reaches the billed upstream, gate that on the shared DAS// cost ceiling so a bot resolving thousands of distinct ids can't run up the// Helius/Alchemy bill past a fixed hourly cap.const ceiling = await limits.heliusDasGlobal();@@ -79,7 +79,7 @@ export default wrap(async (req, res) => {const serveStaleOr = async (onMiss) => {const lastGood = await cacheGet(staleKey).catch(() => null);if (lastGood) {- console.warn('[nft/resolve] upstream unreachable — serving last-known-good for %s', cacheKey);+ console.warn('[nft/resolve] upstream unreachable, serving last-known-good for %s', cacheKey);return json(res, 200, { ...lastGood, stale: true });}return onMiss();@@ -154,7 +154,7 @@ export default wrap(async (req, res) => {// scene/gate-check.js do) and say plainly when it is missing.const apiKey = process.env.ALCHEMY_API_KEY;if (!apiKey) {- return error(res, 503, 'not_configured', 'ALCHEMY_API_KEY not configured — evm nft resolution is unavailable');+ return error(res, 503, 'not_configured', 'ALCHEMY_API_KEY not configured; evm nft resolution is unavailable');}const url = `https://${host}.g.alchemy.com/nft/v3/${apiKey}/getNFTMetadata?contractAddress=${encodeURIComponent(contractAddress)}&tokenId=${encodeURIComponent(tokenId)}`;let resp;