Skip to content

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.

feat: eth vanity grinder, pump launch-prep avatar support, marketplace cleanup

nirholase832648c55cc
diff --git a/.gitignore b/.gitignore
index 238189dab..712edf611 100644
--- a/.gitignore
+++ b/.gitignore
@@ -54,3 +54,12 @@ forks/*/
test-mint.json
www-vanity.json
test-coin-metadata.json
+scripts/x402-genwallets.mjs
+
+# Wallet / private-key material — NEVER commit
+*.privkey.txt
+*.b58.txt
+wallets/
+.wallets/
+x402-test-wallets/
+3dagent-log-export-2026-05-09T23-08-55.csv
diff --git a/api/_lib/rate-limit.js b/api/_lib/rate-limit.js
index c1cb0d96f..ddf258b95 100644
--- a/api/_lib/rate-limit.js
+++ b/api/_lib/rate-limit.js
@@ -108,6 +108,8 @@ export const limits = {
getLimiter('agents:by-address', { limit: 120, window: '1 m' }).limit(ip),
pricingPerIp: (ip) => getLimiter('pricing:ip', { limit: 120, window: '1 m' }).limit(ip),
walletLink: (userId) => getLimiter('wallet:link', { limit: 10, window: '10 m' }).limit(userId),
+ // Agent wallet read endpoints (GET balance, activity). Per authenticated user.
+ walletRead: (userId) => getLimiter('wallet:read', { limit: 60, window: '1 m' }).limit(userId),
agentSuggest: (ip) => getLimiter('agents:suggest', { limit: 120, window: '1 m' }).limit(ip),
read: (ip) => getLimiter('permissions:read', { limit: 300, window: '1 m' }).limit(ip),
permissionsGrant: (userId) =>
diff --git a/api/agents/solana-wallet.js b/api/agents/solana-wallet.js
index e25615098..5670f904b 100644
--- a/api/agents/solana-wallet.js
+++ b/api/agents/solana-wallet.js
@@ -51,7 +51,7 @@ async function handleActivity(req, res, id) {
const auth = await resolveAuth(req);
if (!auth) return error(res, 401, 'unauthorized', 'sign in required');
- const rl = await limits.authIp(clientIp(req));
+ const rl = await limits.walletRead(auth.userId);
if (!rl.success) return error(res, 429, 'rate_limited', 'too many requests');
const [row] = await sql`SELECT id, user_id, meta FROM agent_identities WHERE id = ${id} AND deleted_at IS NULL`;
@@ -152,7 +152,9 @@ async function handleWallet(req, res, id) {
const auth = await resolveAuth(req);
if (!auth) return error(res, 401, 'unauthorized', 'sign in required');
- const rl = await limits.authIp(clientIp(req));
+ const rl = req.method === 'GET'
+ ? await limits.walletRead(auth.userId)
+ : await limits.authIp(clientIp(req));
if (!rl.success) return error(res, 429, 'rate_limited', 'too many requests');
const [row] = await sql`SELECT id, user_id, meta FROM agent_identities WHERE id = ${id} AND deleted_at IS NULL`;
diff --git a/api/marketplace/[action].js b/api/marketplace/[action].js
index ab47af7b0..abf46e232 100644
--- a/api/marketplace/[action].js
+++ b/api/marketplace/[action].js
@@ -321,601 +321,16 @@ async function handleDetail(req, res, id) {
`;
if (!row) return error(res, 404, 'not_found', 'agent not found');
- // A user can view their own unpublished agents
- const auth = await resolveAuth(req).catch(() => null);
- if (!row.is_published && row.user_id !== auth?.userId) {
- return error(res, 404, 'not_found', 'agent not found');
- }
-
- const priceRows = await sql`
- SELECT skill, currency_mint, amount
- FROM agent_skill_prices
- WHERE skill_id IN (SELECT id FROM skills WHERE agent_id = ${id})
- `;
-
- let bookmarked = false;
- if (auth) {
- const [b] =
- await sql`SELECT 1 AS x FROM agent_bookmarks WHERE user_id = ${auth.userId} AND agent_id = ${id}`;
- bookmarked = !!b;
- }
-
- const skill_prices = Object.fromEntries(
- priceRows.map((p) => [p.skill, { amount: p.amount, currency_mint: p.currency_mint, chain: p.chain }]),
- );
-
- const purchased_skills = []; // Placeholder for now
- return json(
- res,
- 200,
- { data: { agent: { ...toDetail(row), skill_prices, bookmarked } } },
- { 'cache-control': 'public, max-age=15' },
- );
-}
-
-// ── Versions ───────────────────────────────────────────────────────────────
-
-async function handleVersions(req, res, id) {
- if (cors(req, res, { methods: 'GET,OPTIONS' })) return;
- if (!method(req, res, ['GET'])) return;
-
- const rl = await limits.widgetRead(clientIp(req));
- if (!rl.success) return error(res, 429, 'rate_limited', 'too many requests');
-
- const rows = await sql`
- SELECT id, version, changelog, category, tags, created_at
- FROM agent_versions
- WHERE agent_id = ${id}
- ORDER BY version DESC
- LIMIT 50
- `;
- return json(res, 200, { data: { versions: rows } });
-}
-
-// ── Similar ────────────────────────────────────────────────────────────────
-
-async function handleSimilar(req, res, id) {
- if (cors(req, res, { methods: 'GET,OPTIONS' })) return;
- if (!method(req, res, ['GET'])) return;
-
- const rl = await limits.widgetRead(clientIp(req));
- if (!rl.success) return error(res, 429, 'rate_limited', 'too many requests');
-
- const [base] = await sql`
- SELECT id, name, description, category, tags FROM agent_identities
- WHERE id = ${id} AND deleted_at IS NULL
- `;
- if (!base) return error(res, 404, 'not_found', 'agent not found');
-
- const rows = await sql`
- SELECT ai.id, ai.name, ai.description, ai.category, ai.tags, ai.avatar_id, ai.user_id,
- ai.forks_count, ai.views_count, ai.published_at, ai.created_at, ai.skills,
- av.thumbnail_key,
- (
- (CASE WHEN ai.category = ${base.category} THEN 3 ELSE 0 END)
- + cardinality(ARRAY(SELECT unnest(ai.tags) INTERSECT SELECT unnest(${base.tags}::text[])))
- + similarity(ai.name, ${base.name})
- + similarity(coalesce(ai.description,''), ${base.description || ''}) * 0.5
- ) AS score
- FROM agent_identities ai
- LEFT JOIN avatars av ON av.id = ai.avatar_id AND av.deleted_at IS NULL
- WHERE ai.is_published = true
- AND ai.deleted_at IS NULL
- AND ai.id <> ${id}
- ORDER BY score DESC
- LIMIT 8
- `;
- return json(res, 200, { data: { items: rows.map(toCard) } });
-}
-
-// ── Fork ───────────────────────────────────────────────────────────────────
-
-async function handleFork(req, res, id) {
- if (cors(req, res, { methods: 'POST,OPTIONS', credentials: true })) return;
- if (!method(req, res, ['POST'])) return;
-
- const auth = await resolveAuth(req);
- if (!auth) return error(res, 401, 'unauthorized', 'sign in required');
-
- const rl = await limits.authIp(clientIp(req));
- if (!rl.success) return error(res, 429, 'rate_limited', 'too many requests');
-
- const [src] = await sql`
- SELECT * FROM agent_identities
- WHERE id = ${id} AND deleted_at IS NULL AND is_published = true
- `;
- if (!src) return error(res, 404, 'not_found', 'agent not found');
-
- const [created] = await sql.transaction([
- sql`
- INSERT INTO agent_identities (
- user_id, name, description, avatar_id, skills, meta,
- category, tags, system_prompt, greeting, capabilities, fork_of
- )
- VALUES (
- ${auth.userId},
- ${src.name},
- ${src.description},
- ${src.avatar_id},
- ${src.skills},
- '{}'::jsonb,
- ${src.category},
- ${src.tags},
- ${src.system_prompt},
- ${src.greeting},
- ${src.capabilities}::jsonb,
- ${src.id}
- )
- RETURNING id, name, description, category, tags, fork_of, created_at
- `,
- sql`UPDATE agent_identities SET forks_count = forks_count + 1 WHERE id = ${id}`,
- ]);
-
- return json(res, 201, { data: { agent: created } });
-}
-
-// ── Bookmark ───────────────────────────────────────────────────────────────
-
-async function handleBookmark(req, res, id) {
- if (cors(req, res, { methods: 'POST,DELETE,OPTIONS', credentials: true })) return;
- if (!method(req, res, ['POST', 'DELETE'])) return;
-
- const auth = await resolveAuth(req);
- if (!auth) return error(res, 401, 'unauthorized', 'sign in required');
-
- const rl = await limits.authIp(clientIp(req));
- if (!rl.success) return error(res, 429, 'rate_limited', 'too many requests');
-
- if (req.method === 'DELETE') {
- await sql`DELETE FROM agent_bookmarks WHERE user_id = ${auth.userId} AND agent_id = ${id}`;
- return json(res, 200, { data: { bookmarked: false } });
- }
-
- await sql`
- INSERT INTO agent_bookmarks (user_id, agent_id)
- VALUES (${auth.userId}, ${id})
- ON CONFLICT DO NOTHING
- `;
- return json(res, 200, { data: { bookmarked: true } });
-}
-
-// ── Publish ────────────────────────────────────────────────────────────────
-
-async function handlePublish(req, res, id) {
- if (cors(req, res, { methods: 'POST,OPTIONS', credentials: true })) return;
- if (!method(req, res, ['POST'])) return;
-
- const auth = await resolveAuth(req);
- if (!auth) return error(res, 401, 'unauthorized', 'sign in required');
-
- const rl = await limits.authIp(clientIp(req));
- if (!rl.success) return error(res, 429, 'rate_limited', 'too many requests');
-
- const body = await readJson(req).catch(() => ({}));
-
- const [existing] = await sql`
- SELECT id, user_id, system_prompt, greeting, category, tags, capabilities
- FROM agent_identities WHERE id = ${id} AND deleted_at IS NULL
- `;
- if (!existing) return error(res, 404, 'not_found', 'agent not found');
- if (existing.user_id !== auth.userId) return error(res, 403, 'forbidden', 'not your agent');
-
- const category =
- body.category && CATEGORIES.includes(body.category) ? body.category : existing.category;
- if (!category) return error(res, 400, 'validation_error', 'category required');
-
- const tags = Array.isArray(body.tags)
- ? body.tags
- .filter((t) => typeof t === 'string')
- .map((t) => t.trim().toLowerCase())
- .filter(Boolean)
- .slice(0, 12)
- : existing.tags;
-
- const systemPrompt =
- typeof body.system_prompt === 'string' ? body.system_prompt.slice(0, 16000) : existing.system_prompt;
- const greeting = typeof body.greeting === 'string' ? body.greeting.slice(0, 1000) : existing.greeting;
- const capabilities = body.capabilities && typeof body.capabilities === 'object' ? body.capabilities : existing.capabilities;
- const changelog = typeof body.changelog === 'string' ? body.changelog.slice(0, 1000) : null;
-
- const [{ next_version }] = await sql`
- SELECT COALESCE(MAX(version), 0) + 1 AS next_version
- FROM agent_versions WHERE agent_id = ${id}
- `;
-
- const [updated] = await sql.transaction([
- sql`
- UPDATE agent_identities
- SET is_published = true,
- published_at = COALESCE(published_at, now()),
- category = ${category},
- tags = ${tags},
- system_prompt = ${systemPrompt},
- greeting = ${greeting},
- capabilities = ${JSON.stringify(capabilities || {})}::jsonb
- WHERE id = ${id}
- RETURNING *
- `,
- sql`
- INSERT INTO agent_versions (
- agent_id, version, system_prompt, greeting, category, tags, capabilities, changelog, created_by
- )
- VALUES (
- ${id}, ${next_version}, ${systemPrompt}, ${greeting},
- ${category}, ${tags}, ${JSON.stringify(capabilities || {})}::jsonb,
- ${changelog}, ${auth.userId}
- )
- `,
- ]);
-
- return json(res, 200, { data: { agent: toDetail(updated), version: next_version } });
-}
-
-// ── View counter ───────────────────────────────────────────────────────────
-
-async function handleView(req, res, id) {
- if (cors(req, res, { methods: 'POST,OPTIONS' })) return;
- if (!method(req, res, ['POST'])) return;
-
- const rl = await limits.widgetRead(clientIp(req));
- if (!rl.success) return json(res, 200, { data: { ok: true } });
-
- queueMicrotask(() => {
- sql`UPDATE agent_identities SET views_count = views_count + 1 WHERE id = ${id} AND is_published = true`.catch(
- (err) => console.error('[marketplace/view]', err),
- );
- });
- return json(res, 200, { data: { ok: true } });
-}
-
-// ── Shaping ────────────────────────────────────────────────────────────────
-
-function toCard(row) {
- return {
- id: row.id,
- name: row.name,
- description: row.description,
- category: row.category,
- tags: row.tags || [],
- avatar_id: row.avatar_id,
- thumbnail_url: row.thumbnail_key ? publicUrl(row.thumbnail_key) : null,
- author_id: row.user_id,
- skills: row.skills || [],
- forks_count: row.forks_count || 0,
- views_count: row.views_count || 0,
- published_at: row.published_at,
- created_at: row.created_at,
- has_paid_skills: row.has_paid_skills || false,
- };
-}
-
-function toDetail(row, skill_prices = {}) {
- return {
- ...toCard(row),
- system_prompt: row.system_prompt,
- greeting: row.greeting,
- capabilities: row.capabilities || {},
- fork_of: row.fork_of || null,
- author_name: row.author_name || null,
- author_avatar: row.author_avatar || null,
- skill_prices,
- };
-}
-
-
-import { sql } from '../_lib/db.js';
-import { authenticateBearer, extractBearer, getSessionUser } from '../_lib/auth.js';
-import { cors, error, json, method, readJson, wrap } from '../_lib/http.js';
-import { publicUrl } from '../_lib/r2.js';
-import { clientIp, limits } from '../_lib/rate-limit.js';
-import { z } from 'zod';
-
-const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
-
-const CATEGORIES = [
- 'academic',
- 'career',
- 'copywriting',
- 'design',
- 'education',
- 'emotions',
- 'entertainment',
- 'games',
- 'general',
- 'life',
- 'marketing',
- 'office',
- 'programming',
- 'translation',
-];
-
-const SORTS = new Set(['recommended', 'recent', 'popular']);
-
-const createAgentSchema = z.object({
- name: z.string().trim().min(1, 'name required').max(100),
- description: z.string().trim().min(1, 'description required').max(500),
- system_prompt: z.string().trim().min(1, 'system prompt required').max(16000),
- greeting: z.string().trim().max(1000).nullable().optional(),
- category: z.enum(CATEGORIES).default('general'),
- tags: z
- .array(z.string().trim().toLowerCase().min(1).max(40))
- .max(12)
- .default([]),
- capabilities: z
- .object({
- bullets: z.array(z.string().max(200)).max(20).default([]),
- skills: z.array(z.any()).max(50).default([]),
- library: z.array(z.any()).max(50).default([]),
- })
- .default({}),
- publish: z.boolean().default(false),
-});
-
-export default wrap(async (req, res) => {
- const url = new URL(req.url, 'http://x');
- const parts = url.pathname.split('/').filter(Boolean); // ['api','marketplace',...]
- const head = parts[2]; // 'categories' | 'agents'
- const id = parts[3];
- const sub = parts[4];
-
- if (head === 'categories') return handleCategories(req, res);
-
- if (head === 'agents') {
- if (!id) {
- if (req.method === 'POST' || (req.method === 'OPTIONS' && req.headers['access-control-request-method'] === 'POST'))
- return handleCreate(req, res);
- return handleList(req, res, url);
- }
- if (id === 'mine') return handleMine(req, res);
- if (!UUID_RE.test(id)) return error(res, 404, 'not_found', 'agent not found');
- if (!sub) return handleDetail(req, res, id);
- if (sub === 'versions') return handleVersions(req, res, id);
- if (sub === 'similar') return handleSimilar(req, res, id);
- if (sub === 'fork') return handleFork(req, res, id);
- if (sub === 'bookmark') return handleBookmark(req, res, id);
- if (sub === 'publish') return handlePublish(req, res, id);
- if (sub === 'view') return handleView(req, res, id);
- return error(res, 404, 'not_found', 'unknown marketplace action');
- }
-
- return error(res, 404, 'not_found', 'unknown marketplace action');
-});
-
-// ── Auth ───────────────────────────────────────────────────────────────────
-
-async function resolveAuth(req) {
- const session = await getSessionUser(req);
- if (session) return { userId: session.id };
- const bearer = await authenticateBearer(extractBearer(req));
- if (bearer) return { userId: bearer.userId };
- return null;
-}
-
-// ── Categories ─────────────────────────────────────────────────────────────
-
-async function handleCategories(req, res) {
- if (cors(req, res, { methods: 'GET,OPTIONS' })) return;
- if (!method(req, res, ['GET'])) return;
-
- const rl = await limits.widgetRead(clientIp(req));
- if (!rl.success) return error(res, 429, 'rate_limited', 'too many requests');
-
- const rows = await sql`
- SELECT category, count(*)::int AS count
- FROM agent_identities
- WHERE is_published = true AND deleted_at IS NULL
- GROUP BY category
- `;
- const counts = Object.fromEntries(
- rows.filter((r) => r.category).map((r) => [r.category, r.count]),
- );
- const total = rows.reduce((s, r) => s + r.count, 0);
- return json(
- res,
- 200,
- {
- data: {
- total,
- categories: CATEGORIES.map((slug) => ({ slug, count: counts[slug] || 0 })),
- },
- },
- { 'cache-control': 'public, max-age=60' },
- );
-}
-
-// ── Create ─────────────────────────────────────────────────────────────────
-
-async function handleCreate(req, res) {
- if (cors(req, res, { methods: 'POST,OPTIONS', credentials: true })) return;
- if (!method(req, res, ['POST'])) return;
-
- const auth = await resolveAuth(req);
- if (!auth) return error(res, 401, 'unauthorized', 'sign in required');
-
- const rl = await limits.authIp(clientIp(req));
- if (!rl.success) return error(res, 429, 'rate_limited', 'too many requests');
-
- let body = await readJson(req).catch(() => null);
- if (!body) return error(res, 400, 'validation_error', 'request body required');
-
- // Accept LobeHub-compatible JSON import: { json: { config, meta } }
- if (body.json && typeof body.json === 'object') {
- const j = body.json;
- body = {
- name: j.meta?.title || j.meta?.name || '',
- description: j.meta?.description || '',
- system_prompt: j.config?.systemRole || '',
- greeting: j.config?.greeting || null,
- category: j.meta?.category || 'general',
- tags: j.meta?.tags || [],
- capabilities: j.meta?.capabilities || {},
- publish: false,
- };
- }
-
- const parsed = createAgentSchema.safeParse(body);
- if (!parsed.success) {
- const msg = parsed.error.issues[0]?.message || 'validation error';
- return error(res, 400, 'validation_error', msg);
- }
-
- const { name, description, system_prompt, greeting, category, tags, capabilities, publish } =
- parsed.data;
- const publishedAt = publish ? new Date().toISOString() : null;
-
- const [agent] = await sql`
- INSERT INTO agent_identities (
- user_id, name, description, system_prompt, greeting,
- category, tags, capabilities, is_published, published_at
- )
- VALUES (
- ${auth.userId}, ${name}, ${description}, ${system_prompt}, ${greeting ?? null},
- ${category}, ${tags}, ${JSON.stringify(capabilities)}::jsonb,
- ${publish}, ${publishedAt}
- )
- RETURNING *
- `;
-
- if (publish) {
- await sql`
- INSERT INTO agent_versions (
- agent_id, version, system_prompt, greeting, category, tags, capabilities, changelog, created_by
- )
- VALUES (
- ${agent.id}, 1, ${system_prompt}, ${greeting ?? null}, ${category}, ${tags},
- ${JSON.stringify(capabilities)}::jsonb, 'Initial release', ${auth.userId}
- )
- `;
- }
-
- return json(res, 201, {
- data: { agent: toDetail({ ...agent, author_name: null, author_avatar: null }) },
- });
-}
-
-// ── Mine ───────────────────────────────────────────────────────────────────
-
-async function handleMine(req, res) {
- if (cors(req, res, { methods: 'GET,OPTIONS', credentials: true })) return;
- if (!method(req, res, ['GET'])) return;
-
- const auth = await resolveAuth(req);
- if (!auth) return error(res, 401, 'unauthorized', 'sign in required');
-
- const rl = await limits.widgetRead(clientIp(req));
- if (!rl.success) return error(res, 429, 'rate_limited', 'too many requests');
-
- const rows = await sql`
- SELECT ai.id, ai.name, ai.description, ai.category, ai.tags, ai.avatar_id, ai.user_id,
- ai.forks_count, ai.views_count, ai.published_at, ai.created_at, ai.skills,
- ai.is_published, av.thumbnail_key
- FROM agent_identities ai
- LEFT JOIN avatars av ON av.id = ai.avatar_id AND av.deleted_at IS NULL
- WHERE ai.user_id = ${auth.userId} AND ai.deleted_at IS NULL
- ORDER BY ai.created_at DESC
- LIMIT 100
- `;
-
- return json(res, 200, {
- data: {
- items: rows.map((r) => ({ ...toCard(r), is_published: r.is_published })),
- },
- });
-}
-
-// ── List ───────────────────────────────────────────────────────────────────
-
-async function handleList(req, res, url) {
- if (cors(req, res, { methods: 'GET,OPTIONS' })) return;
- if (!method(req, res, ['GET'])) return;
-
- const rl = await limits.widgetRead(clientIp(req));
- if (!rl.success) return error(res, 429, 'rate_limited', 'too many requests');
-
- const category = url.searchParams.get('category') || null;
- const q = (url.searchParams.get('q') || '').trim().slice(0, 80);
- const sort = SORTS.has(url.searchParams.get('sort')) ? url.searchParams.get('sort') : 'recommended';
- const limit = Math.min(48, Math.max(1, Number(url.searchParams.get('limit')) || 24));
- const cursor = url.searchParams.get('cursor');
- const offset = cursor ? Math.max(0, Number(cursor) || 0) : 0;
-
- const orderBy =
- sort === 'recent'
- ? sql`published_at DESC NULLS LAST, created_at DESC`
- : sort === 'popular'
- ? sql`(forks_count + views_count) DESC, published_at DESC NULLS LAST`
- : sql`(forks_count * 5 + views_count) DESC, published_at DESC NULLS LAST`;
-
- const cat = category && CATEGORIES.includes(category) ? category : null;
- const qLike = q ? `%${q}%` : null;
-
- const rows = await sql`
- SELECT ai.id, ai.name, ai.description, ai.category, ai.tags, ai.avatar_id, ai.user_id,
- ai.forks_count, ai.views_count, ai.published_at, ai.created_at, ai.skills,
- av.thumbnail_key,
- u.display_name AS author_name,
- EXISTS (
- SELECT 1 FROM agent_skill_prices asp
- WHERE asp.agent_id = ai.id AND asp.is_active = true
- ) AS has_paid_skills
- FROM agent_identities ai
- LEFT JOIN avatars av ON av.id = ai.avatar_id AND av.deleted_at IS NULL
- LEFT JOIN users u ON u.id = ai.user_id
- WHERE ai.is_published = true
- AND ai.deleted_at IS NULL
- AND (${cat}::text IS NULL OR ai.category = ${cat})
- AND (
- ${qLike}::text IS NULL
- OR ai.name ILIKE ${qLike}
- OR ai.description ILIKE ${qLike}
- OR EXISTS (SELECT 1 FROM unnest(ai.tags) t WHERE t ILIKE ${qLike})
- )
- ORDER BY ${orderBy}
- LIMIT ${limit + 1} OFFSET ${offset}
- `;
-
- const hasMore = rows.length > limit;
- const items = rows.slice(0, limit).map(toCard);
-
- return json(
- res,
- 200,
- {
- data: {
- items,
- next_cursor: hasMore ? String(offset + limit) : null,
- },
- },
- { 'cache-control': 'public, max-age=15' },
- );
-}
-
-// ── Detail ─────────────────────────────────────────────────────────────────
-
-async function handleDetail(req, res, id) {
- if (cors(req, res, { methods: 'GET,OPTIONS' })) return;
- if (!method(req, res, ['GET'])) return;
-
- const rl = await limits.widgetRead(clientIp(req));
- if (!rl.success) return error(res, 429, 'rate_limited', 'too many requests');
-
- const [row] = await sql`
- SELECT a.*, u.display_name AS author_name, u.avatar_url AS author_avatar
- FROM agent_identities a
- LEFT JOIN users u ON u.id = a.user_id
- WHERE a.id = ${id} AND a.deleted_at IS NULL
- `;
- if (!row) return error(res, 404, 'not_found', 'agent not found');
-
- // A user can view their own unpublished agents
const auth = await resolveAuth(req).catch(() => null);
if (!row.is_published && row.user_id !== auth?.userId) {
return error(res, 404, 'not_found', 'agent not found');
}
const [priceRows, purchasedRows] = await Promise.all([
- sql`SELECT skill_name, currency_mint, amount FROM agent_skill_prices WHERE agent_id = ${id}`,
- auth ? sql`SELECT skill_name FROM skill_purchases WHERE user_id = ${auth.userId} AND agent_id = ${id}` : Promise.resolve([]),
+ sql`SELECT skill, currency_mint, chain, amount FROM agent_skill_prices WHERE agent_id = ${id} AND is_active = true`,
+ auth
+ ? sql`SELECT skill_name FROM skill_purchases WHERE user_id = ${auth.userId} AND agent_id = ${id}`
+ : Promise.resolve([]),
]);
let bookmarked = false;
@@ -926,9 +341,9 @@ async function handleDetail(req, res, id) {
}
const skill_prices = Object.fromEntries(
- priceRows.map((p) => [p.skill_name, { amount: p.amount, currency_mint: p.currency_mint }]),
+ priceRows.map((p) => [p.skill, { amount: p.amount, currency_mint: p.currency_mint, chain: p.chain }]),
);
- const purchased_skills = purchasedRows.map(r => r.skill_name);
+ const purchased_skills = purchasedRows.map((r) => r.skill_name);
return json(
res,
diff --git a/api/pump/[action].js b/api/pump/[action].js
index 16216103a..449412fe9 100644
--- a/api/pump/[action].js
+++ b/api/pump/[action].js
@@ -474,21 +474,89 @@ async function handleSellConfirm(req, res) {
// ── launch-prep ────────────────────────────────────────────────────────────
-const launchPrepSchema = z.object({
- agent_id: z.string().uuid(),
- wallet_address: z.string().min(32).max(44),
- name: z.string().trim().min(1).max(32),
- symbol: z.string().trim().min(1).max(10),
- uri: z.string().url(),
- network: z.enum(['mainnet', 'devnet']).default('mainnet'),
- buyback_bps: z.number().int().min(0).max(10_000).default(0),
- sol_buy_in: z.number().nonnegative().max(50).default(0), // optional creator initial buy, capped 50 SOL
- // Optional client-ground vanity mint address. When provided, the client
- // already holds the secret key locally and will co-sign in the wallet —
- // the server never sees the secret. When omitted, the server falls back
- // to a fresh Keypair.generate() and returns the secret key for co-sign.
- mint_address: z.string().min(32).max(44).optional(),
-});
+const launchPrepSchema = z
+ .object({
+ agent_id: z.string().uuid().optional(),
+ avatar_id: z.string().uuid().optional(),
+ wallet_address: z.string().min(32).max(44),
+ name: z.string().trim().min(1).max(32),
+ symbol: z.string().trim().min(1).max(10),
+ uri: z.string().url(),
+ network: z.enum(['mainnet', 'devnet']).default('mainnet'),
+ buyback_bps: z.number().int().min(0).max(10_000).default(0),
+ sol_buy_in: z.number().nonnegative().max(50).default(0), // optional creator initial buy, capped 50 SOL
+ // Optional client-ground vanity mint address. When provided, the client
+ // already holds the secret key locally and will co-sign in the wallet —
+ // the server never sees the secret. When omitted, the server falls back
+ // to a fresh Keypair.generate() and returns the secret key for co-sign.
+ mint_address: z.string().min(32).max(44).optional(),
+ })
+ .refine((v) => v.agent_id || v.avatar_id, {
+ message: 'agent_id or avatar_id required',
+ path: ['agent_id'],
+ });
+
+// Resolve a usable agent_identities.id for the launch. If the caller passed
+// avatar_id (e.g. from /studio, where users pick an avatar and not a separate
+// agent), find the agent_identity already linked to that avatar — or create
+// one inline so the launch can proceed without a detour through the agent
+// registration wizard.
+async function resolveLaunchAgentId({ userId, agentId, avatarId }) {
+ if (agentId) {
+ const [row] = await sql`
+ select id, name from agent_identities
+ where id=${agentId} and user_id=${userId} and deleted_at is null
+ limit 1
+ `;
+ return row || null;
+ }
+ const [linked] = await sql`
+ select id, name from agent_identities
+ where user_id=${userId} and avatar_id=${avatarId} and deleted_at is null
+ order by created_at asc limit 1
+ `;
+ if (linked) return linked;
+
+ const [avatar] = await sql`
+ select id, name, description from avatars
+ where id=${avatarId} and owner_id=${userId} and deleted_at is null
+ limit 1
+ `;
+ if (!avatar) return null;
+
+ const agentName = (avatar.name || 'Agent').slice(0, 100);
+ const agentDesc = avatar.description ? String(avatar.description).slice(0, 1000) : null;
+ try {
+ const [created] = await sql`
+ insert into agent_identities (user_id, name, description, avatar_id)
+ values (${userId}, ${agentName}, ${agentDesc}, ${avatar.id})
+ returning id, name
+ `;
+ return created;
+ } catch (err) {
+ if (err?.code !== '23505') throw err;
+ // Unique-per-user constraint: reuse the user's existing identity and
+ // link it to this avatar if it has none yet.
+ const [unlinked] = await sql`
+ select id, name from agent_identities
+ where user_id=${userId} and avatar_id is null and deleted_at is null
+ order by created_at asc limit 1
+ `;
+ if (unlinked) {
+ await sql`
+ update agent_identities set avatar_id=${avatar.id}, updated_at=now()
+ where id=${unlinked.id}
+ `;
+ return unlinked;
+ }
+ const [any] = await sql`
+ select id, name from agent_identities
+ where user_id=${userId} and deleted_at is null
+ order by created_at asc limit 1
+ `;
+ return any || null;
+ }
+}
async function handleLaunchPrep(req, res) {
if (cors(req, res, { methods: 'POST,OPTIONS', credentials: true })) return;
@@ -512,12 +580,15 @@ async function handleLaunchPrep(req, res) {
`;
if (!walletRow) return error(res, 403, 'forbidden', 'wallet not linked to your account');
- // Verify the agent belongs to this user.
- const [agent] = await sql`
- select id, name from agent_identities
- where id=${body.agent_id} and user_id=${user.id} and deleted_at is null limit 1
- `;
+ // Resolve agent_identities.id from either agent_id or avatar_id.
+ // /studio sends avatar_id; the dashboard/vanity flows send agent_id.
+ const agent = await resolveLaunchAgentId({
+ userId: user.id,
+ agentId: body.agent_id,
+ avatarId: body.avatar_id,
+ });
if (!agent) return error(res, 404, 'not_found', 'agent not found');
+ const resolvedAgentId = agent.id;
// Mint pubkey: client-supplied (vanity-ground) or freshly generated.
let mintKeypair = null;
@@ -593,7 +664,7 @@ async function handleLaunchPrep(req, res) {
${body.uri},
${JSON.stringify({
kind: 'pump_launch',
- agent_id: body.agent_id,
+ agent_id: resolvedAgentId,
wallet_address: body.wallet_address,
mint: mint.toBase58(),
name: body.name,
diff --git a/public/eth-vanity.html b/public/eth-vanity.html
new file mode 100644
index 000000000..6659f5ea1
--- /dev/null
+++ b/public/eth-vanity.html
@@ -0,0 +1,442 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <title>Ethereum CREATE2 vanity grinder · three.ws</title>
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <meta name="description" content="Grind a vanity Ethereum smart-contract address by searching CREATE2 salts. Runs entirely in your browser — no keys involved, just a salt you feed to your factory.">
+ <link rel="icon" href="/favicon.ico">
+ <link rel="stylesheet" href="/nav.css">
+ <link rel="preconnect" href="https://fonts.googleapis.com">
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Space+Grotesk:wght@600;700&display=swap" rel="stylesheet">
+ <style>
+ * { box-sizing: border-box; }
+ :root {
+ color-scheme: dark;
+ --fg: #f0f0f0; --muted: #888; --border: rgba(255,255,255,0.08); --bg: #111;
+ --card-bg: #0f0f0f;
+ --ok-bg: rgba(74,222,128,0.12); --ok-fg: #4ade80;
+ --warn-bg: rgba(251,191,36,0.1); --warn-fg: #fbbf24;
+ --bad-bg: rgba(239,68,68,0.1); --bad-fg: #f87171;
+ --header-h: 3.5rem;
+ --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
+ }
+ body {
+ font: 15px/1.5 'Inter', system-ui, -apple-system, sans-serif;
+ background: #000; color: var(--fg); margin: 0;
+ min-height: 100vh; display: flex; flex-direction: column;
+ }
+ main { flex: 1; max-width: 720px; width: 100%; margin: 0 auto; padding: 2.5rem 1rem 4rem; }
+ h1 { font-size: 1.5rem; margin: 0 0 .25rem; font-family: var(--font-display); letter-spacing: -0.02em; }
+ p.lede { color: var(--muted); margin: 0 0 1.5rem; }
+ label { display: block; font-size: .8rem; color: var(--muted); margin: 1rem 0 .25rem; }
+ .card { border: 1px solid var(--border); border-radius: 10px; padding: 1.1rem 1.25rem; background: var(--card-bg); margin-bottom: 1rem; }
+ .card h2 { font-size: .95rem; margin: 0 0 .35rem; font-family: var(--font-display); letter-spacing: -0.01em; }
+ .card .desc { color: var(--muted); font-size: .8rem; margin: 0 0 .35rem; }
+ input[type=text], textarea, select {
+ font: inherit; font-family: ui-monospace, monospace; padding: .55rem .7rem;
+ width: 100%; border: 1px solid rgba(255,255,255,0.12); border-radius: 6px;
+ background: #1a1a1a; color: var(--fg); resize: vertical;
+ }
+ input[type=text]:focus, textarea:focus, select:focus { outline: none; border-color: rgba(255,255,255,0.3); }
+ input.invalid, textarea.invalid { border-color: var(--bad-fg); background: rgba(239,68,68,0.06); }
+
+ .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
+ @media (max-width: 600px) { .row2 { grid-template-columns: 1fr; } }
+
+ .preview { font-family: ui-monospace, monospace; font-size: .9rem; padding: .65rem .75rem; background: #1a1a1a; border-radius: 6px; margin-top: .55rem; word-break: break-all; min-height: 2.4em; line-height: 1.4; border: 1px solid var(--border); }
+ .preview .pfx, .preview .sfx { background: linear-gradient(90deg,#a78bfa,#6366f1); color: #fff; padding: 0 3px; border-radius: 3px; font-weight: 700; }
+ .preview .rest { color: #555; }
+
+ .row { display: flex; justify-content: space-between; align-items: center; margin-top: .55rem; font-size: .85rem; color: var(--muted); }
+ .actions { display: flex; gap: .55rem; margin-top: 1.25rem; align-items: center; flex-wrap: wrap; }
+ .btn { font: inherit; padding: .55rem 1.1rem; border-radius: 6px; border: 1px solid rgba(255,255,255,0.12); background: #1a1a1a; color: var(--fg); cursor: pointer; }
+ .btn:hover { background: #222; }
+ .btn.primary { background: #fff; color: #000; border-color: #fff; font-weight: 600; }
+ .btn.primary:hover { background: #e8e8e8; }
+ .btn:disabled { opacity: .35; cursor: not-allowed; }
+
+ .progress { margin-top: 1.25rem; padding: .9rem 1.1rem; background: #111; border-radius: 8px; border: 1px solid var(--border); font-family: ui-monospace, monospace; font-size: .85rem; }
+ .progress .live { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
+ .progress .stat { font-size: 1.1rem; font-weight: 600; color: #fff; }
+ .progress .scan { font-family: ui-monospace, monospace; font-size: .85rem; color: #555; margin-top: .35rem; word-break: break-all; min-height: 1.4em; }
+
+ .result { margin-top: 1.25rem; padding: 1.1rem 1.25rem; background: rgba(167,139,250,0.06); border: 1px solid rgba(167,139,250,0.25); border-radius: 10px; }
+ .result h3 { margin: 0 0 .4rem; font-size: 1rem; color: #fff; }
+ .result .out-row { font-family: ui-monospace, monospace; font-size: .82rem; word-break: break-all; padding: .55rem .65rem; background: #111; border-radius: 6px; border: 1px solid rgba(167,139,250,0.15); margin-top: .5rem; }
+ .result .out-row .k { color: #a78bfa; display: inline-block; min-width: 5.5rem; }
+ .result .pfx, .result .sfx { background: linear-gradient(90deg,#a78bfa,#6366f1); color: #fff; padding: 0 3px; border-radius: 3px; font-weight: 700; }
+ .result .meta { font-size: .8rem; color: var(--muted); margin: .65rem 0 0; }
+
+ .warn { background: var(--warn-bg); color: var(--warn-fg); padding: .65rem .85rem; border-radius: 6px; margin-top: 1rem; font-size: .8rem; border: 1px solid rgba(251,191,36,0.15); }
+ .error { background: var(--bad-bg); color: var(--bad-fg); padding: .6rem .85rem; border-radius: 6px; margin-top: 1rem; font-size: .85rem; border: 1px solid rgba(239,68,68,0.15); }
+
+ .preset-row { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .4rem; }
+ .preset {
+ background: #1a1a1a; border: 1px solid rgba(255,255,255,0.1); border-radius: 999px;
+ padding: .25rem .65rem; cursor: pointer; font-size: .75rem; color: #bbb;
+ }
+ .preset:hover { background: #242424; border-color: rgba(255,255,255,0.2); }
+
+ .formula {
+ font-family: ui-monospace, monospace; font-size: .75rem;
+ color: #888; background: #0a0a0a; padding: .5rem .65rem;
+ border-radius: 6px; border: 1px solid var(--border); margin-top: .35rem;
+ }
+ .skip-link { position: absolute; left: -9999px; }
+ .skip-link:focus { left: 1rem; top: 1rem; padding: .5rem 1rem; background: #0c0c0c; border: 1px solid rgba(255,255,255,0.1); border-radius: 6px; z-index: 9999; color: #fff; text-decoration: none; }
+ </style>
+</head>
+<body>
+ <a href="#main-content" class="skip-link">Skip to main content</a>
+ <header>
+ <div id="nav-container"></div>
+ </header>
+ <script src="/nav.js"></script>
+
+ <main id="main-content">
+ <h1>✦ Ethereum CREATE2 vanity grinder</h1>
+ <p class="lede">
+ Grind a vanity smart-contract address by searching <strong>CREATE2 salts</strong> — no private keys involved.
+ The result is a deterministic address you can deploy to from your factory of choice (Safe, ERC-4337 SimpleAccount, CreateX, Coinbase Smart Wallet…).
+ Runs entirely in your browser.
+ </p>
+
+ <div class="card">
+ <h2>1. Factory + init code</h2>
+ <p class="desc">CREATE2 fixes the deployer address and the init code; only the salt is yours to choose.</p>
+
+ <div class="formula">address = keccak256(0xff ‖ deployer ‖ salt ‖ keccak256(initCode))[12:]</div>
+
+ <label for="deployer">Deployer / factory address (20 bytes)</label>
+ <input id="deployer" type="text" placeholder="0x…" autocomplete="off" spellcheck="false" />
+ <div class="preset-row" aria-label="Common deployers">
+ <button class="preset" type="button" data-deployer="0x4e59b44847b379578588920cA78FbF26c0B4956C" data-name="Arachnid CREATE2 (deterministic-deployment-proxy)">Arachnid proxy</button>
+ <button class="preset" type="button" data-deployer="0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed" data-name="CreateX">CreateX</button>
+ <button class="preset" type="button" data-deployer="0x4e1DCf7AD4e460CfD30791CCC4F9c8a4f820ec67" data-name="Safe SafeProxyFactory v1.4.1">Safe v1.4.1</button>
+ <button class="preset" type="button" data-deployer="0x0BA5ED0c6AA8c49038F819E587E2633c4A9F428a" data-name="Coinbase Smart Wallet factory">Coinbase Smart Wallet</button>
+ </div>
+
+ <label for="initcode-hash">keccak256(initCode) — 32 bytes</label>
+ <input id="initcode-hash" type="text" placeholder="0x… (64 hex chars)" autocomplete="off" spellcheck="false" />
+ <p class="desc" style="margin-top:.4rem">
+ If you have the raw <code>initCode</code> (deploy bytecode + constructor args), paste it below and we'll hash it for you.
+ </p>
+ <label for="initcode-raw" style="margin-top:.5rem">Raw init code (optional — auto-hashes)</label>
+ <textarea id="initcode-raw" rows="3" placeholder="0x… (paste bytecode + ABI-encoded args)"></textarea>
+ </div>
+
+ <div class="card">
+ <h2>2. Pattern</h2>
+ <p class="desc">Hex characters only (0–9, a–f). Each extra character is 16× harder.</p>
+
+ <div class="row2">
+ <div>
+ <label for="prefix">Prefix (after 0x)</label>
+ <input id="prefix" type="text" maxlength="10" placeholder="e.g. beef" autocomplete="off" spellcheck="false" />
+ </div>
+ <div>
+ <label for="suffix">Suffix</label>
+ <input id="suffix" type="text" maxlength="10" placeholder="e.g. dead" autocomplete="off" spellcheck="false" />
+ </div>
+ </div>
+
+ <div class="preview" id="preview" aria-live="polite"></div>
+
+ <div class="row">
+ <span id="est">type a pattern to see estimated time</span>
+ <span id="cores-row">cores: <span id="cores">?</span></span>
+ </div>
+
+ <div class="actions">
+ <button id="grind" class="btn primary" type="button" disabled>Grind salt</button>
+ <button id="cancel" class="btn" type="button" hidden>Cancel</button>
+ </div>
+
+ <div id="progress" hidden class="progress">
+ <div class="live">
+ <div>
+ <div class="stat" id="rate">0/s</div>
+ <div style="font-size:.75rem;color:#555">tries/sec across <span id="cores2">?</span> cores</div>
+ </div>
+ <div style="text-align:right">
+ <div class="stat"><span id="attempts">0</span></div>
+ <div style="font-size:.75rem;color:#555">attempts · eta <span id="eta">—</span></div>
+ </div>
+ </div>
+ <div class="scan" id="scan"></div>
+ </div>
+
+ <div id="error" hidden class="error"></div>
+ <div id="result" hidden></div>
+ </div>
+ </main>
+
+ <script type="module">
+ import { keccak_256 } from '@noble/hashes/sha3';
+ import { grindCreate2Vanity } from '/src/eth/vanity/grinder.js';
+ import {
+ validatePattern, validateAddress, validateInitCodeHash,
+ estimateAttempts, formatTimeEstimate, MAX_PATTERN_LENGTH,
+ } from '/src/eth/vanity/validation.js';
+
+ const $ = (id) => document.getElementById(id);
+ const HEX_ALPHA = '0123456789abcdef';
+ const RATE_PER_CORE = 60_000; // measured order-of-magnitude for keccak_256 on 85 bytes in a worker
+ const cores = Math.max(1, Math.min(navigator.hardwareConcurrency || 4, 8));
+ $('cores').textContent = cores;
+ $('cores2').textContent = cores;
+
+ function esc(s) { return String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;',"'":'&#39;' })[c]); }
+ function sample(prefix = '', suffix = '') {
+ const total = 40;
+ const fillLen = Math.max(0, total - prefix.length - suffix.length);
+ let mid = '';
+ for (let i = 0; i < fillLen; i++) mid += HEX_ALPHA[Math.floor(Math.random() * 16)];
+ return prefix + mid + suffix;
+ }
+ function fmtTime(seconds) {
+ if (!isFinite(seconds)) return '—';
+ if (seconds < 1) return '<1s';
+ if (seconds < 60) return `~${Math.round(seconds)}s`;
+ if (seconds < 3600) return `~${Math.round(seconds/60)}m`;
+ if (seconds < 86400) return `~${Math.round(seconds/3600)}h`;
+ if (seconds < 31536000) return `~${Math.round(seconds/86400)}d`;
+ return '>1y';
+ }
+ function estSeconds(prefixLen, suffixLen) {
+ const total = prefixLen + suffixLen;
+ return total <= 0 ? 0 : Math.pow(16, total) / (RATE_PER_CORE * cores);
+ }
+ function bytesToHex(bytes) {
+ let s = '';
+ for (let i = 0; i < bytes.length; i++) s += bytes[i].toString(16).padStart(2, '0');
+ return s;
+ }
+ function hexToBytes(hex) {
+ let h = (hex || '').trim();
+ if (h.startsWith('0x') || h.startsWith('0X')) h = h.slice(2);
+ if (h.length % 2) return null;
+ if (!/^[0-9a-f]*$/i.test(h)) return null;
+ const out = new Uint8Array(h.length / 2);
+ for (let i = 0; i < out.length; i++) out[i] = parseInt(h.substring(i*2, i*2+2), 16);
+ return out;
+ }
+
+ // ── Preset deployer chips ──────────────────────────────────────────
+ document.querySelectorAll('.preset[data-deployer]').forEach((b) => {
+ b.title = b.dataset.name || '';
+ b.addEventListener('click', () => {
+ $('deployer').value = b.dataset.deployer;
+ $('deployer').dispatchEvent(new Event('input'));
+ });
+ });
+
+ // ── Auto-hash raw initCode → fill initcode-hash ────────────────────
+ $('initcode-raw').addEventListener('input', () => {
+ const raw = $('initcode-raw').value.trim();
+ if (!raw) return;
+ const bytes = hexToBytes(raw);
+ $('initcode-raw').classList.toggle('invalid', !bytes);
+ if (!bytes) return;
+ const h = '0x' + bytesToHex(keccak_256(bytes));
+ $('initcode-hash').value = h;
+ $('initcode-hash').dispatchEvent(new Event('input'));
+ });
+
+ // ── Live preview / validation ──────────────────────────────────────
+ function readPattern() {
+ const p = $('prefix').value.trim().replace(/^0x/i, '').toLowerCase();
+ const s = $('suffix').value.trim().toLowerCase();
+ return { p, s };
+ }
+ let previewLoop = null;
+ function startPreviewLoop() {
+ stopPreviewLoop();
+ previewLoop = setInterval(() => {
+ const { p, s } = readPattern();
+ if ($('prefix').classList.contains('invalid') || $('suffix').classList.contains('invalid')) return;
+ const middle = $('preview').querySelector('.rest');
+ if (middle) middle.textContent = sample('', '').slice(0, 40 - p.length - s.length);
+ }, 700);
+ }
+ function stopPreviewLoop() { if (previewLoop) clearInterval(previewLoop); previewLoop = null; }
+
+ function update() {
+ const { p, s } = readPattern();
+ const pv = p ? validatePattern(p) : { valid: true, errors: [] };
+ const sv = s ? validatePattern(s) : { valid: true, errors: [] };
+ $('prefix').classList.toggle('invalid', !!p && !pv.valid);
+ $('suffix').classList.toggle('invalid', !!s && !sv.valid);
+
+ const dv = validateAddress($('deployer').value || '');
+ const ich = validateInitCodeHash($('initcode-hash').value || '');
+ $('deployer').classList.toggle('invalid', !!$('deployer').value && !dv.valid);
+ $('initcode-hash').classList.toggle('invalid', !!$('initcode-hash').value && !ich.valid);
+
+ const total = (pv.valid ? p.length : 0) + (sv.valid ? s.length : 0);
+ if (total === 0) {
+ $('preview').innerHTML = `<span class="rest">0x${esc(sample())}</span>`;
+ $('est').textContent = 'type a pattern to see estimated time';
+ } else {
+ const mid = sample('', '').slice(0, 40 - p.length - s.length);
+ $('preview').innerHTML =
+ `0x` +
+ (p ? `<span class="pfx">${esc(p)}</span>` : '') +
+ `<span class="rest">${esc(mid)}</span>` +
+ (s ? `<span class="sfx">${esc(s)}</span>` : '');
+ $('est').textContent = `est. ${fmtTime(estSeconds(p.length, s.length))} on ${cores} cores`;
+ }
+
+ $('grind').disabled =
+ !dv.valid || !ich.valid || total === 0 ||
+ (!!p && !pv.valid) || (!!s && !sv.valid);
+ }
+
+ ['prefix','suffix','deployer','initcode-hash'].forEach((id) => {
+ $(id).addEventListener('input', update);
+ $(id).addEventListener('keydown', (e) => {
+ if (e.key === 'Enter' && !$('grind').disabled) $('grind').click();
+ });
+ });
+ update();
+ startPreviewLoop();
+
+ // ── Grind ──────────────────────────────────────────────────────────
+ let abort = null;
+
+ $('grind').addEventListener('click', async () => {
+ const { p, s } = readPattern();
+ const dv = validateAddress($('deployer').value);
+ const ich = validateInitCodeHash($('initcode-hash').value);
+ if (!dv.valid) { showError(dv.error); return; }
+ if (!ich.valid) { showError(ich.error); return; }
+
+ $('grind').hidden = true;
+ $('cancel').hidden = false;
+ $('progress').hidden = false;
+ $('result').hidden = true;
+ $('error').hidden = true;
+ $('attempts').textContent = '0';
+ $('rate').textContent = '0/s';
+ $('eta').textContent = fmtTime(estSeconds(p.length, s.length));
+ $('scan').textContent = `0x${sample(p, s)}`;
+ stopPreviewLoop();
+
+ const scanLoop = setInterval(() => {
+ $('scan').textContent = `0x${sample(p, s)}`;
+ }, 100);
+
+ abort = new AbortController();
+ try {
+ const result = await grindCreate2Vanity({
+ deployer: dv.normalized,
+ initCodeHash: ich.normalized,
+ prefix: p || undefined,
+ suffix: s || undefined,
+ signal: abort.signal,
+ onProgress: ({ attempts, rate, eta, sample: sm }) => {
+ $('attempts').textContent = attempts.toLocaleString();
+ $('rate').textContent = `${Math.round(rate).toLocaleString()}/s`;
+ $('eta').textContent = eta;
+ if (sm) $('scan').textContent = sm;
+ },
+ });
+ clearInterval(scanLoop);
+ renderResult(result, p, s);
+ } catch (err) {
+ clearInterval(scanLoop);
+ if (err?.name !== 'AbortError') showError(`Grind failed: ${err.message || err}`);
+ resetIdle();
+ }
+ });
+
+ $('cancel').addEventListener('click', () => abort?.abort());
+
+ function showError(msg) {
+ $('error').textContent = msg;
+ $('error').hidden = false;
+ }
+ function resetIdle() {
+ $('grind').hidden = false;
+ $('cancel').hidden = true;
+ $('progress').hidden = true;
+ startPreviewLoop();
+ }
+
+ function renderResult(result, p, s) {
+ $('cancel').hidden = true;
+ $('grind').hidden = false;
+ $('grind').textContent = 'Grind another';
+ $('progress').hidden = true;
+
+ const addrNoPrefix = result.address.slice(2); // 40 hex chars
+ const mid = addrNoPrefix.slice(p.length, addrNoPrefix.length - s.length);
+ const html = `
+ <div class="result">
+ <h3>✦ Salt found</h3>
+ <div class="out-row">
+ <span class="k">address</span> 0x${
+ (p ? `<span class="pfx">${esc(p)}</span>` : '') +
+ esc(mid) +
+ (s ? `<span class="sfx">${esc(s)}</span>` : '')
+ }
+ </div>
+ <div class="out-row"><span class="k">salt</span> ${esc(result.salt)}</div>
+ <div class="out-row"><span class="k">deployer</span> ${esc(result.deployer)}</div>
+ <div class="out-row"><span class="k">initCodeHash</span> ${esc(result.initCodeHash)}</div>
+ <div class="meta">
+ ${result.attempts.toLocaleString()} attempts in ${(result.durationMs/1000).toFixed(1)}s
+ across ${result.workers} cores
+ (${Math.round(result.attempts / (result.durationMs/1000)).toLocaleString()}/s)
+ </div>
+ <div class="actions">
+ <button id="copy-salt" class="btn primary" type="button">Copy salt</button>
+ <button id="copy-addr" class="btn" type="button">Copy address</button>
+ <button id="download" class="btn" type="button">⬇ Download JSON</button>
+ </div>
+ <div class="warn">
+ The address above will only match if you deploy with the <em>exact</em> initCode whose hash you entered.
+ Same factory + same initCode + this salt → same address, on every EVM chain that has this factory deployed.
+ </div>
+ </div>
+ `;
+ $('result').hidden = false;
+ $('result').innerHTML = html;
+
+ $('copy-salt').addEventListener('click', () => copy(result.salt, 'copy-salt', 'Copy salt'));
+ $('copy-addr').addEventListener('click', () => copy(result.address, 'copy-addr', 'Copy address'));
+ $('download').addEventListener('click', () => {
+ const payload = {
+ address: result.address,
+ salt: result.salt,
+ deployer: result.deployer,
+ initCodeHash: result.initCodeHash,
+ pattern: { prefix: p || null, suffix: s || null },
+ attempts: result.attempts,
+ durationMs: result.durationMs,
+ generatedAt: new Date().toISOString(),
+ };
+ const blob = new Blob([JSON.stringify(payload, null, 2)], { type: 'application/json' });
+ const url = URL.createObjectURL(blob);
+ const a = document.createElement('a');
+ a.href = url;
+ a.download = `create2-vanity-${result.address.slice(2, 10)}.json`;
+ document.body.appendChild(a);
+ a.click();
+ a.remove();
+ URL.revokeObjectURL(url);
+ });
+ }
+
+ async function copy(text, btnId, restoreLabel) {
+ try {
+ await navigator.clipboard.writeText(text);
+ $(btnId).textContent = 'Copied!';
+ setTimeout(() => { $(btnId).textContent = restoreLabel; }, 1400);
+ } catch {}
+ }
+ </script>
+</body>
+</html>
diff --git a/public/studio/studio.js b/public/studio/studio.js
index 11f403082..668112c5c 100644
--- a/public/studio/studio.js
+++ b/public/studio/studio.js
@@ -164,12 +164,16 @@ if (preModel) state.preselectedModel = preModel;
toast('Please select your own avatar before launching a token.');
return;
}
- const avatar = state.avatars.find(a => a.id === state.avatarId);
- // The form data from launch-panel is in detail.formData.
- // openPumpLaunchWizard uses identity for defaults, but here we can pass
- // the fresh data from the form.
- const identity = { name: detail.formData?.name || avatar?.name, ...avatar };
- openPumpLaunchWizard(identity, state.avatarId);
+ const avatar = state.avatars.find((a) => a.id === state.avatarId);
+ if (!avatar) {
+ toast('Avatar not loaded yet — try again in a moment.');
+ return;
+ }
+ // state.avatarId is an avatars.id, not an agent_identities.id.
+ // Pass the linked agent_id when known (from /api/avatars lateral join);
+ // otherwise pass avatar_id and the backend will resolve-or-create.
+ const identity = { name: detail.formData?.name || avatar.name, ...avatar };
+ openPumpLaunchWizard(identity, avatar.agent_id || null, avatar.id);
});
await loadAvatars();
diff --git a/src/eth/vanity/grinder-worker.js b/src/eth/vanity/grinder-worker.js
new file mode 100644
index 000000000..e425e3151
--- /dev/null
+++ b/src/eth/vanity/grinder-worker.js
@@ -0,0 +1,133 @@
+/**
+ * CREATE2 vanity grinder Web Worker.
+ *
+ * Hot loop: sample 32 random salt bytes, compute the EIP-1014 CREATE2
+ * address, check prefix/suffix against the lowercased hex address.
+ *
+ * address = keccak256(0xff ‖ deployer ‖ salt ‖ initCodeHash)[12:]
+ *
+ * `deployer` (20 bytes) and `initCodeHash` (32 bytes) are fixed for the
+ * session — we pre-build an 85-byte input buffer with those segments
+ * already in place and only rewrite bytes 21..52 (the salt) per attempt.
+ *
+ * Uses `@noble/hashes/sha3` keccak_256. Vite bundles workers, so the
+ * import resolves at build time.
+ */
+
+import { keccak_256 } from '@noble/hashes/sha3';
+
+const PROGRESS_INTERVAL = 5000;
+const HEX_CHARS = '0123456789abcdef';
+
+let running = false;
+
+self.onmessage = (e) => {
+ const msg = e.data;
+ if (msg?.type === 'start') {
+ running = true;
+ grind(msg);
+ } else if (msg?.type === 'stop') {
+ running = false;
+ }
+};
+
+/** Decode a 0x-prefixed hex string to a Uint8Array. */
+function hexToBytes(hex) {
+ let h = hex.startsWith('0x') || hex.startsWith('0X') ? hex.slice(2) : hex;
+ if (h.length % 2) h = '0' + h;
+ const out = new Uint8Array(h.length / 2);
+ for (let i = 0; i < out.length; i++) {
+ out[i] = parseInt(h.substring(i * 2, i * 2 + 2), 16);
+ }
+ return out;
+}
+
+/** Encode bytes as a lowercase hex string (no 0x). */
+function bytesToHex(bytes) {
+ let s = '';
+ for (let i = 0; i < bytes.length; i++) {
+ const b = bytes[i];
+ s += HEX_CHARS[b >> 4] + HEX_CHARS[b & 0xf];
+ }
+ return s;
+}
+
+/**
+ * @param {{ deployer: string, initCodeHash: string, prefix: string, suffix: string }} cfg
+ */
+async function grind(cfg) {
+ const deployer = hexToBytes(cfg.deployer);
+ const initCodeHash = hexToBytes(cfg.initCodeHash);
+ if (deployer.length !== 20) return self.postMessage({ type: 'error', message: 'deployer must be 20 bytes' });
+ if (initCodeHash.length !== 32) return self.postMessage({ type: 'error', message: 'initCodeHash must be 32 bytes' });
+
+ // Pre-build the 85-byte CREATE2 preimage: 0xff ‖ deployer(20) ‖ salt(32) ‖ initCodeHash(32).
+ // Only bytes 21..52 (salt) change per attempt.
+ const buf = new Uint8Array(1 + 20 + 32 + 32);
+ buf[0] = 0xff;
+ buf.set(deployer, 1);
+ buf.set(initCodeHash, 1 + 20 + 32);
+ const saltView = buf.subarray(1 + 20, 1 + 20 + 32);
+
+ const wantPrefix = (cfg.prefix || '').toLowerCase();
+ const wantSuffix = (cfg.suffix || '').toLowerCase();
+ const pLen = wantPrefix.length;
+ const sLen = wantSuffix.length;
+
+ // Seed the salt with a fresh random base; we then increment a counter
+ // at the tail to avoid re-deriving entropy on every iteration. The
+ // remaining 24 bytes of randomness still give 2^192 distinct salts
+ // per worker, which is more than enough.
+ crypto.getRandomValues(saltView);
+ const counter = new DataView(buf.buffer, buf.byteOffset + 1 + 20 + 24, 8); // last 8 bytes of salt
+ let lo = counter.getUint32(4, false);
+ let hi = counter.getUint32(0, false);
+
+ let attempts = 0;
+ let intervalAttempts = 0;
+ let intervalStart = performance.now();
+
+ while (running) {
+ // Bump the salt counter (big-endian 64-bit increment at salt[24..32]).
+ lo = (lo + 1) >>> 0;
+ if (lo === 0) hi = (hi + 1) >>> 0;
+ counter.setUint32(0, hi, false);
+ counter.setUint32(4, lo, false);
+
+ const digest = keccak_256(buf);
+ // Address is digest[12..32] — 20 bytes, lowercase hex.
+ const addr = bytesToHex(digest.subarray(12));
+
+ attempts++;
+ intervalAttempts++;
+
+ const headOk = !pLen || addr.startsWith(wantPrefix);
+ const tailOk = !sLen || addr.endsWith(wantSuffix);
+
+ if (headOk && tailOk) {
+ // Copy salt out before transferring buf — saltView is a subarray of buf,
+ // and we want to keep buf inside the worker for any subsequent runs.
+ const saltOut = new Uint8Array(32);
+ saltOut.set(saltView);
+ self.postMessage({
+ type: 'match',
+ address: '0x' + addr,
+ salt: '0x' + bytesToHex(saltOut),
+ attempts,
+ }, [saltOut.buffer]);
+ running = false;
+ return;
+ }
+
+ if (intervalAttempts >= PROGRESS_INTERVAL) {
+ const now = performance.now();
+ const elapsed = (now - intervalStart) / 1000;
+ const rate = elapsed > 0 ? intervalAttempts / elapsed : 0;
+ self.postMessage({ type: 'progress', attempts, rate, sample: '0x' + addr });
+ intervalStart = now;
+ intervalAttempts = 0;
+ // Yield so 'stop' messages get processed.
+ await new Promise((r) => setTimeout(r, 0));
+ }
+ }
+}
diff --git a/src/eth/vanity/grinder.js b/src/eth/vanity/grinder.js
new file mode 100644
index 000000000..888428f6f
--- /dev/null
+++ b/src/eth/vanity/grinder.js
@@ -0,0 +1,167 @@
+/**
+ * Ethereum CREATE2 vanity grinder — main-thread API.
+ *
+ * Spawns one Web Worker per logical core (capped at 8) to race for a salt
+ * whose CREATE2-derived address matches the requested hex prefix/suffix.
+ * First match wins; the rest are terminated.
+ *
+ * Usage:
+ * const { address, salt, attempts, durationMs } = await grindCreate2Vanity({
+ * deployer: '0x4e59b44847b379578588920cA78FbF26c0B4956C', // CreateX/Arachnid factory
+ * initCodeHash: '0x...32 bytes...',
+ * prefix: 'beef',
+ * onProgress: ({ attempts, rate, eta }) => updateUI(...),
+ * signal,
+ * });
+ *
+ * Returns the salt to feed into your factory's deploy call. The deployer
+ * must call `CREATE2(value, initCode, salt)` with the *same* initCode whose
+ * hash you passed here, otherwise the predicted address won't match.
+ */
+
+import {
+ validatePattern,
+ validateAddress,
+ validateInitCodeHash,
+ estimateAttempts,
+ formatTimeEstimate,
+} from './validation.js';
+
+const DEFAULT_MAX_WORKERS = 8;
+
+/**
+ * @typedef {object} GrindOptions
+ * @property {string} deployer - 20-byte EVM address of the CREATE2 deployer/factory.
+ * @property {string} initCodeHash - 32-byte keccak256 hash of the init code.
+ * @property {string} [prefix] - Hex prefix (without 0x), case-insensitive.
+ * @property {string} [suffix] - Hex suffix (without 0x), case-insensitive.
+ * @property {number} [maxWorkers]
+ * @property {AbortSignal} [signal]
+ * @property {(p: { attempts: number, rate: number, eta: string, sample?: string }) => void} [onProgress]
+ */
+
+/**
+ * @typedef {object} GrindResult
+ * @property {string} address - Predicted 0x… contract address (lowercase).
+ * @property {string} salt - 0x-prefixed 32-byte salt.
+ * @property {string} deployer - Echoed (normalized).
+ * @property {string} initCodeHash - Echoed (normalized).
+ * @property {number} attempts
+ * @property {number} durationMs
+ * @property {number} workers
+ */
+
+/**
+ * @param {GrindOptions} opts
+ * @returns {Promise<GrindResult>}
+ */
+export function grindCreate2Vanity(opts = {}) {
+ const { prefix = '', suffix = '', signal, onProgress } = opts;
+
+ const dep = validateAddress(opts.deployer || '');
+ if (!dep.valid) return Promise.reject(new Error(`invalid deployer: ${dep.error}`));
+ const ich = validateInitCodeHash(opts.initCodeHash || '');
+ if (!ich.valid) return Promise.reject(new Error(`invalid initCodeHash: ${ich.error}`));
+
+ if (!prefix && !suffix) {
+ return Promise.reject(new Error('prefix or suffix is required'));
+ }
+ let normPrefix = '', normSuffix = '';
+ if (prefix) {
+ const v = validatePattern(prefix);
+ if (!v.valid) return Promise.reject(new Error(`invalid prefix: ${v.errors.join('; ')}`));
+ normPrefix = v.normalized;
+ }
+ if (suffix) {
+ const v = validatePattern(suffix);
+ if (!v.valid) return Promise.reject(new Error(`invalid suffix: ${v.errors.join('; ')}`));
+ normSuffix = v.normalized;
+ }
+
+ const cores = Math.max(1, Math.min(
+ opts.maxWorkers || (typeof navigator !== 'undefined' && navigator.hardwareConcurrency) || 4,
+ DEFAULT_MAX_WORKERS,
+ ));
+ const expected = estimateAttempts(normPrefix.length + normSuffix.length);
+ const startedAt = performance.now();
+
+ /** @type {Worker[]} */
+ const workers = [];
+ const ratesByWorker = new Array(cores).fill(0);
+ const attemptsByWorker = new Array(cores).fill(0);
+
+ const stopAll = () => {
+ for (const w of workers) {
+ try { w.postMessage({ type: 'stop' }); } catch {}
+ try { w.terminate(); } catch {}
+ }
+ workers.length = 0;
+ };
+
+ return new Promise((resolve, reject) => {
+ const onAbort = () => {
+ stopAll();
+ reject(new DOMException('vanity grind aborted', 'AbortError'));
+ };
+ if (signal) {
+ if (signal.aborted) return onAbort();
+ signal.addEventListener('abort', onAbort, { once: true });
+ }
+
+ for (let i = 0; i < cores; i++) {
+ const w = new Worker(new URL('./grinder-worker.js', import.meta.url), { type: 'module' });
+ workers.push(w);
+
+ w.onmessage = (e) => {
+ const msg = e.data;
+ if (msg.type === 'match') {
+ stopAll();
+ if (signal) signal.removeEventListener('abort', onAbort);
+ const totalAttempts = attemptsByWorker.reduce((a, b) => a + b, 0) + msg.attempts;
+ resolve({
+ address: msg.address,
+ salt: msg.salt,
+ deployer: dep.normalized,
+ initCodeHash: ich.normalized,
+ attempts: totalAttempts,
+ durationMs: performance.now() - startedAt,
+ workers: cores,
+ });
+ } else if (msg.type === 'progress') {
+ attemptsByWorker[i] = msg.attempts;
+ ratesByWorker[i] = msg.rate;
+ if (onProgress) {
+ const totalRate = ratesByWorker.reduce((a, b) => a + b, 0);
+ const totalAttempts = attemptsByWorker.reduce((a, b) => a + b, 0);
+ onProgress({
+ attempts: totalAttempts,
+ rate: totalRate,
+ eta: formatTimeEstimate(Math.max(0, expected - totalAttempts), totalRate),
+ sample: msg.sample,
+ });
+ }
+ } else if (msg.type === 'error') {
+ stopAll();
+ if (signal) signal.removeEventListener('abort', onAbort);
+ reject(new Error(msg.message || 'vanity worker reported error'));
+ }
+ };
+
+ w.onerror = (err) => {
+ stopAll();
+ if (signal) signal.removeEventListener('abort', onAbort);
+ reject(err.error || new Error(err.message || 'vanity worker crashed'));
+ };
+
+ w.postMessage({
+ type: 'start',
+ deployer: dep.normalized,
+ initCodeHash: ich.normalized,
+ prefix: normPrefix,
+ suffix: normSuffix,
+ });
+ }
+ });
+}
+
+export { validatePattern, validateAddress, validateInitCodeHash, estimateAttempts, formatTimeEstimate };
diff --git a/src/eth/vanity/validation.js b/src/eth/vanity/validation.js
new file mode 100644
index 000000000..5f6339499
--- /dev/null
+++ b/src/eth/vanity/validation.js
@@ -0,0 +1,88 @@
+/**
+ * Validation for Ethereum CREATE2 vanity grinding.
+ *
+ * Pattern grammar: hex chars [0-9a-f], case-insensitive (we always compare
+ * lowercased — Ethereum addresses are 20 raw bytes; the EIP-55 mixed-case
+ * checksum is purely a presentation layer and isn't matched against here).
+ *
+ * CREATE2 address derivation (EIP-1014):
+ * address = keccak256(0xff ‖ deployer ‖ salt ‖ keccak256(initCode))[12:]
+ *
+ * The grinder samples random `salt` values; `deployer` and `initCodeHash`
+ * are fixed per session. Result is a deterministic smart-contract address —
+ * this is the standard pattern used by modern smart-account factories
+ * (Safe, ERC-4337 SimpleAccount, Coinbase Smart Wallet, CreateX, etc.).
+ */
+
+const HEX = /^[0-9a-f]+$/i;
+
+/** 20 hex chars (40 nibbles) is the entire address — anything past that is impossible. */
+export const MAX_PATTERN_LENGTH = 10;
+
+/** Below this, grinding finishes in seconds on a laptop; >= this hits minutes+. */
+export const FREE_THRESHOLD = 6;
+
+/**
+ * Validate a hex pattern (prefix or suffix), case-insensitive.
+ * Strips a leading "0x" if present.
+ * @param {string} pattern
+ * @returns {{ valid: boolean, errors: string[], normalized: string }}
+ */
+export function validatePattern(pattern) {
+ const errors = [];
+ if (typeof pattern !== 'string') {
+ return { valid: false, errors: ['pattern must be a string'], normalized: '' };
+ }
+ let p = pattern.trim();
+ if (p.startsWith('0x') || p.startsWith('0X')) p = p.slice(2);
+ if (p.length === 0) {
+ return { valid: false, errors: ['pattern is empty'], normalized: '' };
+ }
+ if (p.length > MAX_PATTERN_LENGTH) {
+ errors.push(`length ${p.length} exceeds maximum of ${MAX_PATTERN_LENGTH}`);
+ }
+ if (!HEX.test(p)) {
+ errors.push('pattern must be hexadecimal (0-9, a-f)');
+ }
+ return { valid: errors.length === 0, errors, normalized: p.toLowerCase() };
+}
+
+/** Validate a 20-byte EVM address: optional 0x, 40 hex chars. */
+export function validateAddress(addr) {
+ if (typeof addr !== 'string') return { valid: false, error: 'address must be a string' };
+ let a = addr.trim();
+ if (a.startsWith('0x') || a.startsWith('0X')) a = a.slice(2);
+ if (a.length !== 40) return { valid: false, error: `address must be 20 bytes (40 hex chars), got ${a.length}` };
+ if (!HEX.test(a)) return { valid: false, error: 'address contains non-hex characters' };
+ return { valid: true, normalized: '0x' + a.toLowerCase() };
+}
+
+/** Validate a 32-byte keccak256 init-code hash: optional 0x, 64 hex chars. */
+export function validateInitCodeHash(hash) {
+ if (typeof hash !== 'string') return { valid: false, error: 'init code hash must be a string' };
+ let h = hash.trim();
+ if (h.startsWith('0x') || h.startsWith('0X')) h = h.slice(2);
+ if (h.length !== 64) return { valid: false, error: `init code hash must be 32 bytes (64 hex chars), got ${h.length}` };
+ if (!HEX.test(h)) return { valid: false, error: 'init code hash contains non-hex characters' };
+ return { valid: true, normalized: '0x' + h.toLowerCase() };
+}
+
+/**
+ * Expected attempts to find a hex pattern of `length` nibbles.
+ * 16^length, since each nibble is uniformly random from a 16-char alphabet.
+ */
+export function estimateAttempts(length) {
+ return Math.pow(16, length);
+}
+
+/** Format a duration estimate as a human-readable string. */
+export function formatTimeEstimate(attempts, ratePerSecond) {
+ if (!ratePerSecond || ratePerSecond <= 0) return 'unknown';
+ const seconds = attempts / ratePerSecond;
+ if (seconds < 1) return 'less than a second';
+ if (seconds < 60) return `~${Math.round(seconds)} seconds`;
+ if (seconds < 3600) return `~${Math.round(seconds / 60)} minutes`;
+ if (seconds < 86400) return `~${Math.round(seconds / 3600)} hours`;
+ if (seconds < 31536000) return `~${Math.round(seconds / 86400)} days`;
+ return `~${Math.round(seconds / 31536000)} years`;
+}
diff --git a/src/pump/pump-modals.js b/src/pump/pump-modals.js
index 00975992a..2f7686a5d 100644
--- a/src/pump/pump-modals.js
+++ b/src/pump/pump-modals.js
@@ -371,7 +371,7 @@ function openGovernance({ mint, currentBps }) {
}
// ── Launch wizard ──────────────────────────────────────────────────────────
-function openLaunch({ identity, agentId }) {
+function openLaunch({ identity, agentId, avatarId }) {
const { inner, close } = openModal();
let step = 1;
@@ -492,7 +492,8 @@ function openLaunch({ identity, agentId }) {
headers: { 'content-type': 'application/json' },
credentials: 'include',
body: JSON.stringify({
- agent_id: agentId,
+ ...(agentId ? { agent_id: agentId } : {}),
+ ...(avatarId ? { avatar_id: avatarId } : {}),
wallet_address: payer,
name: f.name,
symbol: f.symbol,
@@ -556,6 +557,6 @@ export function mountPumpModals({ identity, agentId } = {}) {
);
}
-export function openPumpLaunchWizard(identity, agentId) {
- openLaunch({ identity, agentId });
+export function openPumpLaunchWizard(identity, agentId, avatarId) {
+ openLaunch({ identity, agentId, avatarId });
}
diff --git a/vite.config.js b/vite.config.js
index 5ec692b66..cc81aadeb 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -93,6 +93,8 @@ const appConfig = {
'my-agents': resolve(__dirname, 'public/my-agents/index.html'),
discover: resolve(__dirname, 'public/discover/index.html'),
// END:DISCOVER_ROUTE
+ 'vanity-wallet': resolve(__dirname, 'public/vanity-wallet.html'),
+ 'eth-vanity': resolve(__dirname, 'public/eth-vanity.html'),
},
},
},