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
feat: enhance code comments for clarity and update example URLs to be host-neutral
qbdz6bd6bfd1ff49
diff --git a/packages/x402-server/src/index.js b/packages/x402-server/src/index.jsindex 340208e3d..7d476b277 100644--- a/packages/x402-server/src/index.js+++ b/packages/x402-server/src/index.js@@ -473,7 +473,7 @@ async function runSettle({ request, verified, signal }) {}// Cross-check the facilitator's claimed network/payer against what we verified- // (defense-in-depth, mirrors x402-spec.js settlePayment).+ // (defense-in-depth against a misbehaving facilitator).if (result.network && requirement.network && result.network !== requirement.network) {throw new X402Error(`facilitator /settle network mismatch: requested ${requirement.network}, got ${result.network}.`, { code: 'facilitator_bad_response', status: 502 });}diff --git a/packages/x402-server/test/x402-server.test.js b/packages/x402-server/test/x402-server.test.jsindex cadf90dc5..25ecbc994 100644--- a/packages/x402-server/test/x402-server.test.js+++ b/packages/x402-server/test/x402-server.test.js@@ -12,8 +12,7 @@ import {// A scripted fetch double: each call shifts the next queued response and records// the request. No network, no real facilitator — we assert on request shaping-// and response parsing, which is all the SDK is responsible for. (Copied-// verbatim from @three-ws/forge's test harness.)+// and response parsing, which is all the SDK is responsible for.function stubFetch(responses) {const calls = [];const queue = [...responses];@@ -48,17 +47,17 @@ test('buildChallenge() emits the exact v2 accepts[] envelope', () => {asset: 'usdc',payTo: { solana: SYNTH_SOLANA_PAYTO, base: SYNTH_BASE_PAYTO },feePayer: SYNTH_SOLANA_FEEPAYER,- resourceUrl: 'https://three.ws/api/thing',+ resourceUrl: 'https://api.example.com/api/thing',description: 'Doc summarize',});assert.equal(challenge.x402Version, 2);assert.equal(challenge.error, 'X-PAYMENT header is required');- assert.equal(challenge.resource.url, 'https://three.ws/api/thing');+ assert.equal(challenge.resource.url, 'https://api.example.com/api/thing');assert.equal(challenge.resource.description, 'Doc summarize');assert.equal(challenge.accepts.length, 2);- // Solana leads (platform Solana-first ordering) and carries the fee payer.+ // Solana leads (Solana-first ordering) and carries the fee payer.const sol = challenge.accepts[0];assert.equal(sol.scheme, 'exact');assert.equal(sol.network, NETWORK_SOLANA_MAINNET);@@ -245,7 +244,7 @@ test('paid() returns a 402 challenge when no X-PAYMENT header is present', async);const captured = { headers: {}, body: null, ended: false };- const req = { url: '/api/thing', headers: { host: 'three.ws' } };+ const req = { url: '/api/thing', headers: { host: 'api.example.com' } };const res = {statusCode: 200,writableEnded: false,@@ -282,7 +281,7 @@ test('paid() verifies, runs the handler, then settles on a paid call', async ());const header = xPaymentHeader({ network: NETWORK_BASE_MAINNET, payload: { authorization: { value: '10000', to: SYNTH_BASE_PAYTO } } });- const req = { url: '/api/thing', headers: { host: 'three.ws', 'x-payment': header } };+ const req = { url: '/api/thing', headers: { host: 'api.example.com', 'x-payment': header } };const res = { statusCode: 200, writableEnded: false, setHeader() {}, end() { this.writableEnded = true; } };const receipt = await handler(req, res);@@ -301,7 +300,7 @@ test('paid() supports a fetch-style adapter (Request → Response)', async () =>{ price: '5000', payTo: { base: SYNTH_BASE_PAYTO }, network: ['base'], adapter: fetchAdapter },async () => new Response(JSON.stringify({ ok: true })),);- const request = new Request('https://three.ws/api/thing');+ const request = new Request('https://api.example.com/api/thing');const response = await handler(request);assert.equal(response.status, 402);assert.ok(response.headers.get('PAYMENT-REQUIRED'));diff --git a/x402-payment-modal/examples/solana-crypto-paywall/README.md b/x402-payment-modal/examples/solana-crypto-paywall/README.mdindex cdda686f4..3dab91465 100644--- a/x402-payment-modal/examples/solana-crypto-paywall/README.md+++ b/x402-payment-modal/examples/solana-crypto-paywall/README.md@@ -21,7 +21,7 @@ Three things make it a real test, not a mock:constant for it — you start the server, paste a Solana address into the page,and that address becomes the `payTo` in the 402 challenge.-## Run it (inside the three.ws repo)+## Run it (inside this package's repo)The server reuses the repo's `express` + `@solana/*` and imports the package'scheckout helpers from source, so no install is needed:diff --git a/x402-payment-modal/server/checkout.js b/x402-payment-modal/server/checkout.jsindex e33a0c78d..3d4448583 100644--- a/x402-payment-modal/server/checkout.js+++ b/x402-payment-modal/server/checkout.js@@ -13,8 +13,9 @@// live in ./express.js and ./vercel.js.//// Runtime deps: @solana/web3.js and @solana/spl-token (declared as optional peer-// dependencies — install them in the app that mounts this handler). Nothing here-// imports anything three.ws-specific.+// dependencies — install them in the app that mounts this handler). This module+// is fully host-neutral: it has no required configuration and assumes no+// particular merchant, facilitator, or origin.import {Connection,