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(x402): lead every paid endpoint with Solana, so the 402 matches the catalog

nirholas72c841f5e7ea
diff --git a/api/_lib/x402-paid-endpoint.js b/api/_lib/x402-paid-endpoint.js
index a7121addd..d4c625370 100644
--- a/api/_lib/x402-paid-endpoint.js
+++ b/api/_lib/x402-paid-endpoint.js
@@ -8,8 +8,9 @@
// handler that returns JSON.
//
// Pricing: each endpoint gets its own `priceAtomics` (USDC has 6 decimals,
-// so "1000" = $0.001). Networks default to Base mainnet only; pass
-// `networks: ['base', 'solana']` to advertise both. The bazaar discovery
+// so "1000" = $0.001). Networks default to Solana first then Base, which is
+// the order the 402 challenge lists them in; pass `networks` only to narrow
+// that set (e.g. `['solana']`) or to force a different order. The bazaar discovery
// extension is required — agentic.market's catalog rejects entries without
// it. See api/_lib/x402-spec.js for the v2 wire-format details.
//
diff --git a/api/x402/agent-reputation.js b/api/x402/agent-reputation.js
index ee0cea0c5..fddbcbf62 100644
--- a/api/x402/agent-reputation.js
+++ b/api/x402/agent-reputation.js
@@ -165,7 +165,6 @@ const singleEndpoint = paidEndpoint({
route: ROUTE,
method: 'GET',
priceAtomics: priceFor('agent-reputation', '10000'),
- networks: ['base', 'solana'],
description: DESCRIPTION,
bazaar: BAZAAR,
service: withService({
@@ -354,7 +353,6 @@ const sweepEndpoint = paidEndpoint({
route: ROUTE,
method: 'POST',
priceAtomics: priceFor('agent-reputation', '10000'),
- networks: ['base', 'solana'],
description: SWEEP_DESCRIPTION,
bazaar: SWEEP_BAZAAR,
service: withService({
diff --git a/api/x402/animation-download.js b/api/x402/animation-download.js
index c81a2fa4b..d8cd9fd60 100644
--- a/api/x402/animation-download.js
+++ b/api/x402/animation-download.js
@@ -213,7 +213,6 @@ export default async function handler(req, res) {
route: ROUTE,
method: 'GET',
priceAtomics: priceAtomics(row.price_amount),
- networks: ['base', 'solana'],
description: `${DESCRIPTION} — currently delivering: ${row.name}.`,
mimeType: 'application/json',
bazaar: BAZAAR,
diff --git a/api/x402/asset-download.js b/api/x402/asset-download.js
index 7241855d1..a3bc1e1e0 100644
--- a/api/x402/asset-download.js
+++ b/api/x402/asset-download.js
@@ -195,7 +195,6 @@ export default async function handler(req, res) {
route: ROUTE,
method: 'GET',
priceAtomics: String(asset.price_atomics),
- networks: ['base', 'solana'],
description: `${DESCRIPTION} — currently delivering: ${asset.title}.`,
mimeType: 'application/json',
bazaar: BAZAAR,
diff --git a/api/x402/cosmetic-purchase.js b/api/x402/cosmetic-purchase.js
index 17940eb5c..09803c0c9 100644
--- a/api/x402/cosmetic-purchase.js
+++ b/api/x402/cosmetic-purchase.js
@@ -229,7 +229,6 @@ export default async function handler(req, res) {
route: ROUTE,
method: 'GET',
priceAtomics,
- networks: ['base', 'solana'],
description: `${DESCRIPTION} — currently unlocking: ${item.name} (${item.rarity}).`,
bazaar: BAZAAR,
service: withService({
diff --git a/api/x402/fact-check.js b/api/x402/fact-check.js
index 144b111f6..42f667bd9 100644
--- a/api/x402/fact-check.js
+++ b/api/x402/fact-check.js
@@ -603,7 +603,6 @@ function paidHandler() {
route: ROUTE,
method: 'POST',
priceAtomics: priceFor('fact-check', '100000'), // $0.10
- networks: ['base', 'solana'],
description: DESCRIPTION,
bazaar: BAZAAR,
service: withService({
diff --git a/api/x402/llm-proxy.js b/api/x402/llm-proxy.js
index f03ef8be7..d6b2ae3d4 100644
--- a/api/x402/llm-proxy.js
+++ b/api/x402/llm-proxy.js
@@ -172,7 +172,6 @@ export default paidEndpoint({
route: ROUTE,
method: 'POST',
priceAtomics: priceFor('llm-proxy', '5000'), // $0.005 USDC
- networks: ['base', 'solana'],
description: DESCRIPTION,
bazaar: BAZAAR,
service: withService({
diff --git a/api/x402/onchain-identity-verify.js b/api/x402/onchain-identity-verify.js
index e679df8dc..4cb56f7dc 100644
--- a/api/x402/onchain-identity-verify.js
+++ b/api/x402/onchain-identity-verify.js
@@ -153,7 +153,6 @@ export default paidEndpoint({
route: ROUTE,
method: 'GET',
priceAtomics: priceFor('onchain-identity-verify', '5000'),
- networks: ['base', 'solana'],
description: DESCRIPTION,
bazaar: BAZAAR,
service: withService({
diff --git a/api/x402/pump-agent-audit.js b/api/x402/pump-agent-audit.js
index e20b7b3f5..8f7a11e0b 100644
--- a/api/x402/pump-agent-audit.js
+++ b/api/x402/pump-agent-audit.js
@@ -391,7 +391,6 @@ const getEndpoint = paidEndpoint({
route: ROUTE,
method: 'GET',
priceAtomics: priceFor('pump-agent-audit', '20000'),
- networks: ['base', 'solana'],
description: DESCRIPTION,
bazaar: BAZAAR,
service: withService({
@@ -650,7 +649,6 @@ const whaleEndpoint = paidEndpoint({
route: ROUTE,
method: 'POST',
priceAtomics: priceFor('pump-agent-audit', '20000'),
- networks: ['base', 'solana'],
description: WHALE_DESCRIPTION,
bazaar: WHALE_BAZAAR,
service: withService({
diff --git a/api/x402/pump-launch.js b/api/x402/pump-launch.js
index 6c76433de..11ad18785 100644
--- a/api/x402/pump-launch.js
+++ b/api/x402/pump-launch.js
@@ -239,7 +239,6 @@ export default paidEndpoint({
route: ROUTE,
method: 'POST',
priceAtomics: PRICE_ATOMICS,
- networks: ['base', 'solana'],
description: DESCRIPTION,
bazaar: BAZAAR,
service: withService({
diff --git a/api/x402/rate-limit-probe.js b/api/x402/rate-limit-probe.js
index f0f81c287..11792c290 100644
--- a/api/x402/rate-limit-probe.js
+++ b/api/x402/rate-limit-probe.js
@@ -205,7 +205,6 @@ export default paidEndpoint({
route: ROUTE,
method: 'POST',
priceAtomics: priceFor('rate-limit-probe', '1000'),
- networks: ['base', 'solana'],
description: DESCRIPTION,
bazaar: BAZAAR,
service: withService({
diff --git a/api/x402/robinhood-portfolio.js b/api/x402/robinhood-portfolio.js
index 6e3a80d57..5bfef7143 100644
--- a/api/x402/robinhood-portfolio.js
+++ b/api/x402/robinhood-portfolio.js
@@ -93,7 +93,6 @@ export default paidEndpoint({
route: ROUTE,
method: 'GET',
priceAtomics: priceFor('robinhood-portfolio', '2000'),
- networks: ['base', 'solana'],
description: DESCRIPTION,
bazaar: BAZAAR,
service: withService({
diff --git a/api/x402/skill-marketplace.js b/api/x402/skill-marketplace.js
index a49b8bfc9..bd59cb296 100644
--- a/api/x402/skill-marketplace.js
+++ b/api/x402/skill-marketplace.js
@@ -351,7 +351,6 @@ const getEndpoint = paidEndpoint({
route: ROUTE,
method: 'GET',
priceAtomics: priceFor('skill-marketplace', '1000'),
- networks: ['base', 'solana'],
description: DESCRIPTION,
bazaar: BAZAAR,
service: withService({
@@ -380,7 +379,6 @@ const postEndpoint = paidEndpoint({
route: ROUTE,
method: 'POST',
priceAtomics: priceFor('skill-marketplace', '1000'),
- networks: ['base', 'solana'],
description:
DESCRIPTION +
' POST mode="price_distribution" returns min/max/median price + listing count.' +
diff --git a/api/x402/symbol-availability.js b/api/x402/symbol-availability.js
index f7331e6d8..3bd7a140b 100644
--- a/api/x402/symbol-availability.js
+++ b/api/x402/symbol-availability.js
@@ -174,7 +174,6 @@ const singleEndpoint = paidEndpoint({
route: ROUTE,
method: 'GET',
priceAtomics: priceFor('symbol-availability', '1000'),
- networks: ['base', 'solana'],
description: DESCRIPTION,
bazaar: BAZAAR,
service: withService({
@@ -280,7 +279,6 @@ const batchEndpoint = paidEndpoint({
route: ROUTE,
method: 'POST',
priceAtomics: priceFor('symbol-availability-batch', '5000'),
- networks: ['base', 'solana'],
description: BATCH_DESCRIPTION,
bazaar: BATCH_BAZAAR,
service: withService({
diff --git a/api/x402/tutor.js b/api/x402/tutor.js
index a97b5e400..d4e6e5492 100644
--- a/api/x402/tutor.js
+++ b/api/x402/tutor.js
@@ -155,7 +155,6 @@ export default paidEndpoint({
route: ROUTE,
method: 'POST',
priceAtomics: PRICE_ATOMICS,
- networks: ['base', 'solana'],
description: DESCRIPTION,
bazaar: BAZAAR,
service: withService({
diff --git a/tests/x402-solana-first-ordering.test.js b/tests/x402-solana-first-ordering.test.js
new file mode 100644
index 000000000..44e158655
--- /dev/null
+++ b/tests/x402-solana-first-ordering.test.js
@@ -0,0 +1,86 @@
+// Solana leads every paid 402 challenge, and the live challenge agrees with the
+// discovery catalog.
+//
+// The bug this locks in, found 2026-09-10 by auditing production against
+// /.well-known/x402.json: fourteen routes under api/x402/ passed
+// `networks: ['base', 'solana']` to paidEndpoint, overriding the platform's
+// Solana-first default. Twelve of them were ALSO advertised Solana-first in the
+// discovery catalog, so the catalog and the live 402 disagreed about which chain
+// to settle on. An agent that reads the catalog picks Solana; the same agent
+// calling the endpoint is handed Base as accepts[0], and a first-accept client
+// settles on the chain we did not advertise.
+//
+// Not one of the fourteen carried a comment explaining the override, and
+// paidEndpoint's own default documents itself as "Solana-first platform default
+// ... unless a route explicitly overrides the network order", so these were
+// copy-paste drift rather than a decision. CLAUDE.md's chain-priority rule makes
+// Solana the home chain, so the fix was to delete the overrides and inherit.
+//
+// This is a source-level guard on purpose: the ordering is decided by a literal
+// in each route file, so reading the files is what actually catches a regression,
+// and it needs no network and no credentials.
+
+import { describe, it, expect } from 'vitest';
+import { readFileSync, readdirSync } from 'node:fs';
+import { join, dirname } from 'node:path';
+import { fileURLToPath } from 'node:url';
+
+const ROOT = join(dirname(fileURLToPath(import.meta.url)), '..');
+const X402_DIR = join(ROOT, 'api/x402');
+
+function routeFiles() {
+ return readdirSync(X402_DIR)
+ .filter((f) => f.endsWith('.js'))
+ .map((f) => ({ name: f, source: readFileSync(join(X402_DIR, f), 'utf8') }));
+}
+
+describe('x402 paid routes lead with Solana', () => {
+ it('no route under api/x402 puts Base ahead of Solana', () => {
+ const offenders = routeFiles()
+ .filter(({ source }) => /networks:\s*\[\s*'base'\s*,\s*'solana'\s*\]/.test(source))
+ .map(({ name }) => name);
+
+ expect(
+ offenders,
+ `these routes override the Solana-first default and would advertise Base as accepts[0], ` +
+ `which contradicts the discovery catalog and CLAUDE.md's chain priority: ${offenders.join(', ')}`,
+ ).toEqual([]);
+ });
+
+ it('any route that does pin an order pins Solana first', () => {
+ // Pinning the platform default explicitly is redundant but harmless. Pinning
+ // anything that does not start with Solana is the regression.
+ const wrong = [];
+ for (const { name, source } of routeFiles()) {
+ for (const m of source.matchAll(/networks:\s*\[([^\]]*)\]/g)) {
+ const raw = m[1]
+ .split(',')
+ .map((s) => s.trim())
+ .filter(Boolean);
+ // A route may choose its network at runtime: api/x402/service.js passes
+ // `networks: [network]`, resolved per registered service from that
+ // service's own payout address. Only a quoted literal pins an order
+ // this source-level guard can judge, so anything else is skipped
+ // rather than read as a chain named after the variable.
+ if (!raw.length || !/^['"]/.test(raw[0])) continue;
+ const list = raw.map((s) => s.replace(/^['"]|['"]$/g, ''));
+ if (list[0] !== 'solana') wrong.push(`${name}: [${list.join(', ')}]`);
+ }
+ }
+ expect(wrong, `a pinned network order must start with solana: ${wrong.join('; ')}`).toEqual([]);
+ });
+
+ it("paidEndpoint's default is still Solana-first, so inheriting is correct", () => {
+ // The routes above were fixed by DELETING their override and inheriting this
+ // default. If the default itself ever flips, deleting an override silently
+ // becomes the wrong fix, so the two are asserted together.
+ const source = readFileSync(join(ROOT, 'api/_lib/x402-paid-endpoint.js'), 'utf8');
+ const match = source.match(/networks\s*=\s*\[([^\]]*)\]/);
+ expect(match, 'paidEndpoint must declare a default network order').toBeTruthy();
+ const list = match[1]
+ .split(',')
+ .map((s) => s.trim().replace(/^['"]|['"]$/g, ''))
+ .filter(Boolean);
+ expect(list[0]).toBe('solana');
+ });
+});