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
Public deposit panel: Solana-Pay QR, copy address, live funds-received confirmation
nirholas0905807a186f
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 5db8b0137..d206ab3a8 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -6,8 +6,16 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr## 2026-06-19+- **Agent wallet's full money loop is now verified end-to-end on devnet** — A re-runnable harness now exercises the entire agent-wallet lifecycle in one pass — create a wallet, fund it, trade and snipe pump.fun tokens, pay an x402 service, exit a graduated position, and withdraw — against real Solana devnet state. It runs simulate-first and reports each step as passed or honestly blocked on funding/credentials, never a fake result, so regressions in the seams between deposit, trading, sniping, payments, and withdrawal surface before they reach holders. The agent wallet hub's Snipe tab now opens the live Sniper dashboard directly instead of a placeholder. (`/agent-wallet`) `[infra]`- **AR & half-body avatar export fixed for compressed models** — View-in-AR (USDZ for iOS Quick Look) and the half-body VR-seat export now work for avatars that ship with meshopt or Draco geometry compression. Previously these exports silently failed on compressed GLBs because the loader had no decoder registered; the pipeline now loads the meshopt and Draco decoders before parsing, so every avatar — including the compressed ones produced by the server-side bake — converts cleanly. (`/gallery`) `[fix]`+- **Fixed broken links and added retry on failed loads across the app** — Several navigation links pointed at pages that no longer exist — "View plans" on the agent deploy flow, the Classic viewer menu item, and the API-key links on the AWS welcome and selfie pages — and now go to the right place. List pages that could get stuck showing a blank grid or endless skeletons on a network hiccup (your collection, a coin's community profile, the bounty board, the agents directory) now show a clear, retryable error instead. The $THREE dashboard also replaced a non-working "claim" button with a plain explanation that revenue share is distributed to holders automatically. `[fix, improvement]`+- **Fund any agent wallet by scanning a QR or copying the address — with live confirmation** — The agent wallet's Deposit tab is now a complete, public funding panel: a crisp QR code (generated on-device, no third-party service) that your phone wallet can scan, a one-tap copyable Solana address, an optional preset amount, and a Solana deep-link that opens Phantom, Solflare or Backpack on mobile. The panel watches the agent's real on-chain balance and confirms the moment your SOL lands — "◎0.5 SOL received" — instead of leaving you guessing. Anyone can fund an agent, not just its owner, and the new "Fund agent wallet" button on the create-agent success screen leads new users straight into it. `[feature]`+- **Hardened the widget custom-brain proxy against internal-network abuse** — Chat widgets configured with a custom AI "brain" endpoint now route that request through our SSRF guard, so a widget owner can no longer point it at a private/internal address to probe our network. No change for legitimate public endpoints. We also tightened a few backend read paths so a temporary database or price-feed hiccup surfaces as "temporarily unavailable" instead of silently looking like empty data. `[security, improvement]`- **IBM sites can now embed three.ws pages** — We extended the sitewide clickjacking protection to allow IBM properties to frame three.ws. Any page on ibm.com (and its subdomains) may now load three.ws pages inside an iframe — useful for the IBM x402 demo and other IBM-hosted integrations — while every other external site is still refused by default. Sign-in, wallet, dashboard and OAuth consent pages remain hard-locked and cannot be framed by anyone, including IBM. The avatar, widget and walk embeds continue to work on any site as before. `[security, improvement]`+- **Premium avatar cosmetics are now buyable right in the character creator** — Locked premium headwear, eyewear, dyes and auras in the character creator no longer dead-end on a placeholder — clicking one now opens the real wallet checkout and unlocks it the moment the USDC payment settles, then equips it on your live preview. Anything you already own loads pre-unlocked, and the price you see is the true checkout amount pulled from the catalog. (`/create`) `[feature, fix]`+- **See your net take when you price a skill** — The Skill Pricing panel on the Monetize dashboard now shows exactly what you keep on every payment. As you type a per-call price, a line below the field updates live — "You receive $X.XX after 2.5% fee" — so the platform's cut is never a surprise at payout time. The same net figure appears in the Add Pricing dialog, and the panel header states the current platform fee rate, which is read from the live billing config rather than hardcoded. (`/dashboard/monetize`) `[feature, improvement]`+- **Shared agent links now unfurl with the agent's own avatar** — When you paste a link to an agent on X, Discord, Slack, Telegram or iMessage, the preview card now shows that agent's actual avatar, name and description instead of a generic three.ws image — so every shared link is visual proof of the collectible. Bots that don't run JavaScript get the right image and text rendered on the server, and agents without an avatar yet fall back to a clean branded card with their initial. We also fixed the canonical and share URLs on agent pages to point at the real /agents/<id> address. `[feature, improvement]`+- **Unity & Unreal avatar loading documented with code that actually works** — The developer hub's Unity and Unreal cards used to show sample code for an SDK that doesn't exist yet. They now show the real, working way to load a three.ws avatar today — your avatar's GLB endpoint loaded at runtime with glTFast (Unity) or glTFRuntime (Unreal), both standard glTF importers — alongside an honest note that a native package is still on the roadmap. (`/dashboard/developers`) `[docs, improvement]`## 2026-06-18diff --git a/data/changelog.json b/data/changelog.jsonindex f12b7bb42..e00a4ed24 100644--- a/data/changelog.json+++ b/data/changelog.json@@ -1,6 +1,80 @@{"$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-19",+ "title": "Agent wallet's full money loop is now verified end-to-end on devnet",+ "summary": "A re-runnable harness now exercises the entire agent-wallet lifecycle in one pass — create a wallet, fund it, trade and snipe pump.fun tokens, pay an x402 service, exit a graduated position, and withdraw — against real Solana devnet state. It runs simulate-first and reports each step as passed or honestly blocked on funding/credentials, never a fake result, so regressions in the seams between deposit, trading, sniping, payments, and withdrawal surface before they reach holders. The agent wallet hub's Snipe tab now opens the live Sniper dashboard directly instead of a placeholder.",+ "tags": [+ "infra"+ ],+ "link": "/agent-wallet"+ },+ {+ "date": "2026-06-19",+ "title": "Fund any agent wallet by scanning a QR or copying the address — with live confirmation",+ "summary": "The agent wallet's Deposit tab is now a complete, public funding panel: a crisp QR code (generated on-device, no third-party service) that your phone wallet can scan, a one-tap copyable Solana address, an optional preset amount, and a Solana deep-link that opens Phantom, Solflare or Backpack on mobile. The panel watches the agent's real on-chain balance and confirms the moment your SOL lands — \"◎0.5 SOL received\" — instead of leaving you guessing. Anyone can fund an agent, not just its owner, and the new \"Fund agent wallet\" button on the create-agent success screen leads new users straight into it.",+ "tags": [+ "feature"+ ]+ },+ {+ "date": "2026-06-19",+ "title": "Premium avatar cosmetics are now buyable right in the character creator",+ "summary": "Locked premium headwear, eyewear, dyes and auras in the character creator no longer dead-end on a placeholder — clicking one now opens the real wallet checkout and unlocks it the moment the USDC payment settles, then equips it on your live preview. Anything you already own loads pre-unlocked, and the price you see is the true checkout amount pulled from the catalog.",+ "tags": [+ "feature",+ "fix"+ ],+ "link": "/create"+ },+ {+ "date": "2026-06-19",+ "title": "Unity & Unreal avatar loading documented with code that actually works",+ "summary": "The developer hub's Unity and Unreal cards used to show sample code for an SDK that doesn't exist yet. They now show the real, working way to load a three.ws avatar today — your avatar's GLB endpoint loaded at runtime with glTFast (Unity) or glTFRuntime (Unreal), both standard glTF importers — alongside an honest note that a native package is still on the roadmap.",+ "tags": [+ "docs",+ "improvement"+ ],+ "link": "/dashboard/developers"+ },+ {+ "date": "2026-06-19",+ "title": "Fixed broken links and added retry on failed loads across the app",+ "summary": "Several navigation links pointed at pages that no longer exist — \"View plans\" on the agent deploy flow, the Classic viewer menu item, and the API-key links on the AWS welcome and selfie pages — and now go to the right place. List pages that could get stuck showing a blank grid or endless skeletons on a network hiccup (your collection, a coin's community profile, the bounty board, the agents directory) now show a clear, retryable error instead. The $THREE dashboard also replaced a non-working \"claim\" button with a plain explanation that revenue share is distributed to holders automatically.",+ "tags": [+ "fix",+ "improvement"+ ]+ },+ {+ "date": "2026-06-19",+ "title": "Hardened the widget custom-brain proxy against internal-network abuse",+ "summary": "Chat widgets configured with a custom AI \"brain\" endpoint now route that request through our SSRF guard, so a widget owner can no longer point it at a private/internal address to probe our network. No change for legitimate public endpoints. We also tightened a few backend read paths so a temporary database or price-feed hiccup surfaces as \"temporarily unavailable\" instead of silently looking like empty data.",+ "tags": [+ "security",+ "improvement"+ ]+ },+ {+ "date": "2026-06-19",+ "title": "See your net take when you price a skill",+ "summary": "The Skill Pricing panel on the Monetize dashboard now shows exactly what you keep on every payment. As you type a per-call price, a line below the field updates live — \"You receive $X.XX after 2.5% fee\" — so the platform's cut is never a surprise at payout time. The same net figure appears in the Add Pricing dialog, and the panel header states the current platform fee rate, which is read from the live billing config rather than hardcoded.",+ "tags": [+ "feature",+ "improvement"+ ],+ "link": "/dashboard/monetize"+ },+ {+ "date": "2026-06-19",+ "title": "Shared agent links now unfurl with the agent's own avatar",+ "summary": "When you paste a link to an agent on X, Discord, Slack, Telegram or iMessage, the preview card now shows that agent's actual avatar, name and description instead of a generic three.ws image — so every shared link is visual proof of the collectible. Bots that don't run JavaScript get the right image and text rendered on the server, and agents without an avatar yet fall back to a clean branded card with their initial. We also fixed the canonical and share URLs on agent pages to point at the real /agents/<id> address.",+ "tags": [+ "feature",+ "improvement"+ ]+ },{"date": "2026-06-19","title": "IBM sites can now embed three.ws pages",diff --git a/public/changelog.json b/public/changelog.jsonindex 0ccdc22ad..5449c16bf 100644--- a/public/changelog.json+++ b/public/changelog.json@@ -1,11 +1,21 @@{- "generated_at": "2026-06-19T00:19:16.950Z",+ "generated_at": "2026-06-19T00:39:58.999Z","generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json","site": {"name": "three.ws","url": "https://three.ws"},"entries": [+ {+ "date": "2026-06-19",+ "type": "update",+ "title": "Agent wallet's full money loop is now verified end-to-end on devnet",+ "summary": "A re-runnable harness now exercises the entire agent-wallet lifecycle in one pass — create a wallet, fund it, trade and snipe pump.fun tokens, pay an x402 service, exit a graduated position, and withdraw — against real Solana devnet state. It runs simulate-first and reports each step as passed or honestly blocked on funding/credentials, never a fake result, so regressions in the seams between deposit, trading, sniping, payments, and withdrawal surface before they reach holders. The agent wallet hub's Snipe tab now opens the live Sniper dashboard directly instead of a placeholder.",+ "link": "/agent-wallet",+ "tags": [+ "infra"+ ]+ },{"date": "2026-06-19","type": "update",@@ -16,6 +26,38 @@"fix"]},+ {+ "date": "2026-06-19",+ "type": "update",+ "title": "Fixed broken links and added retry on failed loads across the app",+ "summary": "Several navigation links pointed at pages that no longer exist — \"View plans\" on the agent deploy flow, the Classic viewer menu item, and the API-key links on the AWS welcome and selfie pages — and now go to the right place. List pages that could get stuck showing a blank grid or endless skeletons on a network hiccup (your collection, a coin's community profile, the bounty board, the agents directory) now show a clear, retryable error instead. The $THREE dashboard also replaced a non-working \"claim\" button with a plain explanation that revenue share is distributed to holders automatically.",+ "link": null,+ "tags": [+ "fix",+ "improvement"+ ]+ },+ {+ "date": "2026-06-19",+ "type": "update",+ "title": "Fund any agent wallet by scanning a QR or copying the address — with live confirmation",+ "summary": "The agent wallet's Deposit tab is now a complete, public funding panel: a crisp QR code (generated on-device, no third-party service) that your phone wallet can scan, a one-tap copyable Solana address, an optional preset amount, and a Solana deep-link that opens Phantom, Solflare or Backpack on mobile. The panel watches the agent's real on-chain balance and confirms the moment your SOL lands — \"◎0.5 SOL received\" — instead of leaving you guessing. Anyone can fund an agent, not just its owner, and the new \"Fund agent wallet\" button on the create-agent success screen leads new users straight into it.",+ "link": null,+ "tags": [+ "feature"+ ]+ },+ {+ "date": "2026-06-19",+ "type": "update",+ "title": "Hardened the widget custom-brain proxy against internal-network abuse",+ "summary": "Chat widgets configured with a custom AI \"brain\" endpoint now route that request through our SSRF guard, so a widget owner can no longer point it at a private/internal address to probe our network. No change for legitimate public endpoints. We also tightened a few backend read paths so a temporary database or price-feed hiccup surfaces as \"temporarily unavailable\" instead of silently looking like empty data.",+ "link": null,+ "tags": [+ "security",+ "improvement"+ ]+ },{"date": "2026-06-19","type": "update",@@ -27,6 +69,50 @@"improvement"]},+ {+ "date": "2026-06-19",+ "type": "update",+ "title": "Premium avatar cosmetics are now buyable right in the character creator",+ "summary": "Locked premium headwear, eyewear, dyes and auras in the character creator no longer dead-end on a placeholder — clicking one now opens the real wallet checkout and unlocks it the moment the USDC payment settles, then equips it on your live preview. Anything you already own loads pre-unlocked, and the price you see is the true checkout amount pulled from the catalog.",+ "link": "/create",+ "tags": [+ "feature",+ "fix"+ ]+ },+ {+ "date": "2026-06-19",+ "type": "update",+ "title": "See your net take when you price a skill",+ "summary": "The Skill Pricing panel on the Monetize dashboard now shows exactly what you keep on every payment. As you type a per-call price, a line below the field updates live — \"You receive $X.XX after 2.5% fee\" — so the platform's cut is never a surprise at payout time. The same net figure appears in the Add Pricing dialog, and the panel header states the current platform fee rate, which is read from the live billing config rather than hardcoded.",+ "link": "/dashboard/monetize",+ "tags": [+ "feature",+ "improvement"+ ]+ },+ {+ "date": "2026-06-19",+ "type": "update",+ "title": "Shared agent links now unfurl with the agent's own avatar",+ "summary": "When you paste a link to an agent on X, Discord, Slack, Telegram or iMessage, the preview card now shows that agent's actual avatar, name and description instead of a generic three.ws image — so every shared link is visual proof of the collectible. Bots that don't run JavaScript get the right image and text rendered on the server, and agents without an avatar yet fall back to a clean branded card with their initial. We also fixed the canonical and share URLs on agent pages to point at the real /agents/<id> address.",+ "link": null,+ "tags": [+ "feature",+ "improvement"+ ]+ },+ {+ "date": "2026-06-19",+ "type": "update",+ "title": "Unity & Unreal avatar loading documented with code that actually works",+ "summary": "The developer hub's Unity and Unreal cards used to show sample code for an SDK that doesn't exist yet. They now show the real, working way to load a three.ws avatar today — your avatar's GLB endpoint loaded at runtime with glTFast (Unity) or glTFRuntime (Unreal), both standard glTF importers — alongside an honest note that a native package is still on the roadmap.",+ "link": "/dashboard/developers",+ "tags": [+ "docs",+ "improvement"+ ]+ },{"date": "2026-06-18","type": "update",diff --git a/public/changelog.xml b/public/changelog.xmlindex 7e831f6a4..85de99416 100644--- a/public/changelog.xml+++ b/public/changelog.xml@@ -6,6 +6,14 @@<atom:link href="https://three.ws/changelog.xml" rel="self" type="application/rss+xml"/><description>What's new on three.ws — features, improvements, and releases, newest first.</description><language>en</language>+ <item>+ <title>Agent wallet's full money loop is now verified end-to-end on devnet</title>+ <link>https://three.ws/agent-wallet</link>+ <guid isPermaLink="false">2026-06-19:Agent wallet's full money loop is now verified end-to-end on devnet</guid>+ <pubDate>Fri, 19 Jun 2026 12:00:00 GMT</pubDate>+ <category>infra</category>+ <description>A re-runnable harness now exercises the entire agent-wallet lifecycle in one pass — create a wallet, fund it, trade and snipe pump.fun tokens, pay an x402 service, exit a graduated position, and withdraw — against real Solana devnet state. It runs simulate-first and reports each step as passed or honestly blocked on funding/credentials, never a fake result, so regressions in the seams between deposit, trading, sniping, payments, and withdrawal surface before they reach holders. The agent wallet hub's Snipe tab now opens the live Sniper dashboard directly instead of a placeholder.</description>+ </item><item><title>AR & half-body avatar export fixed for compressed models</title><link>https://three.ws/gallery</link>@@ -14,6 +22,30 @@<category>fix</category><description>View-in-AR (USDZ for iOS Quick Look) and the half-body VR-seat export now work for avatars that ship with meshopt or Draco geometry compression. Previously these exports silently failed on compressed GLBs because the loader had no decoder registered; the pipeline now loads the meshopt and Draco decoders before parsing, so every avatar — including the compressed ones produced by the server-side bake — converts cleanly.</description></item>+ <item>+ <title>Fixed broken links and added retry on failed loads across the app</title>+ <link>https://three.ws/changelog</link>+ <guid isPermaLink="false">2026-06-19:Fixed broken links and added retry on failed loads across the app</guid>+ <pubDate>Fri, 19 Jun 2026 12:00:00 GMT</pubDate>+ <category>fix</category>+ <description>Several navigation links pointed at pages that no longer exist — "View plans" on the agent deploy flow, the Classic viewer menu item, and the API-key links on the AWS welcome and selfie pages — and now go to the right place. List pages that could get stuck showing a blank grid or endless skeletons on a network hiccup (your collection, a coin's community profile, the bounty board, the agents directory) now show a clear, retryable error instead. The $THREE dashboard also replaced a non-working "claim" button with a plain explanation that revenue share is distributed to holders automatically.</description>+ </item>+ <item>+ <title>Fund any agent wallet by scanning a QR or copying the address — with live confirmation</title>+ <link>https://three.ws/changelog</link>+ <guid isPermaLink="false">2026-06-19:Fund any agent wallet by scanning a QR or copying the address — with live confirmation</guid>+ <pubDate>Fri, 19 Jun 2026 12:00:00 GMT</pubDate>+ <category>feature</category>+ <description>The agent wallet's Deposit tab is now a complete, public funding panel: a crisp QR code (generated on-device, no third-party service) that your phone wallet can scan, a one-tap copyable Solana address, an optional preset amount, and a Solana deep-link that opens Phantom, Solflare or Backpack on mobile. The panel watches the agent's real on-chain balance and confirms the moment your SOL lands — "◎0.5 SOL received" — instead of leaving you guessing. Anyone can fund an agent, not just its owner, and the new "Fund agent wallet" button on the create-agent success screen leads new users straight into it.</description>+ </item>+ <item>+ <title>Hardened the widget custom-brain proxy against internal-network abuse</title>+ <link>https://three.ws/changelog</link>+ <guid isPermaLink="false">2026-06-19:Hardened the widget custom-brain proxy against internal-network abuse</guid>+ <pubDate>Fri, 19 Jun 2026 12:00:00 GMT</pubDate>+ <category>security</category>+ <description>Chat widgets configured with a custom AI "brain" endpoint now route that request through our SSRF guard, so a widget owner can no longer point it at a private/internal address to probe our network. No change for legitimate public endpoints. We also tightened a few backend read paths so a temporary database or price-feed hiccup surfaces as "temporarily unavailable" instead of silently looking like empty data.</description>+ </item><item><title>IBM sites can now embed three.ws pages</title><link>https://three.ws/changelog</link>@@ -22,6 +54,38 @@<category>security</category><description>We extended the sitewide clickjacking protection to allow IBM properties to frame three.ws. Any page on ibm.com (and its subdomains) may now load three.ws pages inside an iframe — useful for the IBM x402 demo and other IBM-hosted integrations — while every other external site is still refused by default. Sign-in, wallet, dashboard and OAuth consent pages remain hard-locked and cannot be framed by anyone, including IBM. The avatar, widget and walk embeds continue to work on any site as before.</description></item>+ <item>+ <title>Premium avatar cosmetics are now buyable right in the character creator</title>+ <link>https://three.ws/create</link>+ <guid isPermaLink="false">2026-06-19:Premium avatar cosmetics are now buyable right in the character creator</guid>+ <pubDate>Fri, 19 Jun 2026 12:00:00 GMT</pubDate>+ <category>feature</category>+ <description>Locked premium headwear, eyewear, dyes and auras in the character creator no longer dead-end on a placeholder — clicking one now opens the real wallet checkout and unlocks it the moment the USDC payment settles, then equips it on your live preview. Anything you already own loads pre-unlocked, and the price you see is the true checkout amount pulled from the catalog.</description>+ </item>+ <item>+ <title>See your net take when you price a skill</title>+ <link>https://three.ws/dashboard/monetize</link>+ <guid isPermaLink="false">2026-06-19:See your net take when you price a skill</guid>+ <pubDate>Fri, 19 Jun 2026 12:00:00 GMT</pubDate>+ <category>feature</category>+ <description>The Skill Pricing panel on the Monetize dashboard now shows exactly what you keep on every payment. As you type a per-call price, a line below the field updates live — "You receive $X.XX after 2.5% fee" — so the platform's cut is never a surprise at payout time. The same net figure appears in the Add Pricing dialog, and the panel header states the current platform fee rate, which is read from the live billing config rather than hardcoded.</description>+ </item>+ <item>+ <title>Shared agent links now unfurl with the agent's own avatar</title>+ <link>https://three.ws/changelog</link>+ <guid isPermaLink="false">2026-06-19:Shared agent links now unfurl with the agent's own avatar</guid>+ <pubDate>Fri, 19 Jun 2026 12:00:00 GMT</pubDate>+ <category>feature</category>+ <description>When you paste a link to an agent on X, Discord, Slack, Telegram or iMessage, the preview card now shows that agent's actual avatar, name and description instead of a generic three.ws image — so every shared link is visual proof of the collectible. Bots that don't run JavaScript get the right image and text rendered on the server, and agents without an avatar yet fall back to a clean branded card with their initial. We also fixed the canonical and share URLs on agent pages to point at the real /agents/<id> address.</description>+ </item>+ <item>+ <title>Unity & Unreal avatar loading documented with code that actually works</title>+ <link>https://three.ws/dashboard/developers</link>+ <guid isPermaLink="false">2026-06-19:Unity & Unreal avatar loading documented with code that actually works</guid>+ <pubDate>Fri, 19 Jun 2026 12:00:00 GMT</pubDate>+ <category>docs</category>+ <description>The developer hub's Unity and Unreal cards used to show sample code for an SDK that doesn't exist yet. They now show the real, working way to load a three.ws avatar today — your avatar's GLB endpoint loaded at runtime with glTFast (Unity) or glTFRuntime (Unreal), both standard glTF importers — alongside an honest note that a native package is still on the roadmap.</description>+ </item><item><title>Agent economy demos now show honest run status</title><link>https://three.ws/live</link>diff --git a/public/features.json b/public/features.jsonindex 3d558dc8d..9271adb24 100644--- a/public/features.json+++ b/public/features.json@@ -1,5 +1,5 @@{- "generated_at": "2026-06-19T00:19:16.797Z",+ "generated_at": "2026-06-19T00:39:58.962Z","generated_by": "scripts/build-page-index.mjs from data/pages.json","site": {"name": "three.ws",diff --git a/src/agent-wallet-hub/tabs/deposit.js b/src/agent-wallet-hub/tabs/deposit.jsindex cfe22a74a..70e4290fa 100644--- a/src/agent-wallet-hub/tabs/deposit.js+++ b/src/agent-wallet-hub/tabs/deposit.js@@ -1,19 +1,513 @@/**- * Agent Wallet hub — Deposit tab (placeholder; replaced by epic task 02).+ * Agent Wallet hub — Deposit tab (fully built).*- * Visible to owner AND visitors: funding an agent is a public-safe action (you- * can deposit to any agent's public address). Task 02 ships the QR + copy +- * `solana:` deep-link + live "funds received" confirmation here.+ * The public, onboarding-grade "fund this agent" surface. Visible to the owner+ * AND to visitors — funding someone's agent is a first-class, public-safe action,+ * so there are no secrets and no management controls here.+ *+ * What it does:+ * • Shows who you're funding (agent name + avatar) so the deposit is trustworthy.+ * • Renders the agent's Solana address in full + truncated, with one-tap copy.+ * • Renders a crisp Solana-Pay `solana:<address>?label=…[&amount=…]` QR via the+ * first-party, zero-dependency generator in src/erc8004/qr.js — NO third-party+ * CDN. Tapping the QR (or the "Open in a wallet app" link) fires the same+ * `solana:` deep-link so a phone opens Phantom / Solflare / Backpack / etc.+ * • Optional amount field that rewrites the QR + deep-link `?amount=` (in SOL).+ * • Live "funds received" confirmation: polls the real on-chain balance and, the+ * moment it increases, shows "◎X SOL received" and refreshes recent activity.+ * The confirmation fires ONLY on a real balance increase — never simulated.+ *+ * Every state is designed: loading skeleton, waiting-for-first-deposit (calm empty+ * state), received (success), no-wallet (being prepared), and an RPC-unreachable+ * state that keeps the address + QR fully usable while live confirmation retries.+ *+ * Balance is read from GET /api/agents/:id/solana (the same live-RPC path with+ * failover + 60s server cache used across the hub). No hardcoded balances, no+ * fake "received" events.*/-import { registerPlaceholderTab } from './_placeholder.js';+import { registerWalletTab } from '../registry.js';+import { fetchAgentSolanaWallet, fetchAgentSolanaActivity } from '../../agent-solana-wallet.js';+import { renderQRToSVG } from '../../erc8004/qr.js';+import { formatSol, timeAgo, explorerAddressUrl, explorerTxUrl } from '../util.js';++// Balance is server-cached for 60s, so a faster poll just re-reads the cache.+// 15s keeps the "waiting for your deposit" loop feeling live without hammering RPC.+const POLL_MS = 15_000;++const DEP_STYLE_ID = 'awh-deposit-style';+const DEP_STYLE = `+.awh-dep-who { display: flex; align-items: center; gap: var(--space-3,12px); margin-bottom: var(--space-3,12px); }+.awh-dep-who-av { width: 36px; height: 36px; border-radius: var(--radius-md,10px); object-fit: cover; flex: none; background: var(--surface-2, rgba(255,255,255,.05)); border: 1px solid var(--stroke, rgba(255,255,255,.08)); }+.awh-dep-who-txt { font-size: var(--text-md,.8125rem); color: var(--ink-dim,#888); line-height: 1.35; }+.awh-dep-who-txt strong { color: var(--ink-bright,#fff); font-weight: 600; }++.awh-dep-grid { display: grid; grid-template-columns: auto 1fr; gap: var(--space-5,20px); align-items: start; }+@media (max-width: 560px) { .awh-dep-grid { grid-template-columns: 1fr; } }++.awh-dep-qrwrap { display: flex; flex-direction: column; align-items: center; gap: var(--space-2,8px); }+.awh-dep-qr { display: block; width: 188px; max-width: 52vw; height: auto; padding: 10px; background: #fff; border-radius: var(--radius-md,10px); border: 1px solid var(--stroke, rgba(255,255,255,.08)); transition: transform var(--duration-fast,140ms) var(--ease-standard,ease), box-shadow var(--duration-fast,140ms) var(--ease-standard,ease); }+a.awh-dep-qr:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(0,0,0,.35); }+a.awh-dep-qr:focus-visible { outline: var(--focus-ring-width,2px) solid var(--focus-ring-color,#fff); outline-offset: 3px; }+.awh-dep-qr svg { display: block; width: 100%; height: auto; }+.awh-dep-deeplink { font-size: var(--text-sm,.764rem); color: var(--ink-dim,#888); text-decoration: none; border-bottom: 1px dotted currentColor; }+.awh-dep-deeplink:hover { color: var(--ink,#e8e8e8); }++.awh-dep-side { display: flex; flex-direction: column; gap: var(--space-3,12px); min-width: 0; }+.awh-dep-label { font-size: var(--text-2xs,.6875rem); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-dim,#888); }+.awh-dep-addr { font-family: var(--font-mono, ui-monospace, monospace); font-size: var(--text-sm,.764rem); color: var(--ink,#e8e8e8); background: var(--surface-2, rgba(255,255,255,.05)); border: 1px solid var(--stroke, rgba(255,255,255,.08)); border-radius: var(--radius-sm,6px); padding: 9px 11px; word-break: break-all; line-height: 1.5; }+.awh-dep-actions { display: flex; gap: var(--space-2,8px); flex-wrap: wrap; }++.awh-dep-amount { display: flex; flex-direction: column; gap: 5px; }+.awh-dep-amount-field { display: flex; align-items: center; gap: 6px; background: var(--surface-2, rgba(255,255,255,.05)); border: 1px solid var(--stroke, rgba(255,255,255,.08)); border-radius: var(--radius-sm,6px); padding: 2px 10px; transition: border-color var(--duration-fast,140ms); }+.awh-dep-amount-field:focus-within { border-color: var(--stroke-strong, rgba(255,255,255,.22)); }+.awh-dep-amount-field input { flex: 1 1 auto; min-width: 0; appearance: none; -moz-appearance: textfield; font: inherit; font-size: var(--text-md,.8125rem); color: var(--ink-bright,#fff); background: transparent; border: none; padding: 8px 0; }+.awh-dep-amount-field input::-webkit-outer-spin-button, .awh-dep-amount-field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }+.awh-dep-amount-field input:focus { outline: none; }+.awh-dep-amount-field .unit { font-size: var(--text-sm,.764rem); color: var(--ink-dim,#888); font-family: var(--font-mono, ui-monospace, monospace); flex: none; }+.awh-dep-amount-hint { font-size: var(--text-2xs,.6875rem); color: var(--ink-dim,#888); }+.awh-dep-amount-hint.is-err { color: var(--warn,#fbbf24); }++.awh-dep-how { font-size: var(--text-sm,.764rem); color: var(--ink-dim,#888); line-height: 1.55; margin: 0; }++.awh-dep-status { display: flex; align-items: center; gap: 10px; }+.awh-dep-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }+.awh-dep-status[data-state="waiting"] .awh-dep-dot { background: var(--warn,#fbbf24); animation: awh-dep-pulse 1.5s ease-in-out infinite; }+.awh-dep-status[data-state="received"] .awh-dep-dot { background: var(--success,#4ade80); box-shadow: 0 0 8px color-mix(in srgb, var(--success,#4ade80) 70%, transparent); }+.awh-dep-status[data-state="paused"] .awh-dep-dot { background: var(--ink-dim,#888); }+.awh-dep-status-txt { font-size: var(--text-md,.8125rem); color: var(--ink,#e8e8e8); }+.awh-dep-status[data-state="received"] .awh-dep-status-txt { color: var(--success,#4ade80); font-weight: 600; }+.awh-dep-status-sub { font-size: var(--text-sm,.764rem); color: var(--ink-dim,#888); margin-top: 3px; }+.awh-dep-received { animation: awh-dep-pop var(--duration-base,220ms) var(--ease-out,ease); }++.awh-dep-act-list { list-style: none; margin: 0; padding: 0; }+.awh-dep-act-row { display: flex; align-items: center; gap: var(--space-3,12px); padding: 8px 0; border-bottom: 1px solid var(--stroke, rgba(255,255,255,.06)); font-size: var(--text-sm,.764rem); }+.awh-dep-act-row:last-child { border-bottom: none; }+.awh-dep-act-sig { color: var(--ink,#e8e8e8); text-decoration: none; font-family: var(--font-mono, ui-monospace, monospace); }+.awh-dep-act-sig:hover { text-decoration: underline; }+.awh-dep-act-meta { color: var(--ink-dim,#888); flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }+.awh-dep-act-delta { font-family: var(--font-mono, ui-monospace, monospace); flex: none; }+.awh-dep-act-delta.is-pos { color: var(--success,#4ade80); }+.awh-dep-act-delta.is-neg { color: var(--danger,#f87171); }-registerPlaceholderTab({+.awh-dep-skel { display: flex; flex-direction: column; gap: 14px; }+.awh-dep-skel span { background: var(--surface-2, rgba(255,255,255,.05)); border-radius: var(--radius-sm,6px); animation: awh-skel 1.4s ease-in-out infinite; height: 16px; }+.awh-dep-skel span.qr { height: 168px; width: 168px; border-radius: var(--radius-md,10px); }+.awh-dep-skel span.l { width: 70%; } .awh-dep-skel span.m { width: 50%; }++@keyframes awh-dep-pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .4; transform: scale(.85); } }+@keyframes awh-dep-pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }+@keyframes awh-skel { 0%,100% { opacity: .5; } 50% { opacity: 1; } }+@media (prefers-reduced-motion: reduce) { .awh-dep-status .awh-dep-dot, .awh-dep-received, .awh-dep-skel span { animation: none; } a.awh-dep-qr:hover { transform: none; } }+`;++function injectDepositStyle() {+ if (typeof document === 'undefined' || document.getElementById(DEP_STYLE_ID)) return;+ const tag = document.createElement('style');+ tag.id = DEP_STYLE_ID;+ tag.textContent = DEP_STYLE;+ document.head.appendChild(tag);+}++/**+ * Build a Solana-Pay transfer-request URI: `solana:<recipient>[?amount=…][&label=…]`.+ * Per the Solana Pay spec the recipient is a base58 address and `amount` is a+ * decimal in SOL. Returns null without a valid-looking address.+ */+export function buildSolanaPayUri(address, { amount, label } = {}) {+ if (!address || typeof address !== 'string') return null;+ const params = new URLSearchParams();+ const amt = Number(amount);+ if (Number.isFinite(amt) && amt > 0) {+ // Trim to a sane lamport precision (9 dp) and drop trailing zeros.+ params.set('amount', String(amt).slice(0, 24));+ }+ if (label) params.set('label', label);+ const qs = params.toString();+ return `solana:${address}${qs ? `?${qs}` : ''}`;+}++registerWalletTab({id: 'deposit',label: 'Deposit',order: 20,ownerOnly: false,- icon: '↓',- title: 'Fund this wallet',- body: 'Scan a QR with your phone, copy the address, or tap a one-tap Solana deposit link to send SOL to this agent — with a live confirmation the moment funds land. This panel is being wired up now.',+ mount({ panel, ctx }) {+ injectDepositStyle();+ const { escapeHtml, shortAddress, copyToClipboard, toast } = ctx;++ let pollTimer = null;+ let detachNet = null;+ let visible = false;+ let destroyed = false;+ let qrDebounce = null;++ const agentName = ctx.agent?.name || 'this agent';+ const avatar = ctx.agent?.avatar_thumbnail_url || '';+ // Solana-Pay labels are short merchant-style names. Clamp the (user-controlled,+ // unbounded) agent name so it can never push the QR payload past the generator's+ // version-10 capacity — the address + deep-link must always stay scannable.+ const qrLabel = agentName.length > 48 ? `${agentName.slice(0, 47)}…` : agentName;++ const state = {+ loaded: false,+ address: ctx.agent?.solana_address || ctx.agent?.meta?.solana_address || null,+ amount: '', // user-entered SOL amount for the QR/deep-link+ amountError: false,+ // Live confirmation tracking.+ baselineSol: null, // first observed balance; deposits are measured against it+ balanceError: false,+ received: null, // { delta, total } of the most recent detected deposit+ receivedCount: 0,+ // Recent activity (refreshed when a deposit lands).+ activity: null,+ activityLoaded: false,+ };++ function solanaUri() {+ return buildSolanaPayUri(state.address, {+ amount: state.amountError ? null : state.amount,+ label: qrLabel,+ });+ }++ function qrMarkup() {+ const uri = solanaUri();+ if (!uri) return '';+ // First-party, zero-dep QR. SVG scales crisply at any size and needs no canvas.+ // The generator throws above its version-10 capacity; the clamped label keeps+ // us well under it, but fall back to an address-only code (always within+ // capacity) rather than ever throwing out of render or the debounce timer.+ try {+ return renderQRToSVG(uri, { scale: 6, margin: 1 });+ } catch {+ const safe = buildSolanaPayUri(state.address, {});+ try {+ return safe ? renderQRToSVG(safe, { scale: 6, margin: 1 }) : '';+ } catch {+ return '';+ }+ }+ }++ function statusBlock() {+ if (state.balanceError) {+ return `+ <div class="awh-dep-status" data-state="paused">+ <span class="awh-dep-dot" aria-hidden="true"></span>+ <div>+ <div class="awh-dep-status-txt">Live confirmation paused</div>+ <div class="awh-dep-status-sub">The Solana network was unreachable — retrying automatically. Your deposit will still arrive; this panel will confirm it once the network responds.</div>+ </div>+ </div>`;+ }+ if (state.received) {+ const sub =+ state.receivedCount > 1+ ? `That's deposit #${state.receivedCount}. Balance is now ◎${escapeHtml(formatSol(state.received.total))} SOL.`+ : `Balance is now ◎${escapeHtml(formatSol(state.received.total))} SOL. Send more any time, or head to the Balance and Trade tabs.`;+ return `+ <div class="awh-dep-status awh-dep-received" data-state="received">+ <span class="awh-dep-dot" aria-hidden="true"></span>+ <div>+ <div class="awh-dep-status-txt">◎${escapeHtml(formatSol(state.received.delta))} SOL received</div>+ <div class="awh-dep-status-sub">${sub}</div>+ </div>+ </div>`;+ }+ return `+ <div class="awh-dep-status" data-state="waiting">+ <span class="awh-dep-dot" aria-hidden="true"></span>+ <div>+ <div class="awh-dep-status-txt">Waiting for your first deposit…</div>+ <div class="awh-dep-status-sub">Scan the code or send SOL to the address above. The moment funds land on-chain, you'll see it confirmed right here.</div>+ </div>+ </div>`;+ }++ function activityBlock(net) {+ if (!state.activityLoaded) return '';+ const rows = state.activity || [];+ if (!rows.length) return '';+ return `+ <div class="awh-card">+ <h2 class="awh-card-h">Recent activity</h2>+ <ul class="awh-dep-act-list">+ ${rows+ .map((a) => {+ const delta = a.sol_delta;+ let cls = '';+ let txt = '—';+ if (typeof delta === 'number') {+ cls = delta > 0 ? 'is-pos' : delta < 0 ? 'is-neg' : '';+ txt = `${delta > 0 ? '+' : ''}${formatSol(delta)} SOL`;+ }+ const failed = a.success === false;+ return `<li class="awh-dep-act-row">+ <a class="awh-dep-act-sig" href="${escapeHtml(explorerTxUrl(a.signature, net))}" target="_blank" rel="noopener">${escapeHtml(shortAddress(a.signature, 6, 4))}</a>+ <span class="awh-dep-act-meta">${escapeHtml(a.summary ? a.summary : failed ? 'failed' : 'transfer')} · ${escapeHtml(timeAgo(a.block_time))}</span>+ <span class="awh-dep-act-delta ${cls}">${escapeHtml(txt)}</span>+ </li>`;+ })+ .join('')}+ </ul>+ </div>`;+ }++ function render() {+ if (destroyed) return;+ const net = ctx.getNetwork();++ if (!state.loaded) {+ panel.innerHTML = `+ <div class="awh-card awh-dep-skel" aria-busy="true" aria-label="Loading deposit details">+ <span class="qr"></span>+ <span class="l"></span>+ <span class="m"></span>+ </div>`;+ return;+ }++ if (!state.address) {+ panel.innerHTML = `+ <div class="awh-card">+ <div class="awh-dep-who">+ ${avatar ? `<img class="awh-dep-who-av" src="${escapeHtml(avatar)}" alt="" loading="lazy" onerror="this.remove()" />` : ''}+ <div class="awh-dep-who-txt">You're funding <strong>${escapeHtml(agentName)}</strong></div>+ </div>+ <div class="awh-empty">This agent's Solana wallet is still being prepared. It's created automatically — refresh in a moment and the deposit address will appear here.</div>+ <div class="awh-dep-actions" style="margin-top:12px">+ <button class="awh-btn" type="button" data-act="reload">Refresh</button>+ </div>+ </div>`;+ panel.querySelector('[data-act="reload"]')?.addEventListener('click', () => {+ state.loaded = false;+ render();+ loadInitial();+ });+ return;+ }++ const uri = solanaUri();+ panel.innerHTML = `+ <div class="awh-card">+ <div class="awh-dep-who">+ ${avatar ? `<img class="awh-dep-who-av" src="${escapeHtml(avatar)}" alt="" loading="lazy" onerror="this.remove()" />` : ''}+ <div class="awh-dep-who-txt">You're funding <strong>${escapeHtml(agentName)}</strong> — send SOL to the wallet below.</div>+ </div>++ <div class="awh-dep-grid">+ <div class="awh-dep-qrwrap">+ <a class="awh-dep-qr" data-host="qr" href="${escapeHtml(uri)}"+ aria-label="Solana deposit link for ${escapeHtml(agentName)} — scan with a phone wallet, or tap to open a wallet app">${qrMarkup()}</a>+ <a class="awh-dep-deeplink" data-host="deeplink" href="${escapeHtml(uri)}">Open in a wallet app ↗</a>+ </div>++ <div class="awh-dep-side">+ <div>+ <div class="awh-dep-label">Wallet address${net === 'devnet' ? ' · Devnet' : ''}</div>+ <div class="awh-dep-addr" title="${escapeHtml(state.address)}">${escapeHtml(state.address)}</div>+ </div>+ <div class="awh-dep-actions">+ <button class="awh-btn" type="button" data-act="copy" aria-label="Copy wallet address">Copy address</button>+ <a class="awh-btn" href="${escapeHtml(explorerAddressUrl(state.address, net))}" target="_blank" rel="noopener">Explorer ↗</a>+ </div>++ <div class="awh-dep-amount">+ <label class="awh-dep-label" for="awh-dep-amount-input">Amount (optional)</label>+ <div class="awh-dep-amount-field">+ <input id="awh-dep-amount-input" data-input="amount" type="number" inputmode="decimal"+ min="0" step="0.01" placeholder="0.00" value="${escapeHtml(state.amount)}"+ aria-describedby="awh-dep-amount-hint" />+ <span class="unit" aria-hidden="true">SOL</span>+ </div>+ <div class="awh-dep-amount-hint ${state.amountError ? 'is-err' : ''}" id="awh-dep-amount-hint">+ ${state.amountError ? 'Enter a positive number — the QR uses the address only until then.' : 'Preset an amount in the QR + wallet link, or leave blank to let the sender choose.'}+ </div>+ </div>+ </div>+ </div>++ <p class="awh-dep-how">+ <strong>How to fund:</strong> scan the QR with your phone's wallet (Phantom, Solflare, Backpack…),+ tap “Open in a wallet app” on mobile, or copy the address and send SOL from any wallet or exchange.+ </p>+ </div>++ <div class="awh-card" data-host="status">${statusBlock()}</div>++ <div data-host="activity">${activityBlock(net)}</div>+ `;++ panel.querySelector('[data-act="copy"]')?.addEventListener('click', async () => {+ const ok = await copyToClipboard(state.address);+ toast(ok ? 'Address copied' : 'Copy failed — select it manually');+ });++ const amountInput = panel.querySelector('[data-input="amount"]');+ amountInput?.addEventListener('input', onAmountInput);+ }++ function onAmountInput(e) {+ const raw = e.target.value.trim();+ state.amount = raw;+ const n = Number(raw);+ state.amountError = raw !== '' && (!Number.isFinite(n) || n <= 0);+ // Debounce the QR re-render so fast typing stays smooth.+ clearTimeout(qrDebounce);+ qrDebounce = setTimeout(() => {+ if (destroyed) return;+ const uri = solanaUri();+ const qrHost = panel.querySelector('[data-host="qr"]');+ const deeplink = panel.querySelector('[data-host="deeplink"]');+ if (qrHost) {+ qrHost.innerHTML = qrMarkup();+ if (uri) qrHost.setAttribute('href', uri);+ }+ if (deeplink && uri) deeplink.setAttribute('href', uri);+ const hint = panel.querySelector('#awh-dep-amount-hint');+ if (hint) {+ hint.classList.toggle('is-err', state.amountError);+ hint.textContent = state.amountError+ ? 'Enter a positive number — the QR uses the address only until then.'+ : 'Preset an amount in the QR + wallet link, or leave blank to let the sender choose.';+ }+ }, 220);+ }++ function patchStatus() {+ const host = panel.querySelector('[data-host="status"]');+ if (host) host.innerHTML = statusBlock();+ }+ function patchActivity() {+ const host = panel.querySelector('[data-host="activity"]');+ if (host) host.innerHTML = activityBlock(ctx.getNetwork());+ }++ /** Read the live balance. Returns the SOL number, or null if unavailable. */+ async function readBalance() {+ const net = ctx.getNetwork();+ let r;+ try {+ r = await fetchAgentSolanaWallet(ctx.agentId, net);+ } catch {+ return { ok: false };+ }+ if (!r) return { ok: false };+ if (r.status === 'forbidden') return { ok: false, forbidden: true };+ if (r.status === 'none') return { ok: true, address: null, sol: null };+ if (r.status === 'error') return { ok: false };+ if (r.data?.balance_error) return { ok: false };+ return { ok: true, address: r.data?.address || null, sol: r.data?.sol ?? null };+ }++ async function loadInitial() {+ const res = await readBalance();+ if (res.ok) {+ if (res.address) state.address = res.address;+ state.balanceError = false;+ if (typeof res.sol === 'number') state.baselineSol = res.sol;+ } else {+ // Address may still be known from the agent record — keep the panel usable.+ state.balanceError = true;+ }+ state.loaded = true;+ render();+ if (state.address) loadActivity();+ }++ async function poll() {+ if (!visible || destroyed || !state.address) return;+ const res = await readBalance();+ if (!res.ok) {+ if (!state.balanceError) {+ state.balanceError = true;+ patchStatus();+ }+ return;+ }+ const wasErrored = state.balanceError;+ state.balanceError = false;+ const sol = res.sol;+ if (typeof sol !== 'number') {+ if (wasErrored) patchStatus();+ return;+ }+ if (state.baselineSol == null) {+ // First good read after an error — establish the baseline silently.+ state.baselineSol = sol;+ if (wasErrored) patchStatus();+ return;+ }+ const delta = sol - state.baselineSol;+ // Guard against float dust; a real deposit is well above lamport noise.+ if (delta > 1e-7) {+ state.received = { delta, total: sol };+ state.receivedCount += 1;+ state.baselineSol = sol;+ patchStatus();+ toast(`◎${formatSol(delta)} SOL received`);+ loadActivity(); // a deposit just landed — pull the fresh tx in+ } else if (wasErrored) {+ patchStatus();+ }+ }++ async function loadActivity() {+ const net = ctx.getNetwork();+ if (!state.address) return;+ try {+ const data = await fetchAgentSolanaActivity(ctx.agentId, net, 8);+ state.activity = data?.signatures || [];+ } catch {+ state.activity = state.activity || [];+ } finally {+ state.activityLoaded = true;+ patchActivity();+ }+ }++ function startPoll() {+ stopPoll();+ pollTimer = setInterval(poll, POLL_MS);+ }+ function stopPoll() {+ if (pollTimer) clearInterval(pollTimer);+ pollTimer = null;+ }++ // A network switch resets the live-confirmation baseline for the new cluster.+ detachNet = ctx.onNetworkChange(() => {+ state.loaded = false;+ state.baselineSol = null;+ state.received = null;+ state.receivedCount = 0;+ state.activity = null;+ state.activityLoaded = false;+ state.balanceError = false;+ render();+ loadInitial();+ });++ render();++ return {+ onShow() {+ visible = true;+ if (!state.loaded) loadInitial();+ else render();+ startPoll();+ },+ onHide() {+ visible = false;+ stopPoll();+ },+ destroy() {+ destroyed = true;+ stopPoll();+ clearTimeout(qrDebounce);+ detachNet?.();+ },+ };+ },});diff --git a/tasks/agent-wallet-trading/02-public-deposit-panel.md b/tasks/agent-wallet-trading/02-public-deposit-panel.mddeleted file mode 100644index 3e6875683..000000000--- a/tasks/agent-wallet-trading/02-public-deposit-panel.md+++ /dev/null@@ -1,105 +0,0 @@-# Task: Public / onboarding deposit panel — scan QR or copy address, send SOL, live confirmation--## Context--The pieces to fund an agent wallet already exist but are scattered and-owner-gated, so a first-time user has no clean "send SOL to your agent" moment:--- Zero-dep QR generator: `src/erc8004/qr.js` (`renderQRToCanvas`,- `renderQRToSVG`). The agent-detail page also loads QRious from a CDN- (`pages/agent-detail.html:39`) — prefer the first-party `src/erc8004/qr.js` to- avoid a third-party CDN dependency.-- A Receive button + QR canvas + copy-address control exist, but behind- `bindWalletActions(isOwner)` so only the owner ever sees them- (`src/agent-detail.js:1771-1796`, `pages/agent-detail.html:419-443`).-- Live balance API (`GET /api/agents/:id/solana`, `api/agents/solana-wallet.js:251`)- + activity feed (`…/solana/activity`) + 30s client poll- (`src/agent-solana-wallet.js:287,310`) are ready.-- The create-agent success screen already tells the user "It now has its own- wallet" (`pages/create-agent.html:1493`) but offers no way to fund it.--This task turns those into a polished deposit experience that lives in the wallet-hub's **Deposit** tab (built in task 01) and is surfaced on the create-agent-success screen as the natural next step.--## Goal--Any user (owner or visitor) can fund an agent: see the agent's Solana address,-scan a QR with their phone, tap a `solana:` deep-link to open a mobile wallet, or-copy the address — then watch the balance update live and get a clear "X SOL-received" confirmation the moment funds land.--## Files to Read First--- `src/erc8004/qr.js` — first-party QR renderer (use this, not the CDN)-- `src/agent-detail.js:1771-1796` — current owner-only receive/QR logic to generalize-- `pages/agent-detail.html:419-443` — current address/QR markup-- `api/agents/solana-wallet.js:251` — balance + `…/activity` endpoint shape-- `src/agent-solana-wallet.js:287-313` — `fetchAgentSolanaWallet` + poll loop to reuse-- `pages/create-agent.html:1485-1500` + `src/create-agent.js:923-1050` — success screen-- Task 01's wallet hub shell (Deposit tab placeholder) — render into it--## What to Build / Do--1. **Deposit panel** rendered in the hub's Deposit tab and reusable as a modal:- - Agent display name + avatar thumbnail for trust ("You're funding **Nova**").- - The Solana address shown in full + truncated, with a one-tap copy control- (toast on success).- - A crisp QR encoding a **Solana Pay-style `solana:<address>` URI** (with- `?label=<agentName>`), rendered via `src/erc8004/qr.js`. Tapping/clicking it on- mobile triggers the same `solana:` deep-link to open Phantom/Solflare/etc.- - A short, friendly "How to fund" line: scan with your phone wallet, or copy the- address and send SOL from any wallet/exchange.- - Optional amount field that updates the QR/deep-link `?amount=` (SOL).-2. **Live "funds received" feedback.** Reuse the existing poll- (`src/agent-solana-wallet.js`) to watch the balance; when it increases, show a- celebratory but professional confirmation ("◎0.50 SOL received") and refresh the- activity list. Before any deposit, show a calm "Waiting for your first deposit…"- empty state, not a blank.-3. **Wire into onboarding.** On the create-agent success screen- (`pages/create-agent.html` / `src/create-agent.js`), add a prominent- "Fund your agent" action that opens this deposit panel, so funding is the natural- first step after creation. Also reachable from the agent profile.-4. **Make it public-safe.** Visitors (not just owners) can view + use the deposit- panel — funding someone's agent is a feature. No secret, no management controls- for non-owners.--## Constraints--- First-party QR only (`src/erc8004/qr.js`); drop the QRious CDN dependency for this- surface. No external script for core funding UX.-- Real balance/activity from the live endpoints — never simulate a deposit or fake- the "received" event. The confirmation must fire only on a real on-chain balance- increase.-- `solana:` URI must be valid per Solana Pay (correct scheme, base58 address,- optional `amount`/`label`). Verify it opens a wallet on a real phone (or document- the exact tested URI if no device is available).-- Designed states: idle/waiting (empty), polling (subtle), received (success), RPC- error (retry, never blank). Mobile-first (the QR is scanned on a phone but shown on- desktop and vice-versa); 320/768/1440; ARIA labels on copy/QR; focus rings.--## Success Criteria--- `npm run dev`: open the deposit panel from both the create-agent success screen- and the agent profile; QR renders, copy works, the `solana:` deep-link is valid.-- On a devnet/testnet address, sending SOL makes the balance update live and the- "received" confirmation fire from real on-chain state (Network tab shows the real- balance poll).-- Empty/waiting, success, and RPC-error states all render and look premium.-- Zero console errors/warnings; no third-party CDN for the QR. `npm run typecheck` +- `npm test` clean.-- Changelog entry (tag: feature). Run the **completionist** subagent on changed files.--<!-- AUTO:self-delete-on-complete -->-------## ✅ On completion — delete this file--This file is a unit of work, not a permanent doc. The moment every item above is **built, wired, verified, and committed** to the "Definition of done" in the repo-root `CLAUDE.md`, remove it in the same change:--```bash-git rm "tasks/agent-wallet-trading/02-public-deposit-panel.md"-```--Stage the deletion alongside your implementation and include it in the completion commit. This directory is the backlog: a file that still exists is unfinished work; a file that is gone has shipped. Do not delete early, and never leave a completed prompt behind.diff --git a/tests/agent-wallet-deposit-tab.test.js b/tests/agent-wallet-deposit-tab.test.jsnew file mode 100644index 000000000..493cbc23b--- /dev/null+++ b/tests/agent-wallet-deposit-tab.test.js@@ -0,0 +1,190 @@+// @vitest-environment jsdom+//+// Agent Wallet hub — Deposit tab. Mounts the real tab against a mocked Solana+// wallet client and asserts the public-safe funding surface: the Solana-Pay QR ++// deep-link, copy control, optional amount that rewrites the URI, and the live+// "funds received" confirmation that fires ONLY on a real on-chain balance+// increase (never simulated).++import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';++const fetchAgentSolanaWallet = vi.fn();+const fetchAgentSolanaActivity = vi.fn();++vi.mock('../src/agent-solana-wallet.js', () => ({+ fetchAgentSolanaWallet: (...a) => fetchAgentSolanaWallet(...a),+ fetchAgentSolanaActivity: (...a) => fetchAgentSolanaActivity(...a),+}));++const { buildSolanaPayUri } = await import('../src/agent-wallet-hub/tabs/deposit.js');+const { getRegisteredTabs } = await import('../src/agent-wallet-hub/registry.js');+const depositTab = getRegisteredTabs().find((t) => t.id === 'deposit');++const ADDR = 'THREEsynthetic1111111111111111111111111111';++function makeCtx(overrides = {}) {+ return {+ agentId: 'agent-1',+ agent: { id: 'agent-1', name: 'Nova', solana_address: ADDR },+ isOwner: false,+ network: 'mainnet',+ getNetwork: () => 'mainnet',+ onNetworkChange: () => () => {},+ escapeHtml: (s) =>+ String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c]),+ shortAddress: (a, h = 4, t = 4) => (!a ? '' : a.length <= h + t + 1 ? a : `${a.slice(0, h)}…${a.slice(-t)}`),+ copyToClipboard: vi.fn(async () => true),+ toast: vi.fn(),+ openTab: vi.fn(),+ ...overrides,+ };+}++const tick = () => new Promise((r) => setTimeout(r, 0));++function mountTab(ctx = makeCtx()) {+ const panel = document.createElement('div');+ document.body.appendChild(panel);+ const inst = depositTab.mount({ panel, ctx });+ return { panel, inst, ctx };+}++beforeEach(() => {+ fetchAgentSolanaWallet.mockReset();+ fetchAgentSolanaActivity.mockReset();+ fetchAgentSolanaActivity.mockResolvedValue({ signatures: [] });+ document.body.innerHTML = '';+});++describe('buildSolanaPayUri', () => {+ it('builds a valid Solana-Pay URI with a label', () => {+ const uri = buildSolanaPayUri(ADDR, { label: 'Nova' });+ expect(uri).toBe(`solana:${ADDR}?label=Nova`);+ });+ it('includes a positive amount and omits a non-positive one', () => {+ expect(buildSolanaPayUri(ADDR, { amount: '0.5', label: 'Nova' })).toContain('amount=0.5');+ expect(buildSolanaPayUri(ADDR, { amount: '0', label: 'Nova' })).not.toContain('amount=');+ expect(buildSolanaPayUri(ADDR, { amount: 'abc' })).toBe(`solana:${ADDR}`);+ });+ it('returns null without an address', () => {+ expect(buildSolanaPayUri('')).toBeNull();+ });+});++describe('Deposit tab — public funding surface', () => {+ it('is a non-owner-visible tab', () => {+ expect(depositTab).toBeTruthy();+ expect(depositTab.ownerOnly).toBe(false);+ });++ it('renders the QR, address, copy control and who-you-are-funding header', async () => {+ fetchAgentSolanaWallet.mockResolvedValue({ status: 'ok', data: { address: ADDR, sol: 0 } });+ const { panel, inst } = mountTab();+ inst.onShow();+ await tick();++ expect(panel.textContent).toContain('Nova');+ expect(panel.textContent).toContain(ADDR);+ // First-party QR is inline SVG (no third-party CDN script).+ expect(panel.querySelector('a.awh-dep-qr svg')).toBeTruthy();+ // The QR/deep-link encode a valid solana: URI with the agent label.+ const href = panel.querySelector('a.awh-dep-qr')?.getAttribute('href');+ expect(href).toBe(`solana:${ADDR}?label=Nova`);+ expect(panel.querySelector('[data-act="copy"]')).toBeTruthy();+ inst.destroy();+ });++ it('shows the calm "waiting for your first deposit" state before any funds land', async () => {+ fetchAgentSolanaWallet.mockResolvedValue({ status: 'ok', data: { address: ADDR, sol: 0 } });+ const { panel, inst } = mountTab();+ inst.onShow();+ await tick();+ expect(panel.querySelector('.awh-dep-status[data-state="waiting"]')).toBeTruthy();+ expect(panel.textContent).toMatch(/Waiting for your first deposit/i);+ inst.destroy();+ });++ it('rewrites the deep-link with ?amount= when an amount is entered', async () => {+ vi.useFakeTimers();+ try {+ fetchAgentSolanaWallet.mockResolvedValue({ status: 'ok', data: { address: ADDR, sol: 0 } });+ const { panel, inst } = mountTab();+ inst.onShow();+ await vi.runOnlyPendingTimersAsync();++ const input = panel.querySelector('[data-input="amount"]');+ input.value = '0.25';+ input.dispatchEvent(new Event('input', { bubbles: true }));+ await vi.advanceTimersByTimeAsync(300);++ const href = panel.querySelector('a.awh-dep-qr')?.getAttribute('href');+ expect(href).toContain('amount=0.25');+ expect(panel.querySelector('[data-host="deeplink"]')?.getAttribute('href')).toContain('amount=0.25');+ inst.destroy();+ } finally {+ vi.useRealTimers();+ }+ });++ it('fires the "received" confirmation only on a real balance increase', async () => {+ vi.useFakeTimers();+ try {+ fetchAgentSolanaWallet.mockResolvedValueOnce({ status: 'ok', data: { address: ADDR, sol: 0 } });+ const ctx = makeCtx();+ const { panel, inst } = mountTab(ctx);+ inst.onShow();+ await vi.runOnlyPendingTimersAsync();+ // No deposit yet → still waiting, no toast.+ expect(ctx.toast).not.toHaveBeenCalled();++ // Next poll observes a real on-chain increase.+ fetchAgentSolanaWallet.mockResolvedValue({ status: 'ok', data: { address: ADDR, sol: 0.5 } });+ await vi.advanceTimersByTimeAsync(15_000);+ await vi.runOnlyPendingTimersAsync();++ expect(panel.querySelector('.awh-dep-status[data-state="received"]')).toBeTruthy();+ expect(panel.textContent).toMatch(/0\.5 SOL received/i);+ expect(ctx.toast).toHaveBeenCalledWith(expect.stringMatching(/0\.5 SOL received/i));+ inst.destroy();+ } finally {+ vi.useRealTimers();+ }+ });++ it('keeps the address + QR usable and shows a paused state when the RPC is unreachable', async () => {+ fetchAgentSolanaWallet.mockResolvedValue({ status: 'error', error: 'rpc down' });+ const { panel, inst } = mountTab();+ inst.onShow();+ await tick();+ // Address comes from the agent record, so funding still works.+ expect(panel.textContent).toContain(ADDR);+ expect(panel.querySelector('a.awh-dep-qr svg')).toBeTruthy();+ expect(panel.querySelector('.awh-dep-status[data-state="paused"]')).toBeTruthy();+ inst.destroy();+ });++ it('never throws or blanks the panel on an extreme agent name (QR stays scannable)', async () => {+ fetchAgentSolanaWallet.mockResolvedValue({ status: 'ok', data: { address: ADDR, sol: 0 } });+ const longName = '🚀'.repeat(300); // emoji → 4 bytes each, far past QR capacity+ const ctx = makeCtx({ agent: { id: 'agent-1', name: longName, solana_address: ADDR } });+ const { panel, inst } = mountTab(ctx);+ inst.onShow();+ await tick();+ // Address + a real QR still render; nothing threw out of render().+ expect(panel.textContent).toContain(ADDR);+ expect(panel.querySelector('a.awh-dep-qr svg')).toBeTruthy();+ const href = panel.querySelector('a.awh-dep-qr')?.getAttribute('href');+ expect(href?.startsWith(`solana:${ADDR}`)).toBe(true);+ inst.destroy();+ });++ it('shows the "wallet being prepared" state when no address exists anywhere', async () => {+ fetchAgentSolanaWallet.mockResolvedValue({ status: 'none' });+ const ctx = makeCtx({ agent: { id: 'agent-1', name: 'Nova' } });+ const { panel, inst } = mountTab(ctx);+ inst.onShow();+ await tick();+ expect(panel.textContent).toMatch(/still being prepared/i);+ inst.destroy();+ });+});