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: harden x402 checkout ATA probe against malformed RPC replies

nirholasad7de649de42
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f32dcc195..a999707b3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -55,6 +55,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **Solana is now the default payment network** — Solana is now the default everywhere you pick a chain — the dashboard's Default payment network setting, x402 merchant settlement, and the monetization payout wallet all default to Solana for every user, with Solana listed first. Base and Polygon remain available if you prefer an EVM chain. (`/dashboard`) `[improvement]`
- **The $THREE page now spells out why to hold — four real utility pillars** — The $THREE page leads with a clear "Why hold $THREE" section: revenue buybacks (a fixed, live share of platform revenue buys $THREE on the open market), holder rewards (every paid action reflects $THREE back to holders pro-rata), hold-to-access (discounts, higher quotas, and pro perks), and real usage (deploying agents, forging avatars, and trading the marketplace all run on $THREE). Each pillar maps to a mechanism that actually exists on the platform, and the buyback figure is wired to the live commitment. The page's market data also now rides a shared cache, so it stays fast and reliable under heavy traffic. (`/three-token`) `[feature, improvement]`
- **The guided tour, now yours to steer** — The 3D guided tour got a major upgrade. Pick how deep to go: a new “Quick highlights” track samples the best of every chapter in a few minutes, or take the full feature-by-feature walk. A new tour map (open it from the ☰ button or press C) lists every chapter and stop, marks where you are, and lets you search and jump anywhere instantly. You can now change the narrator's voice and set the playback speed (0.75×–1.5×) on the fly, and the tour remembers your spot, voice, and pace across sessions — come back later and pick up right where you left off. (`/tour`) `[feature, improvement]`
+- **USDC checkout no longer fails when an RPC node hiccups** — Paying with USDC at a door (like the Pole Club cover charge) could occasionally fail with an "internal error" right after you connected your wallet, if our Solana RPC briefly returned a malformed reply while building your payment. The checkout now shrugs that off and builds the transaction anyway, so a flaky node no longer turns you away at the door. Nothing was ever charged when this happened. `[fix]`
- **Walk picks up where you left off, plus click-to-walk** — The walk now remembers your avatar, environment, camera, and position across visits (synced to your account when signed in, cached locally otherwise) and greets you with a “Welcome back” you can dismiss or reset. Click anywhere on the page and your site-wide companion walks there, routing around blocked elements. The features page also gained a live walking-avatar demo. (`/walk`) `[feature, improvement]`
- **Walk with any agent, and leave a trail** — Every agent profile now has a “Walk with this agent” action and a live preview that renders that specific agent walking — the walk embed can now load any agent’s avatar by id. And the walking avatar leaves an aesthetic trail behind it (footprints, a glow, or a fading line, your pick) both in the full walk scene and the site-wide companion. (`/walk`) `[feature, improvement]`
- **Your avatar now walks anywhere — new Walk hub, leaderboard, and creator analytics** — There's a dedicated home for the walking avatar at /walk with live demos across six environments, an embeddable one-tag widget, and a Chrome-extension CTA. A new global leaderboard ranks walkers by distance, sites visited, and time (daily / weekly / all-time), and creators who embed an avatar get a private analytics dashboard — sessions, average duration, distance, top embed origins, and custom conversion events. Page-to-page navigation also gained themed, motion-aware transitions. (`/walk`) `[feature]`
diff --git a/api/x402-checkout.js b/api/x402-checkout.js
index 8b935cc64..dd2e6f9a5 100644
--- a/api/x402-checkout.js
+++ b/api/x402-checkout.js
@@ -104,6 +104,24 @@ async function getRecentBlockhash(conn, rpc) {
return blockhash;
}
+// Does an ATA already exist on-chain? web3.js decodes getAccountInfo's reply
+// through a superstruct union, so a flaky/misconfigured RPC returning a malformed
+// 200 (truncated body, proxy error page, wrong-cluster node) throws StructError
+// instead of a clean null — which 500'd the whole checkout at the prepare step.
+// Treat any probe failure as "missing": the only thing the answer gates is an
+// *idempotent* ATA-create instruction, a no-op when the account already exists,
+// so assuming-missing is always safe — same fail-open posture as getMintDecimals.
+export async function ataExists(conn, ata) {
+ try {
+ return (await conn.getAccountInfo(ata)) != null;
+ } catch (err) {
+ console.warn(
+ `[x402-checkout] getAccountInfo(${ata.toBase58()}) failed, assuming ATA missing: ${err?.message || err}`,
+ );
+ return false;
+ }
+}
+
// Solana addresses arrive inside the 402 challenge's `accept` entry, which is
// built from operator-configured env (X402_PAY_TO_SOLANA / X402_FEE_PAYER_SOLANA).
// Those values are pasted into dashboards and routinely carry a trailing newline
@@ -242,8 +260,7 @@ async function handlePrepare(req, res) {
ComputeBudgetProgram.setComputeUnitLimit({ units: 60_000 + tipCount * 40_000 }),
ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 1 }),
];
- const receiverInfo = await conn.getAccountInfo(receiverAta);
- if (!receiverInfo) {
+ if (!(await ataExists(conn, receiverAta))) {
ixs.push(
createAssociatedTokenAccountIdempotentInstruction(
feePayer,
@@ -299,8 +316,7 @@ async function handlePrepare(req, res) {
return error(res, 400, 'invalid_tip', 'donation recipient cannot be the payment recipient');
}
const tipAta = getAssociatedTokenAddressSync(mint, tipTo, false, TOKEN_PROGRAM_ID, ASSOCIATED_TOKEN_PROGRAM_ID);
- const tipAtaInfo = await conn.getAccountInfo(tipAta);
- if (!tipAtaInfo) {
+ if (!(await ataExists(conn, tipAta))) {
ixs.push(
createAssociatedTokenAccountIdempotentInstruction(feePayer, tipAta, tipTo, mint, TOKEN_PROGRAM_ID, ASSOCIATED_TOKEN_PROGRAM_ID),
);
diff --git a/data/changelog.json b/data/changelog.json
index 51bec431d..0288c294e 100644
--- a/data/changelog.json
+++ b/data/changelog.json
@@ -1,6 +1,14 @@
{
"$comment": "Curated changelog entries for three.ws — the editorial layer of the public changelog. New PAGE launches are tracked automatically via the `added` field in data/pages.json; this file is for everything else holders care about: improvements, fixes, SDK releases, trading/payments capabilities, security work. scripts/build-page-index.mjs merges both sources into CHANGELOG.md, public/changelog.json, and public/changelog.xml. Newest first. Allowed tags: feature, improvement, fix, sdk, infra, docs, security. `link` is optional and must be a live three.ws path.",
"entries": [
+ {
+ "date": "2026-06-21",
+ "title": "USDC checkout no longer fails when an RPC node hiccups",
+ "summary": "Paying with USDC at a door (like the Pole Club cover charge) could occasionally fail with an \"internal error\" right after you connected your wallet, if our Solana RPC briefly returned a malformed reply while building your payment. The checkout now shrugs that off and builds the transaction anyway, so a flaky node no longer turns you away at the door. Nothing was ever charged when this happened.",
+ "tags": [
+ "fix"
+ ]
+ },
{
"date": "2026-06-21",
"title": "Arm your agent gets its own setup page",
diff --git a/public/changelog.json b/public/changelog.json
index c5a96ccf3..abb08290a 100644
--- a/public/changelog.json
+++ b/public/changelog.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-06-21T08:50:53.678Z",
+ "generated_at": "2026-06-21T09:24:07.978Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json",
"site": {
"name": "three.ws",
@@ -527,6 +527,16 @@
"improvement"
]
},
+ {
+ "date": "2026-06-21",
+ "type": "update",
+ "title": "USDC checkout no longer fails when an RPC node hiccups",
+ "summary": "Paying with USDC at a door (like the Pole Club cover charge) could occasionally fail with an \"internal error\" right after you connected your wallet, if our Solana RPC briefly returned a malformed reply while building your payment. The checkout now shrugs that off and builds the transaction anyway, so a flaky node no longer turns you away at the door. Nothing was ever charged when this happened.",
+ "link": null,
+ "tags": [
+ "fix"
+ ]
+ },
{
"date": "2026-06-21",
"type": "update",
diff --git a/public/changelog.xml b/public/changelog.xml
index 1e1f2cb6f..46a3a0cfa 100644
--- a/public/changelog.xml
+++ b/public/changelog.xml
@@ -398,6 +398,14 @@
<category>feature</category>
<description>The 3D guided tour got a major upgrade. Pick how deep to go: a new “Quick highlights” track samples the best of every chapter in a few minutes, or take the full feature-by-feature walk. A new tour map (open it from the ☰ button or press C) lists every chapter and stop, marks where you are, and lets you search and jump anywhere instantly. You can now change the narrator's voice and set the playback speed (0.75×–1.5×) on the fly, and the tour remembers your spot, voice, and pace across sessions — come back later and pick up right where you left off.</description>
</item>
+ <item>
+ <title>USDC checkout no longer fails when an RPC node hiccups</title>
+ <link>https://three.ws/changelog</link>
+ <guid isPermaLink="false">2026-06-21:USDC checkout no longer fails when an RPC node hiccups</guid>
+ <pubDate>Sun, 21 Jun 2026 12:00:00 GMT</pubDate>
+ <category>fix</category>
+ <description>Paying with USDC at a door (like the Pole Club cover charge) could occasionally fail with an &quot;internal error&quot; right after you connected your wallet, if our Solana RPC briefly returned a malformed reply while building your payment. The checkout now shrugs that off and builds the transaction anyway, so a flaky node no longer turns you away at the door. Nothing was ever charged when this happened.</description>
+ </item>
<item>
<title>Walk picks up where you left off, plus click-to-walk</title>
<link>https://three.ws/walk</link>
diff --git a/public/features.json b/public/features.json
index e3b169bcf..243e2da59 100644
--- a/public/features.json
+++ b/public/features.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-06-21T08:50:53.667Z",
+ "generated_at": "2026-06-21T09:24:07.962Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json",
"site": {
"name": "three.ws",
diff --git a/tests/x402-checkout-prepare.test.js b/tests/x402-checkout-prepare.test.js
index 3a4e76659..9afad6acd 100644
--- a/tests/x402-checkout-prepare.test.js
+++ b/tests/x402-checkout-prepare.test.js
@@ -1,7 +1,7 @@
import { describe, it, expect } from 'vitest';
import { PublicKey } from '@solana/web3.js';
-import { acceptSchema, prepareSchema } from '../api/x402-checkout.js';
+import { acceptSchema, prepareSchema, ataExists } from '../api/x402-checkout.js';
// The 402 challenge's `accept` is built from operator env (X402_PAY_TO_SOLANA /
// X402_FEE_PAYER_SOLANA). Those values are pasted into dashboards and routinely
@@ -65,3 +65,28 @@ describe('x402-checkout prepareSchema', () => {
expect(parsed.tips[0].to).toBe(USDC);
});
});
+
+describe('x402-checkout ataExists — fail-open on a flaky RPC', () => {
+ const ata = new PublicKey('HgwbNyweQUiV5diWJ1a7ocxgzf3AYSLhTpphEYRLujtN');
+
+ it('reports existing when the RPC returns account data', async () => {
+ const conn = { getAccountInfo: async () => ({ data: Buffer.alloc(165), owner: ata }) };
+ expect(await ataExists(conn, ata)).toBe(true);
+ });
+
+ it('reports missing when the RPC returns a clean null', async () => {
+ const conn = { getAccountInfo: async () => null };
+ expect(await ataExists(conn, ata)).toBe(false);
+ });
+
+ it('assumes missing (fail-open) when getAccountInfo throws StructError — the prepare-step 500 this guards', async () => {
+ const conn = {
+ getAccountInfo: async () => {
+ throw new Error('failed to get info about account: StructError: Expected the value to satisfy a union');
+ },
+ };
+ // Must NOT propagate — assuming-missing only adds an idempotent ATA-create,
+ // safe whether or not the account exists.
+ await expect(ataExists(conn, ata)).resolves.toBe(false);
+ });
+});