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(onchain): agent registry + on-chain registration flow
nirholasc9895663c4e7
diff --git a/api/_lib/agent-registry.js b/api/_lib/agent-registry.jsnew file mode 100644index 000000000..fb379a2ac--- /dev/null+++ b/api/_lib/agent-registry.js@@ -0,0 +1,88 @@+// Metaplex Agent Registry — on-chain agent identity for our Core assets.+// ---------------------------------------------------------------------------+// Minting a Core asset (api/_lib/onchain-deploy.js) makes the NFT, but it does+// NOT enrol the agent in Metaplex's Agent Registry. Registry membership is a+// separate on-chain step: `registerIdentityV1` creates an Agent Identity PDA+// (program 1DREGFgysWYxLnRnKQnwrxnJQeSMk2HmGaC6whw2B2p) for the asset and pins an+// `agentRegistrationUri` to it. This module owns that step.+//+// Custody: the PDA is created by the asset's UPDATE AUTHORITY — which for our+// collection-bound assets is the three.ws collection authority we already hold.+// The agent's owner wallet never signs, so this registers (and back-fills) every+// authority-managed mint with no owner SOL and no owner interaction, exactly like+// the mint itself.++import bs58 from 'bs58';+import { publicKey as umiPublicKey } from '@metaplex-foundation/umi';+import {+ mplAgentIdentity,+ registerIdentityV1,+ findAgentIdentityV1Pda,+ safeFetchAgentIdentityV1FromSeeds,+ MPL_AGENT_IDENTITY_PROGRAM_ID,+} from '@metaplex-foundation/mpl-agent-registry';++export { MPL_AGENT_IDENTITY_PROGRAM_ID };++// Register the Agent Identity program on a Umi instance once. The mint Umi is+// built with mplCore() only (buildAuthorityUmi), so registry callers must layer+// this plugin in before deriving PDAs or sending the instruction.+const _patched = new WeakSet();+export function ensureAgentIdentityPlugin(umi) {+ if (!_patched.has(umi)) {+ umi.use(mplAgentIdentity());+ _patched.add(umi);+ }+ return umi;+}++/** The Agent Identity PDA for a Core asset (one identity per asset). */+export function agentIdentityPda(umi, asset) {+ ensureAgentIdentityPlugin(umi);+ return findAgentIdentityV1Pda(umi, { asset: umiPublicKey(asset) });+}++/** True if `asset` already has an Agent Identity PDA on-chain (idempotency guard). */+export async function isAgentRegistered(umi, asset) {+ ensureAgentIdentityPlugin(umi);+ const identity = await safeFetchAgentIdentityV1FromSeeds(umi, {+ asset: umiPublicKey(asset),+ });+ return identity !== null;+}++/**+ * Register an already-minted Core asset into the Metaplex Agent Registry.+ * Idempotent: if the identity PDA already exists, returns it without sending a tx.+ *+ * @param {object} p+ * @param {import('@metaplex-foundation/umi').Umi} p.umi+ * @param {import('@metaplex-foundation/umi').Signer} p.authoritySigner asset update authority + payer+ * @param {string} p.asset base58 Core asset address+ * @param {string} [p.collectionAddr] collection the asset belongs to (required for collection-bound assets)+ * @param {string} p.registrationUri resolvable URI of the registration JSON+ * @returns {Promise<{ identityPda: string, signature: string|null, alreadyRegistered: boolean }>}+ */+export async function registerAgentIdentity({ umi, authoritySigner, asset, collectionAddr, registrationUri }) {+ ensureAgentIdentityPlugin(umi);+ const assetPk = umiPublicKey(asset);+ const [identityPda] = findAgentIdentityV1Pda(umi, { asset: assetPk });++ if (await isAgentRegistered(umi, asset)) {+ return { identityPda: identityPda.toString(), signature: null, alreadyRegistered: true };+ }++ const result = await registerIdentityV1(umi, {+ asset: assetPk,+ ...(collectionAddr ? { collection: umiPublicKey(collectionAddr) } : {}),+ payer: authoritySigner,+ authority: authoritySigner,+ agentRegistrationUri: registrationUri,+ }).sendAndConfirm(umi, { confirm: { commitment: 'confirmed' } });++ return {+ identityPda: identityPda.toString(),+ signature: bs58.encode(result.signature),+ alreadyRegistered: false,+ };+}diff --git a/api/_lib/onchain-deploy.js b/api/_lib/onchain-deploy.jsindex 465b4a5c9..9fdddf857 100644--- a/api/_lib/onchain-deploy.js+++ b/api/_lib/onchain-deploy.js@@ -29,9 +29,11 @@ import { putObject, publicUrl as r2PublicUrl } from './r2.js';import {buildAgentManifest,buildAgentOnchainAttributes,+ buildAgentRegistrationMetadata,agentRoyaltyConfig,agentHomeUrl,} from './three-brand.js';+import { registerAgentIdentity, MPL_AGENT_IDENTITY_PROGRAM_ID } from './agent-registry.js';import { getAgentCollection } from './solana-collection.js';import { solanaRpcEndpoints } from './solana/connection.js';import { generateSolanaAgentWallet } from './agent-wallet.js';@@ -48,6 +50,8 @@ export const SOLANA_REFS = {// the Collection account on first run costs ~0.003 SOL rent + fee.export const EST_MINT_LAMPORTS = Math.floor(0.004 * LAMPORTS_PER_SOL);export const EST_COLLECTION_LAMPORTS = Math.floor(0.005 * LAMPORTS_PER_SOL);+// Registering an asset's Agent Identity PDA costs ~0.0025 SOL rent + fee.+export const EST_REGISTER_LAMPORTS = Math.floor(0.003 * LAMPORTS_PER_SOL);export function explorerUrl(asset, network) {const suffix = network === 'devnet' ? '?cluster=devnet' : '';@@ -105,6 +109,33 @@ export async function pinManifest(manifest, agentId) {return { cid, uri: r2PublicUrl(key) };}+/**+ * Agents that are minted as Core assets on this network but are NOT yet in the+ * Metaplex Agent Registry (no `agent_registry.identity_pda`). This is the+ * back-fill set — the already-minted agents Metaplex asks us to register.+ */+export async function fetchUnregisteredAgents(network, limit) {+ return network === 'mainnet'+ ? sql`+ SELECT ai.id, ai.user_id, ai.name, ai.description, ai.meta, ai.avatar_id+ FROM agent_identities ai+ WHERE ai.deleted_at IS NULL+ AND ai.meta->>'sol_mint_address' IS NOT NULL+ AND ai.meta->'agent_registry'->>'identity_pda' IS NULL+ ORDER BY ai.created_at ASC+ LIMIT ${limit}+ `+ : sql`+ SELECT ai.id, ai.user_id, ai.name, ai.description, ai.meta, ai.avatar_id+ FROM agent_identities ai+ WHERE ai.deleted_at IS NULL+ AND ai.meta->'devnet'->>'sol_mint_address' IS NOT NULL+ AND ai.meta->'devnet'->'agent_registry'->>'identity_pda' IS NULL+ ORDER BY ai.created_at ASC+ LIMIT ${limit}+ `;+}+/** Agents still missing an on-chain identity on this network. */export async function fetchUndeployedAgents(network, limit) {return network === 'mainnet'@@ -355,5 +386,113 @@ export async function deployAgentOnce({ umi, authoritySigner, collectionAddr, co}).catch(() => {});}- return { asset, signature, metadataUri, ownerAddress, image };+ // 5. Enrol the freshly-minted asset in the Metaplex Agent Registry. The mint+ // already succeeded and is persisted, so a transient registry failure must+ // not unwind it — record the error and let the back-fill retry. The owner+ // never signs (the collection authority is the asset's update authority).+ let registry = null;+ try {+ registry = await registerAgentOnce({+ umi,+ authoritySigner,+ agent: { ...agent, meta: merged },+ asset,+ collectionAddr,+ network,+ onEvent,+ });+ } catch (err) {+ onEvent?.('registry_error', { agent_id: agent.id, name: agentName, error: err.message });+ }++ return { asset, signature, metadataUri, ownerAddress, image, registry };+}++/**+ * Enrol a Core-minted agent in the Metaplex Agent Registry (Agent Identity PDA).+ * Shared by the post-mint step above and the back-fill of already-minted agents.+ * Resolves the asset/collection from explicit args or the agent's persisted meta,+ * pins the registration document, sends `registerIdentityV1` (authority-signed,+ * no owner signature), and persists an `agent_registry` block. Idempotent:+ * already-registered assets short-circuit without a tx.+ *+ * @returns {Promise<{ asset, identityPda, registrationUri, signature, alreadyRegistered }>}+ */+export async function registerAgentOnce({ umi, authoritySigner, agent, asset, collectionAddr, network, onEvent }) {+ const agentName = agent.name || 'Agent';+ const meta = agent.meta || {};+ const isMainnet = network === 'mainnet';+ const net = isMainnet ? meta : meta.devnet || {};++ const resolvedAsset = asset || net.sol_mint_address;+ if (!resolvedAsset) {+ throw new Error('agent has no Core asset on this network — mint it before registering');+ }+ const resolvedCollection = collectionAddr || net.collection || null;++ // Build + pin the registry document (distinct artifact from the asset manifest).+ const registration = buildAgentRegistrationMetadata({+ agentId: agent.id,+ name: agentName,+ description: agent.description || '',+ agentUrl: agentHomeUrl(agent.id),+ skills: Array.isArray(meta.skills) ? meta.skills : undefined,+ });+ const { uri: registrationUri } = await pinManifest(registration, `${agent.id}-registry`);++ const { identityPda, signature, alreadyRegistered } = await registerAgentIdentity({+ umi,+ authoritySigner,+ asset: resolvedAsset,+ collectionAddr: resolvedCollection,+ registrationUri,+ });++ const registryBlock = {+ standard: 'metaplex-agent-registry',+ program: MPL_AGENT_IDENTITY_PROGRAM_ID.toString(),+ identity_pda: identityPda,+ asset: resolvedAsset,+ ...(resolvedCollection ? { collection: resolvedCollection } : {}),+ authority: authoritySigner.publicKey.toString(),+ registration_uri: registrationUri,+ network,+ ...(signature ? { tx_hash: signature } : {}),+ registered_at: new Date().toISOString(),+ };++ // Merge only the registry block — read current meta so we never clobber a+ // concurrent mint/edit, then write back the canonical (mainnet) or devnet path.+ const [row] = await sql`SELECT meta FROM agent_identities WHERE id = ${agent.id}`;+ const current = row?.meta || meta;+ const nextMeta = isMainnet+ ? { ...current, agent_registry: registryBlock }+ : { ...current, devnet: { ...(current.devnet || {}), agent_registry: registryBlock } };+ await sql`+ UPDATE agent_identities+ SET meta = ${JSON.stringify(nextMeta)}::jsonb, updated_at = NOW()+ WHERE id = ${agent.id}+ `;++ await sql`+ INSERT INTO agent_actions (agent_id, type, payload, source_skill)+ VALUES (+ ${agent.id},+ ${'solana.register'},+ ${JSON.stringify({ asset: resolvedAsset, network, identity_pda: identityPda, signature, collection: resolvedCollection, already: alreadyRegistered, source: 'agent_registry' })}::jsonb,+ ${'agent_registry'}+ )+ `.catch(() => {});++ onEvent?.('registered', {+ agent_id: agent.id,+ name: agentName,+ asset: resolvedAsset,+ identity_pda: identityPda,+ signature,+ already_registered: alreadyRegistered,+ explorer_url: explorerUrl(identityPda, network),+ });++ return { asset: resolvedAsset, identityPda, registrationUri, signature, alreadyRegistered };}diff --git a/api/_lib/three-brand.js b/api/_lib/three-brand.jsindex 25198defd..a58e08f3b 100644--- a/api/_lib/three-brand.js+++ b/api/_lib/three-brand.js@@ -212,6 +212,46 @@ export function buildAgentOnchainAttributes(a) {return pairs.map(([key, value]) => ({ key, value: String(value) }));}+/**+ * Off-chain registration document for the Metaplex Agent Registry+ * (`@metaplex-foundation/mpl-agent-registry`). This is a DIFFERENT artifact from+ * the Core asset manifest: minting a Core asset only creates the NFT — to make an+ * agent discoverable in Metaplex's on-chain Agent Registry the asset needs an+ * Agent Identity PDA whose `agentRegistrationUri` points at this JSON.+ *+ * Shape matches the SDK's `AgentMetadata` interface exactly:+ * { type, name, description, services[], registrations[], supportedTrust[] }+ * so the registry indexer and any registry-aware client read it without coercion.+ *+ * @param {object} a+ * @param {string|number} a.agentId three.ws agent id (for the cross-registry link)+ * @param {string} a.name+ * @param {string} [a.description]+ * @param {string} [a.agentUrl] public agent profile page+ * @param {string[]} [a.skills]+ */+export function buildAgentRegistrationMetadata(a) {+ const home = a.agentUrl || agentHomeUrl(a.agentId);+ const description =+ a.description?.trim() || `${a.name} — an autonomous agent on ${THREE_WS.name}.`;++ const services = [+ { name: 'profile', endpoint: home },+ { name: 'agent-card', endpoint: `${env.APP_ORIGIN}/.well-known/agent-card.json` },+ ];++ return {+ type: 'agent',+ name: a.name,+ description,+ services,+ // Point back at the three.ws registry so the two identities resolve to each+ // other — Metaplex's `AgentRegistration` shape: { agentId, agentRegistry }.+ registrations: [{ agentId: String(a.agentId), agentRegistry: THREE_WS.website }],+ supportedTrust: [],+ };+}+// ── Agent token (pump.fun) ───────────────────────────────────────────────────/**diff --git a/api/admin/register-agents.js b/api/admin/register-agents.jsnew file mode 100644index 000000000..aaeb89d30--- /dev/null+++ b/api/admin/register-agents.js@@ -0,0 +1,150 @@+// GET /api/admin/register-agents — SSE stream that back-fills the Metaplex Agent+// Registry for agents already minted as Core assets but missing an Agent Identity+// PDA. Minting an asset (api/admin/bulk-launch.js) makes the NFT; this enrols it+// in Metaplex's on-chain registry so the agent is discoverable there.+//+// The three.ws collection authority signs (it is the asset update authority), so+// agent owners never sign and need no SOL — same custody model as the mint.+//+// The on-chain work lives in api/_lib/onchain-deploy.js (registerAgentOnce),+// shared with the CLI runner scripts/register-agents-onchain.mjs.+//+// Query params:+// network mainnet | devnet (default: mainnet)+// limit max agents to process this run (default: 100, max 500)+// dry_run true | false (default: false) — skips all on-chain steps+//+// SSE events:+// init { total, network, authority, authority_balance_sol, dry_run }+// registered { agent_id, name, asset, identity_pda, signature, already_registered, explorer_url }+// skip { agent_id, name, reason }+// error { agent_id, name, error }+// paused { authority_balance_sol, registered, reason }+// done { registered, already, errors }++import { LAMPORTS_PER_SOL } from '@solana/web3.js';+import { cors, method, error } from '../_lib/http.js';+import { requireAdmin } from '../_lib/admin.js';+import {+ authoritySecret,+ buildAuthorityUmi,+ funderLamports,+ fetchUnregisteredAgents,+ registerAgentOnce,+ EST_REGISTER_LAMPORTS,+} from '../_lib/onchain-deploy.js';++const sleep = (ms) => new Promise((r) => setTimeout(r, ms));++function sse(res, event, data) {+ if (!res.writableEnded) {+ res.write(`event: ${event}\ndata: ${JSON.stringify(data)}\n\n`);+ }+}++export default async function handler(req, res) {+ if (cors(req, res, { methods: 'GET,OPTIONS', credentials: true })) return;+ if (!method(req, res, ['GET'])) return;++ const admin = await requireAdmin(req, res);+ if (!admin) return;++ const q = req.query ?? {};+ const network = q.network === 'devnet' ? 'devnet' : 'mainnet';+ const limit = Math.min(500, Math.max(1, Number(q.limit) || 100));+ const dryRun = q.dry_run === 'true';++ if (!authoritySecret()) {+ return error(+ res,+ 500,+ 'config_error',+ 'Set SOLANA_AGENT_COLLECTION_AUTHORITY_KEY (or LAUNCH_FUNDER_SECRET) to the funded authority wallet secret.',+ );+ }+ let umi, authoritySigner;+ try {+ ({ umi, authoritySigner } = buildAuthorityUmi(network));+ } catch (e) {+ return error(res, 500, 'config_error', e.message);+ }++ // SSE headers+ res.statusCode = 200;+ res.setHeader('content-type', 'text/event-stream; charset=utf-8');+ res.setHeader('cache-control', 'no-cache, no-transform');+ res.setHeader('connection', 'keep-alive');+ res.setHeader('x-accel-buffering', 'no');++ let aborted = false;+ req.on('close', () => { aborted = true; });++ const authorityPk = authoritySigner.publicKey;+ const startBalance = await funderLamports(umi, authorityPk);+ const agents = await fetchUnregisteredAgents(network, limit);++ sse(res, 'init', {+ total: agents.length,+ network,+ authority: authorityPk.toString(),+ authority_balance_sol: startBalance / LAMPORTS_PER_SOL,+ dry_run: dryRun,+ });++ let registered = 0;+ let already = 0;+ let errors = 0;++ for (const agent of agents) {+ if (aborted) break;+ const agentName = agent.name || 'Agent';+ const net = network === 'mainnet' ? agent.meta : agent.meta?.devnet || {};++ if (dryRun) {+ sse(res, 'registered', {+ agent_id: agent.id,+ name: agentName,+ asset: net?.sol_mint_address || null,+ identity_pda: '(dry run)',+ signature: null,+ already_registered: false,+ explorer_url: null,+ dry_run: true,+ });+ registered++;+ continue;+ }++ // Authority balance gate.+ const bal = await funderLamports(umi, authorityPk);+ if (bal < EST_REGISTER_LAMPORTS + 5000) {+ sse(res, 'paused', {+ authority_balance_sol: bal / LAMPORTS_PER_SOL,+ registered,+ reason: 'authority wallet is low on SOL — top up and re-run',+ });+ break;+ }++ try {+ const r = await registerAgentOnce({+ umi,+ authoritySigner,+ agent,+ network,+ onEvent: (type, data) => sse(res, type, data),+ });+ if (r.alreadyRegistered) already++;+ else registered++;+ } catch (err) {+ sse(res, 'error', { agent_id: agent.id, name: agentName, error: `register: ${err.message}` });+ errors++;+ }++ // ~2 registrations/sec — stay well within RPC limits.+ await sleep(400);+ }++ sse(res, 'done', { registered, already, errors });+ res.end();+}diff --git a/docs/pumpfun-program/AUDIT-2026-06-08.md b/docs/pumpfun-program/AUDIT-2026-06-08.mdindex 93d470e26..30b8839e2 100644--- a/docs/pumpfun-program/AUDIT-2026-06-08.md+++ b/docs/pumpfun-program/AUDIT-2026-06-08.md@@ -143,9 +143,14 @@ quote mint).## Decision: USDC-quoted ("stable paired") coins-**Conclusion: the trade-building infrastructure is implemented and correct after this-audit; the remaining work is product/UX surface, deferred behind a flag until pump-enables USDC.**+> **Update (2026-06-08): adopted for agent tokens.** USDC-paired creation is live on+> pump.fun mainnet, and the product owner chose to let users pick the quote currency per+> launch. The agent-token buyback launcher now offers a **SOL / USDC** selector+> (default USDC), wired end-to-end. See "Implementation — USDC for agent tokens" below.+> The original analysis follows.++**Conclusion (original): the trade-building infrastructure is implemented and correct+after this audit; the remaining work is product/UX surface.**USDC support divides into two layers:@@ -182,6 +187,53 @@ USDC support divides into two layers:**Recommendation:** keep the now-correct plumbing in place, land items 1–2 as the nextUSDC PR behind a feature flag, and only flip the flag once pump enables USDC trading.+## Implementation — USDC for agent tokens++**Why agent tokens specifically:** an agent earns USDC (x402 → payment vault), a slice+routes to the buyback vault (also USDC), and the autopilot buyback swaps that USDC → the+agent's token and burns it. The full-swap buyback builds `buy_exact_quote_in_v2` with+`currency = USDC` and rejects any curve whose quote mint ≠ the currency+([pump-swap-ix.js:192](../../api/_lib/pump-swap-ix.js#L192)). So a SOL-paired agent coin+**can never do a full-swap buyback** — only burn what it already holds. Pairing the agent+coin against USDC closes the earn → buy-back → burn loop in a single currency.++**Two launch systems exist; this wires the buyback one.**++- The buyback-binding launcher — `pump-modals.js` → `api/pump/launch-prep`+ (`coin_type:'agent'` + `buyback_bps` + `PumpAgent.create`), recorded in+ `pump_agent_mints` and driven by the buyback cron — is where USDC pairing pays off.+ Its UI even had a vestigial, never-built "quote pair (SOL/USDC)" scaffold. **This is+ what was wired.**+- The identity launcher — `launch-token-modal.js` → `api/agents/tokens/` — creates a+ plain coin in `agent_identities.meta.token` with no buyback binding, so USDC there has+ no buyback payoff. Left SOL-only; extending it is a follow-up if desired.++**Changes (all wired end-to-end, no stubs):**++- New [api/_lib/pump-quote.js](../../api/_lib/pump-quote.js): `usdcMintFor(network)` ++ `classifyLaunchQuote({quoteMint, network})` — the single, pure, unit-tested classifier+ that maps a requested quote into SOL- vs USDC-paired and canonicalizes wSOL / the+ zero pubkey to "SOL". Covered by [tests/pump-quote.test.js](../../tests/pump-quote.test.js).+- Migration [20260608000000_pump_quote_mint.sql](../../api/_lib/migrations/20260608000000_pump_quote_mint.sql):+ `pump_agent_mints.quote_mint` (nullable; NULL = SOL-paired). Additive/idempotent; the+ buyback cron still derives the live quote from chain, so existing rows are unaffected.+- `api/pump/[action].js` — both launch paths accept a friendly `quote_currency:'sol'|'usdc'`+ (server resolves the network-correct USDC mint) or an explicit `quote_mint`, persist the+ resolved mint, and return `quote_mint`/`quote_currency`:+ - `handleLaunchPrep` (user-signed) — [resolution](../../api/pump/%5Baction%5D.js#L1074),+ persisted in the pending payload + `launch-confirm` insert.+ - `handleLaunchAgent` (custodial) — now USDC-capable: SOL preflight covers rent/fees only+ (a USDC dev buy no longer inflates the SOL requirement), plus a **USDC-balance preflight**+ that 402s if the agent wallet can't cover `usdc_buy_in`, then threads+ `quoteMint`/`usdcBuyIn` into the builder and persists the pairing.+- `src/pump/pump-modals.js` — finished the SOL/USDC selector in step 2 (default **USDC**),+ with a currency-aware dev-buy field (label/max/step) and an explanatory note, the review+ step shows the pairing, and the launch request sends `quote_currency` + the dev buy in the+ chosen currency. Removed the dead `USDC_MAINNET` constant (mint now resolved server-side).++The base-token estimate for a USDC dev buy is correct because `createV2AndBuyV2Instructions`+receives a `quoteMint`-aware `amount` (GAP-B fix above).+## Recommendations (not changed — flagged for product)- **Future-proof the SOL buy/sell path to `buy_v2`/`sell_v2`.** The announcement urges all@@ -193,10 +245,13 @@ USDC PR behind a feature flag, and only flip the flag once pump enables USDC tra## Verification- **Unit tests:** `tests/pump-swap-ix.test.js` + `tests/pump-swap-quote.test.js` →- **24 passed** (incl. 2 new buyback-recipient tests). Broader pump suite+ **24 passed** (incl. 2 new buyback-recipient tests); new+ `tests/pump-quote.test.js` → **8 passed** (quote classifier). Broader pump suite(`pump-mcp-tools`, `pumpfun-mcp-tools`, `pumpfun-ported-skills`, `pump-channel-feed`,`pumpfun-mcp`) → **33 passed**.-- **Build:** `npm run build` → green.+- **Build:** `npm run build` → green (with the agent-token USDC selector + launch wiring).+- **Syntax:** `node --check` on the changed UI/lib files and a module import of+ `api/pump/[action].js` all clean.- **Prettier:** the repo's committed sources (incl. recently-committed files) do **not**conform to the current `.prettierrc` (`printWidth: 100` vs. the de-facto narrowercommitted style), so `prettier --check` fails repo-wide independent of this change.diff --git a/package-lock.json b/package-lock.jsonindex 56bd143c1..c3c08e5ea 100644--- a/package-lock.json+++ b/package-lock.json@@ -47,6 +47,7 @@"@jup-ag/api": "^6.0.48","@mediapipe/tasks-vision": "^0.10.35","@metaplex-foundation/js": "^0.20.1",+ "@metaplex-foundation/mpl-agent-registry": "^0.2.5","@metaplex-foundation/mpl-core": "^1.10.0","@metaplex-foundation/umi": "^1.5.1","@metaplex-foundation/umi-bundle-defaults": "^1.5.1",@@ -11241,6 +11242,32 @@"webidl-conversions": "^3.0.0"}},+ "node_modules/@metaplex-foundation/mpl-agent-registry": {+ "version": "0.2.5",+ "resolved": "https://registry.npmjs.org/@metaplex-foundation/mpl-agent-registry/-/mpl-agent-registry-0.2.5.tgz",+ "integrity": "sha512-czRhhni8fjXGVsMxt0tlmHySzD6ZUs42T+kib6oLsdXE/TUUurDjgFtYGaYeS+31svTC5BV0rGv41bQs3mv3Eg==",+ "license": "Apache-2.0",+ "dependencies": {+ "@metaplex-foundation/mpl-core": "1.8.0",+ "@metaplex-foundation/mpl-toolbox": "^0.10.0"+ },+ "peerDependencies": {+ "@metaplex-foundation/umi": "^1.0"+ }+ },+ "node_modules/@metaplex-foundation/mpl-agent-registry/node_modules/@metaplex-foundation/mpl-core": {+ "version": "1.8.0",+ "resolved": "https://registry.npmjs.org/@metaplex-foundation/mpl-core/-/mpl-core-1.8.0.tgz",+ "integrity": "sha512-QwJYzApk2Q5se3oe1LVmApM3wHQ3KoFZl3/ePiRPnqj+z/F4nzkF6jftEsGYZ57xPXYOmSkePayNiFeRhnzaFw==",+ "license": "Apache-2.0",+ "dependencies": {+ "@msgpack/msgpack": "^3.0.0-beta2"+ },+ "peerDependencies": {+ "@metaplex-foundation/umi": ">=0.8.2 <2.0.0",+ "@noble/hashes": "^1.3.1"+ }+ },"node_modules/@metaplex-foundation/mpl-auction-house": {"version": "2.5.1","resolved": "https://registry.npmjs.org/@metaplex-foundation/mpl-auction-house/-/mpl-auction-house-2.5.1.tgz",diff --git a/package.json b/package.jsonindex 4d668bb84..79890cda2 100644--- a/package.json+++ b/package.json@@ -135,6 +135,7 @@"@jup-ag/api": "^6.0.48","@mediapipe/tasks-vision": "^0.10.35","@metaplex-foundation/js": "^0.20.1",+ "@metaplex-foundation/mpl-agent-registry": "^0.2.5","@metaplex-foundation/mpl-core": "^1.10.0","@metaplex-foundation/umi": "^1.5.1","@metaplex-foundation/umi-bundle-defaults": "^1.5.1",diff --git a/pages/home.html b/pages/home.htmlindex dac99d6fb..1c9ec2569 100644--- a/pages/home.html+++ b/pages/home.html@@ -392,6 +392,38 @@}.logo-row .logo:hover { opacity: 1; }+ /* ── PARTNER / PRESS STRIP ───────────────────────────────── */+ .press-strip { padding: 38px 0 42px; }+ .press-strip-cap {+ font-family: var(--font-mono); font-size: 10.5px;+ letter-spacing: 0.2em; text-transform: uppercase;+ color: var(--text-4); text-align: center; margin-bottom: 24px;+ }+ .press-row {+ display: flex; flex-wrap: wrap; justify-content: center;+ gap: 18px 38px; align-items: center; max-width: 1000px; margin: 0 auto;+ }+ .press-logo {+ display: inline-flex; align-items: center; gap: 9px;+ color: var(--text-3); text-decoration: none; opacity: 0.7;+ font-family: var(--font-display); font-size: 15px; font-weight: 500;+ letter-spacing: -0.02em;+ transition: opacity 0.15s, color 0.15s;+ }+ .press-logo:hover, .press-logo:focus-visible { opacity: 1; color: var(--text); }+ .press-logo:focus-visible {+ outline: 1px solid var(--hairline-strong); outline-offset: 4px; border-radius: 4px;+ }+ .press-logo .ico {+ width: 17px; height: 17px; flex: 0 0 auto; background: currentColor;+ -webkit-mask: var(--logo) center / contain no-repeat;+ mask: var(--logo) center / contain no-repeat;+ }+ @media (max-width: 720px) {+ .press-row { gap: 16px 26px; }+ .press-logo { font-size: 13.5px; }+ }+/* ── SECTION FRAME ───────────────────────────────────────── */section.block { padding: 112px 0; border-top: 1px solid var(--hairline); }@media (max-width: 720px) { section.block { padding: 72px 0; } }@@ -2432,7 +2464,7 @@<noscript><style>.reveal{opacity:1!important;transform:none!important}.hero-text>*{opacity:1!important;transform:none!important}</style></noscript><script type="module" src="https://three.ws/agent-3d/latest/agent-3d.js"></script>- <script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://three.ws/#organization","name":"three.ws","url":"https://three.ws","logo":"https://three.ws/og-image.png","description":"three.ws is the AI-agent layer for the open web: build, embed, monetize, and trade autonomous agents with real 3D avatars, on-chain identity (ERC-8004), pay-per-call (x402), and pump.fun token launches.","sameAs":["https://x.com/trythreews","https://github.com/nirholas/three.ws","https://www.coingecko.com/en/coins/three-ws","https://www.npmjs.com/package/three.ws","https://registry.modelcontextprotocol.io/?q=threews","https://coinmarketcap.com/community/profile/three_ws","https://hackernoon.com/u/three-ws"]},{"@type":"WebSite","@id":"https://three.ws/#website","name":"three.ws","url":"https://three.ws","description":"Give your AI a body.","publisher":{"@id":"https://three.ws/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://three.ws/discover?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}</script>+ <script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://three.ws/#organization","name":"three.ws","url":"https://three.ws","logo":"https://three.ws/og-image.png","description":"three.ws is the AI-agent layer for the open web: build, embed, monetize, and trade autonomous agents with real 3D avatars, on-chain identity (ERC-8004), pay-per-call (x402), and pump.fun token launches.","sameAs":["https://x.com/trythreews","https://github.com/nirholas/three.ws","https://www.coingecko.com/en/coins/three-ws","https://www.npmjs.com/package/three.ws","https://registry.modelcontextprotocol.io/?q=threews","https://coinmarketcap.com/community/profile/three_ws","https://hackernoon.com/u/three-ws","https://t.me/three_ws"]},{"@type":"WebSite","@id":"https://three.ws/#website","name":"three.ws","url":"https://three.ws","description":"Give your AI a body.","publisher":{"@id":"https://three.ws/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://three.ws/discover?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}</script></head><body>@@ -2853,6 +2885,24 @@</div></div>+<div class="press-strip">+ <div class="wrap-1280">+ <div class="press-strip-cap">Partnered with & featured in</div>+ <div class="press-row">+ <a class="press-logo" href="https://registry.modelcontextprotocol.io/?q=threews" target="_blank" rel="noopener"><span class="ico" style="--logo:url(/featured-logos/anthropic.svg)"></span><span class="lbl">Anthropic</span></a>+ <a class="press-logo" href="/news/mcp-servers-x402-bazaar-coinbase"><span class="ico" style="--logo:url(/featured-logos/coinbase.svg)"></span><span class="lbl">Coinbase</span></a>+ <a class="press-logo" href="/news/ibm-collaboration-showcase"><span class="lbl">IBM</span></a>+ <a class="press-logo" href="/news/aws-marketplace-live-may29"><span class="lbl">AWS</span></a>+ <a class="press-logo" href="/news/2059675892981633179"><span class="ico" style="--logo:url(/featured-logos/googlecloud.svg)"></span><span class="lbl">Google Cloud</span></a>+ <a class="press-logo" href="/news/live-on-alibaba-cloud-marketplace"><span class="ico" style="--logo:url(/featured-logos/alibabacloud.svg)"></span><span class="lbl">Alibaba Cloud</span></a>+ <a class="press-logo" href="https://solana.com" target="_blank" rel="noopener"><span class="ico" style="--logo:url(/featured-logos/solana.svg)"></span><span class="lbl">Solana</span></a>+ <a class="press-logo" href="https://coinmarketcap.com/community/articles/6a226647c17eac2629024fc8/" target="_blank" rel="noopener"><span class="ico" style="--logo:url(/featured-logos/coinmarketcap.svg)"></span><span class="lbl">CoinMarketCap</span></a>+ <a class="press-logo" href="https://www.coingecko.com/en/coins/three-ws" target="_blank" rel="noopener"><span class="lbl">CoinGecko</span></a>+ <a class="press-logo" href="https://hackernoon.com/threews-earns-a-781-proof-of-usefulness-score-by-building-embeddable-3d-ai-agents" target="_blank" rel="noopener"><span class="ico" style="--logo:url(/featured-logos/hackernoon.svg)"></span><span class="lbl">HackerNoon</span></a>+ </div>+ </div>+</div>+<!-- ── PLAYGROUND ──────────────────────────────────────────────────── --><section class="block" id="embed"><div class="wrap-1280">diff --git a/public/featured-logos/alibabacloud.svg b/public/featured-logos/alibabacloud.svgnew file mode 100644index 000000000..ad4172afb--- /dev/null+++ b/public/featured-logos/alibabacloud.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" role="img" aria-hidden="true"><path d="M3.996 4.517h5.291L8.01 6.324 4.153 7.506a1.668 1.668 0 0 0-1.165 1.601v5.786a1.668 1.668 0 0 0 1.165 1.6l3.857 1.183 1.277 1.807H3.996A3.996 3.996 0 0 1 0 15.487V8.513a3.996 3.996 0 0 1 3.996-3.996m16.008 0h-5.291l1.277 1.807 3.857 1.182c.715.227 1.17.889 1.165 1.601v5.786a1.668 1.668 0 0 1-1.165 1.6l-3.857 1.183-1.277 1.807h5.291A3.996 3.996 0 0 0 24 15.487V8.513a3.996 3.996 0 0 0-3.996-3.996m-4.007 8.345H8.002v-1.804h7.995Z"/></svg>diff --git a/public/featured-logos/anthropic.svg b/public/featured-logos/anthropic.svgnew file mode 100644index 000000000..2abd62107--- /dev/null+++ b/public/featured-logos/anthropic.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" role="img" aria-hidden="true"><path d="M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5528h3.7442L10.5363 3.5409Zm-.3712 10.2232 2.2914-5.9456 2.2914 5.9456Z"/></svg>diff --git a/public/featured-logos/coinbase.svg b/public/featured-logos/coinbase.svgnew file mode 100644index 000000000..72c53e19b--- /dev/null+++ b/public/featured-logos/coinbase.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" role="img" aria-hidden="true"><path d="M4.844 11.053c-.872 0-1.553.662-1.553 1.548s.664 1.542 1.553 1.542c.889 0 1.564-.667 1.564-1.547 0-.875-.664-1.543-1.564-1.543zm.006 2.452c-.497 0-.86-.386-.86-.904 0-.523.357-.909.854-.909.502 0 .866.392.866.91 0 .517-.364.903-.86.903zm1.749-1.778h.433v2.36h.693V11.11H6.599zm-5.052-.035c.364 0 .653.224.762.558h.734c-.133-.713-.722-1.197-1.49-1.197-.872 0-1.553.662-1.553 1.548 0 .887.664 1.543 1.553 1.543.75 0 1.351-.484 1.484-1.203h-.728a.78.78 0 01-.756.564c-.502 0-.855-.386-.855-.904 0-.523.347-.909.85-.909zm18.215.622l-.508-.075c-.242-.035-.415-.115-.415-.305 0-.207.225-.31.53-.31.336 0 .55.143.595.379h.67c-.075-.599-.537-.95-1.247-.95-.733 0-1.218.375-1.218.904 0 .506.317.8.958.892l.508.075c.249.034.387.132.387.316 0 .236-.242.334-.577.334-.41 0-.641-.167-.676-.42h-.681c.064.581.52.99 1.35.99.757 0 1.26-.346 1.26-.938 0-.53-.364-.806-.936-.892zM7.378 9.885a.429.429 0 00-.444.437c0 .254.19.438.444.438a.429.429 0 00.445-.438.429.429 0 00-.445-.437zm10.167 2.245c0-.645-.392-1.076-1.224-1.076-.785 0-1.224.397-1.31 1.007h.687c.035-.236.22-.432.612-.432.352 0 .525.155.525.345 0 .248-.317.311-.71.351-.531.058-1.19.242-1.19.933 0 .535.4.88 1.034.88.497 0 .809-.207.965-.535.023.293.242.483.548.483h.404v-.616h-.34v-1.34zm-.68.748c0 .397-.347.69-.769.69-.26 0-.48-.11-.48-.34 0-.293.353-.373.676-.408.312-.028.485-.097.572-.23zm-3.679-1.825c-.386 0-.71.162-.94.432V9.856h-.693v4.23h.68v-.391c.232.282.56.449.953.449.832 0 1.461-.656 1.461-1.543 0-.886-.64-1.548-1.46-1.548zm-.103 2.452c-.497 0-.86-.386-.86-.904 0-.517.369-.909.865-.909.503 0 .855.386.855.91 0 .517-.364.903-.86.903zm-3.187-2.452c-.45 0-.745.184-.919.443v-.385H8.29v2.975h.693v-1.617c0-.455.289-.777.716-.777.398 0 .647.282.647.69v1.704h.692v-1.755c0-.748-.386-1.278-1.142-1.278zM24 12.503c0-.851-.624-1.45-1.46-1.45-.89 0-1.542.668-1.542 1.548 0 .927.698 1.543 1.553 1.543.722 0 1.287-.426 1.432-1.03h-.722c-.104.264-.358.414-.699.414-.445 0-.78-.276-.854-.76H24v-.264zm-2.252-.23c.11-.414.422-.615.78-.615.392 0 .693.224.762.615Z"/></svg>diff --git a/public/featured-logos/coinmarketcap.svg b/public/featured-logos/coinmarketcap.svgnew file mode 100644index 000000000..3c87bc182--- /dev/null+++ b/public/featured-logos/coinmarketcap.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" role="img" aria-hidden="true"><path d="M20.738 14.341c-.419.265-.912.298-1.286.087-.476-.27-.738-.898-.738-1.774v-2.618c0-1.264-.5-2.164-1.336-2.407-1.416-.413-2.482 1.32-2.882 1.972l-2.498 4.05v-4.95c-.028-1.14-.398-1.821-1.1-2.027-.466-.135-1.161-.081-1.837.953l-5.597 8.987A9.875 9.875 0 0 1 2.326 12c0-5.414 4.339-9.818 9.672-9.818 5.332 0 9.67 4.404 9.67 9.818.004.018.002.034.003.053.05 1.049-.29 1.883-.933 2.29zm3.08-2.34-.001-.055C23.787 5.353 18.497 0 11.997 0 5.48 0 .177 5.383.177 12c0 6.616 5.303 12 11.82 12 2.991 0 5.846-1.137 8.037-3.2.435-.41.46-1.1.057-1.541a1.064 1.064 0 0 0-1.519-.059 9.56 9.56 0 0 1-6.574 2.618c-2.856 0-5.425-1.263-7.197-3.268l5.048-8.105v3.737c0 1.794.696 2.374 1.28 2.544.584.17 1.476.054 2.413-1.468.998-1.614 2.025-3.297 3.023-4.88v2.276c0 1.678.672 3.02 1.843 3.68 1.056.597 2.384.543 3.465-.14 1.312-.828 2.018-2.354 1.944-4.193z"/></svg>diff --git a/public/featured-logos/googlecloud.svg b/public/featured-logos/googlecloud.svgnew file mode 100644index 000000000..f0300f746--- /dev/null+++ b/public/featured-logos/googlecloud.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" role="img" aria-hidden="true"><path d="M12.19 2.38a9.344 9.344 0 0 0-9.234 6.893c.053-.02-.055.013 0 0-3.875 2.551-3.922 8.11-.247 10.941l.006-.007-.007.03a6.717 6.717 0 0 0 4.077 1.356h5.173l.03.03h5.192c6.687.053 9.376-8.605 3.835-12.35a9.365 9.365 0 0 0-2.821-4.552l-.043.043.006-.05A9.344 9.344 0 0 0 12.19 2.38zm-.358 4.146c1.244-.04 2.518.368 3.486 1.15a5.186 5.186 0 0 1 1.862 4.078v.518c3.53-.07 3.53 5.262 0 5.193h-5.193l-.008.009v-.04H6.785a2.59 2.59 0 0 1-1.067-.23h.001a2.597 2.597 0 1 1 3.437-3.437l3.013-3.012A6.747 6.747 0 0 0 8.11 8.24c.018-.01.04-.026.054-.023a5.186 5.186 0 0 1 3.67-1.69z"/></svg>diff --git a/public/featured-logos/hackernoon.svg b/public/featured-logos/hackernoon.svgnew file mode 100644index 000000000..5f49b35fb--- /dev/null+++ b/public/featured-logos/hackernoon.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" role="img" aria-hidden="true"><path d="M5.701 0v6.223H8.85V4.654h1.576v7.842H12V4.654h1.574v1.569h3.15V0zm11.024 6.223v3.136h1.574V6.223zm1.574 3.136v4.705h1.576v-1.568h1.574v-1.568h-1.574V9.359zm0 4.705h-1.574v3.137h1.574zm-1.574 3.137h-3.15v1.569H8.85V17.2H5.7V24h11.024zm-11.024 0v-3.137H4.125v3.137zm-1.576-3.137V9.36H2.551v4.705zm0-4.705h1.576V6.223H4.125Z"/></svg>diff --git a/public/featured-logos/solana.svg b/public/featured-logos/solana.svgnew file mode 100644index 000000000..599c816ff--- /dev/null+++ b/public/featured-logos/solana.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" role="img" aria-hidden="true"><path d="m23.8764 18.0313-3.962 4.1393a.9201.9201 0 0 1-.306.2106.9407.9407 0 0 1-.367.0742H.4599a.4689.4689 0 0 1-.2522-.0733.4513.4513 0 0 1-.1696-.1962.4375.4375 0 0 1-.0314-.2545.4438.4438 0 0 1 .117-.2298l3.9649-4.1393a.92.92 0 0 1 .3052-.2102.9407.9407 0 0 1 .3658-.0746H23.54a.4692.4692 0 0 1 .2523.0734.4531.4531 0 0 1 .1697.196.438.438 0 0 1 .0313.2547.4442.4442 0 0 1-.1169.2297zm-3.962-8.3355a.9202.9202 0 0 0-.306-.2106.941.941 0 0 0-.367-.0742H.4599a.4687.4687 0 0 0-.2522.0734.4513.4513 0 0 0-.1696.1961.4376.4376 0 0 0-.0314.2546.444.444 0 0 0 .117.2297l3.9649 4.1394a.9204.9204 0 0 0 .3052.2102c.1154.049.24.0744.3658.0746H23.54a.469.469 0 0 0 .2523-.0734.453.453 0 0 0 .1697-.1961.4382.4382 0 0 0 .0313-.2546.4444.4444 0 0 0-.1169-.2297zM.46 6.7225h18.7815a.9411.9411 0 0 0 .367-.0742.9202.9202 0 0 0 .306-.2106l3.962-4.1394a.4442.4442 0 0 0 .117-.2297.4378.4378 0 0 0-.0314-.2546.453.453 0 0 0-.1697-.196.469.469 0 0 0-.2523-.0734H4.7596a.941.941 0 0 0-.3658.0745.9203.9203 0 0 0-.3052.2102L.1246 5.9687a.4438.4438 0 0 0-.1169.2295.4375.4375 0 0 0 .0312.2544.4512.4512 0 0 0 .1692.196.4689.4689 0 0 0 .2518.0739z"/></svg>diff --git a/scripts/deploy-agents-onchain.mjs b/scripts/deploy-agents-onchain.mjsindex b1ea0252e..03d70b744 100644--- a/scripts/deploy-agents-onchain.mjs+++ b/scripts/deploy-agents-onchain.mjs@@ -102,7 +102,13 @@ async function main() {}process.stdout.write(`[${deployed + errors + 1}/${agents.length}] ${name} … `);try {- const r = await deployAgentOnce({ umi, authoritySigner, collectionAddr, collectionAsset, agent, network });+ const r = await deployAgentOnce({+ umi, authoritySigner, collectionAddr, collectionAsset, agent, network,+ onEvent: (type, d) => {+ if (type === 'registered') console.log(` ↳ registry: ${d.identity_pda}${d.already_registered ? ' (already)' : ''}`);+ else if (type === 'registry_error') console.log(` ↳ registry skipped: ${d.error} (back-fill later)`);+ },+ });deployed++;console.log(`✓ ${r.asset}`);console.log(` ${explorerUrl(r.asset, network)}`);diff --git a/scripts/register-agents-onchain.mjs b/scripts/register-agents-onchain.mjsnew file mode 100644index 000000000..992cafd36--- /dev/null+++ b/scripts/register-agents-onchain.mjs@@ -0,0 +1,121 @@+#!/usr/bin/env node+/**+ * Register already-minted three.ws agents into the Metaplex Agent Registry — CLI.+ * ---------------------------------------------------------------------------+ * Minting a Core asset (scripts/deploy-agents-onchain.mjs) creates the NFT but+ * does NOT enrol the agent in Metaplex's Agent Registry. This runner back-fills+ * that step for every agent that already has a Core asset but no Agent Identity+ * PDA, via api/_lib/agent-registry.js — the same code new mints auto-run.+ *+ * The three.ws collection authority signs (it is the asset update authority), so+ * agent owners never sign and need no SOL — identical custody to the mint.+ *+ * Usage (env comes from .env via Node's --env-file):+ * # preview which agents would be registered — no SOL, no writes:+ * node --env-file=.env scripts/register-agents-onchain.mjs --limit 5 --dry-run+ *+ * # real devnet run:+ * node --env-file=.env scripts/register-agents-onchain.mjs --network devnet --limit 5 --confirm+ *+ * # real mainnet run (spends SOL — requires --confirm):+ * node --env-file=.env scripts/register-agents-onchain.mjs --limit 5 --confirm+ *+ * Re-runs are safe: already-registered agents are skipped automatically.+ */++import { LAMPORTS_PER_SOL } from '@solana/web3.js';+import {+ authoritySecret,+ buildAuthorityUmi,+ funderLamports,+ fetchUnregisteredAgents,+ registerAgentOnce,+ explorerUrl,+ EST_REGISTER_LAMPORTS,+} from '../api/_lib/onchain-deploy.js';++function arg(name, fallback) {+ const i = process.argv.indexOf(name);+ return i >= 0 && process.argv[i + 1] ? process.argv[i + 1] : fallback;+}+function flag(name) {+ return process.argv.includes(name);+}++const sleep = (ms) => new Promise((r) => setTimeout(r, ms));+const sol = (lamports) => (lamports / LAMPORTS_PER_SOL).toFixed(4);++async function main() {+ const network = arg('--network', 'mainnet') === 'devnet' ? 'devnet' : 'mainnet';+ const limit = Math.min(500, Math.max(1, Number(arg('--limit', '5'))));+ const dryRun = flag('--dry-run');+ const confirmed = flag('--confirm');++ console.log('\nthree.ws — Metaplex Agent Registry back-fill');+ console.log(` network: ${network} limit: ${limit} ${dryRun ? 'DRY RUN' : 'LIVE'}`);++ if (!authoritySecret()) {+ console.error('\n✗ Set SOLANA_AGENT_COLLECTION_AUTHORITY_KEY (or LAUNCH_FUNDER_SECRET) in .env.');+ process.exit(1);+ }++ const { umi, authoritySigner } = buildAuthorityUmi(network);+ const authorityPk = authoritySigner.publicKey;+ const balance = await funderLamports(umi, authorityPk);+ console.log(` authority: ${authorityPk.toString()} (${sol(balance)} SOL)\n`);++ const agents = await fetchUnregisteredAgents(network, limit);+ console.log(`Found ${agents.length} minted agent(s) not yet in the registry on ${network}:`);+ for (const a of agents) {+ const net = network === 'mainnet' ? a.meta : a.meta?.devnet || {};+ console.log(` • ${a.name || 'Agent'} (${String(a.id).slice(0, 8)}) asset ${String(net.sol_mint_address || '?').slice(0, 8)}…`);+ }++ if (agents.length === 0) {+ console.log('\nNothing to do — every minted agent is already in the registry.');+ return;+ }++ if (dryRun) {+ console.log('\nDry run — no SOL spent, no writes. Re-run with --confirm to register.');+ return;+ }++ if (!confirmed) {+ console.error('\n✗ Refusing a live run without --confirm (it spends real SOL). Add --confirm to proceed.');+ process.exit(1);+ }++ let registered = 0, already = 0, errors = 0;+ for (const agent of agents) {+ const name = agent.name || 'Agent';+ const bal = await funderLamports(umi, authorityPk);+ if (bal < EST_REGISTER_LAMPORTS + 5000) {+ console.log(`\n⏸ Paused — authority low on SOL (${sol(bal)}). Top up and re-run.`);+ break;+ }+ process.stdout.write(`[${registered + already + errors + 1}/${agents.length}] ${name} … `);+ try {+ const r = await registerAgentOnce({ umi, authoritySigner, agent, network });+ if (r.alreadyRegistered) {+ already++;+ console.log(`• already registered (${r.identityPda})`);+ } else {+ registered++;+ console.log(`✓ ${r.identityPda}`);+ console.log(` ${explorerUrl(r.identityPda, network)}`);+ }+ } catch (err) {+ errors++;+ console.log(`✗ ${err.message}`);+ }+ await sleep(400);+ }++ console.log(`\nDone — registered: ${registered}, already: ${already}, errors: ${errors}.`);+}++main().catch((err) => {+ console.error('\n✗ Fatal:', err?.stack || err?.message || err);+ process.exit(1);+});diff --git a/src/dashboard-next/pages/three-token.js b/src/dashboard-next/pages/three-token.jsindex 09aff4ebd..e77625f64 100644--- a/src/dashboard-next/pages/three-token.js+++ b/src/dashboard-next/pages/three-token.js@@ -11,8 +11,9 @@// GET /api/three-token/activity { events }import { mountShell } from '../shell.js';-import { requireUser, get, esc, relTime, ApiError } from '../api.js';+import { requireUser, esc, relTime, ApiError } from '../api.js';import { fetchTokenConfig, fetchTokenPrice } from '../../token-pay.js';+import { createThreeTokenData } from '../../pump/three-token-data.js';const MONO = `'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace`;// THREE_MINT is fetched live from /api/token/config below. This fallback is@@ -75,14 +76,6 @@ function toast(msg) {}, 1800);}-async function safeGet(url) {- try {- return await get(url);- } catch {- return null;- }-}-// ── Boot ──────────────────────────────────────────────────────────────────────(async function boot() {@@ -109,25 +102,46 @@ async function safeGet(url) {const host = main.querySelector('[data-slot="content"]');- const [stats, revenueShare, activity, tokenConfig] = await Promise.all([- safeGet('/api/three-token/stats'),- safeGet('/api/three-token/revenue-share'),- safeGet('/api/three-token/activity'),+ // Single source of truth for all $THREE data — price, protocol metrics,+ // revenue share, activity, burns, and the signed-in holder's live position.+ // The store wraps the same /api/three-token/* endpoints this page used to+ // fetch inline; centralising them keeps every section (and the new position+ // widget) reading one consistent snapshot. It polls protocol + activity and+ // tears itself down when `host` leaves the DOM.+ const store = createThreeTokenData({ pollMs: 30_000, anchorEl: host, autoStart: false });+ const [, tokenConfig] = await Promise.all([+ store.refresh(),fetchTokenConfig().catch(() => null),]);- // Update THREE_MINT from live config so external links stay correct.- if (tokenConfig?.mint) THREE_MINT = tokenConfig.mint;+ const snap = store.getState();+ const stats = snap.protocol.status === 'ok'+ ? { token: snap.protocol.token, protocol: snap.protocol.protocol }+ : null;+ const revenueShare = snap.revenueShare.status === 'ok' && !snap.revenueShare.unauthenticated+ ? snap.revenueShare+ : null;+ const activity = snap.activity.status === 'ok' ? { events: snap.activity.events } : null;++ // Canonical mint comes from the store's /stats payload (single source);+ // fall back to /api/token/config only if stats didn't resolve.+ if (snap.protocol.token?.mint) THREE_MINT = snap.protocol.token.mint;+ else if (tokenConfig?.mint) THREE_MINT = tokenConfig.mint;host.innerHTML = '';host.appendChild(renderHeroMetrics(stats));+ host.appendChild(renderPositionWidget(store));host.appendChild(renderUtilityPillars(stats));host.appendChild(renderLiveConverter(tokenConfig));host.appendChild(renderRevenueShare(stats, revenueShare));host.appendChild(renderDeployBurn(stats));host.appendChild(renderActivityFeed(activity));host.appendChild(renderTokenInfo());++ // Resolve the holder's on-chain position now that the widget is mounted; it+ // subscribes to the store and renders the result (or its empty/error state).+ store.refreshPosition();} catch (err) {if (err instanceof ApiError && err.status === 401) {location.href = `/login?return=${encodeURIComponent(location.pathname)}`;@@ -199,6 +213,99 @@ function renderHeroMetrics(stats) {return wrap;}+// ── Your position (signed-in holder's live $THREE balance) ──────────────────────++// A reactive panel showing the connected wallet's real $THREE holding. Subscribes+// to the shared store, so it updates whenever the position refreshes (initial+// load, the Refresh button, a tab refocus after a trade) and whenever the price+// moves. Renders an independent state for every case: loading, signed-out,+// no-wallet, zero-balance, populated, and error — never a blank void.+function renderPositionWidget(store) {+ const section = document.createElement('div');+ section.className = 'dn-panel';+ section.setAttribute('aria-label', 'Your $THREE position');+ section.style.cssText = 'position:relative;overflow:hidden';+ section.innerHTML = `+ <div style="display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px">+ <div style="font-size:11.5px;color:var(--nxt-ink-fade);text-transform:uppercase;letter-spacing:0.06em">Your Position</div>+ <button data-action="refresh-position" class="dn-btn" aria-label="Refresh your position" style="font-size:12px;padding:4px 10px">Refresh</button>+ </div>+ <div data-slot="position-body"></div>+ `;++ const body = section.querySelector('[data-slot="position-body"]');+ const render = (state) => { body.innerHTML = positionBody(state.position, state.protocol.token || {}); };++ // Delegated so the inline Retry button (re-rendered on each state change) works+ // the same as the header Refresh button.+ section.addEventListener('click', (e) => {+ const btn = e.target.closest('[data-action="refresh-position"]');+ if (!btn) return;+ btn.disabled = true;+ Promise.resolve(store.refreshPosition()).finally(() => { btn.disabled = false; });+ });++ // Cheap freshness: re-pull the position when the tab regains focus (e.g. after+ // the user buys/sells $THREE elsewhere). Position-only — never the heavy feeds.+ const onVisible = () => { if (document.visibilityState === 'visible') store.refreshPosition(); };+ document.addEventListener('visibilitychange', onVisible);++ const unsub = store.subscribe(render);++ // Tear down listeners when the panel leaves the DOM.+ new MutationObserver((_m, obs) => {+ if (!section.isConnected) {+ unsub();+ document.removeEventListener('visibilitychange', onVisible);+ obs.disconnect();+ }+ }).observe(document.body, { childList: true, subtree: true });++ return section;+}++function positionBody(pos, token) {+ switch (pos.status) {+ case 'idle':+ case 'loading':+ return `<div class="dn-skeleton" style="height:64px;border-radius:10px" aria-busy="true" aria-label="Loading your position"></div>`;+ case 'unauthenticated':+ return positionEmpty('Sign in to see your $THREE position.', 'Sign in', `/login?return=${encodeURIComponent(location.pathname)}`);+ case 'no_wallet':+ return positionEmpty('Link a Solana wallet to track your $THREE holdings.', 'Link wallet', '/dashboard/account');+ case 'zero':+ return positionEmpty('You don’t hold $THREE yet.', 'Get $THREE', `https://pump.fun/coin/${THREE_MINT}`, true);+ case 'error':+ return `<div style="display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap">+ <span style="color:var(--nxt-ink-fade);font-size:13.5px">Couldn’t load your position right now.</span>+ <button data-action="refresh-position" class="dn-btn" style="font-size:12px;padding:4px 10px">Retry</button>+ </div>`;+ case 'ok': {+ const amount = pos.amount ?? 0;+ const cells = [+ { label: 'Balance', value: `${fmtCompact(amount)} <span style="font-size:13px;color:var(--nxt-ink-fade)">$THREE</span>` },+ { label: 'Value', value: pos.usd != null ? fmtUsd(pos.usd) : '—' },+ { label: 'Share of supply', value: pos.pctOfSupply != null ? fmtPct(pos.pctOfSupply * 100) : '—' },+ ];+ return `<div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:12px">+ ${cells.map((c) => `<div>+ <div style="font-size:11px;color:var(--nxt-ink-fade);text-transform:uppercase;letter-spacing:0.05em;margin-bottom:4px">${esc(c.label)}</div>+ <div style="font-size:20px;font-weight:700;font-family:${MONO}">${c.value}</div>+ </div>`).join('')}+ </div>`;+ }+ default:+ return '';+ }+}++function positionEmpty(message, ctaLabel, href, external = false) {+ return `<div style="display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap">+ <span style="color:var(--nxt-ink-fade);font-size:13.5px">${esc(message)}</span>+ <a class="dn-btn" href="${esc(href)}" ${external ? 'target="_blank" rel="noopener"' : ''} style="font-size:12.5px;white-space:nowrap">${esc(ctaLabel)}</a>+ </div>`;+}+// ── Four utility pillars ──────────────────────────────────────────────────────function renderUtilityPillars(stats) {diff --git a/src/pump/three-token-data.test.js b/src/pump/three-token-data.test.jsnew file mode 100644index 000000000..bd65510b5--- /dev/null+++ b/src/pump/three-token-data.test.js@@ -0,0 +1,186 @@+// Unit tests for the $THREE shared data store. Network is stubbed at the+// dashboard-next/api.js boundary (the only thing the store talks to), so these+// exercise state transitions, not real I/O.++import { describe, it, expect, beforeEach, vi } from 'vitest';++const h = vi.hoisted(() => {+ class ApiError extends Error {+ constructor(status, code, message) {+ super(message || code || `HTTP ${status}`);+ this.name = 'ApiError';+ this.status = status;+ this.code = code;+ }+ }+ return { mockGet: vi.fn(), mockPost: vi.fn(), mockGetMe: vi.fn(), ApiError };+});++vi.mock('../dashboard-next/api.js', () => ({+ get: h.mockGet,+ post: h.mockPost,+ getMe: h.mockGetMe,+ ApiError: h.ApiError,+}));++import { createThreeTokenData, THREE_MINT } from './three-token-data.js';++const WALLET = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'; // 44-char base58, synthetic++function statsOk() {+ return {+ token: { mint: THREE_MINT, symbol: '$THREE', price_usd: 2, supply: 1000, decimals: 6, source: 'birdeye' },+ protocol: { total_agents: 5, revenue_share_pool_pct: 10, agent_deploy_burn: 1000 },+ };+}++// Default happy-path router for GET. Individual tests override as needed.+function routeGet(path) {+ if (path === '/api/three-token/stats') return Promise.resolve(statsOk());+ if (path === '/api/three-token/activity') return Promise.resolve({ events: [{ id: 'e1', type: 'payment' }] });+ if (path === '/api/three-token/burns') return Promise.resolve({ burns: [], total_burned: 5000, burn_per_deploy: 1000 });+ if (path === '/api/three-token/revenue-share') return Promise.resolve({ user_id: 'u1', revenue_share_pool_usd: 50 });+ return Promise.reject(new Error(`unexpected GET ${path}`));+}++beforeEach(() => {+ h.mockGet.mockReset();+ h.mockPost.mockReset();+ h.mockGetMe.mockReset();+ h.mockGet.mockImplementation(routeGet);+ h.mockGetMe.mockResolvedValue(null);+});++describe('createThreeTokenData — protocol/activity/burns', () => {+ it('loads protocol, activity, and burns to ok', async () => {+ const store = createThreeTokenData({ autoStart: false });+ await store.refresh();+ const s = store.getState();+ expect(s.protocol.status).toBe('ok');+ expect(s.protocol.token.mint).toBe(THREE_MINT);+ expect(s.protocol.token.price_usd).toBe(2);+ expect(s.activity.status).toBe('ok');+ expect(s.activity.events).toHaveLength(1);+ expect(s.burns.status).toBe('ok');+ expect(s.burns.total_burned).toBe(5000);+ store.destroy();+ });++ it('marks a field error without poisoning the others', async () => {+ h.mockGet.mockImplementation((path) => {+ if (path === '/api/three-token/activity') return Promise.reject(new Error('boom'));+ return routeGet(path);+ });+ const store = createThreeTokenData({ autoStart: false });+ await store.refresh();+ const s = store.getState();+ expect(s.activity.status).toBe('error');+ expect(s.protocol.status).toBe('ok'); // unaffected+ store.destroy();+ });+});++describe('createThreeTokenData — revenue share', () => {+ it('treats a 401 as unauthenticated, not an error', async () => {+ h.mockGet.mockImplementation((path) => {+ if (path === '/api/three-token/revenue-share') return Promise.reject(new h.ApiError(401, 'unauthorized', 'sign in'));+ return routeGet(path);+ });+ const store = createThreeTokenData({ autoStart: false });+ await store.refresh();+ const s = store.getState();+ expect(s.revenueShare.status).toBe('ok');+ expect(s.revenueShare.unauthenticated).toBe(true);+ store.destroy();+ });++ it('surfaces a non-401 failure as an error', async () => {+ h.mockGet.mockImplementation((path) => {+ if (path === '/api/three-token/revenue-share') return Promise.reject(new h.ApiError(500, 'server_error', 'down'));+ return routeGet(path);+ });+ const store = createThreeTokenData({ autoStart: false });+ await store.refresh();+ expect(store.getState().revenueShare.status).toBe('error');+ store.destroy();+ });+});++describe('createThreeTokenData — position', () => {+ it('computes a real position for a connected holder', async () => {+ h.mockGetMe.mockResolvedValue({ wallet_address: WALLET });+ h.mockPost.mockResolvedValue({ tokens: [{ mint: THREE_MINT, amount: 100, usd: 200 }] });+ const store = createThreeTokenData({ autoStart: false });+ await store.refreshPosition();+ const p = store.getState().position;+ expect(p.status).toBe('ok');+ expect(p.wallet).toBe(WALLET);+ expect(p.amount).toBe(100);+ expect(p.usd).toBe(200);+ expect(p.pctOfSupply).toBeCloseTo(0.1); // 100 / 1000 supply+ expect(h.mockPost).toHaveBeenCalledWith('/api/wallet/balances', { chain: 'solana', address: WALLET });+ store.destroy();+ });++ it('reports zero when the wallet holds no $THREE', async () => {+ h.mockGetMe.mockResolvedValue({ wallet_address: WALLET });+ h.mockPost.mockResolvedValue({ tokens: [{ mint: 'SomeOtherMint1111111111111111111111111111111', amount: 5, usd: 9 }] });+ const store = createThreeTokenData({ autoStart: false });+ await store.refreshPosition();+ const p = store.getState().position;+ expect(p.status).toBe('zero');+ expect(p.amount).toBe(0);+ store.destroy();+ });++ it('reports unauthenticated when there is no session', async () => {+ h.mockGetMe.mockResolvedValue(null);+ const store = createThreeTokenData({ autoStart: false });+ await store.refreshPosition();+ expect(store.getState().position.status).toBe('unauthenticated');+ expect(h.mockPost).not.toHaveBeenCalled();+ store.destroy();+ });++ it('reports no_wallet when signed in without a Solana address', async () => {+ h.mockGetMe.mockResolvedValue({ wallet_address: '0xabc0000000000000000000000000000000000000' }); // EVM, not base58 Solana+ const store = createThreeTokenData({ autoStart: false });+ await store.refreshPosition();+ expect(store.getState().position.status).toBe('no_wallet');+ store.destroy();+ });++ it('uses an explicit wallet override and refreshes on setWallet', async () => {+ h.mockPost.mockResolvedValue({ tokens: [{ mint: THREE_MINT, amount: 50, usd: 100 }] });+ const store = createThreeTokenData({ autoStart: false });+ store.setWallet(WALLET); // schedules a refreshPosition+ await new Promise((r) => setTimeout(r, 0));+ await store.refreshPosition();+ expect(store.getState().position.status).toBe('ok');+ expect(h.mockGetMe).not.toHaveBeenCalled(); // override skips session resolution+ store.destroy();+ });+});++describe('createThreeTokenData — store mechanics', () => {+ it('pushes the current snapshot to a new subscriber and on updates', async () => {+ const store = createThreeTokenData({ autoStart: false });+ const seen = [];+ const unsub = store.subscribe((s) => seen.push(s.protocol.status));+ expect(seen[0]).toBe('loading'); // immediate snapshot+ await store.refresh();+ expect(seen.at(-1)).toBe('ok');+ unsub();+ store.destroy();+ });++ it('stops emitting after destroy', async () => {+ const store = createThreeTokenData({ autoStart: false });+ let calls = 0;+ store.subscribe(() => { calls++; });+ const baseline = calls;+ store.destroy();+ await store.refresh(); // patches are no-ops after destroy+ expect(calls).toBe(baseline);+ });+});diff --git a/tasks/week-2026-06-08/C1-three-token-data-hook.md b/tasks/week-2026-06-08/C1-three-token-data-hook.mddeleted file mode 100644index 3b12dedab..000000000--- a/tasks/week-2026-06-08/C1-three-token-data-hook.md+++ /dev/null@@ -1,114 +0,0 @@-# C1 — Build the `three-token-data.js` shared data hook (keystone)--**Track:** C — build next · **Priority:** P1 · **Effort:** ~half day · **Depends on:** none-**Unblocks:** C2, C4, C5 (and optionally C6). Build this first.--## Context--The $THREE holder feature set (Tasks 14/16/17 in `tasks/wow-sprint/`) all need a **single source of-truth** for $THREE data. That module — `src/pump/three-token-data.js` — **does not exist yet**.-Today the closest thing is inline boot logic in `src/dashboard-next/pages/three-token.js`-(~lines 112–117) that does `Promise.all([stats, revenue-share, activity, tokenConfig])`. Generalize-that into a reusable, subscribable store so every holder surface reads from one place and they don't-drift.--**Do not invent new fetch primitives.** Every backend it needs already exists.--### Existing endpoints it wraps (all live; `api/three-token/[action].js` dispatcher)--- `GET /api/three-token/stats` (public, edge-cached ~20s) → `{ token:{ mint, symbol, price_usd,- price_change_24h, market_cap, volume_24h, holders, liquidity, supply, decimals, source },- protocol:{ total_agents, total_revenue_usd, total_payments, revenue_share_pool_pct, agent_deploy_burn } }`-- `GET /api/three-token/revenue-share` (authed; `401` if not signed in) → pro-rata math- `{ user_id, token_price, total_supply, total_holders, platform_revenue_usd, revenue_share_pool_pct,- revenue_share_pool_usd, per_token_yield }`. **This is protocol-level math, NOT a per-wallet- claimable balance.**-- `GET /api/three-token/activity` → `{ events: [...] }` (recent revenue events)-- `GET /api/three-token/burns` → `{ burns:[...], total_burned, burn_per_deploy }`-- `POST /api/wallet/balances` with `{ chain:'solana', address }` → per-wallet token balances (used- to compute the holder's $THREE position). Helper: `getBalances` in `api/_lib/balances.js`.--### Existing client helpers to reuse--- `src/dashboard-next/api.js` — `get`, `post`, `requireUser`, `ApiError` (typed 401), `esc`, `relTime`.-- `$THREE` mint constant: confirm the canonical one in the client (e.g. `src/token-pay.js`- `fetchTokenConfig`) — value is `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`.-- Self-cleanup `MutationObserver` pattern already in `three-token.js` (~lines 430–435).--## What to build--Create `src/pump/three-token-data.js` exporting a factory that returns a subscribable store (a-plain store, **not** a React hook — this codebase is vanilla JS modules):--```js-createThreeTokenData({ pollMs = 30000 }) => {- getState(): ThreeTokenState, // last snapshot, synchronous- subscribe(fn): () => void, // fires on every refresh; returns unsubscribe- refresh(): Promise<void>, // force a full fetch now- refreshPosition(): Promise<void>, // re-fetch only the wallet position (after a trade/claim)- destroy(): void, // clear interval + observers-}-```--`ThreeTokenState` — each field carries its **own** status so widgets render independent-loading/empty/error states:--```-{- protocol: { status: 'loading'|'ok'|'error', token:{...stats.token}, protocol:{...stats.protocol}, source, updatedAt },- revenueShare: { status, ...revenue-share fields | unauthenticated: true },- activity: { status, events: [] },- burns: { status, burns: [], total_burned, burn_per_deploy },- position: { status: 'idle'|'loading'|'unauthenticated'|'zero'|'ok'|'error',- wallet, amount, usd, pctOfSupply, price } // null until a wallet is known-}-```--Behavior:-- `protocol` ← `get('/api/three-token/stats')`; `activity` ← `.../activity`; `burns` ← `.../burns`.-- `revenueShare` ← `get('/api/three-token/revenue-share')`; treat `ApiError` 401 as- `{ status:'ok', unauthenticated:true }`, not an error.-- `position` ← resolve the signed-in user's linked Solana wallet, then- `post('/api/wallet/balances', { chain:'solana', address })`, find the `$THREE` mint row, compute- `pctOfSupply = amount / protocol.token.supply`. `idle` until a wallet is known; `unauthenticated`- if not signed in; `zero` if the wallet holds no $THREE; `ok` otherwise.-- Polling refreshes `protocol` + `activity` on `pollMs`. `position` refreshes on demand only- (`refreshPosition`) — don't hammer `/api/wallet/balances` on every tick.-- `destroy()` clears the interval and any observer. Include the `MutationObserver` self-cleanup so- a store tied to a detached DOM node tears itself down (copy the `three-token.js` pattern).-- All fetches go through `src/dashboard-next/api.js` (`get`/`post`) — never raw `fetch`.--## Acceptance criteria--- [ ] `src/pump/three-token-data.js` exists and exports `createThreeTokenData` with the signature- above.-- [ ] Each state field exposes an independent `status`; 401 on revenue-share is handled as- `unauthenticated`, not an error.-- [ ] Position computes real `amount`/`usd`/`pctOfSupply` from `/api/wallet/balances` for a- connected wallet, and reports `zero`/`unauthenticated`/`idle` correctly otherwise.-- [ ] Polling refreshes protocol/activity only; position is on-demand.-- [ ] `destroy()` fully tears down (no leaked intervals/observers).-- [ ] A focused unit test covers state transitions (loading → ok, 401 → unauthenticated, zero- balance → zero) with the network layer stubbed at the `api.js` boundary.-- [ ] No other module needs to fetch $THREE data directly anymore (this is the one place).--## Verification--1. `npx vitest run src/pump/three-token-data.test.js` (add this test).-2. Temporarily wire the store into `three-token.js` boot (or a scratch harness in dev) and confirm,- in a real browser with a connected wallet, that protocol/activity/position populate from real- API responses (Network tab shows the real calls).--## Rules--Obey [CLAUDE.md](../../CLAUDE.md). Real endpoints only — no sample arrays, no fake balances. Only-$THREE. Design loading/empty/error states deliberately (the per-field `status` exists for exactly-this).--## Completion protocol--1. Re-read your diff (`git diff`) and confirm every line is justified.-2. Delete this file: `tasks/week-2026-06-08/C1-three-token-data-hook.md`.-3. Commit your code **and** this file's deletion together, e.g.:- `git add -A && git commit -m "feat(pump): three-token-data shared store as single source of truth for $THREE; close C1"`-4. Do **not** push — the human controls pushes.diff --git a/tasks/week-2026-06-08/C2-holder-position-widget.md b/tasks/week-2026-06-08/C2-holder-position-widget.mddeleted file mode 100644index 917c2a39c..000000000--- a/tasks/week-2026-06-08/C2-holder-position-widget.md+++ /dev/null@@ -1,73 +0,0 @@-# C2 — $THREE holder "Your position" widget (wow-sprint Task 14)--**Track:** C — build next · **Priority:** P1 · **Effort:** ~1 day · **Depends on:** **C1** (the shared hook)--## Context--`tasks/wow-sprint/14-holder-dashboard.md` calls for a $THREE holder dashboard — "the reason to log-in." Most of it is **already built**: `src/dashboard-next/pages/three-token.js` renders hero-metrics, the revenue-share calculator, deploy-burn, activity feed, and token info from the real-endpoints (~60% done). **The missing piece is the "Your position" widget**: the connected wallet's-real $THREE holding — amount, USD value, % of supply — plus a proper connect-wallet empty state.--Read `tasks/wow-sprint/14-holder-dashboard.md` in full before starting.--## Prerequisite--This task consumes the `createThreeTokenData` store from **C1** (`src/pump/three-token-data.js`),-specifically its `position` field. **Do not start until C1 is merged.** Do not re-fetch-`/api/wallet/balances` directly — use the store's `position` + `refreshPosition()`.--## What to build--1. **Refactor `three-token.js` to consume the C1 store.** Replace the inline `Promise.all` boot- (~lines 112–117) with `createThreeTokenData(...)` + `subscribe(...)`. Existing sections- (hero metrics, calculator, burns, activity) should now read from the store's fields instead of- their own fetches. Keep the existing renderers (`renderHeroMetrics`, `fmtUsd`, `fmtCompact`,- `fmtPct`, `pctColor`, `toast`, `safeGet`) — just change their data source.-2. **Add the "Your position" widget** as a new section near the top of the page:- - **Connected + holding:** show $THREE balance, USD value, % of supply, and (if cheaply- available from the store) price. Use the existing number formatters.- - **Connected + zero balance (`position.status === 'zero'`):** show a "you don't hold $THREE yet"- state with a clear CTA to acquire it (link to the token/swap page — coin-agnostic copy, only- $THREE named).- - **Not signed in (`unauthenticated`):** show a connect-wallet empty state with a sign-in CTA- (reuse the page's existing `ApiError 401 → /login` convention).- - **Loading:** skeleton (use the page's `skeletonBlock`/`skeletonGrid`).- - **Error:** designed, actionable error state (not a blank void).-3. **Refresh on relevant events.** After a sign-in or a trade completes, call- `store.refreshPosition()` so the widget updates without a full reload.-4. **States, motion, a11y:** every interactive element gets hover/active/focus states; transitions- on opacity/transform; semantic markup + ARIA labels; works at 320 / 768 / 1440px.--## Acceptance criteria--- [ ] `three-token.js` reads all data from the C1 store; no duplicate $THREE fetching remains.-- [ ] "Your position" shows real balance / USD / % supply for a connected, holding wallet.-- [ ] All four non-happy states are designed: zero-balance, unauthenticated, loading, error.-- [ ] Position updates after sign-in / trade via `refreshPosition()` (no full reload needed).-- [ ] No console errors/warnings from changed code; Network tab shows real calls succeeding.-- [ ] Responsive + accessible + hover/active/focus on all interactive elements.--## Verification--1. `npm run dev`; open the holder dashboard route.-2. With **no** wallet/session: confirm the connect-wallet empty state + working sign-in CTA.-3. With a connected wallet holding $THREE: confirm real position numbers; cross-check the balance- against `/api/wallet/balances` in the Network tab.-4. With a connected wallet holding **no** $THREE: confirm the zero-state + acquire CTA.-5. Throttle/offline to confirm the error state renders (not a blank).-6. `npx vitest run` — existing dashboard tests still pass.--## Rules--Obey [CLAUDE.md](../../CLAUDE.md). Only $THREE. No fake balances or placeholder numbers — if the-store has no data yet, show the loading/empty state, never invented values.--## Completion protocol--1. Re-read your diff (`git diff`) and confirm every line is justified.-2. Delete this file: `tasks/week-2026-06-08/C2-holder-position-widget.md`.-3. Commit your code **and** this file's deletion together, e.g.:- `git add -A && git commit -m "feat(holder): your-position widget on $THREE dashboard via shared store; close C2"`-4. Do **not** push — the human controls pushes.