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.

refactor(erc8004): retire the legacy deploy button for the RegisterUI wizard modal

nirholas61af612f8d80
diff --git a/public/style.css b/public/style.css
index be60de881..466d6e513 100644
--- a/public/style.css
+++ b/public/style.css
@@ -11285,3 +11285,48 @@ a.pill--devnet:hover {
opacity: 1;
transform: translateX(-50%) translateY(0);
}
+
+/* ── Deploy wizard modal overlay (agent pages / avatar page) ────────────────
+ RegisterUI in modal mode mounts into this fixed overlay; the card inside
+ carries role="dialog". Backdrop click and Escape both close it. */
+.agent-register-overlay {
+ position: fixed;
+ inset: 0;
+ z-index: 10000;
+ display: flex;
+ align-items: flex-start;
+ justify-content: center;
+ padding: 48px 16px 64px;
+ overflow-y: auto;
+ background: rgba(0, 0, 0, 0.72);
+ backdrop-filter: blur(6px);
+ -webkit-backdrop-filter: blur(6px);
+ animation: register-overlay-in 0.18s ease-out both;
+}
+@keyframes register-overlay-in {
+ from { opacity: 0; }
+ to { opacity: 1; }
+}
+.agent-register-overlay .erc8004-card {
+ width: min(880px, 100%);
+ outline: none;
+}
+@media (prefers-reduced-motion: reduce) {
+ .agent-register-overlay { animation: none; }
+}
+
+/* Vanity address + grind progress on the Solana review step */
+.deploy-vanity-row { margin: 10px 0 0; }
+.deploy-vanity-link {
+ background: none;
+ border: none;
+ padding: 0;
+ cursor: pointer;
+ font-size: var(--text-sm);
+ color: rgba(255, 255, 255, 0.65);
+ text-decoration: underline;
+ text-underline-offset: 3px;
+}
+.deploy-vanity-link:hover { color: #fff; }
+.deploy-vanity-link code { font-weight: 600; }
+.deploy-grind { align-items: center; gap: 10px; margin-top: 10px; }
diff --git a/src/agent-detail.js b/src/agent-detail.js
index 37bcea792..4b9e2d69a 100644
--- a/src/agent-detail.js
+++ b/src/agent-detail.js
@@ -2665,10 +2665,11 @@ function mountOwnerBar(agent) {
dashLink.textContent = 'Manage Agents';
bar.appendChild(dashLink);
- // Deploy on-chain (only if not yet deployed)
- const alreadyDeployed = !!(
- (agent.rawMetadata?.onchain || agent.onchain)?.txHash
- );
+ // Deploy on-chain (only if not yet deployed). The persisted wire shape is
+ // snake_case (tx_hash); legacy client code wrote txHash. Accept both so a
+ // deployed agent never re-offers a second paid mint.
+ const adOnchain = agent.rawMetadata?.onchain || agent.onchain;
+ const alreadyDeployed = !!(adOnchain?.tx_hash || adOnchain?.txHash);
if (!alreadyDeployed) {
const deployBtn = el('button', {
class: 'ad-btn ad-btn-deploy',
@@ -2710,7 +2711,8 @@ async function mountDeploySlot(agent) {
// When deploy succeeds, hide the "Deploy on-chain" button in the owner bar
// (the success chip in the slot replaces the call-to-action).
const observer = new MutationObserver(() => {
- if (deployAgentObj.onchain?.txHash && slot.querySelector('.deploy-chip--success')) {
+ const oc = deployAgentObj.onchain;
+ if ((oc?.tx_hash || oc?.txHash) && slot.querySelector('.deploy-chip--success')) {
observer.disconnect();
const heroDeployBtn = document.querySelector('#ad-owner-bar .ad-btn-deploy');
if (heroDeployBtn) heroDeployBtn.remove();
@@ -2781,7 +2783,8 @@ async function openDeployModalFromDetail(agent) {
let deployed = false;
const observer = new MutationObserver(() => {
- if (deployAgentObj.onchain?.txHash && deployHost.querySelector('.deploy-chip--success')) {
+ const oc = deployAgentObj.onchain;
+ if ((oc?.tx_hash || oc?.txHash) && deployHost.querySelector('.deploy-chip--success')) {
deployed = true;
}
});
diff --git a/src/agent-home-orphans.js b/src/agent-home-orphans.js
deleted file mode 100644
index 89d079eee..000000000
--- a/src/agent-home-orphans.js
+++ /dev/null
@@ -1,169 +0,0 @@
-/**
- * Agent Home orphan mounts: SharePanel + DeployButton.
- *
- * Call mountOrphans() after the agent identity is ready. Handles:
- * - Share button (all visitors)
- * - Deploy chip (owner only, conditionally on-chain state)
- *
- * @module agent-home-orphans
- */
-
-import { SharePanel } from './share-panel.js';
-import { DeployButton } from './erc8004/deploy-button.js';
-import './erc8004/deploy-button.css';
-import { getCurrentUser } from './wallet-auth.js';
-import { CHAIN_META, addressExplorerUrl } from './erc8004/chain-meta.js';
-
-/**
- * Mount the share button and (if owner) the deploy chip.
- *
- * @param {{ agentId: string, identity: import('./agent-identity.js').AgentIdentity, shareMount: HTMLElement }} opts
- * @returns {Promise<void>}
- */
-export async function mountOrphans({ agentId, identity, shareMount }) {
- _mountShareButton(shareMount, identity);
-
- // Ownership resolution: rawAgent.user_id is only returned to the owner
- const [user, rawAgent] = await Promise.all([getCurrentUser(), _fetchRawAgent(agentId)]);
-
- if (!user || !rawAgent || rawAgent.user_id !== user.id) return;
-
- const chipMount = _createChipMount();
-
- if (rawAgent.chain_id) {
- // Already on-chain: show pill (API doesn't store tx_hash, link to registry contract)
- _renderSuccessChip(chipMount, rawAgent.chain_id, rawAgent.erc8004_registry);
- } else {
- // Not yet deployed: mount the deploy button. Pass through avatarId,
- // description, and skills so register-prep can build a complete
- // manifest pinned to IPFS — without these the on-chain agentURI
- // would point to a stub.
- const agentObj = {
- id: rawAgent.id,
- name: rawAgent.name,
- description: rawAgent.description || '',
- avatarId: rawAgent.avatar_id || null,
- skills: Array.isArray(rawAgent.skills) ? rawAgent.skills : [],
- chainId: null,
- txHash: null,
- contractAddress: rawAgent.erc8004_registry || null,
- };
- const btn = new DeployButton({ agent: agentObj, container: chipMount });
- btn.mount();
- _watchForDeploy(chipMount, agentObj);
- }
-}
-
-// ── Private helpers ────────────────────────────────────────────────────────────
-
-/**
- * @param {HTMLElement} mount
- * @param {import('./agent-identity.js').AgentIdentity} identity
- */
-function _mountShareButton(mount, identity) {
- const btn = document.createElement('button');
- btn.className = 'agent-share-btn';
- btn.setAttribute('aria-label', 'Share agent');
- btn.setAttribute('aria-haspopup', 'dialog');
- btn.innerHTML =
- `<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor"` +
- ` stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">` +
- `<circle cx="18" cy="5" r="3"/><circle cx="6" cy="12" r="3"/><circle cx="18" cy="19" r="3"/>` +
- `<line x1="8.59" y1="13.51" x2="15.42" y2="17.49"/>` +
- `<line x1="15.41" y1="6.51" x2="8.59" y2="10.49"/>` +
- `</svg>Share`;
-
- let panel = null;
- btn.addEventListener('click', () => {
- if (!panel) {
- panel = new SharePanel({
- agent: { id: identity.id, name: identity.name },
- container: document.body,
- });
- }
- panel.open();
- });
-
- mount.appendChild(btn);
-}
-
-/** Insert a chip mount in its own row beneath the hero (below the subtitle). */
-function _createChipMount() {
- const subtitle = document.getElementById('page-agent-desc');
- const titleEl = document.getElementById('page-agent-name');
- const anchor = subtitle || titleEl;
- if (!anchor) {
- const fallback = document.createElement('div');
- document.body.appendChild(fallback);
- return fallback;
- }
-
- const chipMount = document.createElement('div');
- chipMount.className = 'agent-deploy-chip-mount';
- anchor.parentNode.insertBefore(chipMount, anchor.nextSibling);
- return chipMount;
-}
-
-/**
- * @param {HTMLElement} mount
- * @param {number} chainId
- * @param {string|null} registryAddress
- */
-function _renderSuccessChip(mount, chainId, registryAddress) {
- const meta = CHAIN_META[chainId];
- const chainName = meta?.name ?? `Chain ${chainId}`;
- const explorerUrl = registryAddress ? addressExplorerUrl(chainId, registryAddress) : '#';
- mount.innerHTML =
- `<a class="deploy-chip deploy-chip--success"` +
- ` href="${_esc(explorerUrl)}" target="_blank" rel="noopener noreferrer">` +
- `&#x2B22; On ${_esc(chainName)}` +
- `</a>`;
-}
-
-/** Watch for deploy-chip--success appearing → show a brief toast. */
-function _watchForDeploy(mount, agentObj) {
- const obs = new MutationObserver(() => {
- if (!mount.querySelector('.deploy-chip--success')) return;
- obs.disconnect();
- const chainName = CHAIN_META[agentObj.chainId]?.name ?? 'chain';
- _showToast(`Agent registered on ${chainName}`);
- });
- obs.observe(mount, { childList: true, subtree: true });
-}
-
-/** @param {string} msg */
-function _showToast(msg) {
- const toast = document.createElement('div');
- toast.className = 'agent-deploy-toast';
- toast.textContent = msg;
- document.body.appendChild(toast);
- requestAnimationFrame(() => toast.classList.add('agent-deploy-toast--visible'));
- setTimeout(() => {
- toast.classList.remove('agent-deploy-toast--visible');
- setTimeout(() => toast.remove(), 300);
- }, 3000);
-}
-
-/**
- * @param {string} agentId
- * @returns {Promise<object|null>}
- */
-async function _fetchRawAgent(agentId) {
- try {
- const res = await fetch(`/api/agents/${agentId}`, { credentials: 'include' });
- if (!res.ok) return null;
- const { agent } = await res.json();
- return agent ?? null;
- } catch {
- return null;
- }
-}
-
-/** @param {unknown} str */
-function _esc(str) {
- return String(str ?? '')
- .replace(/&/g, '&amp;')
- .replace(/</g, '&lt;')
- .replace(/>/g, '&gt;')
- .replace(/"/g, '&quot;');
-}
diff --git a/src/agent-hub-actions.js b/src/agent-hub-actions.js
index c59200b32..4dae33f68 100644
--- a/src/agent-hub-actions.js
+++ b/src/agent-hub-actions.js
@@ -64,14 +64,22 @@ export function renderHubActions(panel, identity, rawAgent) {
const wrap = document.createElement('div');
wrap.className = 'agent-register-overlay';
document.body.appendChild(wrap);
- new RegisterUI(
+ const ui = new RegisterUI(
wrap,
- () => {
- wrap.remove();
- location.reload();
+ () => {},
+ {
+ initialTab: 'my',
+ // onRegistered must NOT tear down the UI: the success screen with
+ // the tx link stays up until the user closes it themselves.
+ onClose: ({ registered }) => {
+ wrap.remove();
+ if (registered) location.reload();
+ },
},
- { initialTab: 'my' },
);
+ wrap.addEventListener('click', (e) => {
+ if (e.target === wrap) ui.destroy();
+ });
} catch (err) {
log.error('[hub] register-ui load failed', err);
} finally {
@@ -88,14 +96,20 @@ export function renderHubActions(panel, identity, rawAgent) {
const wrap = document.createElement('div');
wrap.className = 'agent-register-overlay';
document.body.appendChild(wrap);
- new RegisterUI(
+ const ui = new RegisterUI(
wrap,
- () => {
- wrap.remove();
- location.reload();
+ () => {},
+ {
+ initial,
+ onClose: ({ registered }) => {
+ wrap.remove();
+ if (registered) location.reload();
+ },
},
- { initial },
);
+ wrap.addEventListener('click', (e) => {
+ if (e.target === wrap) ui.destroy();
+ });
} catch (err) {
log.error('[hub] register-ui load failed', err);
deployBtn.disabled = false;
diff --git a/src/avatar-page.js b/src/avatar-page.js
index 4e8272eda..91909621f 100644
--- a/src/avatar-page.js
+++ b/src/avatar-page.js
@@ -1163,7 +1163,15 @@ async function openDeployOnchain() {
const wrap = document.createElement('div');
wrap.className = 'agent-register-overlay';
document.body.appendChild(wrap);
- new RegisterUI(wrap, () => { wrap.remove(); }, { initial });
+ const ui = new RegisterUI(wrap, () => {}, {
+ initial,
+ // Keep the success screen (tx link, agent page CTA) up until the user
+ // closes it; only then tear down the overlay.
+ onClose: () => wrap.remove(),
+ });
+ wrap.addEventListener('click', (e) => {
+ if (e.target === wrap) ui.destroy();
+ });
} catch (err) {
log.error('[avatar] deploy on-chain failed', err);
} finally {
diff --git a/src/erc8004/deploy-button.js b/src/erc8004/deploy-button.js
deleted file mode 100644
index 3c8b8fd44..000000000
--- a/src/erc8004/deploy-button.js
+++ /dev/null
@@ -1,767 +0,0 @@
-/**
- * DeployButton — minimal "Deploy on-chain" UI for an agent's home page.
- *
- * Flow (matches the canonical 3-step pipeline used by /deploy):
- * 1. POST /api/agents/register-prep — server pins a manifest to IPFS,
- * returns { cid, metadataURI, prepId }.
- * The prepId is cached in localStorage so retries reuse the same prep
- * record (idempotency: never pin twice on a flaky network).
- * 2. registry.register(metadataURI) — user signs the on-chain mint.
- * 3. POST /api/agents/register-confirm — server verifies the receipt against
- * the prep record and upserts
- * agent_identities.{chain_id,
- * erc8004_agent_id, erc8004_registry,
- * registration_cid}.
- *
- * Distinct from register-ui.js (the full multi-tab wizard) — this is the
- * one-click chip surfaced on the agent's profile page for the owner.
- */
-
-import { ensureWallet, getIdentityRegistry } from './agent-registry.js';
-import { REGISTRY_DEPLOYMENTS } from './abi.js';
-import {
- CHAIN_META,
- supportedChainIdsGrouped,
- switchChain,
- addressExplorerUrl,
-} from './chain-meta.js';
-import { runSolanaDeploy, solanaTxExplorerUrl, detectSolanaWallet } from './solana-deploy.js';
-import { openVanityModal } from './vanity-modal.js';
-import { log } from '../shared/log.js';
-
-const VANITY_LS_KEY = (agentId) => `3dagent:vanity-prefix:${agentId}`;
-const VANITY_TTL_MS = 30 * 60 * 1000;
-
-function _loadVanity(agentId) {
- try {
- const raw = localStorage.getItem(VANITY_LS_KEY(agentId));
- if (!raw) return '';
- const { prefix, ts } = JSON.parse(raw);
- if (Date.now() - ts > VANITY_TTL_MS) return '';
- return prefix || '';
- } catch { return ''; }
-}
-function _saveVanity(agentId, prefix) {
- try {
- if (prefix) localStorage.setItem(VANITY_LS_KEY(agentId), JSON.stringify({ prefix, ts: Date.now() }));
- else localStorage.removeItem(VANITY_LS_KEY(agentId));
- } catch {}
-}
-
-// Sentinel chain selections for non-EVM targets. The chain dropdown stores
-// these as option values; _chainId may be a number (EVM chainId) or one of
-// these strings.
-const SOLANA_MAINNET = 'solana-mainnet';
-const SOLANA_DEVNET = 'solana-devnet';
-const SOLANA_LABELS = {
- [SOLANA_MAINNET]: 'Solana',
- [SOLANA_DEVNET]: 'Solana Devnet',
-};
-function _isSolana(id) {
- return id === SOLANA_MAINNET || id === SOLANA_DEVNET;
-}
-function _solanaNetwork(id) {
- return id === SOLANA_DEVNET ? 'devnet' : 'mainnet';
-}
-
-// Faucet links for testnets where users commonly run out of gas.
-const FAUCETS = {
- 84532: 'https://www.coinbase.com/faucets/base-ethereum-sepolia-faucet',
- 11155111: 'https://sepoliafaucet.com/',
- 421614: 'https://www.alchemy.com/faucets/arbitrum-sepolia',
- 11155420: 'https://app.optimism.io/faucet',
- 80002: 'https://faucet.polygon.technology/',
- 43113: 'https://faucet.avax.network/',
- 97: 'https://testnet.bnbchain.org/faucet-smart',
-};
-
-const WALLET_INSTALL_URL = 'https://metamask.io/download/';
-
-function _hasWallet() {
- return typeof window !== 'undefined' && !!window.ethereum;
-}
-
-// localStorage key for caching the active prep record across retries.
-function _prepCacheKey(agentId) {
- return `3dagent:deploy-prep:${agentId}`;
-}
-
-export class DeployButton {
- /**
- * @param {object} opts
- * @param {object} opts.agent Agent record. Required: id, name.
- * Optional but recommended for a
- * richer manifest: avatarId,
- * description, skills.
- * @param {HTMLElement} opts.container Where to mount.
- * @param {number|string} [opts.preferredChainId] Defaults to Solana mainnet.
- */
- constructor({ agent, container, preferredChainId = SOLANA_MAINNET }) {
- this._agent = agent;
- this._container = container;
- this._chainId = preferredChainId;
- this._root = null;
- }
-
- mount() {
- this._root = document.createElement('div');
- this._root.className = 'deploy-button-root';
- this._container.appendChild(this._root);
- this._render();
- }
-
- unmount() {
- if (this._root) {
- this._root.remove();
- this._root = null;
- }
- }
-
- _render() {
- if (!this._root) return;
- const agent = this._agent;
-
- if (agent.chainId && agent.txHash) {
- this._renderSuccessChip(agent.chainId, agent.txHash, agent.contractAddress);
- } else if (!_isSolana(this._chainId) && !REGISTRY_DEPLOYMENTS[this._chainId]) {
- this._renderDisabled('No registry on this chain');
- } else {
- this._renderDeployButton();
- }
- }
-
- _renderDeployButton() {
- const { mainnets, testnets } = supportedChainIdsGrouped();
- const evmOptionsFor = (ids) =>
- ids
- .map(
- (id) =>
- `<option value="${id}"${id === this._chainId ? ' selected' : ''}>${_esc(
- CHAIN_META[id]?.name || `Chain ${id}`,
- )}</option>`,
- )
- .join('');
- const solanaOptionFor = (id) =>
- `<option value="${id}"${id === this._chainId ? ' selected' : ''}>${_esc(SOLANA_LABELS[id])}</option>`;
-
- const showVanity = _isSolana(this._chainId);
- // Hydrate from localStorage on first render.
- if (this._vanityPrefix == null) this._vanityPrefix = _loadVanity(this._agent?.id) || '';
-
- this._root.innerHTML = `
- <div class="deploy-chain-row">
- <select class="deploy-chain-select" title="Choose chain to deploy to" aria-label="Target chain">
- <optgroup label="Solana (recommended)">${solanaOptionFor(SOLANA_MAINNET)}${solanaOptionFor(SOLANA_DEVNET)}</optgroup>
- <optgroup label="EVM Mainnets">${evmOptionsFor(mainnets)}</optgroup>
- <optgroup label="EVM Testnets">${evmOptionsFor(testnets)}</optgroup>
- </select>
- <button class="deploy-btn" title="Deploy this agent as an ERC-8004 token on-chain">
- &#x2B22; Deploy on-chain
- </button>
- </div>
- <div class="deploy-vanity-link-row" style="${showVanity ? '' : 'display:none'};margin-top:4px;font-size:12px;">
- <button type="button" class="deploy-vanity-link"
- style="background:none;border:none;color:rgba(255,255,255,0.6);cursor:pointer;padding:0;font-size:12px;text-decoration:underline">
- ${this._vanityPrefix
- ? `&#10024; Vanity: <span style="font-family:monospace;font-weight:600">${_esc(this._vanityPrefix)}</span> &middot; change`
- : '&#10024; Customize address (optional)'}
- </button>
- </div>
- `;
-
- const select = this._root.querySelector('.deploy-chain-select');
- const vanityLinkRow = this._root.querySelector('.deploy-vanity-link-row');
- const vanityLink = this._root.querySelector('.deploy-vanity-link');
-
- vanityLink.addEventListener('click', async () => {
- const chosen = await openVanityModal({
- agentName: this._agent?.name || '',
- initial: this._vanityPrefix || '',
- });
- if (chosen === null) return; // dismissed
-
- // Modal returns either a string (prefix to grind in browser) or
- // { prefix, secretKey } when the user pasted a CLI-ground keypair.
- if (chosen && typeof chosen === 'object') {
- this._vanityPrefix = chosen.prefix || '';
- this._preGroundSecretKey = chosen.secretKey;
- } else {
- this._vanityPrefix = chosen;
- this._preGroundSecretKey = null;
- }
- _saveVanity(this._agent?.id, this._vanityPrefix);
- this._renderDeployButton(); // re-render to update label
- });
-
- select.addEventListener('change', async (ev) => {
- const raw = ev.target.value;
- const newChainId = _isSolana(raw) ? raw : Number(raw);
- this._chainId = newChainId;
- vanityLinkRow.style.display = _isSolana(newChainId) ? '' : 'none';
- if (!_isSolana(newChainId) && _hasWallet()) {
- select.disabled = true;
- try {
- await switchChain(newChainId);
- } catch (err) {
- if (!_isUserRejection(err)) {
- log.warn('[deploy-button] switchChain failed:', err?.message);
- }
- } finally {
- select.disabled = false;
- }
- }
- });
-
- this._root
- .querySelector('.deploy-btn')
- .addEventListener('click', () => this._startDeploy());
- }
-
- _renderDisabled(reason) {
- this._root.innerHTML = `
- <button class="deploy-btn deploy-btn--disabled" disabled title="${_esc(reason)}">
- &#x2B22; Deploy on-chain
- </button>
- <span class="deploy-tooltip">${_esc(reason)}</span>
- `;
- }
-
- _renderSuccessChip(chainId, txHash, contractAddress, vanityPrefix) {
- let chainName, explorerUrl;
- if (_isSolana(chainId)) {
- const network = _solanaNetwork(chainId);
- chainName = SOLANA_LABELS[chainId];
- explorerUrl = solanaTxExplorerUrl(network, txHash);
- } else {
- const meta = CHAIN_META[chainId];
- chainName = meta ? meta.name : `Chain ${chainId}`;
- // Use the registry contract URL on the explorer — it's the most
- // universally available link, since some chains' explorers don't
- // surface tx hashes for arbitrary contracts.
- explorerUrl = contractAddress ? addressExplorerUrl(chainId, contractAddress) : '#';
- }
- const vanityNote = vanityPrefix
- ? ` &middot; <span style="background:linear-gradient(90deg,#ffd54f,#ff8a65);color:#1a1a1a;padding:0 6px;border-radius:999px;font-weight:600">&#10024; ${_esc(vanityPrefix)}</span>`
- : '';
- this._root.innerHTML = `
- <a class="deploy-chip deploy-chip--success" href="${_esc(explorerUrl)}" target="_blank" rel="noopener noreferrer"
- aria-label="View this agent's registry on the ${_esc(chainName)} block explorer">
- &#x2B22; On-chain on ${_esc(chainName)}${vanityNote} &middot; view on explorer
- </a>
- `;
- }
-
- _renderProgress(steps, activeIdx, extra) {
- // Inject keyframes once into the document head
- if (!document.getElementById('db-progress-kf')) {
- const style = document.createElement('style');
- style.id = 'db-progress-kf';
- style.textContent = `
- @keyframes db-pulse { 0%,100%{box-shadow:0 0 0 0 rgba(99,102,241,.55)} 50%{box-shadow:0 0 0 10px rgba(99,102,241,0)} }
- @keyframes db-spin { to{transform:rotate(360deg)} }
- @keyframes db-flow { to{background-position:0 -16px} }
- @keyframes db-rise { from{opacity:0;transform:translateY(4px)} to{opacity:1;transform:none} }
- @keyframes db-blink { 0%,100%{opacity:.35} 50%{opacity:1} }
- .db-step{display:flex;align-items:center;gap:11px;padding:11px 14px;border-radius:10px;font-size:13px;transition:background .25s,border-color .25s,color .25s,opacity .25s}
- .db-step--done{background:rgba(99,102,241,.92);border:1px solid rgba(99,102,241,.55);color:#fff;font-weight:600;opacity:1}
- .db-step--active{background:rgba(99,102,241,.14);border:1px solid rgba(99,102,241,.85);color:#c7d2fe;font-weight:700;opacity:1;animation:db-pulse 1.7s ease-in-out infinite}
- .db-step--pending{background:rgba(255,255,255,.03);border:1px solid rgba(255,255,255,.08);color:#5b6270;font-weight:500;opacity:.6}
- .db-connector{width:2px;height:16px;margin-left:27px;border-radius:2px}
- .db-connector--filled{background:rgba(99,102,241,.7)}
- .db-connector--flow{background:linear-gradient(180deg,rgba(99,102,241,.85) 0 8px,transparent 8px 16px);background-size:2px 16px;animation:db-flow .55s linear infinite}
- .db-connector--idle{background:rgba(255,255,255,.07)}
- .db-status{margin-top:14px;font-size:16px;font-weight:700;letter-spacing:-.01em;line-height:1.2;background:linear-gradient(90deg,#c7d2fe,#a5b4fc);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;animation:db-rise .35s ease both}
- .db-status--done{background:linear-gradient(90deg,#a7f3d0,#6ee7b7)}
- .db-cancel{margin-top:14px;font-size:12.5px;font-weight:600;background:transparent;border:1px solid rgba(255,255,255,.16);border-radius:8px;padding:8px 16px;cursor:pointer;color:#9ca3af;transition:border-color .15s,color .15s,background .15s}
- .db-cancel:hover{border-color:rgba(248,113,113,.6);color:#fca5a5;background:rgba(248,113,113,.08)}
- .db-cancel:focus-visible{outline:2px solid rgba(165,180,252,.8);outline-offset:2px}
- .db-spinner{animation:db-spin .85s linear infinite}
- .db-detail--busy{animation:db-blink 1.6s ease-in-out infinite}
- @media (prefers-reduced-motion: reduce){
- .db-step--active{animation:none}
- .db-connector--flow{animation:none;background:rgba(99,102,241,.7)}
- .db-status{animation:none}
- .db-detail--busy{animation:none}
- }
- `;
- document.head.appendChild(style);
- }
-
- const isDone = activeIdx >= steps.length;
- const liveText = isDone ? 'Deployed on-chain' : `${steps[activeIdx]}…`;
-
- const rows = steps.map((s, i) => {
- const done = i < activeIdx;
- const active = i === activeIdx;
- const cls = done ? 'db-step--done' : active ? 'db-step--active' : 'db-step--pending';
- const icon = done
- ? `<span style="font-size:16px;line-height:1;width:18px;text-align:center;flex-shrink:0">✓</span>`
- : active
- ? `<svg width="18" height="18" viewBox="0 0 18 18" class="db-spinner" style="flex-shrink:0" aria-hidden="true"><circle cx="9" cy="9" r="7" fill="none" stroke="rgba(165,180,252,.22)" stroke-width="2"/><path d="M9 2A7 7 0 0 1 16 9" fill="none" stroke="#c7d2fe" stroke-width="2" stroke-linecap="round"/></svg>`
- : `<span style="width:18px;height:18px;flex-shrink:0;display:inline-block;border-radius:50%;border:1.5px solid rgba(255,255,255,.1)"></span>`;
- const tile = `<div class="db-step ${cls}">${icon}<span>${_esc(s)}</span></div>`;
- if (i === steps.length - 1) return tile;
- // Connector below this tile: filled if next step reached, flowing if
- // this step is the active one (work in progress), idle otherwise.
- const conn = done
- ? (i + 1 <= activeIdx ? 'db-connector--filled' : 'db-connector--flow')
- : active
- ? 'db-connector--flow'
- : 'db-connector--idle';
- return `${tile}<div class="db-connector ${conn}" aria-hidden="true"></div>`;
- }).join('');
-
- this._root.innerHTML = `
- <div role="status" aria-live="polite" aria-label="Deployment progress"
- style="display:flex;flex-direction:column;align-items:stretch;gap:0">
- ${rows}
- </div>
- <div class="db-status ${isDone ? 'db-status--done' : ''}">${_esc(liveText)}</div>
- <div class="deploy-progress-detail${extra?.text ? ' db-detail--busy' : ''}" aria-live="polite"
- style="margin-top:7px;font-size:11.5px;color:#6b7280;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;min-height:1.2em;letter-spacing:.01em">
- ${extra?.text ? _esc(extra.text) : ''}
- </div>
- ${extra?.cancelable ? `<button class="db-cancel deploy-cancel-btn" type="button">⊘ Stop grinding</button>` : ''}
- `;
- if (extra?.onCancel) {
- const cb = this._root.querySelector('.deploy-cancel-btn');
- if (cb) cb.addEventListener('click', extra.onCancel);
- }
- }
-
- _renderError(msg, action) {
- const actionHtml = action
- ? `<button class="deploy-action-btn">${_esc(action.label)}</button>`
- : '<button class="deploy-action-btn deploy-action-btn--reset">Try again</button>';
- this._root.innerHTML = `
- <div class="deploy-error" role="alert">
- <span class="deploy-error-msg" title="${_esc(msg)}">${_esc(msg)}</span>
- ${actionHtml}
- </div>
- `;
- const btn = this._root.querySelector('.deploy-action-btn');
- if (action) {
- btn.addEventListener('click', action.handler);
- } else {
- btn.addEventListener('click', () => this._renderDeployButton());
- }
- }
-
- // ─── Deploy state machine ──────────────────────────────────────────────
-
- async _startSolanaDeploy() {
- if (!detectSolanaWallet()) {
- this._renderError('No Solana wallet detected. Install Phantom to continue.', {
- label: 'Install Phantom',
- handler: () => window.open('https://phantom.app', '_blank', 'noopener'),
- });
- return;
- }
-
- const agent = this._agent;
- if (!agent?.id) {
- this._renderError('This agent is missing an ID — cannot deploy.');
- return;
- }
-
- const network = _solanaNetwork(this._chainId);
- const vanityPrefix = (this._vanityPrefix || '').trim();
- const preGround = this._preGroundSecretKey || null;
- const willGrind = vanityPrefix && !preGround;
- const steps = preGround
- ? ['Loading pre-ground keypair', 'Sign tx', 'Confirming on-chain', 'Saving']
- : willGrind
- ? ['Grinding vanity address', 'Sign tx', 'Confirming on-chain', 'Saving']
- : ['Connecting wallet', 'Sign tx', 'Confirming on-chain', 'Saving'];
- const abort = new AbortController();
- this._renderProgress(steps, 0, willGrind ? {
- text: `searching for "${vanityPrefix}…"`,
- cancelable: true,
- onCancel: () => abort.abort(),
- } : preGround ? {
- text: `using CLI-ground keypair${vanityPrefix ? ` for "${vanityPrefix}…"` : ''}`,
- } : undefined);
-
- let result;
- try {
- result = await runSolanaDeploy({
- agent,
- network,
- vanity: (vanityPrefix || preGround) ? {
- prefix: vanityPrefix || undefined,
- preGroundSecretKey: preGround || undefined,
- signal: abort.signal,
- onProgress: willGrind ? ({ attempts, rate, eta }) => {
- const detail = this._root.querySelector('.deploy-progress-detail');
- if (detail) {
- detail.textContent =
- `🔍 "${vanityPrefix}…" ${attempts.toLocaleString()} tries · ${Math.round(rate).toLocaleString()}/s · eta ${eta}`;
- }
- } : undefined,
- } : undefined,
- });
- this._renderProgress(steps, 1);
- this._renderProgress(steps, 3);
- } catch (err) {
- if (_isUserRejection(err) || err?.name === 'AbortError') return this._renderDeployButton();
- if (err.code === 'forbidden') {
- this._renderError(
- 'Your Solana wallet is not linked to this account. Sign in with your Solana wallet first.',
- {
- label: 'Open wallet sign-in',
- handler: () => (window.location.href = '/login'),
- },
- );
- return;
- }
- if (err.code === 'payment_required') {
- this._renderError(
- `${err.message || 'Paid plan required'} — upgrade to use 5+ character vanity prefixes.`,
- {
- label: 'View plans',
- handler: () => (window.location.href = '/pricing'),
- },
- );
- return;
- }
- this._renderError(`Solana deploy failed: ${_humanError(err)}`);
- return;
- }
-
- this._agent.chainId = this._chainId;
- this._agent.txHash = result.txSignature;
- this._agent.contractAddress = result.assetPubkey;
- _saveVanity(this._agent?.id, ''); // clear after successful deploy
- this._preGroundSecretKey = null;
- this._renderSuccessChip(this._chainId, result.txSignature, result.assetPubkey, result.vanityPrefix);
-
- // Redirect to the cinematic reveal page after a brief success flash
- const agentId = this._agent.id;
- const txSig = result.txSignature || '';
- const assetPk = result.assetPubkey || '';
- const chain = this._chainId;
- setTimeout(() => {
- window.location.href = `/mint-success?id=${encodeURIComponent(agentId)}&tx=${encodeURIComponent(txSig)}&asset=${encodeURIComponent(assetPk)}&chain=${encodeURIComponent(chain)}`;
- }, 900);
- }
-
- async _startDeploy() {
- // Newcomers deploying on-chain for the first time get the plain-language
- // wallet/USDC/fees explainer + guided setup before any wallet prompt.
- // Returning/ready users pass straight through. Lazy-loaded.
- try {
- const { ensureOnchainPrimer } = await import('../shared/onchain-primer.js');
- if (!(await ensureOnchainPrimer({ action: 'deploy' }))) return;
- } catch (err) {
- log.warn('[deploy-button] onchain primer unavailable', err);
- }
-
- if (_isSolana(this._chainId)) return this._startSolanaDeploy();
-
- if (!_hasWallet()) {
- this._renderError('No wallet detected. Install one to deploy on-chain.', {
- label: 'Install MetaMask',
- handler: () => window.open(WALLET_INSTALL_URL, '_blank', 'noopener'),
- });
- return;
- }
-
- const agent = this._agent;
- if (!agent?.id) {
- this._renderError('This agent is missing an ID — cannot deploy.');
- return;
- }
- if (!agent.avatarId && !agent.avatar_id) {
- this._renderError('This agent has no avatar attached. Add a body before deploying.', {
- label: 'Open editor',
- handler: () =>
- (window.location.href = `/app?agent=${encodeURIComponent(agent.id)}`),
- });
- return;
- }
-
- const steps = ['Preparing manifest', 'Sign tx', 'Confirming on-chain', 'Saving'];
- this._renderProgress(steps, 0);
-
- // ── Step 0: prep + IPFS pin ────────────────────────────────────────
- // Reuse a recent prep record so retries don't re-pin and don't waste
- // time. Server expires prep records after 1h.
- let prep;
- try {
- prep = await this._getOrCreatePrep();
- } catch (err) {
- this._renderError(`Could not prepare manifest: ${err.message}`);
- return;
- }
-
- // ── Connect wallet on the selected chain ───────────────────────────
- let signer, walletChainId;
- try {
- ({ signer, chainId: walletChainId } = await ensureWallet());
- } catch (err) {
- if (_isUserRejection(err)) return this._renderDeployButton();
- this._renderError(`Wallet connection failed: ${_humanError(err)}`);
- return;
- }
-
- if (walletChainId !== this._chainId) {
- const targetName = CHAIN_META[this._chainId]?.name || `chain ${this._chainId}`;
- this._renderError(`Wallet is on a different network. Switch to ${targetName}.`, {
- label: `Switch to ${targetName}`,
- handler: async () => {
- try {
- await switchChain(this._chainId);
- this._renderDeployButton();
- } catch (e) {
- if (_isUserRejection(e)) return this._renderDeployButton();
- this._renderError(`Network switch failed: ${_humanError(e)}`);
- }
- },
- });
- return;
- }
-
- const deployment = REGISTRY_DEPLOYMENTS[walletChainId];
- if (!deployment?.identityRegistry) {
- this._renderDisabled('No ERC-8004 registry deployed on this chain');
- return;
- }
-
- // ── Step 1: sign tx ────────────────────────────────────────────────
- this._renderProgress(steps, 1);
- const registry = getIdentityRegistry(walletChainId, signer);
- let tx;
- try {
- tx = await registry['register(string)'](prep.metadataURI);
- } catch (err) {
- this._handleSignError(err, walletChainId);
- return;
- }
-
- // ── Step 2: wait for confirmation ──────────────────────────────────
- this._renderProgress(steps, 2);
- let receipt;
- try {
- receipt = await tx.wait();
- } catch (err) {
- this._renderError(`Transaction reverted: ${_humanError(err)}`);
- return;
- }
- if (receipt?.status !== 1) {
- this._renderError('Transaction failed on-chain.');
- return;
- }
-
- // Pull the agentId out of the Registered event so the confirm call
- // can cross-check it against the on-chain receipt server-side.
- const onchainAgentId = _parseRegisteredAgentId(receipt, registry);
- if (onchainAgentId == null) {
- this._renderError(
- 'Could not parse Registered event from the receipt. The tx is on-chain — please retry "Save".',
- {
- label: 'Retry save',
- handler: () =>
- this._confirmAndFinish(prep, walletChainId, tx, null, deployment),
- },
- );
- return;
- }
-
- // ── Step 3: server-side confirm (verify + upsert) ──────────────────
- this._renderProgress(steps, 3);
- await this._confirmAndFinish(prep, walletChainId, tx, onchainAgentId, deployment);
- }
-
- /**
- * Cache layer for register-prep so retries reuse the same IPFS pin
- * (idempotent across reloads / network blips).
- */
- async _getOrCreatePrep() {
- const agent = this._agent;
- const cacheKey = _prepCacheKey(agent.id);
-
- try {
- const raw = localStorage.getItem(cacheKey);
- if (raw) {
- const cached = JSON.parse(raw);
- if (cached?.prepId && cached?.metadataURI && cached?.expiresAt > Date.now()) {
- return cached;
- }
- }
- } catch {
- /* fall through to a fresh prep */
- }
-
- const body = {
- name: agent.name || 'Agent',
- description: agent.description || '',
- avatarId: agent.avatarId || agent.avatar_id,
- ...(Array.isArray(agent.skills) && agent.skills.length > 0
- ? { skills: agent.skills }
- : {}),
- };
-
- const resp = await fetch('/api/agents/register-prep', {
- method: 'POST',
- credentials: 'include',
- headers: { 'content-type': 'application/json' },
- body: JSON.stringify(body),
- });
- if (!resp.ok) {
- const data = await resp.json().catch(() => ({}));
- throw new Error(data.error_description || `register-prep returned ${resp.status}`);
- }
- const prep = await resp.json();
- const cached = {
- prepId: prep.prepId,
- cid: prep.cid,
- metadataURI: prep.metadataURI,
- expiresAt: Date.now() + 50 * 60 * 1000, // server keeps prep 1h, expire ours at 50m
- };
- try {
- localStorage.setItem(cacheKey, JSON.stringify(cached));
- } catch {
- /* quota or disabled storage — fine, we just lose retry caching */
- }
- return cached;
- }
-
- async _confirmAndFinish(prep, chainId, tx, onchainAgentId, deployment) {
- try {
- const resp = await fetch('/api/agents/register-confirm', {
- method: 'POST',
- credentials: 'include',
- headers: { 'content-type': 'application/json' },
- body: JSON.stringify({
- prepId: prep.prepId,
- chainId,
- agentId: String(onchainAgentId ?? 0),
- txHash: tx.hash,
- }),
- });
- if (!resp.ok) {
- const data = await resp.json().catch(() => ({}));
- throw new Error(
- data.error_description || `register-confirm returned ${resp.status}`,
- );
- }
- } catch (err) {
- this._renderError(
- `Mint succeeded on-chain but server save failed: ${err.message}. Reload the page to retry — your tx is at ${tx.hash.slice(0, 10)}…`,
- );
- return;
- }
-
- // Clear the prep cache — it's been consumed server-side.
- try {
- localStorage.removeItem(_prepCacheKey(this._agent.id));
- } catch {
- /* ignore */
- }
-
- // Reflect in local agent state and flip to the success chip.
- this._agent.chainId = chainId;
- this._agent.txHash = tx.hash;
- this._agent.contractAddress = deployment.identityRegistry;
- this._agent.erc8004AgentId = onchainAgentId;
- this._renderSuccessChip(chainId, tx.hash, deployment.identityRegistry);
-
- // Redirect to the cinematic reveal page after a brief success flash
- const agentId = this._agent.id;
- setTimeout(() => {
- window.location.href = `/mint-success?id=${encodeURIComponent(agentId)}&tx=${encodeURIComponent(tx.hash)}&asset=${encodeURIComponent(deployment.identityRegistry || '')}&chain=${encodeURIComponent(chainId)}`;
- }, 900);
- }
-
- // ─── Error classification ──────────────────────────────────────────────
-
- _handleSignError(err, chainId) {
- if (_isUserRejection(err)) {
- this._renderDeployButton();
- return;
- }
- if (_isInsufficientFunds(err)) {
- const faucetUrl = FAUCETS[chainId];
- this._renderError('Insufficient funds in this wallet.', {
- label: faucetUrl ? 'Get testnet funds' : 'Try again',
- handler: () => {
- if (faucetUrl) window.open(faucetUrl, '_blank');
- else this._renderDeployButton();
- },
- });
- return;
- }
- if (_isReplacementUnderpriced(err)) {
- this._renderError(
- 'A pending transaction from this wallet is blocking the new one. Cancel it in your wallet and try again.',
- );
- return;
- }
- this._renderError(`Transaction failed: ${_humanError(err)}`);
- }
-}
-
-// ─── Helpers ──────────────────────────────────────────────────────────────
-
-/**
- * EIP-1193 user-rejection detection.
- * Spec: error code 4001 = user rejected request.
- * ethers also wraps errors with `code: 'ACTION_REJECTED'`.
- */
-function _isUserRejection(err) {
- if (!err) return false;
- if (err.code === 4001) return true;
- if (err.code === 'ACTION_REJECTED') return true;
- if (err?.info?.error?.code === 4001) return true;
- return /user rejected|user denied|rejected by user|user cancel/i.test(err.message || '');
-}
-
-function _isInsufficientFunds(err) {
- if (!err) return false;
- if (err.code === 'INSUFFICIENT_FUNDS') return true;
- if (err?.info?.error?.code === -32000) {
- // Some RPCs surface insufficient funds via -32000 + body text.
- return /insufficient funds/i.test(err?.info?.error?.message || '');
- }
- return /insufficient funds|insufficient balance|not enough.*funds/i.test(err.message || '');
-}
-
-function _isReplacementUnderpriced(err) {
- if (!err) return false;
- if (err.code === 'REPLACEMENT_UNDERPRICED') return true;
- return /replacement.*underpriced|already known|nonce too low/i.test(err.message || '');
-}
-
-/** Pull a human-readable string from a ProviderError / ethers error. */
-function _humanError(err) {
- if (!err) return 'unknown error';
- const inner = err?.info?.error?.message || err?.shortMessage || err?.message;
- return String(inner || 'unknown error')
- .replace(/\s+/g, ' ')
- .slice(0, 240);
-}
-
-/** Decode the Registered event's agentId from a confirmed receipt. */
-function _parseRegisteredAgentId(receipt, registry) {
- if (!receipt?.logs) return null;
- for (const log of receipt.logs) {
- try {
- const parsed = registry.interface.parseLog(log);
- if (parsed?.name === 'Registered') {
- return Number(parsed.args.agentId);
- }
- } catch {
- /* not our event */
- }
- }
- return null;
-}
-
-/** Escape HTML attribute/text content to prevent XSS. */
-function _esc(str) {
- return String(str ?? '')
- .replace(/&/g, '&amp;')
- .replace(/</g, '&lt;')
- .replace(/>/g, '&gt;')
- .replace(/"/g, '&quot;');
-}
diff --git a/src/erc8004/vanity-modal.js b/src/erc8004/vanity-modal.js
index 2dbb66afc..c4186bb38 100644
--- a/src/erc8004/vanity-modal.js
+++ b/src/erc8004/vanity-modal.js
@@ -90,41 +90,45 @@ function _suggestionsFor(agentName) {
}
const STYLE = `
-.vm-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 9999; display: flex; align-items: center; justify-content: center; padding: 1rem; }
-.vm-modal { background: #fff; border-radius: 12px; max-width: 460px; width: 100%; padding: 1.25rem 1.4rem; box-shadow: 0 20px 60px rgba(0,0,0,.3); font: 14px/1.4 system-ui, sans-serif; color: #111; }
-.vm-title { font-size: 1.1rem; font-weight: 600; margin: 0 0 .25rem; }
-.vm-sub { color: #666; font-size: .8rem; margin: 0 0 1rem; }
-.vm-input { font: inherit; font-family: ui-monospace, monospace; padding: .5rem .65rem; width: 100%; border: 1px solid #ccc; border-radius: 6px; box-sizing: border-box; text-transform: none; }
-.vm-input.invalid { border-color: #c33; background: #fff8f8; }
-.vm-preview { font-family: ui-monospace, monospace; font-size: .85rem; padding: .55rem .65rem; background: #f7f7f8; border-radius: 6px; margin-top: .55rem; word-break: break-all; }
+.vm-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.72); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); z-index: 10000; display: flex; align-items: center; justify-content: center; padding: 1rem; }
+.vm-modal { background: #101014; border: 1px solid rgba(255,255,255,.12); border-radius: 12px; max-width: 460px; width: 100%; padding: 1.25rem 1.4rem; box-shadow: 0 20px 60px rgba(0,0,0,.6); font: 14px/1.4 system-ui, sans-serif; color: #e8e8e8; }
+.vm-title { font-size: 1.1rem; font-weight: 600; margin: 0 0 .25rem; color: #fff; }
+.vm-sub { color: #999; font-size: .8rem; margin: 0 0 1rem; }
+.vm-input { font: inherit; font-family: ui-monospace, monospace; padding: .5rem .65rem; width: 100%; border: 1px solid rgba(255,255,255,.18); border-radius: 6px; box-sizing: border-box; text-transform: none; background: rgba(255,255,255,.05); color: #fff; }
+.vm-input:focus-visible { outline: 2px solid rgba(255,255,255,.5); outline-offset: 1px; }
+.vm-input.invalid { border-color: #f87171; background: rgba(248,113,113,.08); }
+.vm-preview { font-family: ui-monospace, monospace; font-size: .85rem; padding: .55rem .65rem; background: rgba(255,255,255,.05); border-radius: 6px; margin-top: .55rem; word-break: break-all; }
.vm-preview .pfx { background: linear-gradient(90deg,#ffd54f,#ff8a65); color: #1a1a1a; padding: 0 2px; border-radius: 2px; font-weight: 600; }
-.vm-preview .rest { color: #888; }
+.vm-preview .rest { color: #777; }
.vm-meter { display: flex; gap: 3px; margin-top: .6rem; }
-.vm-meter .seg { flex: 1; height: 6px; border-radius: 3px; background: #eee; }
-.vm-meter .seg.lit-1, .vm-meter .seg.lit-2, .vm-meter .seg.lit-3, .vm-meter .seg.lit-4 { background: #4caf50; }
-.vm-meter .seg.lit-5 { background: #fb8c00; }
-.vm-meter .seg.lit-6 { background: #d32f2f; }
-.vm-row { display: flex; justify-content: space-between; align-items: center; margin-top: .5rem; font-size: .78rem; color: #666; }
+.vm-meter .seg { flex: 1; height: 6px; border-radius: 3px; background: rgba(255,255,255,.1); }
+.vm-meter .seg.lit-1, .vm-meter .seg.lit-2, .vm-meter .seg.lit-3, .vm-meter .seg.lit-4 { background: #4ade80; }
+.vm-meter .seg.lit-5 { background: #fb923c; }
+.vm-meter .seg.lit-6 { background: #f87171; }
+.vm-row { display: flex; justify-content: space-between; align-items: center; margin-top: .5rem; font-size: .78rem; color: #999; }
.vm-paid { background: linear-gradient(90deg,#ffd54f,#ff8a65); color: #1a1a1a; font-weight: 600; padding: .1rem .5rem; border-radius: 999px; font-size: .7rem; }
.vm-chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .85rem; }
-.vm-chip { background: #f0f0f2; border: 1px solid #ddd; border-radius: 999px; padding: .25rem .65rem; cursor: pointer; font-family: ui-monospace, monospace; font-size: .75rem; color: #333; }
-.vm-chip:hover { background: #e6e6e8; }
+.vm-chip { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.14); border-radius: 999px; padding: .25rem .65rem; cursor: pointer; font-family: ui-monospace, monospace; font-size: .75rem; color: #ddd; }
+.vm-chip:hover { background: rgba(255,255,255,.12); }
.vm-chip-est { color: #888; margin-left: .35rem; font-family: system-ui, sans-serif; }
-.vm-warn { background: #fff3cd; color: #855008; padding: .5rem .65rem; border-radius: 6px; margin-top: .85rem; font-size: .75rem; }
+.vm-warn { background: rgba(251,191,36,.12); color: #fbbf24; padding: .5rem .65rem; border-radius: 6px; margin-top: .85rem; font-size: .75rem; }
.vm-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1.1rem; }
-.vm-btn { font: inherit; padding: .45rem .9rem; border-radius: 6px; border: 1px solid #ccc; background: #fff; cursor: pointer; }
-.vm-btn.primary { background: #111; color: #fff; border-color: #111; }
+.vm-btn { font: inherit; padding: .45rem .9rem; border-radius: 6px; border: 1px solid rgba(255,255,255,.2); background: transparent; color: #e8e8e8; cursor: pointer; }
+.vm-btn:hover:not(:disabled) { background: rgba(255,255,255,.08); }
+.vm-btn.primary { background: #fff; color: #000; border-color: #fff; }
+.vm-btn.primary:hover:not(:disabled) { background: #e8e8e8; }
.vm-btn:disabled { opacity: .4; cursor: not-allowed; }
-.vm-skip { background: none; border: none; color: #666; font-size: .75rem; cursor: pointer; margin-top: .5rem; padding: 0; }
-.vm-cli { margin-top: .85rem; padding: .55rem .65rem; background: #f7f7f8; border: 1px solid #eee; border-radius: 6px; font-size: .72rem; color: #555; }
-.vm-cli code { background: #fff; padding: .1rem .3rem; border-radius: 3px; border: 1px solid #e0e0e0; font-family: ui-monospace, monospace; }
-.vm-cli a { color: #0d47a1; }
-.vm-cli .vm-paste-toggle { background: none; border: none; color: #0d47a1; cursor: pointer; padding: 0; font-size: .72rem; text-decoration: underline; }
+.vm-skip { background: none; border: none; color: #999; font-size: .75rem; cursor: pointer; margin-top: .5rem; padding: 0; }
+.vm-skip:hover { color: #ddd; }
+.vm-cli { margin-top: .85rem; padding: .55rem .65rem; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.1); border-radius: 6px; font-size: .72rem; color: #aaa; }
+.vm-cli code { background: rgba(255,255,255,.08); padding: .1rem .3rem; border-radius: 3px; border: 1px solid rgba(255,255,255,.1); font-family: ui-monospace, monospace; color: #ddd; }
+.vm-cli a { color: #93c5fd; }
+.vm-cli .vm-paste-toggle { background: none; border: none; color: #93c5fd; cursor: pointer; padding: 0; font-size: .72rem; text-decoration: underline; }
.vm-paste { margin-top: .55rem; }
-.vm-paste textarea { font: inherit; font-family: ui-monospace, monospace; font-size: .7rem; width: 100%; min-height: 70px; box-sizing: border-box; padding: .4rem .5rem; border: 1px solid #ccc; border-radius: 6px; resize: vertical; }
+.vm-paste textarea { font: inherit; font-family: ui-monospace, monospace; font-size: .7rem; width: 100%; min-height: 70px; box-sizing: border-box; padding: .4rem .5rem; border: 1px solid rgba(255,255,255,.18); border-radius: 6px; resize: vertical; background: rgba(255,255,255,.05); color: #fff; }
.vm-paste-status { margin-top: .35rem; font-size: .72rem; min-height: 1em; }
-.vm-paste-status.ok { color: #1b5e20; }
-.vm-paste-status.bad { color: #b71c1c; }
+.vm-paste-status.ok { color: #4ade80; }
+.vm-paste-status.bad { color: #f87171; }
`;
let _styleInjected = false;
diff --git a/src/onchain/README.md b/src/onchain/README.md
index c1d8051ad..3da305087 100644
--- a/src/onchain/README.md
+++ b/src/onchain/README.md
@@ -1,7 +1,8 @@
# src/onchain
-Unified, family-agnostic on-chain deploy stack. Parallel to (and intended to
-eventually supersede) `src/erc8004/deploy-button.js` + `src/erc8004/solana-deploy.js`.
+Unified, family-agnostic on-chain deploy stack. This superseded the legacy
+`src/erc8004/deploy-button.js` (deleted 2026-08-06); `src/erc8004/solana-deploy.js`
+remains as the RegisterUI wizard's Solana driver (vanity grinding included).
## Why this exists