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: point forge holder links to /three-token route
nirholas6fbfd7692a1e
diff --git a/api/forge.js b/api/forge.jsindex e5d89c199..8144d52b2 100644--- a/api/forge.js+++ b/api/forge.js@@ -492,7 +492,7 @@ async function startJob(req, res) {return json(res, err.status || 402, {error: err.code || 'payment_invalid',feature: 'forge.high',- get_three_url: '/three',+ get_three_url: '/three-token',pay_per_use: usd ? { action: 'forge.high', usd } : null,message: err.message || 'That $THREE payment could not be verified.',});@@ -625,7 +625,7 @@ async function startJob(req, res) {return json(res, 409, {error: 'payment_already_used',feature: 'forge.high',- get_three_url: '/three',+ get_three_url: '/three-token',message:'This payment has already been used for a generation. Pay again to generate another High model.',});diff --git a/src/forge.js b/src/forge.jsindex 32422fcc1..1d32490fb 100644--- a/src/forge.js+++ b/src/forge.js@@ -671,7 +671,7 @@ async function reflectHighAccess(tierId, { silent = false } = {}) {renderLock(host,lockStateFromAccess(access, {- getThreeUrl: '/three',+ getThreeUrl: '/three-token',onUseFree: () => selectTier('standard'),useFreeLabel: 'Use Standard (free)',// Working Pay-per-use CTA: pay $THREE for one High generation in place.@@ -719,8 +719,8 @@ function applyHighAffordances(access) {if (note) {note.dataset.state = state;note.innerHTML = eligible- ? '<span class="fq-holder-ico" aria-hidden="true">◆</span> High quality is unlocked — you hold <a href="/three">$THREE</a>.'- : '<span class="fq-holder-ico" aria-hidden="true">◆</span> High quality is a <a href="/three">$THREE holder</a> feature — hold to unlock, or pay per generation.';+ ? '<span class="fq-holder-ico" aria-hidden="true">◆</span> High quality is unlocked — you hold <a href="/three-token">$THREE</a>.'+ : '<span class="fq-holder-ico" aria-hidden="true">◆</span> High quality is a <a href="/three-token">$THREE holder</a> feature — hold to unlock, or pay per generation.';}}diff --git a/x402-payment-modal/CHANGELOG.md b/x402-payment-modal/CHANGELOG.mdnew file mode 100644index 000000000..88d2309a9--- /dev/null+++ b/x402-payment-modal/CHANGELOG.md@@ -0,0 +1,33 @@+# Changelog++All notable changes to `@three-ws/x402-payment-modal` are documented here. This+project adheres to [Semantic Versioning](https://semver.org).++## 1.0.0++Initial public release. Extracted from the three.ws platform as a standalone,+dependency-free package.++### Added++- **Drop-in payment modal** for any x402 paid endpoint — declarative+ (`data-x402-endpoint` auto-binding) and programmatic (`pay()` / `window.X402`).+- **Solana payments** via Phantom (USDC), backed by the bundled checkout server+ helpers (`prepare` / `encode`).+- **EVM payments** via any injected wallet (Base USDC, EIP-3009+ `transferWithAuthorization`) — signed entirely in the browser, no server call.+- **SIWX (Sign-In-With-X / CAIP-122) re-entry** — wallets that already paid can+ sign in instead of paying again, with automatic fallback to the pay flow.+- **Client-side spending caps** — per-call / hourly / daily limits enforced in+ `localStorage`, with rollback on failure.+- **`configure()` + script-tag `data-*` config** for checkout origin, branding,+ builder-code attribution, and esm.sh CDN URLs.+- **Framework-agnostic server module** with Express and Vercel adapters+ (`@three-ws/x402-payment-modal/server`).+- **Theming** — light + automatic dark mode, all classes overridable, `--x402-z`+ z-index custom property.+- **Automatic 429 throttle retry** — re-sends the same signed payment up to twice+ while an upstream rate limit resets (no double charge; payment isn't settled+ until the merchant call succeeds).+- TypeScript definitions, full docs (`docs/`), tutorial, and runnable examples+ (plain HTML, React, Express).diff --git a/x402-payment-modal/server/README.md b/x402-payment-modal/server/README.mdnew file mode 100644index 000000000..373d3461d--- /dev/null+++ b/x402-payment-modal/server/README.md@@ -0,0 +1,68 @@+# Server — Solana checkout helpers++The modal's **EVM** path signs EIP-3009 typed-data in the browser and never calls+your server. The **Solana** path needs a small endpoint because Phantom signs+serialized transactions but doesn't build instructions: this module builds the+SPL `transferChecked` the buyer signs, then wraps the signed transaction into the+base64 `X-PAYMENT` envelope the x402 facilitator expects.++> If you only accept Base/EVM USDC, you don't need any of this.++## Install peer deps++```bash+npm install @solana/web3.js @solana/spl-token+```++## Mount it++**Express**++```js+import express from 'express';+import { x402CheckoutRouter } from '@three-ws/x402-payment-modal/server/express';++const app = express();+app.use(express.json());+app.use('/api/x402-checkout', x402CheckoutRouter({ rpcUrl: process.env.SOLANA_RPC_URL }));+```++**Vercel / Next.js** — `api/x402-checkout.js`++```js+export { default } from '@three-ws/x402-payment-modal/server/vercel';+// or, with options:+// import { createVercelCheckoutHandler } from '@three-ws/x402-payment-modal/server/vercel';+// export default createVercelCheckoutHandler({ rpcUrl: process.env.SOLANA_RPC_URL });+```++**Anything else** — use the core router:++```js+import { handleCheckout } from '@three-ws/x402-payment-modal/server';++const { status, body } = await handleCheckout({+ action: url.searchParams.get('action'), // 'prepare' | 'encode'+ body: await readJson(req),+ options: { rpcUrl: process.env.SOLANA_RPC_URL },+});+```++## Exports++| Export | Description |+| --- | --- |+| `prepareSolanaCheckout({ accept, buyer, rpcUrl?, devnetRpcUrl? })` | Build the partially-signed v0 transaction the buyer signs. |+| `encodeX402Payment({ accept, signedTxBase64, resourceUrl, builderCode? })` | Wrap the signed tx into the base64 `X-PAYMENT` envelope. |+| `handleCheckout({ action, body, options? })` | Route `prepare`/`encode`; returns `{ status, body }`. |+| `CheckoutError` | `Error` subclass with `.status` and `.code`. |+| `isSolanaNetwork(network)` | CAIP-2 / `solana` alias check. |+| `X402_VERSION`, `NETWORK_SOLANA_MAINNET`, `NETWORK_SOLANA_DEVNET` | Constants. |++Adapters: `./express` → `x402CheckoutRouter(options)`, `./vercel` →+`createVercelCheckoutHandler(options)` (default export is a ready handler). Both+set permissive CORS (`origin: '*'`) by default and handle the `OPTIONS`+preflight; pass `{ origin }` to restrict it.++See [../docs/server-setup.md](../docs/server-setup.md) for the request/response+shapes and environment variables.