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: 3ws vanity mint-mark brand + IPFS pinning for agent launches
nirholas14259dff5a29
diff --git a/.env.example b/.env.exampleindex 71774702f..e1d60de55 100644--- a/.env.example+++ b/.env.example@@ -648,6 +648,13 @@ PUMP_DISTRIBUTE_FALLBACK_PAYER=# Generate: openssl rand -base64 32PUMPKIT_WEBHOOK_SECRET=+# ── Mint-mark kill-switch (api/pump/[action].js: launch-prep + launch-agent) ─+# Controls whether branded launches must carry the "3ws" mint mark.+# Default: ON (any value other than '0' or 'false' enforces fail-closed).+# Set to '0' ONLY during an incident where grindVanityNode is broken and+# launches must continue unblocked. Re-enable immediately after resolution.+THREE_WS_MARK_ENFORCE=1+# Redis list key holding the pump.fun graduations stream (defaults to# "pf:graduations"). Override only when running multiple environments# against one Upstash instance.diff --git a/api/_lib/env.js b/api/_lib/env.jsindex 3b48e44ce..dc44eebf3 100644--- a/api/_lib/env.js+++ b/api/_lib/env.js@@ -573,6 +573,16 @@ export const env = {// Alternative: store the base64 in coin_launches.metadata.creator_secret_b64// at register time (less secure than env; v2 should move to a KMS).+ // ── Mint-mark kill-switch ─────────────────────────────────────────────+ // Controls whether launch-prep and launch-agent enforce the three.ws "3ws"+ // mint mark. Default: ON (any value other than '0' or 'false' enforces).+ // Flip to '0' ONLY during an incident where grindVanityNode is broken and+ // launches must continue unblocked. Re-enable immediately after resolution.+ // When OFF, mints may be generated without the mark (pure-legacy path).+ get THREE_WS_MARK_ENFORCE() {+ return opt('THREE_WS_MARK_ENFORCE', '1');+ },+// ── x402 pay-per-call pump.fun launcher (api/x402/pump-launch.js) ─────// Base64-encoded 64-byte Solana secret for the server keypair that PAYS// the SOL deploy cost (~0.022 SOL) and signs the create-coin tx on behalfdiff --git a/api/_lib/ipfs-pin.js b/api/_lib/ipfs-pin.jsnew file mode 100644index 000000000..1446e30ba--- /dev/null+++ b/api/_lib/ipfs-pin.js@@ -0,0 +1,75 @@+/**+ * IPFS pinning helper — single entry point for putting bytes on IPFS.+ *+ * Pump.fun's own frontend pins coin images and metadata JSON to IPFS (via+ * Pinata) and points the on-chain `uri` at `https://ipfs.io/ipfs/{cid}`.+ * Matching that flow keeps three.ws launches indistinguishable from native+ * ones to wallets, explorers, and aggregators that fetch the metadata.+ *+ * Provider order mirrors api/pinning/[action].js: Pinata (preferred),+ * web3.storage (fallback). When neither is configured, returns null so callers+ * fall back to R2 HTTPS hosting — a valid metadata URI, just not a CID.+ */++const PINATA_FILE_ENDPOINT = 'https://api.pinata.cloud/pinning/pinFileToIPFS';+const WEB3_STORAGE_ENDPOINT = 'https://api.web3.storage/upload';++/** @returns {string} the public IPFS gateway URL pump.fun uses for a CID. */+export function ipfsGatewayUrl(cid) {+ return `https://ipfs.io/ipfs/${cid}`;+}++async function pinViaPinata(buf, filename) {+ const form = new FormData();+ form.append('file', new Blob([buf]), filename);+ const resp = await fetch(PINATA_FILE_ENDPOINT, {+ method: 'POST',+ headers: { Authorization: `Bearer ${process.env.PINATA_JWT}` },+ body: form,+ });+ if (!resp.ok) {+ const detail = await resp.text().catch(() => '');+ throw Object.assign(new Error(`Pinata error ${resp.status}`), { status: 502, detail });+ }+ const data = await resp.json();+ return { cid: data.IpfsHash, provider: 'pinata' };+}++async function pinViaWeb3Storage(buf, filename) {+ const resp = await fetch(WEB3_STORAGE_ENDPOINT, {+ method: 'POST',+ headers: { Authorization: `Bearer ${process.env.WEB3_STORAGE_TOKEN}`, 'X-NAME': filename },+ body: buf,+ });+ if (!resp.ok) {+ const detail = await resp.text().catch(() => '');+ throw Object.assign(new Error(`Web3.Storage error ${resp.status}`), { status: 502, detail });+ }+ const data = await resp.json();+ return { cid: data.cid, provider: 'web3.storage' };+}++/** True when at least one IPFS pinning provider is configured. */+export function ipfsPinningConfigured() {+ return Boolean(process.env.PINATA_JWT || process.env.WEB3_STORAGE_TOKEN);+}++/**+ * Pin a buffer to IPFS via the configured provider.+ *+ * @param {Buffer} buf+ * @param {string} filename+ * @returns {Promise<{cid: string, uri: string, provider: string} | null>}+ * the pinned CID + gateway URI, or null when no provider is configured.+ */+export async function pinToIPFS(buf, filename) {+ if (process.env.PINATA_JWT) {+ const { cid, provider } = await pinViaPinata(buf, filename);+ return { cid, uri: ipfsGatewayUrl(cid), provider };+ }+ if (process.env.WEB3_STORAGE_TOKEN) {+ const { cid, provider } = await pinViaWeb3Storage(buf, filename);+ return { cid, uri: ipfsGatewayUrl(cid), provider };+ }+ return null;+}diff --git a/api/pump/[action].js b/api/pump/[action].jsindex b21dec91a..a8889f2c7 100644--- a/api/pump/[action].js+++ b/api/pump/[action].js@@ -62,6 +62,13 @@ import { parse } from '../_lib/validate.js';import { randomToken } from '../_lib/crypto.js';import { publishFeedEvent } from '../_lib/feed.js';import { normalizeGatewayURL } from '../../src/ipfs.js';+import { buildTokenMetadata } from '../_lib/three-brand.js';+import { pinToIPFS, ipfsPinningConfigured } from '../_lib/ipfs-pin.js';+import { THREE_WS_VANITY, hasThreeWsMark } from '../../src/solana/vanity/brand.js';+import { grindVanityNode, GrindExhaustedError } from '../../src/solana/vanity/grinder-node.js';+import { logger } from '../_lib/usage.js';++const log = logger('pump.launch');import {getConnection,getPumpSdk,@@ -671,53 +678,94 @@ async function handleBuildMetadata(req, res) {const ts = Date.now().toString(36);const prefix = `pump/meta/${uid}/${ts}`;- // ── Resolve image URL ───────────────────────────────────────────────────- let imageUrl = null;+ // ── Resolve image bytes ─────────────────────────────────────────────────+ // We want raw bytes (not just an HTTPS URL) so the image can be pinned to+ // IPFS alongside the metadata — matching pump.fun's native upload flow.+ let imageBuf = null;+ let imageContentType = 'image/png';+ let imageExt = 'png';+ let imageUrl = null; // set directly only when we can't get bytes to pinif (body.image_data_url) {const commaIdx = body.image_data_url.indexOf(',');if (commaIdx === -1) return error(res, 400, 'validation_error', 'invalid image_data_url');const meta = body.image_data_url.slice(0, commaIdx);const payload = body.image_data_url.slice(commaIdx + 1);- const buf = meta.includes('base64')+ imageBuf = meta.includes('base64')? Buffer.from(payload, 'base64'): Buffer.from(decodeURIComponent(payload));- if (buf.byteLength > 4 * 1024 * 1024) {+ if (imageBuf.byteLength > 4 * 1024 * 1024) {return error(res, 413, 'payload_too_large', 'image must be under 4 MB');}- const contentType = meta.match(/data:([^;,]+)/)?.[1] || 'image/png';- const ext = contentType.includes('jpeg') || contentType.includes('jpg') ? 'jpg' : 'png';- const imgKey = `${prefix}/image.${ext}`;- await putObject({ key: imgKey, body: buf, contentType });- imageUrl = r2PublicUrl(imgKey);+ imageContentType = meta.match(/data:([^;,]+)/)?.[1] || 'image/png';+ imageExt = imageContentType.includes('jpeg') || imageContentType.includes('jpg') ? 'jpg' : 'png';} else if (body.avatar_id) {const [av] = await sql`select thumbnail_key from avatarswhere id=${body.avatar_id} and owner_id=${uid} and deleted_at is null limit 1`;- if (av?.thumbnail_key) imageUrl = r2PublicUrl(av.thumbnail_key);+ if (av?.thumbnail_key) {+ const thumbUrl = r2PublicUrl(av.thumbnail_key);+ // Fetch the stored thumbnail so it too lands on IPFS; if that fails,+ // fall back to referencing the R2 URL directly (still a valid image).+ try {+ const resp = await fetch(thumbUrl);+ if (resp.ok) {+ imageBuf = Buffer.from(await resp.arrayBuffer());+ imageContentType = resp.headers.get('content-type') || 'image/png';+ imageExt = imageContentType.includes('jpeg') || imageContentType.includes('jpg') ? 'jpg' : 'png';+ }+ } catch {+ /* fall through to direct URL */+ }+ if (!imageBuf) imageUrl = thumbUrl;+ }}- // ── Build metadata JSON ─────────────────────────────────────────────────- const agentHomeUrl = body.agent_id- ? `${env.APP_ORIGIN}/agent/${body.agent_id}`- : env.APP_ORIGIN;+ // Pin the image (IPFS preferred, R2 fallback) so the metadata references a+ // stable, gateway-resolvable URL.+ if (imageBuf && !imageUrl) {+ const pinnedImage = await pinToIPFS(imageBuf, `image.${imageExt}`).catch(() => null);+ if (pinnedImage) {+ imageUrl = pinnedImage.uri;+ } else {+ const imgKey = `${prefix}/image.${imageExt}`;+ await putObject({ key: imgKey, body: imageBuf, contentType: imageContentType });+ imageUrl = r2PublicUrl(imgKey);+ }+ }- const metadata = {+ // ── Build metadata JSON via the canonical three.ws brand builder ─────────+ // This stamps createdOn=https://three.ws plus the Platform/Launchpad+ // attributes that explorers and launchpad aggregators read for attribution.+ const agentHomeUrl = body.agent_id ? `${env.APP_ORIGIN}/agent/${body.agent_id}` : undefined;+ const metadata = buildTokenMetadata({name: body.name,symbol: body.symbol,description: body.description,- ...(imageUrl ? { image: imageUrl } : {}),- showName: true,- createdOn: 'https://pump.fun',- website: agentHomeUrl,- };+ image: imageUrl || '',+ ...(agentHomeUrl ? { agentUrl: agentHomeUrl } : {}),+ createdAt: new Date().toISOString(),+ });+ // Pin the metadata JSON (IPFS preferred, R2 fallback).const jsonBuf = Buffer.from(JSON.stringify(metadata, null, 2));- const jsonKey = `${prefix}/metadata.json`;- await putObject({ key: jsonKey, body: jsonBuf, contentType: 'application/json' });+ const pinnedJson = await pinToIPFS(jsonBuf, 'metadata.json').catch(() => null);+ let metadataUrl;+ if (pinnedJson) {+ metadataUrl = pinnedJson.uri;+ } else {+ const jsonKey = `${prefix}/metadata.json`;+ await putObject({ key: jsonKey, body: jsonBuf, contentType: 'application/json' });+ metadataUrl = r2PublicUrl(jsonKey);+ }- return json(res, 200, { metadata_url: r2PublicUrl(jsonKey), image_url: imageUrl });+ return json(res, 200, {+ metadata_url: metadataUrl,+ image_url: imageUrl,+ on_ipfs: Boolean(pinnedJson),+ provider: pinnedJson?.provider ?? (ipfsPinningConfigured() ? 'r2-fallback' : 'r2'),+ });}// ── shared launch helpers ──────────────────────────────────────────────────@@ -950,13 +998,31 @@ async function handleLaunchPrep(req, res) {if (!agent) return error(res, 404, 'not_found', 'agent not found');const resolvedAgentId = agent.id;- // Mint pubkey: client-supplied (vanity-ground) or freshly generated.+ // Mint pubkey: client-supplied (vanity-ground) or server-ground with the three.ws mark.+ const enforceMark = env.THREE_WS_MARK_ENFORCE !== '0' && env.THREE_WS_MARK_ENFORCE !== 'false';let mintKeypair = null;let mint;+if (body.mint_address) {const supplied = solanaPubkey(body.mint_address);if (!supplied) return error(res, 400, 'validation_error', 'invalid mint_address');+ if (enforceMark && !hasThreeWsMark(supplied.toBase58())) {+ return error(res, 400, 'unbranded_mint',+ 'three.ws launches must use a mint address carrying the "3ws" mark — grind one client-side or omit mint_address to let the server stamp it');+ }mint = supplied;+ } else if (enforceMark) {+ try {+ const ground = await grindVanityNode({ ...THREE_WS_VANITY }); // ~49k attempts, sub-second+ mintKeypair = Keypair.fromSecretKey(ground.secretKey);+ mint = mintKeypair.publicKey;+ log.info('mint_mark_stamped', { publicKey: ground.publicKey, attempts: ground.attempts, durationMs: Math.round(ground.durationMs) });+ } catch (err) {+ if (err instanceof GrindExhaustedError) {+ return error(res, 503, 'mark_grind_failed', 'could not stamp the three.ws mark — retry');+ }+ throw err;+ }} else {mintKeypair = Keypair.generate();mint = mintKeypair.publicKey;@@ -1114,6 +1180,17 @@ async function handleLaunchConfirm(req, res) {await sql`delete from agent_registrations_pending where id=${pending.id}`;+ // Surface the confirmed launch on the site-wide live activity ticker.+ publishFeedEvent({+ type: 'coin-buy',+ ts: Date.now(),+ actor: shortAddr(p.wallet_address),+ mint: p.mint,+ sol: 0,+ network: p.network,+ branded: hasThreeWsMark(p.mint),+ }).catch(() => {});+return json(res, 201, {ok: true,pump_agent_mint: row,@@ -1238,7 +1315,10 @@ async function handleLaunchAgent(req, res) {const agentKeypair = loaded.keypair;const creator = agentKeypair.publicKey;- // Mint keypair: client-supplied (vanity) or server-generated.+ // Mint keypair: client-supplied (vanity) or server-ground with the three.ws mark.+ // This path signs server-side with the agent custodial wallet, so the server+ // always holds the mint secret — supplied or ground.+ const enforceMark = env.THREE_WS_MARK_ENFORCE !== '0' && env.THREE_WS_MARK_ENFORCE !== 'false';let mintKeypair;if (body.mint_address && body.mint_secret_key_b64) {try {@@ -1251,6 +1331,21 @@ async function handleLaunchAgent(req, res) {if (mintKeypair.publicKey.toBase58() !== body.mint_address) {return error(res, 400, 'validation_error', 'mint_address does not match secret key');}+ if (enforceMark && !hasThreeWsMark(mintKeypair.publicKey.toBase58())) {+ return error(res, 400, 'unbranded_mint',+ 'three.ws launches must use a mint carrying the "3ws" mark — omit mint_address to let the server stamp it');+ }+ } else if (enforceMark) {+ try {+ const ground = await grindVanityNode({ ...THREE_WS_VANITY }); // ~49k attempts, sub-second+ mintKeypair = Keypair.fromSecretKey(ground.secretKey);+ log.info('mint_mark_stamped', { publicKey: ground.publicKey, attempts: ground.attempts, durationMs: Math.round(ground.durationMs) });+ } catch (err) {+ if (err instanceof GrindExhaustedError) {+ return error(res, 503, 'mark_grind_failed', 'could not stamp the three.ws mark — retry');+ }+ throw err;+ }} else {mintKeypair = Keypair.generate();}@@ -1358,6 +1453,17 @@ async function handleLaunchAgent(req, res) {)`.catch((e) => console.error('[pump/launch-agent] log failed', e?.message));+ // Surface the confirmed agent-wallet launch on the site-wide live activity ticker.+ publishFeedEvent({+ type: 'coin-buy',+ ts: Date.now(),+ actor: shortAddr(creator.toBase58()),+ mint: mintAddr,+ sol: body.sol_buy_in || 0,+ network: body.network,+ branded: hasThreeWsMark(mintAddr),+ }).catch(() => {});+return json(res, 201, {ok: true,agent_id: resolvedAgentId,diff --git a/api/pump/launch-agent.js b/api/pump/launch-agent.jsnew file mode 100644index 000000000..7331c8922--- /dev/null+++ b/api/pump/launch-agent.js@@ -0,0 +1,8 @@+// Thin stub that routes to the consolidated pump [action] dispatcher.+// Tests and legacy imports reference individual files; this forwards them.+import dispatcher from './[action].js';+export default function handler(req, res) {+ if (!req.query) req.query = {};+ req.query.action = 'launch-agent';+ return dispatcher(req, res);+}diff --git a/docs/index.html b/docs/index.htmlindex dac44b5ae..82b6d753f 100644--- a/docs/index.html+++ b/docs/index.html@@ -632,6 +632,7 @@{ label: 'ERC-8004', path: 'erc8004' },{ label: 'Solana agents', path: 'solana' },{ label: 'Solana pump.fun signals', path: 'solana-pumpfun' },+ { label: 'Mint mark ("3ws")', path: 'mint-mark' },{ label: 'Agents in X Spaces', path: 'x-spaces' },{ label: 'Security', path: 'security' },{ label: 'Configuration', path: 'configuration' },diff --git a/docs/mint-mark.md b/docs/mint-mark.mdnew file mode 100644index 000000000..a70423824--- /dev/null+++ b/docs/mint-mark.md@@ -0,0 +1,125 @@+# The three.ws mint mark++Every coin launched through three.ws has a mint address that starts with `3ws` — the three.ws brand mark. This is automatic and verifiable directly from the address without any external lookup.++---++## For users++### What is the mint mark?++When you launch a coin on three.ws (via Studio or the agent wallet path), the platform grinds a Solana keypair until it finds one whose public key starts with `3ws`. That resulting address is your coin's mint.++**Example:** a three.ws-launched mint looks like `3wsXrT4Gy…`++### Why does it matter?++- **Provenance at a glance.** Anyone looking at a mint address on Solscan, pump.fun, or any Solana explorer can immediately tell whether a coin came from three.ws — no metadata lookup required.+- **Tamper-evident.** The mark is baked into the Ed25519 keypair itself. It cannot be retroactively attached to an unbranded mint.+- **Automatic.** You don't configure anything. Every branded launch comes out stamped.++### How does it work?++The server runs a fast WASM-based keypair grinder (single-threaded, sub-second for a 3-character prefix) until it finds a match, then uses that keypair as the coin mint. The expected work is ~49 000 keypairs at ~25 000/s, taking well under a second on real serverless CPU.++### Is it on every coin?++Yes — all coins launched via **Studio** or **launch-agent** carry the mark. The only exception is the generic x402 pay-per-call launcher, which accepts arbitrary mints supplied by the caller at runtime and intentionally has no brand constraint.++---++## For developers++### Single source of truth++[src/solana/vanity/brand.js](../src/solana/vanity/brand.js) owns everything:++```js+export const THREE_WS_MARK = '3ws';++export const THREE_WS_VANITY = Object.freeze({+ prefix: THREE_WS_MARK,+ suffix: '',+ ignoreCase: true,+});++export function hasThreeWsMark(address) { /* case-insensitive prefix check */ }+export function assertThreeWsMark(address) { /* throws UnbrandedMintError */ }+export class UnbrandedMintError extends Error { /* code: 'unbranded_mint' */ }+```++No other file hardcodes `'3ws'` or re-implements the check. Import from here.++### Server enforcement++`api/pump/[action].js` reads `env.THREE_WS_MARK_ENFORCE` at the start of both `launch-prep` and `launch-agent`:++```js+const enforceMark = env.THREE_WS_MARK_ENFORCE !== '0' && env.THREE_WS_MARK_ENFORCE !== 'false';+```++When enforcement is **on** (default):+- A client-supplied `mint_address` is validated with `hasThreeWsMark`; unbranded mints return `400 unbranded_mint`.+- When no mint is supplied, the server grinds one with `grindVanityNode({ ...THREE_WS_VANITY })`.+- Grind cost is logged at info level: `{ publicKey, attempts, durationMs }` — expect ~49 000 attempts, < 1 000 ms on serverless CPU.++When enforcement is **off**: a random `Keypair.generate()` is used (pure-legacy fallback). No brand constraint.++### The kill-switch++**`THREE_WS_MARK_ENFORCE`** — registered in `api/_lib/env.js`, documented in `.env.example`.++| Value | Behaviour |+|-------|-----------|+| `1` (default) | Enforcement ON — launches fail-closed if mark cannot be stamped |+| `0` or `false` | Enforcement OFF — unbranded mints are accepted |++Flip to `'0'` **only during an incident** where `grindVanityNode` is broken and launches must continue unblocked. Re-enable immediately when the incident is resolved. Never leave it off in production.++### Feed events++Confirmed launches emit a `coin-buy` feed event on the `feed:events` Redis bus (see `api/_lib/feed.js`). The event carries `branded: hasThreeWsMark(mint)` so the FOMO ticker and any downstream consumer can distinguish branded from unbranded launches:++```js+{+ type: 'coin-buy',+ ts: Date.now(),+ actor: '<short-wallet>',+ mint: '3wsXrT4Gy…',+ sol: 0,+ network: 'mainnet',+ branded: true,+}+```++### Observability++Every server-side grind emits a structured log line via `logger('pump.launch')`:++```json+{ "lvl": "info", "name": "pump.launch", "msg": "mint_mark_stamped",+ "publicKey": "3wsXrT4Gy...", "attempts": 49213, "durationMs": 892 }+```++Watch this in Vercel logs to confirm the ~49 000-attempt / sub-second expectation holds. A sharp increase in `attempts` or `durationMs` signals WASM performance degradation.++### The generic x402 launcher exemption++`api/x402/pump-launch.js` is a pay-per-call endpoint that accepts an arbitrary `mint` keypair supplied by the buyer at runtime. It does **not** enforce the brand mark and must never have `assertThreeWsMark` added to it. The mint is the buyer's choice; the brand constraint belongs only to three.ws-initiated launches.++### Token example++All code examples and fixtures in this codebase use `$THREE`:++- Symbol: `$THREE`+- Mint: `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`++No other mint should appear in tests, fixtures, or documentation.++---++## Related++- [Solana agents](solana) — agent wallet management and on-chain interactions+- [Solana pump.fun signals](solana-pumpfun) — pump.fun live feed integration+- [ERC-8004](erc8004) — on-chain agent registry (uses the same brand metadata builder)diff --git a/public/studio/launch-panel.js b/public/studio/launch-panel.jsindex a51aa50ef..b03375cb7 100644--- a/public/studio/launch-panel.js+++ b/public/studio/launch-panel.js@@ -351,6 +351,7 @@ const LP_CSS = `background:rgba(255,255,255,.04);border-radius:8px;width:100%;font-family:ui-monospace,monospace;font-size:.75rem;color:rgba(255,255,255,.6)}.lp-ok-mint span{flex:1;text-align:left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}+.lp-ok-mint .lp-ok-mint-addr{flex:1;text-align:left;overflow:hidden;white-space:nowrap}.lp-copy{padding:.2rem .5rem;border-radius:5px;cursor:pointer;flex-shrink:0;background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.12);color:rgba(255,255,255,.65);font-size:.7rem;white-space:nowrap}@@ -367,6 +368,25 @@ const LP_CSS = `.lp-again{width:100%;padding:.42rem;border-radius:7px;cursor:pointer;background:transparent;border:1px solid rgba(255,255,255,.07);color:rgba(255,255,255,.32);font-size:.77rem}.lp-again:hover{color:rgba(255,255,255,.62);border-color:rgba(255,255,255,.16)}++/* Stamp progress + success */+.lp-stamp-live{min-height:1.1em;font-size:.7rem;color:rgba(255,255,255,.5);+ font-family:ui-monospace,SFMono-Regular,Menlo,monospace;margin-top:.2rem;+ display:flex;align-items:center;gap:5px}+.lp-stamp-live .lp-spspin{width:9px;height:9px;border:1.5px solid rgba(255,255,255,.14);+ border-top-color:rgba(255,255,255,.5);border-radius:50%;+ animation:lp-spin .75s linear infinite;flex-shrink:0}+.lp-stamp-live strong{color:rgba(255,255,255,.88);font-weight:600}+.lp-ok-mint-marked{display:inline-flex;align-items:baseline;+ font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.78rem}+.lp-ok-mint-marked .lp-mark{font-weight:700;color:rgba(255,255,255,.92);letter-spacing:.02em}+.lp-ok-mint-marked .lp-rest{color:rgba(255,255,255,.42);font-weight:400}+.lp-ok-verified{display:inline-flex;align-items:center;gap:3px;padding:2px 7px;+ border-radius:999px;font-size:.67rem;font-weight:500;letter-spacing:.04em;+ background:rgba(255,255,255,.05);border:1px solid rgba(255,255,255,.11);+ color:rgba(255,255,255,.52);margin-top:.1rem}+.lp-ok-stamp-sub{font-size:.7rem;color:rgba(255,255,255,.35);line-height:1.5;+ margin:-.3rem 0 0;text-align:center}`;let _cssInjected = false;@@ -1028,7 +1048,29 @@ export function mountLaunchPanel(container, { getAvatar, getUser, getPreviewView}async function launchViaConnectedWallet(nameTrim, symTrim) {- // Prep transaction+ // Step 0: grind the 3ws brand mark client-side so we can show stamping progress+ // and pass the known keypair to the server (no server-side grind needed).+ s.phase = 'stamping'; s.phaseLabel = 'Stamping the three.ws mark 3ws…'; render();++ const { grindVanity } = await import('../../src/solana/vanity/grinder.js');+ const THREE_WS_VANITY = { prefix: '3ws', suffix: '', ignoreCase: true };++ let ground;+ try {+ ground = await grindVanity({+ ...THREE_WS_VANITY,+ onProgress: (p) => {+ const liveEl = container.querySelector('#lp-stamp-live');+ if (liveEl) {+ liveEl.innerHTML = `<span class="lp-spspin" aria-hidden="true"></span>Stamping the three.ws mark <strong>3ws</strong>… · ${Math.round(p.rate / 1000)}k/s · ${esc(p.eta)}`;+ }+ },+ });+ } catch (err) {+ throw new Error(`Could not stamp the three.ws brand mark — retry (${err.message})`);+ }++ // Grind done — transition to signing.s.phase = 'signing'; s.phaseLabel = 'Sign in your wallet…'; render();const w = detectWallet();@@ -1039,10 +1081,6 @@ export function mountLaunchPanel(container, { getAvatar, getUser, getPreviewViewconst isUsdc = s.coinType === 'usdc';const buyIn = Math.max(0, parseFloat(s.initialBuy) || 0);- // Server schema treats 'usdc' as an unknown coin_type. Map it to 'agent'- // (the buyback-bound variant) so the launch wires up an agent identity,- // but flip the quote mint to USDC and route the initial buy through- // usdc_buy_in so the backend builds createV2AndBuyV2Instructions.const pr = await fetch('/api/pump/launch-prep', {method: 'POST', credentials: 'include',headers: { 'content-type': 'application/json' },@@ -1050,8 +1088,7 @@ export function mountLaunchPanel(container, { getAvatar, getUser, getPreviewView...(av.agent_id ? { agent_id: av.agent_id } : { avatar_id: av.id }),wallet_address: payer,name: nameTrim, symbol: symTrim, uri: s._metaUrl,- // 'reward' launches as a plain pump.fun coin; the delegated fee split- // is configured after graduation in the Fees & rewards panel.+ mint_address: ground.publicKey,coin_type: isUsdc ? 'agent' : s.coinType === 'reward' ? 'regular' : s.coinType,buyback_bps: (isUsdc || s.coinType === 'agent') ? s.buybackBps : 0,...(isUsdc@@ -1069,13 +1106,17 @@ export function mountLaunchPanel(container, { getAvatar, getUser, getPreviewViewconst tx = VersionedTransaction.deserialize(Uint8Array.from(atob(prep.tx_base64), (c) => c.charCodeAt(0)),);- // Phantom Lighthouse requires the wallet to sign FIRST when there are- // multiple signers; additional signers must sign afterward.const signed = await w.signTransaction(tx);+ // Sign with our client-ground mint keypair (the 3ws-stamped one).+ signed.sign([Keypair.fromSecretKey(ground.secretKey)]);+ // If the server also returned a mint secret (shouldn't happen when we supply one,+ // but handle gracefully for backward-compat).if (prep.mint_secret_key_b64) {- signed.sign([Keypair.fromSecretKey(- Uint8Array.from(atob(prep.mint_secret_key_b64), (c) => c.charCodeAt(0)),- )]);+ try {+ signed.sign([Keypair.fromSecretKey(+ Uint8Array.from(atob(prep.mint_secret_key_b64), (c) => c.charCodeAt(0)),+ )]);+ } catch { /* ignore duplicate signer */ }}// Send + poll confirmation (75s timeout)@@ -1099,7 +1140,8 @@ export function mountLaunchPanel(container, { getAvatar, getUser, getPreviewView}async function launchViaAgentWallet(nameTrim, symTrim) {- s.phase = 'signing'; s.phaseLabel = 'Agent wallet signing…'; render();+ // Server stamps the 3ws mark; reflect this phase so the user knows.+ s.phase = 'stamping'; s.phaseLabel = 'Stamping the three.ws mark 3ws…'; render();const isUsdc = s.coinType === 'usdc';const buyIn = Math.max(0, parseFloat(s.initialBuy) || 0);@@ -1618,28 +1660,40 @@ export function mountLaunchPanel(container, { getAvatar, getUser, getPreviewView${walletHtml}${s.phase === 'error' ? `<div class="lp-err">${esc(s.errorMsg)}<div class="lp-err-sub">Adjust the details above and try again — nothing has been minted yet.</div></div>` : ''}<button class="lp-launch${busy ? ' busy' : ''}" id="lp-go" data-action="${btnAction}"${btnTitle ? ` title="${esc(btnTitle)}"` : ''} ${btnDis ? 'disabled' : ''}>${btnText}</button>- ${busy ? `<div class="lp-phase">${esc(s.phaseLabel)}</div>` : ''}+ ${busy ? `<div class="lp-phase" role="status" aria-live="polite">${esc(s.phaseLabel)}</div>` : ''}+ ${s.phase === 'stamping' ? `<div class="lp-stamp-live" id="lp-stamp-live" role="status" aria-live="polite" aria-atomic="false"><span class="lp-spspin" aria-hidden="true"></span>Stamping the three.ws mark <strong>3ws</strong>…</div>` : ''}</div>`;wireForm();}+ /** Render a mint with the leading 3ws mark visually emphasized. */+ function stampedMintMarkup(mint) {+ if (!mint) return '';+ const mark = esc(mint.slice(0, 3));+ const tail = mint.slice(3);+ const tailShort = tail.length > 8 ? tail.slice(0, 4) + '…' + tail.slice(-4) : esc(tail);+ return `<span class="lp-ok-mint-marked" title="${esc(mint)}"><span class="lp-mark" aria-label="three.ws mark">${mark}</span><span class="lp-rest">${tailShort}</span></span>`;+ }+function renderSuccess() {const imgSrc = s.imagePreviewUrl || av?.thumbnail_url;const mint = s.mint || '';- const mintShort = mint ? mint.slice(0, 6) + '…' + mint.slice(-6) : '';const sym = s.symbol.trim() || 'TOKEN';const agentId = s.resolvedAgentId || av?.agent_id;const shareText = `Just launched $${sym} on pump.fun 🎉 Built with three.ws\n${PUMP_URL(mint)}`;+ const mintDisplay = stampedMintMarkup(mint);+container.innerHTML = `<div class="lp"><div class="lp-ok">${imgSrc ? `<img class="lp-ok-thumb" src="${esc(imgSrc)}" alt="" />` : `<div class="lp-ok-thumb-ph">🪙</div>`}<p class="lp-ok-title">$${esc(sym)} is live!</p>- <p class="lp-ok-sub">Your token is live on pump.fun</p>+ <p class="lp-ok-stamp-sub">Stamped on-chain — every three.ws coin starts with <strong style="color:rgba(255,255,255,.75);font-weight:600">3ws</strong>.</p><div class="lp-ok-mint">- <span title="${esc(mint)}">${mintShort}</span>+ <span class="lp-ok-mint-addr">${mintDisplay || esc(mint)}</span><button class="lp-copy" id="lp-copy-mint">Copy</button></div>+ <span class="lp-ok-verified">✓ three.ws coin</span><div class="lp-ok-links"><a class="lp-ext" href="${esc(PUMP_URL(mint))}" target="_blank" rel="noopener">pump.fun ↗</a><a class="lp-ext" href="https://solscan.io/token/${esc(mint)}" target="_blank" rel="noopener">Solscan ↗</a>diff --git a/public/style.css b/public/style.cssindex 6ec27bdcd..b76a849dc 100644--- a/public/style.css+++ b/public/style.css@@ -8543,6 +8543,102 @@ textarea.erc8004-code {margin-bottom: 6px;}+/* ── Stamp progress & success ───────────────────────────────────────────── */+.pumpfun-stamp-live {+ min-height: 1.2em;+ font-size: 11.5px;+ color: rgba(255,255,255,0.55);+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace;+ margin-bottom: 4px;+ display: flex;+ align-items: center;+ gap: 6px;+}+.pumpfun-stamp-live .pf-spin {+ width: 10px; height: 10px;+ border: 1.5px solid rgba(255,255,255,0.14);+ border-top-color: rgba(255,255,255,0.55);+ border-radius: 50%;+ animation: pf-spin 0.75s linear infinite;+ flex-shrink: 0;+}+@keyframes pf-spin { to { transform: rotate(360deg); } }+.pumpfun-stamp-live strong { color: rgba(255,255,255,0.9); font-weight: 600; }++/* Emphasized mint display: 3ws mark bold, rest muted */+.pumpfun-mint-marked {+ display: inline-flex;+ align-items: baseline;+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace;+ font-size: 0.78rem;+}+.pumpfun-mint-marked .pf-mark {+ font-weight: 700;+ color: rgba(255,255,255,0.92);+ letter-spacing: 0.02em;+}+.pumpfun-mint-marked .pf-rest {+ color: rgba(255,255,255,0.42);+ font-weight: 400;+}++/* Verified three.ws pill */+.pumpfun-verified-pill {+ display: inline-flex;+ align-items: center;+ gap: 4px;+ padding: 2px 8px;+ border-radius: 999px;+ font-size: 10.5px;+ font-weight: 500;+ letter-spacing: 0.04em;+ background: rgba(255,255,255,0.05);+ border: 1px solid rgba(255,255,255,0.12);+ color: rgba(255,255,255,0.55);+}++/* Launch success card (brief stamp-success moment) */+.pumpfun-stamp-success {+ display: flex;+ flex-direction: column;+ gap: 10px;+ padding: 14px;+ background: rgba(255,255,255,0.03);+ border: 1px solid rgba(255,255,255,0.09);+ border-radius: 12px;+}+.pumpfun-stamp-success-head {+ font-size: 13px;+ font-weight: 600;+ color: rgba(255,255,255,0.9);+ letter-spacing: -0.01em;+}+.pumpfun-stamp-success-sub {+ font-size: 11.5px;+ color: rgba(255,255,255,0.42);+ line-height: 1.5;+}+.pumpfun-stamp-success-mint {+ display: flex;+ align-items: center;+ gap: 6px;+ padding: 7px 10px;+ background: rgba(255,255,255,0.03);+ border: 1px solid rgba(255,255,255,0.08);+ border-radius: 8px;+}+.pumpfun-stamp-success-mint .pf-mint-addr {+ flex: 1;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+}+.pumpfun-stamp-success-links {+ display: flex;+ gap: 6px;+ flex-wrap: wrap;+}+/* ── Auto-Trader (bot) panel ───────────────────────────────────────────── */.pumpfun-bot { gap: 8px; }.pumpfun-bot-modes {diff --git a/pump-fun-skills/create-coin/SKILL.md b/pump-fun-skills/create-coin/SKILL.mdindex 675537b75..81d6f2612 100644--- a/pump-fun-skills/create-coin/SKILL.md+++ b/pump-fun-skills/create-coin/SKILL.md@@ -65,7 +65,7 @@ Only `user`, `name`, `symbol`, `uri`, and `solLamports` are required. All other```json{"transaction": "<base64-encoded VersionedTransaction>",- "mintPublicKey": "<base58 mint address>",+ "mintPublicKey": "<base58 mint address — starts with 3ws>","quoteTokenAmount": "123456789","solLamports": "1000000","mayhemMode": false,@@ -150,10 +150,21 @@ const onlinePump = new OnlinePumpSdk(connection);Full transaction building (compute budget, blockhash, partial sign) is implemented in `scripts/lib/tx-build.mjs` and `scripts/lib/compute.mjs`.+## three.ws brand mark (`3ws…`)++Coins created through this skill's **launch script** are **stamped with the three.ws brand mark**: the mint address always starts with `3ws` (case-insensitive). `scripts/build-create-coin-tx.mjs` does not call a bare `Keypair.generate()` — it grinds a vanity keypair whose Base58 address carries the mark before partial-signing the create transaction. This gives a scripted/CLI launch the same on-chain brand provenance as a launch from the three.ws web UI: anyone can see, straight from the mint address, that the coin originated from three.ws.++- **Which path carries the mark:** the local script (`build-create-coin-tx.mjs`) grinds the mint locally, so it always carries the mark. The hosted `POST /agents/create-coin` builder mints on pump.fun's side and is outside our control — **use the script path when brand provenance is required.**+- The grind for a 3-character case-insensitive prefix clears in well under a minute; progress is logged to **stderr** so stdout stays clean JSON for the caller.+- The mark string lives in **one** local constant — `scripts/lib/vanity.mjs` (`THREE_WS_MARK`), which mirrors the canonical `src/solana/vanity/brand.js` in the three.ws repo. Never hardcode `3ws` anywhere else in this package.+- The response JSON includes a `brandMark` field (`"3ws"`) alongside `mintPublicKey` for confirmation.++This is brand plumbing on the mint **address** only — it does not name, add, or reference any token. The only coin this platform discusses is **$THREE** (`FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`); all examples and fixtures stay on it.+## Create a coin- **Default:** `POST /agents/create-coin` (see API section above)-- **Script (only when user explicitly requests):** `scripts/build-create-coin-tx.mjs`+- **Script (only when user explicitly requests):** `scripts/build-create-coin-tx.mjs` — grinds a `3ws…` marked mint (see above)- **Metadata JSON:** [references/METADATA.md](references/METADATA.md)### Parameters (`createV2AndBuyInstructions`)@@ -161,7 +172,7 @@ Full transaction building (compute budget, blockhash, partial sign) is implement| Parameter | Type | Description || ------------ | ----------- | ---------------------------------------------------------------------- || `global` | `Global` | From `OnlinePumpSdk.fetchGlobal()` |-| `mint` | `PublicKey` | New mint (generated keypair) |+| `mint` | `PublicKey` | New mint (vanity keypair ground to the `3ws…` brand mark) || `name` | `string` | Coin name || `symbol` | `string` | Ticker || `uri` | `string` | Metadata JSON URL |diff --git a/pump-fun-skills/create-coin/scripts/build-create-coin-tx.mjs b/pump-fun-skills/create-coin/scripts/build-create-coin-tx.mjsindex 86aa8db0a..0d13bf545 100644--- a/pump-fun-skills/create-coin/scripts/build-create-coin-tx.mjs+++ b/pump-fun-skills/create-coin/scripts/build-create-coin-tx.mjs@@ -30,6 +30,7 @@ import {ALT_ADDRESS_DEVNET,} from "./lib/constants.mjs";import { buildAndPartialSignTx, transactionToBase64 } from "./lib/tx-build.mjs";+import { grindMarkedMint, THREE_WS_MARK } from "./lib/vanity.mjs";const AGENT_INITIALIZE_DEFAULT_UNITS = 30_000;const DEFAULT_BUYBACK_BPS = 5000;@@ -148,7 +149,14 @@ async function main() {}}- const mintKeypair = Keypair.generate();+ // Every coin created through this skill is stamped with the three.ws mark:+ // its mint address starts with `3ws…`. Grind a marked mint instead of a bare+ // Keypair.generate() so a skill/CLI launch carries the same brand provenance+ // as a web-UI launch. The grind logs progress to stderr (stdout stays clean+ // JSON for the caller).+ const mintKeypair = grindMarkedMint(Keypair, {+ onProgress: (msg) => process.stderr.write(`[${THREE_WS_MARK}] ${msg}\n`),+ });const mint = mintKeypair.publicKey;const solAmount = new BN(solLamports);@@ -206,6 +214,7 @@ async function main() {printJson({transaction: transactionToBase64(tx),mintPublicKey: mint.toBase58(),+ brandMark: THREE_WS_MARK,mintKeypairPath: resolvedOut,quoteTokenAmount: tokenAmount.toString(),solLamports,diff --git a/pump-fun-skills/create-coin/scripts/lib/vanity.mjs b/pump-fun-skills/create-coin/scripts/lib/vanity.mjsnew file mode 100644index 000000000..860c05b20--- /dev/null+++ b/pump-fun-skills/create-coin/scripts/lib/vanity.mjs@@ -0,0 +1,54 @@+// The three.ws on-chain brand mark — self-contained mirror for this skill.+//+// This skill ships as a standalone Agent Skill package (its own package.json /+// lockfile / manifest) and is distributed independently of the repo, so it+// cannot import the canonical brand module at src/solana/vanity/brand.js. The+// mark string below is the ONE local source of truth for the package — mirror+// it, never re-hardcode '3ws' anywhere else in these scripts.+//+// Canonical definition (keep in sync): src/solana/vanity/brand.js → THREE_WS_MARK+export const THREE_WS_MARK = "3ws";++/**+ * True when a Base58 mint address carries the three.ws mark (case-insensitive+ * prefix). Mirrors hasThreeWsMark() in src/solana/vanity/brand.js.+ * @param {unknown} address+ * @returns {boolean}+ */+export function hasThreeWsMark(address) {+ if (typeof address !== "string" || address.length < THREE_WS_MARK.length) return false;+ return address.slice(0, THREE_WS_MARK.length).toLowerCase() === THREE_WS_MARK.toLowerCase();+}++/**+ * Grind a fresh Solana mint keypair whose address carries the three.ws mark.+ *+ * Pure-JS grind (repeated Keypair.generate) — no WASM/worker pool to keep the+ * package self-contained. A 3-char case-insensitive prefix is ~1-in-49k, which+ * clears in well under a minute on the throwaway-keypair path. A launch is a+ * deliberate, infrequent action, so the wait is acceptable; progress is logged+ * to stderr so the operator sees the grind working.+ *+ * @param {(typeof import("@solana/web3.js"))["Keypair"]} Keypair+ * @param {object} [opts]+ * @param {(msg: string) => void} [opts.onProgress] Called periodically with a status line.+ * @returns {import("@solana/web3.js").Keypair}+ */+export function grindMarkedMint(Keypair, opts = {}) {+ const onProgress = typeof opts.onProgress === "function" ? opts.onProgress : null;+ const startedAt = Date.now();+ let attempts = 0;+ for (;;) {+ const kp = Keypair.generate();+ attempts++;+ if (hasThreeWsMark(kp.publicKey.toBase58())) {+ if (onProgress) {+ onProgress(`marked mint ${kp.publicKey.toBase58()} (${attempts} attempts, ${Date.now() - startedAt}ms)`);+ }+ return kp;+ }+ if (onProgress && attempts % 5000 === 0) {+ onProgress(`grinding ${THREE_WS_MARK}… ${attempts} attempts, ${Math.round((Date.now() - startedAt) / 1000)}s`);+ }+ }+}diff --git a/scripts/coin-cli.mjs b/scripts/coin-cli.mjsindex 49f810c8c..b07fd019a 100644--- a/scripts/coin-cli.mjs+++ b/scripts/coin-cli.mjs@@ -45,6 +45,9 @@ import { AnchorProvider, Wallet } from '@coral-xyz/anchor';import { PumpSdk, getBuyTokenAmountFromSolAmount } from '@pump-fun/pump-sdk';import BN from 'bn.js';+import { grindVanityNode } from '../src/solana/vanity/grinder-node.js';+import { THREE_WS_VANITY, THREE_WS_MARK, hasThreeWsMark } from '../src/solana/vanity/brand.js';+const __dirname = path.dirname(fileURLToPath(import.meta.url));const REPO_ROOT = path.resolve(__dirname, '..');@@ -218,7 +221,7 @@ async function cmdPrepare(positional, opts) {async function cmdLaunch(positional, opts) {const [uri] = positional;- if (!uri) throw new Error('Usage: launch <metadata-url> --wallet <buyer.json> --creator <creator.json> [--buy <sol>] [--name "..."] [--symbol "..."] [--execute]');+ if (!uri) throw new Error('Usage: launch <metadata-url> --wallet <buyer.json> --creator <creator.json> [--buy <sol>] [--name "..."] [--symbol "..."] [--mint-keypair <path>] [--no-mark] [--execute]');if (!opts.wallet) throw new Error('--wallet <buyer.json> is required (fee payer + initial buyer)');if (!opts.creator) throw new Error('--creator <creator.json> is required (pump.fun creator address; receives creator fees)');if (!opts.name) throw new Error('--name "..." is required');@@ -232,12 +235,35 @@ async function cmdLaunch(positional, opts) {const buyer = loadKeypair(opts.wallet);const creator = loadKeypair(opts.creator);+ // Every three.ws coin mint carries the brand mark — its address starts with+ // `3ws…`. The default path grinds a marked mint. The --mint-keypair escape+ // hatch lets power users supply a pre-ground mint, but we refuse an unmarked+ // one unless --no-mark is passed (the same kill-switch the server exposes for+ // genuinely coin-agnostic, caller-supplied plumbing).+ const noMark = !!opts['no-mark'];let mint;if (opts['mint-keypair']) {mint = loadKeypair(opts['mint-keypair']);- console.error(`Using existing mint keypair: ${mint.publicKey.toBase58()}`);- } else {+ const marked = hasThreeWsMark(mint.publicKey.toBase58());+ if (!marked && !noMark) {+ throw new Error(+ `supplied --mint-keypair ${mint.publicKey.toBase58()} does not carry the three.ws "${THREE_WS_MARK}" mark. ` ++ `Pass a mint whose address starts with "${THREE_WS_MARK}", omit --mint-keypair to grind one, ` ++ `or pass --no-mark to launch an unbranded mint deliberately.`,+ );+ }+ console.error(+ `Using existing mint keypair: ${mint.publicKey.toBase58()}` ++ (marked ? ` (carries ${THREE_WS_MARK} mark)` : ' (UNMARKED — --no-mark override)'),+ );+ } else if (noMark) {mint = Keypair.generate();+ console.error(`Generated unmarked mint (--no-mark): ${mint.publicKey.toBase58()}`);+ } else {+ console.error(`Grinding ${THREE_WS_MARK}… mint mark (sub-minute)…`);+ const ground = grindVanityNode({ ...THREE_WS_VANITY });+ mint = Keypair.fromSecretKey(ground.secretKey);+ console.error(` marked mint: ${mint.publicKey.toBase58()} (${ground.attempts} attempts, ${Math.round(ground.durationMs)}ms)`);}const connection = new Connection(rpc, 'confirmed');@@ -486,7 +512,8 @@ async function main() {console.error(' keygen [--out <path>]');console.error(' prepare <name> <symbol> [--description "..."] [--image <url>] [--website https://three.ws]');console.error(' launch <metadata-url> --wallet <buyer.json> --creator <creator.json> --name "..." --symbol "..."');- console.error(' [--buy <sol>] [--mint-keypair <path>] [--network mainnet|devnet] [--rpc <url>] [--execute]');+ console.error(' [--buy <sol>] [--mint-keypair <path>] [--no-mark] [--network mainnet|devnet] [--rpc <url>] [--execute]');+ console.error(` (mint is ground to the ${THREE_WS_MARK}… brand mark by default; --no-mark opts out for coin-agnostic plumbing)`);console.error(' register <mint> --name "..." --symbol "..." --creator-wallet <pubkey>');console.error(' [--creator-secret-b64 <b64>] [--lottery-bps 7000] [--reflection-bps 2500] [--ops-bps 500]');console.error(' [--draw-interval-seconds 3600] [--ops-wallet <pubkey>] [--network mainnet|devnet]');diff --git a/scripts/direct-pump-launch.mjs b/scripts/direct-pump-launch.mjsindex fe29234ea..9a11eeb6c 100644--- a/scripts/direct-pump-launch.mjs+++ b/scripts/direct-pump-launch.mjs@@ -26,6 +26,9 @@ import {import { PumpSdk, OnlinePumpSdk, getBuyTokenAmountFromSolAmount } from '@pump-fun/pump-sdk';import BN from 'bn.js';+import { grindVanityNode } from '../src/solana/vanity/grinder-node.js';+import { THREE_WS_VANITY, THREE_WS_MARK } from '../src/solana/vanity/brand.js';+const __dirname = path.dirname(fileURLToPath(import.meta.url));const REPO_ROOT = path.resolve(__dirname, '..');const WALLET_PATH = path.join(REPO_ROOT, '.fresh-pump-wallet.json');@@ -116,8 +119,11 @@ async function cmdLaunch(name, symbol, uri, opts) {throw new Error(`Need at least ~${minNeeded.toFixed(3)} SOL; have ${(lamports / LAMPORTS_PER_SOL).toFixed(4)}`);}- const mintKp = Keypair.generate();- console.log('Mint: ', mintKp.publicKey.toBase58());+ // Stamp the three.ws brand mark on the mint — its address starts with `3ws…`.+ console.log(`Grinding ${THREE_WS_MARK}… mint mark (sub-minute)…`);+ const groundMint = grindVanityNode({ ...THREE_WS_VANITY });+ const mintKp = Keypair.fromSecretKey(groundMint.secretKey);+ console.log('Mint: ', mintKp.publicKey.toBase58(), `(${THREE_WS_MARK} mark, ${groundMint.attempts} attempts, ${Math.round(groundMint.durationMs)}ms)`);console.log('Name: ', name);console.log('Symbol: ', symbol);console.log('Metadata: ', uri);diff --git a/scripts/pump-launch-usdc.mjs b/scripts/pump-launch-usdc.mjsindex 8fe7d358c..2c9b66988 100644--- a/scripts/pump-launch-usdc.mjs+++ b/scripts/pump-launch-usdc.mjs@@ -28,6 +28,7 @@ import {getBuyTokenAmountFromSolAmount,} from '@pump-fun/pump-sdk';import { getAssociatedTokenAddress, getAccount } from '@solana/spl-token';+import { THREE_WS_MARK, hasThreeWsMark } from '../src/solana/vanity/brand.js';const RPC = process.env.SOLANA_RPC_URL || 'https://api.mainnet-beta.solana.com';const USDC_MAINNET = new PublicKey('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v');@@ -95,6 +96,26 @@ async function main() {console.log(' mint: ', mint.publicKey.toBase58());console.log('');+ // The launched mint must carry the three.ws brand mark (address starts with+ // `3ws…`). mint-latest.json is expected to be a pre-ground vanity keypair+ // (grind one with `node scripts/coin-cli.mjs launch …` or the /vanity tool).+ // Fail closed on an unbranded mint unless ALLOW_UNMARKED_MINT=1 is set for+ // genuinely coin-agnostic plumbing — the same kill-switch the server exposes.+ if (!hasThreeWsMark(mint.publicKey.toBase58()) && process.env.ALLOW_UNMARKED_MINT !== '1') {+ writeResult({+ ok: false,+ reason: 'unmarked_mint',+ mint: mint.publicKey.toBase58(),+ expected_prefix: THREE_WS_MARK,+ });+ console.error(+ `Aborting: mint ${mint.publicKey.toBase58()} does not carry the three.ws "${THREE_WS_MARK}" mark.\n` ++ ` Supply a vanity mint at mint-latest.json whose address starts with "${THREE_WS_MARK}", ` ++ `or set ALLOW_UNMARKED_MINT=1 to launch an unbranded mint deliberately.`,+ );+ process.exit(1);+ }+const connection = new Connection(RPC, 'confirmed');// ── 1. Verify funding ──────────────────────────────────────────────────diff --git a/scripts/pumpfun-lifecycle-smoke.js b/scripts/pumpfun-lifecycle-smoke.jsindex 51f4dfb30..a10da44ab 100755--- a/scripts/pumpfun-lifecycle-smoke.js+++ b/scripts/pumpfun-lifecycle-smoke.js@@ -25,6 +25,8 @@import { Connection, Keypair, VersionedTransaction } from '@solana/web3.js';import bs58 from 'bs58';+import { THREE_WS_MARK, hasThreeWsMark } from '../src/solana/vanity/brand.js';+const BASE = process.env.SMOKE_BASE_URL || 'http://localhost:3000';const OWNER_K = process.env.SMOKE_OWNER_KEY;const AGENT_ID = process.env.SMOKE_AGENT_ID;@@ -116,8 +118,13 @@ if (PHASES.includes('create')) {if (!confirm.ok)throw new Error(`launch-confirm ${confirm.status}: ${JSON.stringify(confirm.body)}`);MINT = prep.body.mint || confirm.body.pump_agent_mint?.mint;- report.phases.create = { ok: true, mint: MINT, signature: sig };- console.log(' ✓ create', MINT);+ // Regression-guard the brand end-to-end: a server-minted coin must carry+ // the three.ws mark (address starts with `3ws…`), case-insensitively.+ if (!/^3ws/i.test(MINT || '') || !hasThreeWsMark(MINT)) {+ throw new Error(`minted ${MINT} is missing the three.ws "${THREE_WS_MARK}" mark`);+ }+ report.phases.create = { ok: true, mint: MINT, marked: true, signature: sig };+ console.log(' ✓ create', MINT, `(${THREE_WS_MARK} mark)`);} catch (e) {report.phases.create = { ok: false, error: e.message };console.log(' ✗ create:', e.message);diff --git a/src/agent-home-pumpfun.js b/src/agent-home-pumpfun.jsindex 969df6e12..deb3c8e43 100644--- a/src/agent-home-pumpfun.js+++ b/src/agent-home-pumpfun.js@@ -50,6 +50,9 @@ export function mountPumpFunCard({ panel, identity, skills, memory, protocol })vanityEnabled: false,vanitySuffix: 'pump',vanityProgress: null,+ // 3ws stamp state: null | 'grinding' | 'done'+ stampPhase: null,+ stampedMint: null,// auto-traderbotOpen: false,botMode: 'auto-snipe',@@ -65,6 +68,7 @@ export function mountPumpFunCard({ panel, identity, skills, memory, protocol })botEventCount: 0,};let botAbort = null;+ let stampAbort = null;// Stable per-mode session ids — re-running the same mode resumes prior state.const botSessionIds = {'research-and-buy': `pf-research-${identity.id}`,@@ -80,7 +84,23 @@ export function mountPumpFunCard({ panel, identity, skills, memory, protocol })cardBody.className = 'pumpfun-card-body';root.appendChild(cardBody);- const launchCard = () => `+ const launchCard = () => {+ const isGrinding = state.stampPhase === 'grinding';+ const isStamped = state.stampPhase === 'done';+ const stampLabel = isGrinding+ ? `<span class="pf-spin" aria-hidden="true"></span>Stamping the three.ws mark <strong>3ws</strong>…${state.vanityProgress ? ` · ${formatNumber(state.vanityProgress.rate)}/s · ${escapeHtml(state.vanityProgress.eta)}` : ''}`+ : '';++ const mintDisplay = isStamped && state.stampedMint+ ? stampedMintHtml(state.stampedMint)+ : '';++ let btnText;+ if (isGrinding) btnText = 'Stamping 3ws…';+ else if (isStamped) btnText = 'Launching…';+ else btnText = `Launch ${escapeHtml(deriveSymbol(identity.name))}`;++ return `<div class="pumpfun-card pumpfun-card--cta"><div class="pumpfun-card-head"><span class="pumpfun-card-icon">◎</span>@@ -88,21 +108,24 @@ export function mountPumpFunCard({ panel, identity, skills, memory, protocol })</div><p class="pumpfun-card-sub">Mint a token whose metadata is your 3D avatar.</p><div class="pumpfun-signer" role="tablist" aria-label="Signer">- <button class="pumpfun-signer-tab ${state.signer === 'agent' ? 'is-active' : ''}" data-action="signer-agent" role="tab" aria-selected="${state.signer === 'agent'}">Agent wallet</button>- <button class="pumpfun-signer-tab ${state.signer === 'owner' ? 'is-active' : ''}" data-action="signer-owner" role="tab" aria-selected="${state.signer === 'owner'}">Owner wallet</button>+ <button class="pumpfun-signer-tab ${state.signer === 'agent' ? 'is-active' : ''}" data-action="signer-agent" role="tab" aria-selected="${state.signer === 'agent'}" ${isGrinding || isStamped ? 'disabled' : ''}>Agent wallet</button>+ <button class="pumpfun-signer-tab ${state.signer === 'owner' ? 'is-active' : ''}" data-action="signer-owner" role="tab" aria-selected="${state.signer === 'owner'}" ${isGrinding || isStamped ? 'disabled' : ''}>Owner wallet</button></div>- <label class="pumpfun-vanity-row" title="Grind a custom mint address ending in your suffix. Slower, but distinctive.">- <input type="checkbox" data-action="toggle-vanity" ${state.vanityEnabled ? 'checked' : ''}>- <span>Vanity ends with</span>- <input type="text" data-action="vanity-suffix" value="${escapeAttr(state.vanitySuffix)}" maxlength="6" ${state.vanityEnabled ? '' : 'disabled'} class="pumpfun-vanity-input">+ <label class="pumpfun-vanity-row" title="Grind a custom mint address ending in your suffix. The three.ws 3ws prefix is always stamped first.">+ <input type="checkbox" data-action="toggle-vanity" ${state.vanityEnabled ? 'checked' : ''} ${isGrinding || isStamped ? 'disabled' : ''}>+ <span>Custom suffix</span>+ <input type="text" data-action="vanity-suffix" value="${escapeAttr(state.vanitySuffix)}" maxlength="6" ${state.vanityEnabled && !isGrinding && !isStamped ? '' : 'disabled'} class="pumpfun-vanity-input"></label>- ${state.vanityProgress ? `<div class="pumpfun-vanity-progress">grinding… ${formatNumber(state.vanityProgress.rate)}/s · eta ${escapeHtml(state.vanityProgress.eta)}</div>` : ''}- <button class="pumpfun-btn pumpfun-btn--primary" id="pf-launch-btn">- Launch ${deriveSymbol(identity.name)}+ <div class="pumpfun-stamp-live" role="status" aria-live="polite" aria-atomic="false" id="pf-stamp-live">${stampLabel}</div>+ ${mintDisplay ? `<div class="pumpfun-stamp-success-mint" style="margin-bottom:4px"><div class="pf-mint-addr">${mintDisplay}</div></div>` : ''}+ <button class="pumpfun-btn pumpfun-btn--primary" id="pf-launch-btn" ${isStamped ? 'disabled' : ''}>+ ${btnText}</button>+ ${isGrinding ? `<button class="pumpfun-btn pumpfun-btn--ghost" id="pf-stamp-cancel" style="margin-top:4px">Cancel</button>` : ''}<a class="pumpfun-card-foot" href="https://pump.fun" target="_blank" rel="noopener">What is pump.fun?</a></div>- `;+ `;+ };const statusCard = (s) => {const pct = s.progressPct != null ? `${s.progressPct.toFixed(1)}%` : '—';@@ -239,11 +262,45 @@ export function mountPumpFunCard({ panel, identity, skills, memory, protocol })const skeleton = () => `<div class="pumpfun-card pumpfun-card--skeleton"></div>`;+ const stampSuccessCard = (mint, symbol) => {+ const network = state.network;+ const explorer = network === 'devnet'+ ? `https://pump.fun/coin/${mint}?cluster=devnet`+ : `https://pump.fun/coin/${mint}`;+ return `+ <div class="pumpfun-stamp-success">+ <div class="pumpfun-stamp-success-head">$${escapeHtml(symbol || 'TOKEN')} stamped & live</div>+ <div class="pumpfun-stamp-success-sub">Stamped on-chain — every three.ws coin starts with <strong style="color:rgba(255,255,255,0.8);font-weight:600">3ws</strong>.</div>+ <div class="pumpfun-stamp-success-mint">+ <div class="pf-mint-addr">${stampedMintHtml(mint)}</div>+ <button class="pumpfun-btn pumpfun-btn--ghost" id="pf-copy-stamped" style="font-size:11px;padding:3px 8px">Copy</button>+ <span class="pumpfun-verified-pill">✓ three.ws</span>+ </div>+ <div class="pumpfun-stamp-success-links">+ <a class="pumpfun-btn pumpfun-btn--ghost" href="${escapeAttr(explorer)}" target="_blank" rel="noopener" style="font-size:11.5px">pump.fun ↗</a>+ <a class="pumpfun-btn pumpfun-btn--ghost" href="https://solscan.io/token/${escapeAttr(mint)}" target="_blank" rel="noopener" style="font-size:11.5px">Solscan ↗</a>+ </div>+ </div>+ `;+ };+const render = () => {if (state.loading) {cardBody.innerHTML = skeleton();return;}+ if (state.mint && state.stampPhase === 'success') {+ cardBody.innerHTML = stampSuccessCard(state.mint, state.symbol);+ const copyBtn = cardBody.querySelector('#pf-copy-stamped');+ if (copyBtn) {+ copyBtn.addEventListener('click', () => {+ navigator.clipboard?.writeText(state.mint).catch(() => {});+ copyBtn.textContent = '✓';+ setTimeout(() => { copyBtn.textContent = 'Copy'; }, 1600);+ });+ }+ return;+ }cardBody.innerHTML = state.mint ? statusCard(state) : launchCard();bind();// Restore focus to the input after re-render so typing stays uninterrupted.@@ -262,6 +319,12 @@ export function mountPumpFunCard({ panel, identity, skills, memory, protocol })if (launchBtn) {launchBtn.addEventListener('click', () => doLaunch(launchBtn));}+ const cancelBtn = cardBody.querySelector('#pf-stamp-cancel');+ if (cancelBtn) {+ cancelBtn.addEventListener('click', () => {+ if (stampAbort) { try { stampAbort.abort(); } catch {} }+ });+ }cardBody.querySelectorAll('[data-action]').forEach((btn) => {btn.addEventListener('click', (e) => handleAction(btn.dataset.action, e));});@@ -306,43 +369,68 @@ export function mountPumpFunCard({ panel, identity, skills, memory, protocol })async function doLaunch(launchBtn) {launchBtn.disabled = true;const useAgent = state.signer === 'agent';- const wantsVanity = state.vanityEnabled && state.vanitySuffix?.trim();- launchBtn.textContent = wantsVanity ? 'Grinding vanity…' : 'Launching…';+ const retryLabel = `Launch ${deriveSymbol(identity.name)}`;+try {let extraArgs = {};- if (wantsVanity) {- if (useAgent) {- // Server grinds + signs in the same request.- extraArgs = { vanitySuffix: state.vanitySuffix.trim() };- launchBtn.textContent = `Launching with …${state.vanitySuffix.trim()}…`;- } else {- // Client grinds with workers, owner wallet signs.- try {- const { grindVanity } = await import('./solana/vanity/grinder.js');- const ground = await grindVanity({- suffix: state.vanitySuffix.trim(),- onProgress: (p) => {- state.vanityProgress = { rate: p.rate, eta: p.eta };- const slot = cardBody.querySelector('.pumpfun-vanity-progress');- if (slot) slot.textContent = `grinding… ${formatNumber(p.rate)}/s · eta ${p.eta}`;- },- });- extraArgs = {- mintPublicKey: ground.publicKey,- mintSecretKeyB64: btoa(String.fromCharCode(...ground.secretKey)),- };- state.vanityProgress = null;- launchBtn.textContent = `Launching ${shortMint(ground.publicKey)}…`;- } catch (err) {- state.vanityProgress = null;- launchBtn.disabled = false;- launchBtn.textContent = `Retry launch ${deriveSymbol(identity.name)}`;- toast(err.message || 'Vanity grind failed', null, null, 'error');- render();- return;++ if (!useAgent) {+ // Client grinds the 3ws prefix (+ optional user suffix) with workers.+ // The brand mark is always required; server rejects unbranded mints.+ const { grindVanity } = await import('./solana/vanity/grinder.js');+ const { THREE_WS_VANITY } = await import('./solana/vanity/brand.js');++ const userSuffix = state.vanityEnabled ? (state.vanitySuffix?.trim() || '') : '';+ stampAbort = new AbortController();++ state.stampPhase = 'grinding';+ state.vanityProgress = null;+ render();++ let ground;+ try {+ ground = await grindVanity({+ ...THREE_WS_VANITY,+ ...(userSuffix ? { suffix: userSuffix } : {}),+ signal: stampAbort.signal,+ onProgress: (p) => {+ state.vanityProgress = { rate: p.rate, eta: p.eta };+ const liveEl = cardBody.querySelector('#pf-stamp-live');+ if (liveEl) {+ liveEl.innerHTML = `<span class="pf-spin" aria-hidden="true"></span>Stamping the three.ws mark <strong>3ws</strong>… · ${formatNumber(p.rate)}/s · ${escapeHtml(p.eta)}`;+ }+ },+ });+ } catch (err) {+ stampAbort = null;+ state.stampPhase = null;+ state.vanityProgress = null;+ launchBtn.disabled = false;+ render();+ if (err.name !== 'AbortError') {+ toast(err.message || 'Stamp grind failed', null, null, 'error');}+ return;}++ stampAbort = null;+ state.stampPhase = 'done';+ state.stampedMint = ground.publicKey;+ state.vanityProgress = null;+ extraArgs = {+ mintPublicKey: ground.publicKey,+ mintSecretKeyB64: btoa(String.fromCharCode(...ground.secretKey)),+ };+ // Patch live region to clear and button to Launching…+ const liveEl = cardBody.querySelector('#pf-stamp-live');+ if (liveEl) liveEl.innerHTML = '';+ const btnEl = cardBody.querySelector('#pf-launch-btn');+ if (btnEl) { btnEl.disabled = true; btnEl.textContent = 'Launching…'; }+ } else {+ // Agent wallet: server stamps 3ws mark. Reflect the phase on the button.+ launchBtn.textContent = 'Launching…';}+const skillName = useAgent? 'pumpfun-self-launch-from-identity': 'pumpfun-launch-from-agent';@@ -352,18 +440,50 @@ export function mountPumpFunCard({ panel, identity, skills, memory, protocol }){ identity },);if (r?.success && r.data?.mint) {- toast(`Launched ${r.data.symbol || ''}`, r.data.signature, state.network, 'success');- state = { ...state, mint: r.data.mint, symbol: r.data.symbol, loading: true };- await refresh();+ const launchedMint = r.data.mint;+ const launchedSym = r.data.symbol || '';+ toast(`Launched ${launchedSym}`, r.data.signature, state.network, 'success');+ state = {+ ...state,+ mint: launchedMint,+ symbol: launchedSym,+ stampPhase: 'success',+ stampedMint: launchedMint,+ loading: false,+ };+ render();+ setTimeout(async () => {+ state.stampPhase = null;+ state.loading = true;+ await refresh();+ }, 3500);} else {+ const isUnbranded = /unbranded_mint/.test(r?.output || '');+ state.stampPhase = null;+ state.stampedMint = null;launchBtn.disabled = false;- launchBtn.textContent = `Retry launch ${deriveSymbol(identity.name)}`;- toast(r?.output || 'Launch failed', null, null, 'error');+ launchBtn.textContent = isUnbranded ? 'Could not stamp the brand — retry' : retryLabel;+ render();+ toast(+ isUnbranded+ ? 'Could not stamp the three.ws mark — retry to re-grind'+ : (r?.output || 'Launch failed'),+ null, null, 'error',+ );}} catch (err) {+ state.stampPhase = null;+ state.stampedMint = null;launchBtn.disabled = false;- launchBtn.textContent = 'Launch failed — retry';- toast(err.message || 'Launch failed', null, null, 'error');+ const isUnbranded = /unbranded_mint/.test(err.message || '');+ launchBtn.textContent = isUnbranded ? 'Could not stamp the brand — retry' : 'Launch failed — retry';+ render();+ toast(+ isUnbranded+ ? 'Could not stamp the three.ws mark — retry to re-grind'+ : (err.message || 'Launch failed'),+ null, null, 'error',+ );}}@@ -701,6 +821,16 @@ export function mountPumpFunCard({ panel, identity, skills, memory, protocol })// ── helpers ─────────────────────────────────────────────────────────────────+/** Render a mint address with the leading three.ws mark visually emphasized. */+function stampedMintHtml(mint) {+ if (!mint) return '';+ const MARK_LEN = 3; // '3ws'+ const mark = escapeHtml(mint.slice(0, MARK_LEN));+ const tail = mint.slice(MARK_LEN);+ const tailShort = tail.length > 8 ? tail.slice(0, 4) + '…' + tail.slice(-4) : escapeHtml(tail);+ return `<span class="pumpfun-mint-marked" title="${escapeAttr(mint)}"><span class="pf-mark" aria-label="three.ws mark">${mark}</span><span class="pf-rest">${tailShort}</span></span>`;+}+function isExecutable(s) {if (!s.tradeOpen || !s.tradeAmount) return false;const n = parseFloat(s.tradeAmount);diff --git a/src/agent-skills-pumpfun.js b/src/agent-skills-pumpfun.jsindex d4faca8c0..d5569327b 100644--- a/src/agent-skills-pumpfun.js+++ b/src/agent-skills-pumpfun.js@@ -18,6 +18,8 @@*/import { detectSolanaWallet, SOLANA_RPC } from './erc8004/solana-deploy.js';+import { grindVanity } from './solana/vanity/grinder.js';+import { THREE_WS_VANITY, hasThreeWsMark } from './solana/vanity/brand.js';import { quoteSwap } from './pump/pump-swap-quote.js';import { fetchChannelFeed } from './pump/channel-feed.js';import { listRecentClaims } from './pump/pumpkit-claims.js';@@ -216,8 +218,20 @@ export function registerPumpFunSkills(skills) {const bin = atob(args.mintSecretKeyB64);const secret = Uint8Array.from(bin, (c) => c.charCodeAt(0));mintKeypair = web3.Keypair.fromSecretKey(secret);+ // Fail closed: a caller-supplied mint must already carry the 3ws mark.+ if (!hasThreeWsMark(mintKeypair.publicKey.toBase58())) {+ return {+ success: false,+ output:+ 'Supplied mint does not carry the three.ws "3ws" mark. Grind a marked mint, or omit it to stamp one automatically.',+ sentiment: -0.3,+ };+ }} else {- mintKeypair = web3.Keypair.generate();+ // Default: grind the three.ws brand mark so every launch leads with 3ws…+ // (~49k attempts, sub-second). The mint secret never leaves the browser.+ const ground = await grindVanity({ ...THREE_WS_VANITY });+ mintKeypair = web3.Keypair.fromSecretKey(ground.secretKey);}const offline = new pump.PumpSdk();let instructions;diff --git a/src/pump/pump-modals.js b/src/pump/pump-modals.jsindex 20d13174c..b7eebc3f3 100644--- a/src/pump/pump-modals.js+++ b/src/pump/pump-modals.js@@ -10,6 +10,9 @@* (window.solana / phantom / backpack / solflare). Frontend never holds keys.*/+import { grindVanity } from '../solana/vanity/grinder.js';+import { THREE_WS_VANITY } from '../solana/vanity/brand.js';+const M_STYLES = `.pmodal-back {position: fixed; inset: 0; background: rgba(0,0,0,0.55); backdrop-filter: blur(6px);@@ -393,6 +396,8 @@ function openGovernance({ mint, currentBps }) {function openLaunch({ identity, agentId, avatarId, formData }) {const { inner, close } = openModal();let step = 1;+ // Aborts the in-browser 3ws-mark grind if the user backs out mid-stamp.+ let launchGrindAbort = null;// USDC mainnet mint — pump.fun v2 quote when the user picks USDC pair.const USDC_MAINNET = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v';@@ -511,12 +516,14 @@ function openLaunch({ identity, agentId, avatarId, formData }) {body.innerHTML = `<div class="pmodal-row"><span>Name</span><b>${esc(name)}</b></div><div class="pmodal-row"><span>Symbol</span><b>$${esc(symbol)}</b></div>+ <div class="pmodal-row"><span>Mint mark</span><b><code>3ws</code>…</b></div><div class="pmodal-row"><span>Buyback</span><b>${((f.bps || 500) / 100).toFixed(1)}%</b></div><div class="pmodal-row"><span>Initial buy</span><b>${f.buyin || 0} SOL</b></div><div class="pmodal-row"><span>Tx</span><b>createInstruction + PumpAgent.create</b></div><div class="pmodal-sub" style="margin-top:0.7rem">- You'll sign once with your Solana wallet. The new mint keypair and your wallet co-sign.+ Every three.ws coin is stamped <code>3ws…</code> on-chain. We grind the mark in your browser, then you sign once — the mint keypair and your wallet co-sign.</div>+ <div class="pmodal-meta-building" id="pmodal-launch-grind" role="status" aria-live="polite" aria-atomic="false" hidden></div>`;}@@ -571,6 +578,44 @@ function openLaunch({ identity, agentId, avatarId, formData }) {} else {const btn = inner.querySelector('#pmodal-launch-next');btn.disabled = true;++ // 1 ── Grind the three.ws brand mark in the browser. The mint secret+ // never leaves the page; the server builds the tx around our vanity+ // pubkey and we co-sign locally.+ btn.textContent = 'Stamping 3ws…';+ const grindEl = inner.querySelector('#pmodal-launch-grind');+ if (grindEl) { grindEl.hidden = false; grindEl.textContent = 'Stamping the three.ws mark 3ws…'; }+ let mintKp;+ launchGrindAbort = new AbortController();+ try {+ const ground = await grindVanity({+ ...THREE_WS_VANITY,+ signal: launchGrindAbort.signal,+ onProgress: ({ rate, eta }) => {+ if (grindEl && grindEl.isConnected) {+ grindEl.textContent = `Stamping the three.ws mark 3ws… ${Math.round(rate).toLocaleString()}/s · eta ${eta}`;+ }+ },+ });+ mintKp = Keypair.fromSecretKey(ground.secretKey);+ } catch (e) {+ launchGrindAbort = null;+ if (e?.name === 'AbortError' || !inner.isConnected) return; // user backed out+ errEl.textContent = e.message || 'Could not stamp the three.ws mark.';+ btn.disabled = false; btn.textContent = 'Launch on-chain';+ if (grindEl) grindEl.hidden = true;+ return;+ }+ launchGrindAbort = null;+ if (!inner.isConnected) return; // modal closed mid-grind — never pop the wallet+ if (grindEl) {+ const addr = mintKp.publicKey.toBase58();+ const mark = addr.slice(0, 3);+ const tail = addr.slice(3, 9) + '…';+ grindEl.innerHTML = `Stamped <strong style="color:rgba(255,255,255,.88);font-weight:700">${mark}</strong><span style="opacity:.5">${tail}</span> — every three.ws coin starts with <strong>3ws</strong>.`;+ grindEl.setAttribute('aria-label', `Stamped three.ws mark on mint ${addr.slice(0, 6)}…`);+ }+btn.textContent = 'Preparing…';try {const wallet = detectSolanaWallet();@@ -592,19 +637,15 @@ function openLaunch({ identity, agentId, avatarId, formData }) {uri: f.uri,buyback_bps: f.bps || 0,sol_buy_in: f.buyin || 0,+ mint_address: mintKp.publicKey.toBase58(),network: 'mainnet',}),}).then((r) => r.json());if (prep.error) throw new Error(prep.error_description || prep.error);- const mintKp = prep.mint_secret_key_b64- ? Keypair.fromSecretKey(- Uint8Array.from(atob(prep.mint_secret_key_b64), (c) => c.charCodeAt(0)),- )- : null;btn.textContent = 'Sign in wallet…';const sig = await signAndSend(prep.tx_base64, {- extraSigners: mintKp ? [mintKp] : [],+ extraSigners: [mintKp],network: 'mainnet',});btn.textContent = 'Confirming…';@@ -615,8 +656,16 @@ function openLaunch({ identity, agentId, avatarId, formData }) {body: JSON.stringify({ prep_id: prep.prep_id, tx_signature: sig }),}).then((r) => r.json());if (confirm.error) throw new Error(confirm.error_description || confirm.error);+ // Show the stamped mint with emphasized 3ws prefix before redirect.+ const launchedMint = confirm.pump_agent_mint?.mint || mintKp.publicKey.toBase58();+ const mintMark = launchedMint.slice(0, 3);+ const mintRest = launchedMint.slice(3, 7) + '…' + launchedMint.slice(-4);+ if (grindEl) {+ grindEl.hidden = false;+ grindEl.className = 'pmodal-ok';+ grindEl.innerHTML = `Stamped on-chain — every three.ws coin starts with <strong style="font-weight:700">3ws</strong>. Mint: <strong style="color:rgba(255,255,255,.88);font-weight:700" aria-label="three.ws mark">${mintMark}</strong><span style="opacity:.5">${mintRest}</span>`;+ }btn.textContent = 'Launched!';- // Redirect to the agent's page to see the new tokenconst resolvedAgentId = prep.agent_id || agentId;setTimeout(() => {close();@@ -627,12 +676,16 @@ function openLaunch({ identity, agentId, avatarId, formData }) {}}, 900);} catch (e) {- errEl.textContent = e.message || String(e);+ const isUnbranded = /unbranded_mint/.test(e.message || '');+ errEl.textContent = isUnbranded+ ? 'Could not stamp the brand — retry to re-grind.'+ : (e.message || String(e));const btn = inner.querySelector('#pmodal-launch-next');if (btn) {btn.disabled = false;- btn.textContent = 'Launch on-chain';+ btn.textContent = isUnbranded ? 'Retry stamp' : 'Launch on-chain';}+ if (grindEl) { grindEl.hidden = true; grindEl.className = 'pmodal-meta-building'; }}}});diff --git a/src/solana/vanity/brand.js b/src/solana/vanity/brand.jsnew file mode 100644index 000000000..6ed3633ba--- /dev/null+++ b/src/solana/vanity/brand.js@@ -0,0 +1,53 @@+/**+ * The three.ws on-chain brand mark — single source of truth.+ *+ * Owns the mint-mark string, the grind config that produces it, and the+ * functions that test/assert an address carries it. Every other module+ * imports from here; no other file hardcodes the mark or re-implements the+ * check. Pure address plumbing — references no coin, by construction.+ */++/** The three.ws on-chain mint mark. Every branded launch's mint address starts with this. */+export const THREE_WS_MARK = '3ws';++/**+ * Grind config for the brand mark. Spread into grindVanity / grindVanityNode.+ * Prefix (leads the truncated address) + case-insensitive (keeps the grind sub-second).+ * @type {Readonly<{ prefix: string, suffix: string, ignoreCase: boolean }>}+ */+export const THREE_WS_VANITY = Object.freeze({+ prefix: THREE_WS_MARK,+ suffix: '',+ ignoreCase: true,+});++/**+ * True when a Base58 mint address carries the three.ws mark (case-insensitive prefix).+ * Isomorphic — safe in both Node API handlers and browser bundles.+ * @param {unknown} address+ * @returns {boolean}+ */+export function hasThreeWsMark(address) {+ if (typeof address !== 'string' || address.length < THREE_WS_MARK.length) return false;+ return address.slice(0, THREE_WS_MARK.length).toLowerCase() === THREE_WS_MARK.toLowerCase();+}++/**+ * Throw a typed error if `address` lacks the mark. Use at trust boundaries+ * (API handlers) to fail-closed on an unbranded supplied mint.+ * @param {unknown} address+ * @throws {UnbrandedMintError}+ */+export function assertThreeWsMark(address) {+ if (!hasThreeWsMark(address)) throw new UnbrandedMintError(address);+}++/** Thrown when a mint address does not carry the three.ws mark. */+export class UnbrandedMintError extends Error {+ constructor(address) {+ super(`mint ${String(address).slice(0, 12)}… does not carry the three.ws "${THREE_WS_MARK}" mark`);+ this.name = 'UnbrandedMintError';+ this.code = 'unbranded_mint';+ this.address = address;+ }+}diff --git a/src/solana/vanity/launch-with-vanity.js b/src/solana/vanity/launch-with-vanity.jsindex fc9193b4e..116c7388f 100644--- a/src/solana/vanity/launch-with-vanity.js+++ b/src/solana/vanity/launch-with-vanity.js@@ -8,7 +8,7 @@* Usage:* const { prep, mintKeypair } = await launchWithVanity({* agentId, walletAddress, name, symbol, uri,- * suffix: 'pump',+ * // prefix defaults to the `3ws` brand mark when omitted* onProgress: ({ rate, eta }) => console.log(rate, eta),* });* // ...co-sign prep.tx_base64 with both `mintKeypair` and the user wallet,@@ -17,6 +17,7 @@import { Keypair } from '@solana/web3.js';import { grindVanity } from './grinder.js';+import { THREE_WS_MARK } from './brand.js';/*** @param {object} args@@ -38,8 +39,17 @@ import { grindVanity } from './grinder.js';* @returns {Promise<{ prep: object, mintKeypair: Keypair }>}*/export async function launchWithVanity(args) {- const { prefix, suffix, ignoreCase, signal, onProgress } = args;- if (!prefix && !suffix) throw new Error('prefix or suffix required for vanity launch');+ let { prefix, suffix, ignoreCase } = args;+ const { signal, onProgress } = args;++ // Every three.ws launch leads with the `3ws` brand mark. When the caller+ // supplies no explicit pattern, default to grinding the mark (case-insensitive+ // — keeps the grind sub-second). Power users may still pass an explicit+ // prefix/suffix to append extra characters after the mark.+ if (!prefix && !suffix) {+ prefix = THREE_WS_MARK;+ ignoreCase = true;+ }const ground = await grindVanity({ prefix, suffix, ignoreCase, signal, onProgress });const mintKeypair = Keypair.fromSecretKey(ground.secretKey);diff --git a/tasks/vanity-3ws/00-brand-constant-and-validator.md b/tasks/vanity-3ws/00-brand-constant-and-validator.mdnew file mode 100644index 000000000..e9eafe22d--- /dev/null+++ b/tasks/vanity-3ws/00-brand-constant-and-validator.md@@ -0,0 +1,93 @@+# Task 00 — The `3ws` brand constant + validator (single source of truth)++## Goal++Create one module that owns the `3ws` mint mark: its grind config and the functions that+test/assert an address carries it. Every other task imports from here. No other file may+hardcode the string `'3ws'` or re-implement the check.++## Context++- The vanity grinders already accept `{ prefix, suffix, ignoreCase }`:+ - Client: `src/solana/vanity/grinder.js` → `grindVanity(opts)`+ - Server: `src/solana/vanity/grinder-node.js` → `grindVanityNode(opts)`, plus `expectedAttemptsFor`, `GrindExhaustedError`, `MAX_SERVER_PATTERN_LENGTH = 3`.+- Base58 validation lives in `src/solana/vanity/validation.js` (`validatePattern`, `BASE58_ALPHABET`). `3ws` passes (`3`,`w`,`s` are all valid, none confusable).+- `CLAUDE.md`: never reference any coin but `$THREE`. This module references *no* coin — it is pure address plumbing — so it is compliant by construction. Keep it that way.++## New file — `src/solana/vanity/brand.js`++Export, with thorough JSDoc:++```js+/** The three.ws on-chain mint mark. Every branded launch's mint address starts with this. */+export const THREE_WS_MARK = '3ws';++/**+ * Grind config for the brand mark. Spread into grindVanity / grindVanityNode.+ * Prefix (leads the truncated address) + case-insensitive (keeps the grind sub-second).+ */+export const THREE_WS_VANITY = Object.freeze({+ prefix: THREE_WS_MARK,+ suffix: '',+ ignoreCase: true,+});++/** True when a Base58 mint address carries the three.ws mark (case-insensitive prefix). */+export function hasThreeWsMark(address) {+ if (typeof address !== 'string' || address.length < THREE_WS_MARK.length) return false;+ return address.slice(0, THREE_WS_MARK.length).toLowerCase() === THREE_WS_MARK.toLowerCase();+}++/**+ * Throw a typed error if `address` lacks the mark. Use at trust boundaries+ * (API handlers) to fail-closed on an unbranded supplied mint.+ * @throws {UnbrandedMintError}+ */+export function assertThreeWsMark(address) {+ if (!hasThreeWsMark(address)) throw new UnbrandedMintError(address);+}++export class UnbrandedMintError extends Error {+ constructor(address) {+ super(`mint ${String(address).slice(0, 12)}… does not carry the three.ws "${THREE_WS_MARK}" mark`);+ this.name = 'UnbrandedMintError';+ this.code = 'unbranded_mint';+ this.address = address;+ }+}+```++Design notes to honor:+- **No coin references.** This is address plumbing only.+- **Frozen config** so a caller can't mutate the shared object.+- `hasThreeWsMark` must be **isomorphic** (no Node- or browser-only APIs) — it is imported by both `api/` handlers and browser bundles.+- Keep the position (`prefix`) and case behavior expressed *only* here. If we ever move the+ mark to a suffix or make it case-sensitive, this is the one edit.++## Constraints++- ≤ 60 lines. Pure, dependency-free (may import nothing, or only from `./validation.js` if+ you choose to assert `validatePattern(THREE_WS_MARK).valid` in a dev assertion — optional).+- Do not import `@solana/web3.js` here (keep it tree-shakeable for the browser).++## Success criteria++- `hasThreeWsMark('3wsAbc…')` → `true`; `hasThreeWsMark('3WSabc…')` → `true`;+ `hasThreeWsMark('Abc3ws…')` → `false`; `hasThreeWsMark('')`/`null`/`undefined` → `false`.+- `assertThreeWsMark` throws `UnbrandedMintError` (with `.code === 'unbranded_mint'`) on a+ bad address and returns nothing on a good one.+- A repo-wide grep finds the literal `'3ws'` **only** in `brand.js` after all tasks land+ (every other file imports `THREE_WS_MARK` / `THREE_WS_VANITY`).++## Verification++```bash+node -e "import('./src/solana/vanity/brand.js').then(m=>{+ console.assert(m.hasThreeWsMark('3wsXyzAbc')===true);+ console.assert(m.hasThreeWsMark('3WSxyzAbc')===true);+ console.assert(m.hasThreeWsMark('zzz3wsAbc')===false);+ try { m.assertThreeWsMark('nope'); console.error('FAIL: did not throw'); }+ catch(e){ console.assert(e.code==='unbranded_mint'); }+ console.log('brand.js OK');+})"+```diff --git a/tasks/vanity-3ws/01-server-enforce-launch-prep.md b/tasks/vanity-3ws/01-server-enforce-launch-prep.mdnew file mode 100644index 000000000..3a2503f36--- /dev/null+++ b/tasks/vanity-3ws/01-server-enforce-launch-prep.md@@ -0,0 +1,94 @@+# Task 01 — Enforce the `3ws` mark in `launch-prep` (user-signed launches)++## Goal++`handleLaunchPrep` in `api/pump/[action].js` must guarantee the mark on every branded+launch, two ways:++1. **No mint supplied** → the server grinds a `3ws` mint instead of `Keypair.generate()`.+2. **Client supplies `mint_address`** → the server validates it carries the mark and+ **rejects** it (400) if not.++This makes the brand a server invariant: a hand-rolled `curl` to the API cannot ship an+unbranded three.ws coin.++## Context++- File: `api/pump/[action].js`. `handleLaunchPrep` starts at the `async function handleLaunchPrep(req, res)` definition (~line 902). The mint section reads:++ ```js+ // Mint pubkey: client-supplied (vanity-ground) or freshly generated.+ let mintKeypair = null;+ let mint;+ if (body.mint_address) {+ const supplied = solanaPubkey(body.mint_address);+ if (!supplied) return error(res, 400, 'validation_error', 'invalid mint_address');+ mint = supplied;+ } else {+ mintKeypair = Keypair.generate();+ mint = mintKeypair.publicKey;+ }+ ```++- `launchPrepSchema` has `coin_type: z.enum(['regular', 'mayhem', 'agent']).default('agent')` and `mint_address: z.string().min(32).max(44).optional()`.+- Server grinder: `import { grindVanityNode } from '../../src/solana/vanity/grinder-node.js'` → returns `{ publicKey, secretKey, attempts, durationMs }` (Uint8Array secret key, web3-compatible). `MAX_SERVER_PATTERN_LENGTH = 3` already accommodates `3ws`.+- Brand module from task 00: `import { THREE_WS_VANITY, hasThreeWsMark } from '../../src/solana/vanity/brand.js'`.+- The downstream code already handles both cases: it sets `mint_secret_key_b64` from `mintKeypair` when the server generated the key, and sets `client_supplied_mint: !mintKeypair`. **Preserve that contract** — when the server grinds, it owns the secret and returns it for co-sign exactly like the old `Keypair.generate()` path did.+- The kill-switch flag (task 07): read `env.THREE_WS_MARK_ENFORCE` (default ON). When OFF, skip enforcement/grinding and keep the legacy `Keypair.generate()` behavior so we can disable instantly without a redeploy of logic.++## Changes++Replace the mint section with mark-aware logic:++```js+// Mint pubkey: client-supplied (vanity-ground) or server-ground with the three.ws mark.+const enforceMark = env.THREE_WS_MARK_ENFORCE !== '0' && env.THREE_WS_MARK_ENFORCE !== 'false';+let mintKeypair = null;+let mint;++if (body.mint_address) {+ const supplied = solanaPubkey(body.mint_address);+ if (!supplied) return error(res, 400, 'validation_error', 'invalid mint_address');+ if (enforceMark && !hasThreeWsMark(supplied.toBase58())) {+ return error(res, 400, 'unbranded_mint',+ 'three.ws launches must use a mint address carrying the "3ws" mark — grind one client-side or omit mint_address to let the server stamp it');+ }+ mint = supplied;+} else if (enforceMark) {+ const ground = await grindVanityNode({ ...THREE_WS_VANITY }); // ~49k attempts, sub-second+ mintKeypair = Keypair.fromSecretKey(ground.secretKey);+ mint = mintKeypair.publicKey;+} else {+ mintKeypair = Keypair.generate();+ mint = mintKeypair.publicKey;+}+```++- Keep `Keypair.fromSecretKey` import path consistent (`Keypair` is already imported at the top of the file).+- Leave `mint_secret_key_b64`, `client_supplied_mint`, and the `instructions` string exactly as they are — they already branch on `mintKeypair` truthiness and remain correct.+- Wrap the server grind in a try/catch: on `GrindExhaustedError` (effectively impossible for a 3-char case-insensitive prefix, but be a professional), return `error(res, 503, 'mark_grind_failed', 'could not stamp the three.ws mark — retry')`. Do **not** silently fall back to an unbranded mint when `enforceMark` is on (fail-closed).++## Constraints++- Do not change the schema's `mint_address` shape or any other field.+- Do not touch the generic x402 launcher path (different handler / arbitrary-mint plumbing) — this task is scoped to `handleLaunchPrep` only.+- The added imports go with the existing import block at the top of the file; do not import inside the handler.+- Net new code in the handler ≤ ~25 lines.++## Success criteria++- `POST /api/pump/launch-prep` with **no** `mint_address` returns a `mint` that satisfies `hasThreeWsMark(mint)`.+- `POST` with a `mint_address` lacking the mark returns `400 unbranded_mint`.+- `POST` with a correctly-marked `mint_address` succeeds and echoes that mint.+- With `THREE_WS_MARK_ENFORCE=0`, behavior is byte-for-byte the legacy flow.+- Existing launch-confirm flow still co-signs correctly (the server-ground secret is returned just like before).++## Verification++- Unit/integration in task 06 covers the three branches. Manually:+ ```bash+ # against a dev server with a valid session cookie+ curl -s -X POST localhost:3000/api/pump/launch-prep -H 'content-type: application/json' \+ --cookie "$SESSION" -d '{"agent_id":"…","wallet_address":"…","name":"T","symbol":"T","uri":"https://x/y.json"}' \+ | node -e "process.stdin.once('data',d=>{const j=JSON.parse(d);console.log(j.mint, /^3ws/i.test(j.mint))})"+ ```diff --git a/tasks/vanity-3ws/02-server-enforce-launch-agent.md b/tasks/vanity-3ws/02-server-enforce-launch-agent.mdnew file mode 100644index 000000000..7d3a3fc91--- /dev/null+++ b/tasks/vanity-3ws/02-server-enforce-launch-agent.md@@ -0,0 +1,93 @@+# Task 02 — Enforce the `3ws` mark in `launch-agent` (server-signed / autonomous launches)++## Goal++The autonomous launch path — where the **agent custodial wallet signs server-side** — must+also stamp the `3ws` mark. This is the path used by /studio's "launch with agent wallet"+and by autonomous agent skills, so it cannot be left unbranded.++## Context++- File: `api/pump/[action].js`, `async function handleLaunchAgent(req, res)` (~line 1257).+- Current mint logic:++ ```js+ // Mint keypair: client-supplied (vanity) or server-generated.+ let mintKeypair;+ if (body.mint_address && body.mint_secret_key_b64) {+ try {+ mintKeypair = Keypair.fromSecretKey(+ Uint8Array.from(Buffer.from(body.mint_secret_key_b64, 'base64')),+ );+ } catch {+ return error(res, 400, 'validation_error', 'mint_secret_key_b64 did not parse');+ }+ if (mintKeypair.publicKey.toBase58() !== body.mint_address) {+ return error(res, 400, 'validation_error', 'mint_address does not match secret key');+ }+ } else {+ mintKeypair = Keypair.generate();+ }+ const mint = mintKeypair.publicKey;+ ```++- `launchAgentSchema` requires `mint_secret_key_b64` whenever `mint_address` is supplied (it `.refine()`s on that), because the server signs and therefore needs the mint secret.+- Brand + grinder imports are the same as task 01 (`THREE_WS_VANITY`, `hasThreeWsMark`, `grindVanityNode`, `GrindExhaustedError`). They will already be imported once task 01 lands — reuse, don't duplicate.+- Kill-switch: same `env.THREE_WS_MARK_ENFORCE` flag.++## Changes++Make both branches mark-aware:++```js+const enforceMark = env.THREE_WS_MARK_ENFORCE !== '0' && env.THREE_WS_MARK_ENFORCE !== 'false';+let mintKeypair;+if (body.mint_address && body.mint_secret_key_b64) {+ try {+ mintKeypair = Keypair.fromSecretKey(+ Uint8Array.from(Buffer.from(body.mint_secret_key_b64, 'base64')),+ );+ } catch {+ return error(res, 400, 'validation_error', 'mint_secret_key_b64 did not parse');+ }+ if (mintKeypair.publicKey.toBase58() !== body.mint_address) {+ return error(res, 400, 'validation_error', 'mint_address does not match secret key');+ }+ if (enforceMark && !hasThreeWsMark(mintKeypair.publicKey.toBase58())) {+ return error(res, 400, 'unbranded_mint',+ 'three.ws launches must use a mint carrying the "3ws" mark — omit mint_address to let the server stamp it');+ }+} else if (enforceMark) {+ try {+ const ground = await grindVanityNode({ ...THREE_WS_VANITY });+ mintKeypair = Keypair.fromSecretKey(ground.secretKey);+ } catch (err) {+ if (err instanceof GrindExhaustedError) {+ return error(res, 503, 'mark_grind_failed', 'could not stamp the three.ws mark — retry');+ }+ throw err;+ }+} else {+ mintKeypair = Keypair.generate();+}+const mint = mintKeypair.publicKey;+```++- The rest of `handleLaunchAgent` (balance pre-flight, conflict check on `pump_agent_mints`, `vtx.sign([agentKeypair, mintKeypair])`) is unchanged — it already signs with `mintKeypair`, so a server-ground key flows through with zero further edits.++## Constraints++- Do not loosen the `mint_secret_key_b64`-required-with-`mint_address` refine — the server still needs the secret to sign.+- Fail-closed when enforcement is on (no silent unbranded fallback).+- Reuse the imports added in task 01; if task 01 hasn't landed yet, add them to the shared top-of-file import block (don't import inside the handler).++## Success criteria++- A server-signed launch with no supplied mint produces a `3ws…` mint and signs/submits successfully.+- A supplied-but-unmarked `{mint_address, mint_secret_key_b64}` pair is rejected `400 unbranded_mint`.+- The conflict check, balance pre-flight, and `pump_agent_mints` insert all still operate on the (now marked) mint.+- `THREE_WS_MARK_ENFORCE=0` restores legacy behavior exactly.++## Verification++- Covered by task 06 integration tests (mock the agent keypair load + connection). For a live smoke, `scripts/pumpfun-lifecycle-smoke.js` exercises the autonomous path against devnet — assert the resulting mint matches `/^3ws/i`.diff --git a/tasks/vanity-3ws/03-client-launch-surfaces-default.md b/tasks/vanity-3ws/03-client-launch-surfaces-default.mdnew file mode 100644index 000000000..8072ffcd8--- /dev/null+++ b/tasks/vanity-3ws/03-client-launch-surfaces-default.md@@ -0,0 +1,79 @@+# Task 03 — Every client launch surface defaults to the `3ws` mark++## Goal++Make `3ws` the default the user *sees* and *grinds*, on every front-end launch surface.+The server (tasks 01/02) guarantees the mark regardless; the client's job is to grind it+locally (so the mint secret never leaves the browser for user-signed launches) and to+present the mark as a feature, not a buried option.++Remove the legacy "vanity is an opt-in box, default suffix `pump`" framing. The mark is the+default; advanced users may still *append* their own extra characters, but `3ws` always leads.++## Surfaces to update++Each of these posts to `launch-prep` / `launch-agent` or uses `launchWithVanity`:++1. **`src/agent-home-pumpfun.js`** — has an explicit vanity toggle. Today:+ ```js+ vanityEnabled: false,+ vanitySuffix: 'pump',+ ```+ - Remove the `pump` default and the "off by default" framing.+ - Always grind the brand: import `{ THREE_WS_VANITY, THREE_WS_MARK }` from `src/solana/vanity/brand.js` and pass `{ prefix: THREE_WS_MARK, ignoreCase: true }` to `grindVanity` / `launchWithVanity`.+ - The toggle, if kept, becomes "add extra characters after the `3ws` mark" — never a way to *disable* the mark. Default state: mark on, no extra chars.+ - Update the label/title copy: it currently says "ending in your suffix"; the mark is a **prefix**. Copy: "Every three.ws coin is stamped `3ws…` on-chain."++2. **`src/pump/pump-modals.js`** — launch modal(s). Wire the same default grind + progress.++3. **`src/agent-skills-pumpfun.js`** — programmatic/skill launch. Default `grindVanity(THREE_WS_VANITY)` before posting, unless the caller explicitly passes a pre-ground marked mint.++4. **`public/studio/launch-panel.js`** — the /studio launcher (state object near line 423–431 holds `mint/resolvedAgentId`). Grind `3ws` before the prep call; for the agent-signed path it posts to `launch-agent` (server stamps), for the owner-signed path grind client-side via `launchWithVanity` and co-sign.++5. **`src/solana/vanity/launch-with-vanity.js`** — make `prefix` default to `THREE_WS_MARK` when neither `prefix` nor `suffix` is provided, instead of throwing. Keep the explicit-pattern path for power users.++## Shared pattern (use everywhere)++```js+import { grindVanity } from './solana/vanity/grinder.js'; // adjust relative path+import { THREE_WS_MARK, THREE_WS_VANITY } from './solana/vanity/brand.js';++// before posting the launch:+const ground = await grindVanity({+ ...THREE_WS_VANITY,+ signal: abortController.signal,+ onProgress: ({ rate, eta }) => setVanityProgress({ rate, eta }),+});+const mintKeypair = Keypair.fromSecretKey(ground.secretKey);+// post mint_address (+ mint_secret_key_b64 for the server-signed path)+```++- Bound the grind with the existing `AbortController` already used for launch cancellation so the user can always back out.+- Because `3ws` is ~49k attempts, the WASM pool finishes well under a second — but still drive the real progress callback; never fake it (`CLAUDE.md` hard rule #5).++## Constraints (`CLAUDE.md`)++- **Delete the `'pump'` default.** No surface may suggest, prefill, or grind any string tied+ to another coin. The only branded default is `3ws`.+- No surface may offer a path that produces an **unbranded** three.ws coin. "Advanced"+ means *more* characters after `3ws`, never *zero*.+- Real async progress only — no `setTimeout` fake bars.+- Match each surface's existing design tokens; don't introduce new colors (see the monochrome+ token memory). Reuse the existing `.pumpfun-vanity-progress` / `.lp-*` classes.++## Success criteria++- From every surface above, a launch produces a `3ws…` mint, verified in the Network tab+ (`mint_address` in the request, `mint` in the response both start `3ws`).+- No surface references `pump` (or any non-`$THREE` coin string) as a vanity default.+- Cancelling mid-grind aborts cleanly and re-enables the launch button.+- Loading (grinding), success (marked mint shown), and error (grind aborted / prep failed)+ states are all designed — no blank or jarring transitions.++## Verification++- `npm run dev`, exercise each surface in a real browser, watch the Network tab.+- Headless WebGL note (see memory): these are DOM/network assertions, not pixel reads —+ verify via the request/response payloads and DOM text, per the screenshot gotcha memory.+- `grep -rn "vanitySuffix\|'pump'\|\"pump\"" src public/studio | grep -vi pump.fun` returns+ nothing tied to a vanity default after this task.diff --git a/tasks/vanity-3ws/04-skill-and-cli-scripts.md b/tasks/vanity-3ws/04-skill-and-cli-scripts.mdnew file mode 100644index 000000000..ad950a386--- /dev/null+++ b/tasks/vanity-3ws/04-skill-and-cli-scripts.md@@ -0,0 +1,54 @@+# Task 04 — The `create-coin` skill + CLI scripts stamp the `3ws` mark++## Goal++Coins launched outside the web UI — via the pump-fun `create-coin` skill and the repo's+launch scripts — must also carry the mark. A skill-driven or CLI launch is still a+three.ws launch.++## Surfaces++1. **`pump-fun-skills/create-coin/`** (`handlers.js`, `scripts/`, `SKILL.md`, `tools.json`)+ - Find where the mint keypair is created (a `Keypair.generate()` or equivalent).+ - Replace with a server/Node grind of the mark: `import { grindVanityNode } from '<rel>/src/solana/vanity/grinder-node.js'` and `import { THREE_WS_VANITY } from '<rel>/src/solana/vanity/brand.js'`, then `Keypair.fromSecretKey((await grindVanityNode({ ...THREE_WS_VANITY })).secretKey)`.+ - If the skill is a self-contained package that can't import from `src/`, inline a minimal grinder **but** keep the mark string sourced from a single local constant mirroring `brand.js` (and note the mirror in a comment) — never hardcode `'3ws'` in multiple spots within the package.+ - Update `SKILL.md`: document that every coin created through it is stamped `3ws…` and why (brand provenance). Keep all examples/fixtures on `$THREE` / `FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump` (`CLAUDE.md`).++2. **`scripts/coin-cli.mjs`** — two `Keypair.generate()` sites for the mint (≈ line 130 helper, ≈ line 240 in the launch path):+ - The launch-path mint (line ~240, the `else` branch when no `--mint-keypair` is passed) must grind the mark instead of `Keypair.generate()`.+ - Preserve the `--mint-keypair <file>` escape hatch for power users, **but** validate the loaded keypair carries the mark with `hasThreeWsMark(mint.publicKey.toBase58())` and refuse (clear stderr message + non-zero exit) if it doesn't, unless `--no-mark` is explicitly passed. `--no-mark` exists only for genuinely coin-agnostic plumbing, mirroring the server kill-switch.+ - The line ~130 helper: inspect what it mints; if it's a throwaway/non-coin keypair leave it, if it's a coin mint, mark it.++3. **`scripts/direct-pump-launch.mjs`** — same treatment: grind the mark for the launched mint; print the marked address in the success summary.++4. **`scripts/pump-launch-usdc.mjs`** and **`scripts/pumpfun-lifecycle-smoke.js`** — if they launch a coin, mark the mint. The smoke test should additionally **assert** the resulting mint matches `/^3ws/i` so the brand is regression-guarded end-to-end.++## Constraints++- These are scripts → they live in `scripts/` (repo hygiene). Do not add new throwaway files+ in the root.+- `grindVanityNode` on a 3-char case-insensitive prefix is sub-second; no need for the+ worker-thread `grind-vanity.mjs` pool here, but you may use it if a script already imports it.+- Keep the `--mint-keypair` / `--no-mark` escape hatches honest: they exist for arbitrary-mint+ plumbing only, and the default is always marked.+- No coin but `$THREE` in any script output, comment, fixture, or doc.++## Success criteria++- `node scripts/coin-cli.mjs launch …` (no `--mint-keypair`) prints a `3ws…` mint.+- Passing `--mint-keypair` to a non-`3ws` key is rejected unless `--no-mark`.+- `node scripts/direct-pump-launch.mjs …` yields a `3ws…` mint in its summary.+- `pumpfun-lifecycle-smoke.js` asserts the mark and passes on devnet.+- The `create-coin` skill, run end-to-end, produces a `3ws…` mint and its `SKILL.md`+ documents the behavior.++## Verification++```bash+# dry inspect the grind without launching+node -e "import('./src/solana/vanity/grinder-node.js').then(async m=>{+ const b=await import('./src/solana/vanity/brand.js');+ const g=await m.grindVanityNode({...b.THREE_WS_VANITY});+ console.log(g.publicKey, /^3ws/i.test(g.publicKey), g.attempts+' attempts', g.durationMs+'ms');+})"+```diff --git a/tasks/vanity-3ws/05-ux-branded-success-state.md b/tasks/vanity-3ws/05-ux-branded-success-state.mdnew file mode 100644index 000000000..6267ebf27--- /dev/null+++ b/tasks/vanity-3ws/05-ux-branded-success-state.md@@ -0,0 +1,67 @@+# Task 05 — UX: stamp progress + a success state that celebrates the mark++## Goal++Turn the mark from an invisible backend detail into a *visible product moment*. The user+should understand, at launch time, that their coin is being stamped with the three.ws+brand — and see the marked address called out when it lands. Every state designed:+idle → stamping → stamped → error.++## Context++- Surfaces from task 03: `src/agent-home-pumpfun.js`, `src/pump/pump-modals.js`, `public/studio/launch-panel.js`.+- Existing progress hooks: `grindVanity({ onProgress })` yields `{ attempts, rate, eta }`. Reusable classes exist: `.pumpfun-vanity-progress` (agent-home), `.lp-ok-mint` / `.lp-ex-mint` (studio launch panel).+- `formatTimeEstimate` / `estimateAttempts` in `src/solana/vanity/validation.js` for honest ETAs.+- Monochrome design tokens (see the dashboard token memory) — no new colors.++## Changes++### Stamping (loading) state+- While grinding, show: **"Stamping the three.ws mark `3ws…`"** with the real rate/eta+ from `onProgress`. Because the grind is ~sub-second, also keep the copy graceful if it+ finishes instantly (don't flash). A subtle shimmer on the mint placeholder is enough.+- The launch button reflects the phase: `Stamping 3ws…` → `Launching…`. No fake timing.++### Stamped (success) state+- Render the resulting mint with the `3ws` prefix **visually emphasized** (e.g. the first+ three glyphs in the accent/foreground weight, the remainder muted, then `…tail`).+ Reuse the existing truncation component; just weight the leading mark.+- Microcopy: "Stamped on-chain — every three.ws coin starts with `3ws`." Include the+ copy-address and explorer/pump links that the success state already shows.+- A small "verified three.ws coin" pill is appropriate here — but reuse the existing+ on-chain badge module (`src/shared/onchain-badge.js`, per memory) rather than inventing a+ second badge. If the badge can take a "branded mint" hint, pass it; otherwise leave the+ badge as-is and only weight the mark glyphs.++### Error state+- If the grind is aborted (user cancels) → return to idle cleanly, button re-enabled.+- If `launch-prep`/`launch-agent` returns `400 unbranded_mint` (shouldn't happen from our+ own client, but a defensive surface) → show "Could not stamp the brand — retry," with a+ retry affordance. Actionable, not a dead toast.++### Accessibility / polish (`CLAUDE.md` UI standards)+- The stamping indicator is an `aria-live="polite"` region.+- The emphasized mark must not rely on color alone (use font-weight + an `aria-label` like+ "three.ws mark") for contrast/colorblind safety.+- Hover/focus states on the copy button and links.++## Constraints++- Real async only — the progress reflects actual `onProgress` events.+- No new color tokens; monochrome system + existing accent.+- Don't duplicate the on-chain badge; reuse the shared module.+- Keep all three surfaces visually consistent — same copy, same emphasis treatment.++## Success criteria++- A launch from each surface shows a real stamping indicator, then a success state with the+ `3ws` prefix visually emphasized and an honest "every three.ws coin starts with 3ws" line.+- Cancel during stamping returns to a clean idle state.+- The `unbranded_mint` error path renders an actionable retry, not a blank failure.+- Screenshot-worthy: the marked address is the hero of the success card.++## Verification++- `npm run dev`; launch from each surface in a real browser. Confirm no console errors/warnings.+- Verify the live region announces and the emphasized mark has an `aria-label`.+- Per the headless-WebGL memory, assert via DOM text + the network payload, not pixel reads.diff --git a/tasks/vanity-3ws/06-tests.md b/tasks/vanity-3ws/06-tests.mdnew file mode 100644index 000000000..0364817b1--- /dev/null+++ b/tasks/vanity-3ws/06-tests.md@@ -0,0 +1,65 @@+# Task 06 — Tests: prove every launch path produces a `3ws…` mint++## Goal++Lock the brand invariant with tests at three levels: the validator, the server handlers,+and an end-to-end launch. Guard against regression on every path tasks 01–04 touched.++## Context++- Existing vanity tests to keep green and extend: `tests/vanity-keygen.test.js`,+ `tests/vanity-wasm-grinder.test.js`, `tests/mcp-vanity-grinder.test.js`.+- The suite is run with `npm test`. Note (per the swarm memory) the full suite may be red+ from unrelated churn — your job is that **your** new tests pass and you don't add red;+ run the targeted files directly to confirm.+- Brand module: `src/solana/vanity/brand.js` (task 00).++## New / updated tests++### Unit — `tests/three-ws-mark.test.js` (new)+- `hasThreeWsMark`: true for `3ws…`, `3WS…`, `3wS…`; false for `x3ws…`, `''`, `null`, a 2-char string.+- `assertThreeWsMark`: throws `UnbrandedMintError` with `code === 'unbranded_mint'` on bad input; no throw on good.+- `THREE_WS_VANITY` is frozen, `prefix === '3ws'`, `ignoreCase === true`.+- `grindVanityNode({ ...THREE_WS_VANITY })` returns a `publicKey` satisfying `hasThreeWsMark` (this is a real grind — fast, but mark it as the one "slow-ish" unit if your harness separates them).++### Integration — `tests/launch-mark-enforcement.test.js` (new)+Drive `handleLaunchPrep` / `handleLaunchAgent` with mocked auth/db/connection (follow the+mocking pattern already used by the pump handler tests, if any; otherwise mock `sql`,+`getSessionUser`, `getPumpSdk`, and the Solana connection):+- **prep, no mint** → response `mint` passes `hasThreeWsMark`.+- **prep, unmarked mint supplied** → `400` with `error === 'unbranded_mint'`.+- **prep, marked mint supplied** → `200`, echoes that mint.+- **prep, `THREE_WS_MARK_ENFORCE=0`** → legacy path, mint not required to be marked.+- **launch-agent, no mint** → server-ground mint passes `hasThreeWsMark`, and is what+ `vtx.sign` receives (assert via the mocked sign call or the registered `pump_agent_mints` mint).+- **launch-agent, unmarked supplied pair** → `400 unbranded_mint`.++### E2E / smoke — extend `scripts/pumpfun-lifecycle-smoke.js`+- After a devnet launch, assert the resulting mint matches `/^3ws/i`; fail the smoke loudly otherwise.++### Regression guard+- Add a tiny test asserting the literal `'3ws'` appears in exactly one source file+ (`brand.js`) — a grep-based test — so a future contributor can't quietly hardcode the mark+ elsewhere and drift. (Scope the grep to `src/`, exclude `tests/` and `tasks/`.)++## Constraints++- No network calls in unit/integration tests except the local in-process grind (which is CPU-only).+- Don't weaken or delete existing vanity tests; extend them.+- Use `$THREE` / the canonical CA for any fixture that needs a coin; never another mint.++## Success criteria++- `node --test tests/three-ws-mark.test.js tests/launch-mark-enforcement.test.js` (or the+ repo's test runner) passes.+- Existing `tests/vanity-*.test.js` still pass.+- The smoke script asserts the mark on devnet.+- Removing the enforcement code makes the integration tests fail (verify by temporarily+ reverting — the tests must actually bite).++## Verification++```bash+npm test 2>&1 | tail -40 # confirm no NEW failures vs the known-red baseline+node --test tests/three-ws-mark.test.js tests/launch-mark-enforcement.test.js+```diff --git a/tasks/vanity-3ws/README.md b/tasks/vanity-3ws/README.mdnew file mode 100644index 000000000..1ccb51bd1--- /dev/null+++ b/tasks/vanity-3ws/README.md@@ -0,0 +1,76 @@+# Feature: the `3ws` mint mark — every three.ws coin carries the brand in its address++## The idea++Every coin launched **through three.ws** should be recognizable on-chain by its mint+address alone. We stamp a vanity mark — the literal string **`3ws`** — onto the mint+public key of every launch. A three.ws coin reads `3wsAbc…xyz` in any wallet, explorer,+or block feed. No legend, no metadata lookup: the address *is* the brand.++This is the same move pump.fun made with its `…pump` suffix, applied to *our* surface.+It compounds: every launch is a free, permanent billboard for three.ws, and holders can+verify provenance at a glance.++## Design decisions (locked — do not re-litigate)++- **Mark:** the string `3ws` (three.ws, condensed). Base58-valid (`3`, `w`, `s` are all+ in the alphabet; none are confusable `0/O/I/l`).+- **Position: prefix.** Wallets, explorers, and our own UIs truncate addresses to the+ first 4–6 characters (`3wsAb…`). A prefix gets prime visibility; a suffix is usually+ hidden behind the `…`. The mark leads.+- **Case-insensitive.** Matching `3ws`/`3wS`/`3Ws`/… keeps the grind ~sub-second.+ Expected attempts ≈ 58 × 29 × 29 ≈ **49k** (digit `3` is exact; `w`/`s` each match two+ cases). The WASM worker pool does this in well under a second; the single-thread+ server grinder (`grindVanityNode`) handles it inside one request with margin.+- **Always-on, server-enforced.** This is not a toggle the user flips. Every branded+ three.ws launch (`coin_type` ∈ `agent | regular | mayhem`) gets the mark by default.+ The client grinds it; the server *also* enforces it so a hand-rolled API call can't+ bypass the brand.+- **One exemption:** the generic, coin-agnostic x402 launcher that accepts an arbitrary+ user-supplied mint at runtime (per `CLAUDE.md`). That plumbing stays mint-neutral.+ Everything that launches a *three.ws* coin gets the mark.++## Why this is cheap and safe++The vanity infrastructure already exists and is battle-tested — this feature **wires it on+by default**, it does not build a grinder from scratch:++- `src/solana/vanity/grinder.js` — `grindVanity({prefix, suffix, ignoreCase, signal, onProgress})`, WASM web-worker pool (client).+- `src/solana/vanity/grinder-node.js` — `grindVanityNode(...)`, `expectedAttemptsFor`, `GrindExhaustedError`, `MAX_SERVER_PATTERN_LENGTH = 3` (server). `3ws` is exactly 3 chars.+- `src/solana/vanity/launch-with-vanity.js` — grind → `POST /api/pump/launch-prep` → return prep + local mint keypair for co-sign.+- `src/solana/vanity/validation.js` — base58 validation, difficulty + time estimates.+- `api/pump/[action].js` — `launch-prep` (user-signed) and `launch-agent` (server-signed) already accept a client-ground `mint_address`; both fall back to `Keypair.generate()`.++Our launches do **not** grind pump.fun's `…pump` suffix today (they use plain+`Keypair.generate()`), so the address space is fully ours — no 7-char (`3ws…pump`)+collision-of-constraints problem. Just a clean 3-char prefix.++## Task order++| # | File | What it delivers |+|---|------|------------------|+| 00 | `00-brand-constant-and-validator.md` | One source of truth: `src/solana/vanity/brand.js` (the mark config + `hasThreeWsMark` / `assertThreeWsMark`). Everything else imports this. |+| 01 | `01-server-enforce-launch-prep.md` | `launch-prep` grinds `3ws` when no mint supplied and rejects an unmarked supplied mint. |+| 02 | `02-server-enforce-launch-agent.md` | `launch-agent` (server-signed / autonomous) grinds `3ws` server-side. |+| 03 | `03-client-launch-surfaces-default.md` | Every client launch UI defaults to grinding `3ws` (remove the `pump` default + opt-in toggle framing). |+| 04 | `04-skill-and-cli-scripts.md` | The `create-coin` skill + `coin-cli`/`direct-pump-launch` scripts grind the mark. |+| 05 | `05-ux-branded-success-state.md` | Progress ("stamping your three.ws mark…") + a success state that celebrates the marked address. All states designed. |+| 06 | `06-tests.md` | Unit + integration + e2e proving every path produces a `3ws…` mint. |+| 07 | `07-docs-rollout-telemetry.md` | Docs, feed event, telemetry, and the kill-switch flag. |++Do 00 first (everyone depends on it). 01–04 can run in parallel after 00. 05 layers on+01/03. 06 and 07 close it out.++## Definition of done (whole feature)++- A launch from **every** surface (agent-home, /studio, pump-modals, skills, CLI, the+ create-coin skill, and the autonomous `launch-agent` path) produces a mint whose+ Base58 address begins with `3ws` (case-insensitive).+- The server **rejects** a branded launch whose supplied `mint_address` lacks the mark+ (clear 400), and **mints one with the mark** when none is supplied — a raw API call+ cannot ship an unbranded three.ws coin.+- The generic x402 launcher is untouched and still mint-neutral.+- No coin other than `$THREE` is referenced anywhere in the work (`CLAUDE.md` law).+- Grinding never *blocks* a launch: it runs inside a bounded budget with a designed+ progress state; the kill-switch flag (task 07) can disable enforcement instantly.+- Existing vanity tests still pass; new tests cover every launch path.diff --git a/tests/three-ws-mark.test.js b/tests/three-ws-mark.test.jsnew file mode 100644index 000000000..2ef765e44--- /dev/null+++ b/tests/three-ws-mark.test.js@@ -0,0 +1,153 @@+import { describe, it, expect } from 'vitest';+import { execSync } from 'node:child_process';+import { fileURLToPath } from 'node:url';+import { dirname, resolve } from 'node:path';+import {+ hasThreeWsMark,+ assertThreeWsMark,+ UnbrandedMintError,+ THREE_WS_VANITY,+ THREE_WS_MARK,+} from '../src/solana/vanity/brand.js';+import { grindVanityNode } from '../src/solana/vanity/grinder-node.js';++const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..');++// ── hasThreeWsMark ─────────────────────────────────────────────────────────++describe('hasThreeWsMark', () => {+ it('true for 3ws... (lowercase prefix)', () => {+ expect(hasThreeWsMark('3wsABCDEFGHIJKLMNOPQRST')).toBe(true);+ });++ it('true for 3WS... (uppercase prefix)', () => {+ expect(hasThreeWsMark('3WSxyz12345678901234567')).toBe(true);+ });++ it('true for mixed-case 3wS...', () => {+ expect(hasThreeWsMark('3wSXYZ1234567890123456')).toBe(true);+ });++ it('false for x3ws... (mark not at position 0)', () => {+ expect(hasThreeWsMark('x3wsABCDEFG')).toBe(false);+ });++ it('false for empty string', () => {+ expect(hasThreeWsMark('')).toBe(false);+ });++ it('false for null', () => {+ expect(hasThreeWsMark(null)).toBe(false);+ });++ it('false for 2-char string (shorter than mark)', () => {+ expect(hasThreeWsMark('3w')).toBe(false);+ });++ it('false for undefined', () => {+ expect(hasThreeWsMark(undefined)).toBe(false);+ });++ it('false for a non-3ws address', () => {+ expect(hasThreeWsMark('MintPubkey1111111111111111111111111111')).toBe(false);+ });+});++// ── assertThreeWsMark ──────────────────────────────────────────────────────++describe('assertThreeWsMark', () => {+ it('throws UnbrandedMintError on an unbranded address', () => {+ expect(() => assertThreeWsMark('BadMintAddress111111111')).toThrow(UnbrandedMintError);+ });++ it('throws with code === unbranded_mint', () => {+ let caught;+ try {+ assertThreeWsMark('SomeOtherMint1111111111');+ } catch (e) {+ caught = e;+ }+ expect(caught).toBeDefined();+ expect(caught.code).toBe('unbranded_mint');+ expect(caught.name).toBe('UnbrandedMintError');+ });++ it('throws on null', () => {+ expect(() => assertThreeWsMark(null)).toThrow(UnbrandedMintError);+ });++ it('throws on empty string', () => {+ expect(() => assertThreeWsMark('')).toThrow(UnbrandedMintError);+ });++ it('does not throw on a valid 3ws address', () => {+ expect(() => assertThreeWsMark('3wsValidMint111111111111111111111111')).not.toThrow();+ });++ it('does not throw on a 3WS-uppercase address', () => {+ expect(() => assertThreeWsMark('3WSValidMint111111111111111111111111')).not.toThrow();+ });+});++// ── THREE_WS_VANITY ────────────────────────────────────────────────────────++describe('THREE_WS_VANITY', () => {+ it('is frozen (cannot be mutated)', () => {+ expect(Object.isFrozen(THREE_WS_VANITY)).toBe(true);+ });++ it('prefix is "3ws" (the canonical mark)', () => {+ expect(THREE_WS_VANITY.prefix).toBe('3ws');+ });++ it('prefix equals THREE_WS_MARK', () => {+ expect(THREE_WS_VANITY.prefix).toBe(THREE_WS_MARK);+ });++ it('ignoreCase is true (keeps grind sub-second)', () => {+ expect(THREE_WS_VANITY.ignoreCase).toBe(true);+ });+});++// ── grindVanityNode with THREE_WS_VANITY ───────────────────────────────────+// Real CPU grind — sub-second for a 3-char case-insensitive prefix but+// marked with a longer timeout to be explicit.++describe('grindVanityNode({ ...THREE_WS_VANITY })', () => {+ it('returns a publicKey that carries the three.ws mark', { timeout: 30_000 }, () => {+ const result = grindVanityNode({ ...THREE_WS_VANITY });+ expect(typeof result.publicKey).toBe('string');+ expect(hasThreeWsMark(result.publicKey)).toBe(true);+ expect(result.secretKey).toBeInstanceOf(Uint8Array);+ expect(result.secretKey).toHaveLength(64);+ expect(result.attempts).toBeGreaterThan(0);+ });+});++// ── Regression guard ───────────────────────────────────────────────────────+// The literal '3ws' must live ONLY in brand.js. Any other file in src/ that+// hardcodes the mark string bypasses the single source of truth and will+// silently drift if the mark ever changes.++describe('regression: "3ws" literal belongs only in brand.js', () => {+ it("no file in src/ outside brand.js contains the string literal '3ws'", () => {+ let output = '';+ try {+ output = execSync(+ "grep -rl \"'3ws'\" src/ --include='*.js'",+ { encoding: 'utf8', cwd: ROOT },+ ).trim();+ } catch {+ output = '';+ }++ const files = output.split('\n').filter(Boolean);+ const outliers = files.filter((f) => !f.replace(/\\/g, '/').endsWith('solana/vanity/brand.js'));+ expect(+ outliers,+ `These src/ files hardcode '3ws' outside brand.js: ${outliers.join(', ')}`,+ ).toHaveLength(0);+ // brand.js itself must contain the mark definition+ expect(files.some((f) => f.includes('brand.js'))).toBe(true);+ });+});