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: erc8004 surface updates

nirholas8d2c2c4bd4eb
diff --git a/src/erc8004/deploy-button.css b/src/erc8004/deploy-button.css
index 8e9dfc628..01f6bdc98 100644
--- a/src/erc8004/deploy-button.css
+++ b/src/erc8004/deploy-button.css
@@ -92,7 +92,7 @@
border: 1px solid var(--nxt-stroke-strong, rgba(255, 255, 255, 0.14));
border-radius: var(--nxt-radius-sm, 10px);
background: var(--nxt-accent-soft, rgba(255, 255, 255, 0.04));
- color: var(--nxt-ink, #e8e8e8);
+ color: var(--nxt-ink, var(--ink));
font-size: 0.875rem;
font-weight: 600;
cursor: pointer;
@@ -135,7 +135,7 @@
.deploy-chip--success {
background: rgba(74, 222, 128, 0.1);
border: 1px solid rgba(74, 222, 128, 0.4);
- color: var(--nxt-success, #4ade80);
+ color: var(--nxt-success, var(--success));
}
.deploy-chip--success:hover {
@@ -171,7 +171,7 @@
}
.progress-step--done {
- color: var(--nxt-success, #4ade80);
+ color: var(--nxt-success, var(--success));
}
.progress-sep {
@@ -201,7 +201,7 @@
width: 6px;
height: 6px;
border-radius: 50%;
- background: var(--nxt-danger, #f87171);
+ background: var(--nxt-danger, var(--danger));
box-shadow: 0 0 8px rgba(248, 113, 113, 0.6);
}
diff --git a/src/erc8004/deploy-button.js b/src/erc8004/deploy-button.js
index 92680f439..4c85ca6fa 100644
--- a/src/erc8004/deploy-button.js
+++ b/src/erc8004/deploy-button.js
@@ -27,6 +27,7 @@ import {
} 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;
@@ -203,7 +204,7 @@ export class DeployButton {
await switchChain(newChainId);
} catch (err) {
if (!_isUserRejection(err)) {
- console.warn('[deploy-button] switchChain failed:', err?.message);
+ log.warn('[deploy-button] switchChain failed:', err?.message);
}
} finally {
select.disabled = false;
@@ -382,6 +383,16 @@ export class DeployButton {
}
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()) {
diff --git a/src/erc8004/register-ui.js b/src/erc8004/register-ui.js
index 4bb82ce7e..43c3dd6e1 100644
--- a/src/erc8004/register-ui.js
+++ b/src/erc8004/register-ui.js
@@ -55,6 +55,9 @@ import {
INPUT_TYPES,
} from './resolve-avatar.js';
import { runSolanaDeploy, solanaTxExplorerUrl, detectSolanaWallet } from './solana-deploy.js';
+import { onchainBadgeHTML, ensureOnchainBadgeStyles } from '../shared/onchain-badge.js';
+import { log } from '../shared/log.js';
+ensureOnchainBadgeStyles();
// ───────────────────────────────────────────────────────────────────────────
// Solana sentinels — chain dropdown stores these strings instead of a numeric
@@ -104,6 +107,37 @@ function _resolveNetworkArg(raw) {
return id && REGISTRY_DEPLOYMENTS[id] ? id : null;
}
+// ───────────────────────────────────────────────────────────────────────────
+// Error classification — turns raw error messages into user-readable copy
+// ───────────────────────────────────────────────────────────────────────────
+
+function _classifyDeployError(raw, err = null) {
+ const m = String(raw || '').toLowerCase();
+ const code = err?.code;
+ // Wallet rejection (MetaMask 4001, ethers ACTION_REJECTED, Phantom)
+ if (code === 4001 || code === 'ACTION_REJECTED' ||
+ /user rejected|user denied|cancelled|reject/i.test(m)) {
+ return 'You cancelled the signature request — no transaction was sent. Click Deploy to try again.';
+ }
+ // Insufficient gas / funds
+ if (/insufficient funds|not enough|gas/i.test(m)) {
+ return 'Insufficient funds — make sure your wallet has enough ETH (or SOL) to cover gas. Top up and retry.';
+ }
+ // Wrong chain
+ if (/wrong chain|wrong network|mismatched chain/i.test(m)) {
+ return 'Wrong chain — switch your wallet to the target network and click Deploy again.';
+ }
+ // Network / RPC errors
+ if (/network|rpc|fetch|timeout|econnrefused|http 5/i.test(m)) {
+ return 'Network error — check your connection and retry. If the problem persists the RPC may be down.';
+ }
+ // Contract revert
+ if (/revert|execution reverted/i.test(m)) {
+ return `Transaction reverted by the contract — ${raw}. Check the registry address and retry.`;
+ }
+ return `Deploy failed: ${raw}`;
+}
+
// ───────────────────────────────────────────────────────────────────────────
// SRI integrity cache
// ───────────────────────────────────────────────────────────────────────────
@@ -432,7 +466,7 @@ export class RegisterUI {
<span class="deploy-chain-label">Target network</span>
<select class="erc8004-chain-select" title="Target chain"></select>
</label>
- <button class="erc8004-btn erc8004-btn--wallet deploy-wallet-btn" type="button">
+ <button class="erc8004-btn erc8004-btn--wallet deploy-wallet-btn btn btn--secondary" type="button">
Connect wallet
</button>
</div>
@@ -454,10 +488,10 @@ export class RegisterUI {
<div class="erc8004-header">
<div class="erc8004-controls">
<select class="erc8004-chain-select" title="Target chain"></select>
- <button class="erc8004-btn erc8004-btn--wallet" type="button">
+ <button class="erc8004-btn erc8004-btn--wallet btn btn--secondary" type="button">
Connect MetaMask
</button>
- <button class="erc8004-btn erc8004-btn--close" type="button" title="Close">✕</button>
+ <button class="erc8004-btn erc8004-btn--close btn btn--ghost btn--icon" type="button" title="Close">✕</button>
</div>
</div>
@@ -811,7 +845,7 @@ export class RegisterUI {
throw new Error(`link failed (${res.status}): ${text}`);
}
} catch (err) {
- console.warn('[erc8004] Failed to link on-chain agentId to account:', err.message);
+ log.warn('[erc8004] Failed to link on-chain agentId to account:', err.message);
if (throwOnError) throw err;
}
}
@@ -1186,14 +1220,14 @@ export class RegisterUI {
<label class="erc8004-label">Image URL
<div class="erc8004-image-row">
<input class="erc8004-input" name="imageUrl" placeholder="https://example.com/avatar.png or ipfs://…" value="${esc(this.form.imageUrl)}" />
- ${this._viewer ? `<button type="button" class="erc8004-btn erc8004-btn--ghost erc8004-capture-btn" data-role="capture3d" title="Snapshot the current 3D viewer and use it as the agent image">📸 Use 3D view</button>` : ''}
+ ${this._viewer ? `<button type="button" class="erc8004-btn erc8004-btn--ghost erc8004-capture-btn btn btn--ghost" data-role="capture3d" title="Snapshot the current 3D viewer and use it as the agent image">📸 Use 3D view</button>` : ''}
</div>
</label>
<p class="erc8004-hint">Avatar or logo for your agent NFT</p>
<div class="erc8004-wizard-nav">
<span></span>
- <button class="erc8004-btn erc8004-btn--primary" data-role="next">Next: Services →</button>
+ <button class="erc8004-btn erc8004-btn--primary btn btn--primary" data-role="next">Next: Services →</button>
</div>
`;
body.querySelector('[name="name"]').addEventListener('input', (e) => {
@@ -1289,7 +1323,7 @@ export class RegisterUI {
<div class="erc8004-services" data-role="list"></div>
- <button class="erc8004-btn erc8004-btn--ghost" data-role="add">+ Add endpoint</button>
+ <button class="erc8004-btn erc8004-btn--ghost btn btn--ghost" data-role="add">+ Add endpoint</button>
<label class="erc8004-checkbox" style="margin-top:12px">
<input type="checkbox" data-role="x402" ${this.form.x402Support ? 'checked' : ''} />
@@ -1297,8 +1331,8 @@ export class RegisterUI {
</label>
<div class="erc8004-wizard-nav">
- <button class="erc8004-btn" data-role="back">← Back</button>
- <button class="erc8004-btn erc8004-btn--primary" data-role="next">Next: Configuration →</button>
+ <button class="erc8004-btn btn btn--secondary" data-role="back">← Back</button>
+ <button class="erc8004-btn erc8004-btn--primary btn btn--primary" data-role="next">Next: Configuration →</button>
</div>
`;
const list = body.querySelector('[data-role="list"]');
@@ -1312,7 +1346,7 @@ export class RegisterUI {
</select>
<input class="erc8004-input" data-field="name" placeholder="Name" value="${esc(svc.name)}" />
<input class="erc8004-input" data-field="endpoint" placeholder="https://… or ipfs://…" value="${esc(svc.endpoint)}" />
- <button class="erc8004-btn erc8004-btn--ghost erc8004-btn--x" data-role="rm" title="Remove">✕</button>
+ <button class="erc8004-btn erc8004-btn--ghost erc8004-btn--x btn btn--ghost btn--icon" data-role="rm" title="Remove">✕</button>
</div>
`,
)
@@ -1385,8 +1419,8 @@ export class RegisterUI {
<p class="erc8004-hint">Without a token, uploads go through our backend (R2). Paste a Pinata JWT to pin directly to IPFS.</p>
<div class="erc8004-wizard-nav">
- <button class="erc8004-btn" data-role="back">← Back</button>
- <button class="erc8004-btn erc8004-btn--primary" data-role="next">Next: Deploy →</button>
+ <button class="erc8004-btn btn btn--secondary" data-role="back">← Back</button>
+ <button class="erc8004-btn erc8004-btn--primary btn btn--primary" data-role="next">Next: Deploy →</button>
</div>
`;
@@ -1601,24 +1635,50 @@ export class RegisterUI {
</div>
</details>
+ <div class="deploy-phase-track" data-role="phase-track" hidden aria-live="polite">
+ <div class="deploy-phase deploy-phase--pending" data-phase="prepare">
+ <span class="deploy-phase-dot" aria-hidden="true"></span>
+ <div class="deploy-phase-content">
+ <span class="deploy-phase-label">Prepare</span>
+ <span class="deploy-phase-hint">Pinning metadata to IPFS and building the on-chain record</span>
+ </div>
+ </div>
+ <div class="deploy-phase deploy-phase--pending" data-phase="sign">
+ <span class="deploy-phase-dot" aria-hidden="true"></span>
+ <div class="deploy-phase-content">
+ <span class="deploy-phase-label">Sign</span>
+ <span class="deploy-phase-hint">One wallet signature mints your agent as an ERC-721 NFT — no other approvals needed</span>
+ </div>
+ </div>
+ <div class="deploy-phase deploy-phase--pending" data-phase="confirm">
+ <span class="deploy-phase-dot" aria-hidden="true"></span>
+ <div class="deploy-phase-content">
+ <span class="deploy-phase-label">Confirm</span>
+ <span class="deploy-phase-hint">Waiting for the transaction to land and the agent ID to be assigned</span>
+ </div>
+ </div>
+ </div>
+
<div class="erc8004-log" data-role="log"></div>
- <div class="erc8004-result" data-role="result" style="display:none">
- <h4 class="erc8004-h4">✓ Agent registered</h4>
+ <div class="erc8004-result deploy-result" data-role="result" style="display:none">
+ <div class="deploy-result-badge" data-role="res-badge"></div>
+ <h4 class="erc8004-h4 deploy-result-heading">Agent registered on-chain</h4>
<dl class="erc8004-result-dl">
<dt>Agent ID</dt> <dd data-role="res-id"></dd>
<dt>Metadata</dt> <dd data-role="res-uri"></dd>
<dt>Tx Hash</dt> <dd data-role="res-tx"></dd>
</dl>
<div class="erc8004-row">
- <button class="erc8004-btn" data-role="view-3d">View in 3D</button>
- <a class="erc8004-btn" data-role="view-explorer" target="_blank" rel="noopener">View on explorer ↗</a>
+ <button class="erc8004-btn btn btn--secondary" data-role="view-3d">View in 3D</button>
+ <a class="erc8004-btn btn btn--secondary" data-role="view-explorer" target="_blank" rel="noopener">Explorer ↗</a>
+ <a class="erc8004-btn btn btn--secondary" href="/showcase">Browse showcase ↗</a>
</div>
</div>
<div class="erc8004-wizard-nav">
- <button class="erc8004-btn" data-role="back">← Back</button>
- <button class="erc8004-btn erc8004-btn--primary" data-role="deploy" ${walletOk ? '' : 'disabled'}>🚀 Register Agent On-Chain</button>
+ <button class="erc8004-btn btn btn--secondary" data-role="back">← Back</button>
+ <button class="erc8004-btn erc8004-btn--primary btn btn--primary" data-role="deploy" ${walletOk ? '' : 'disabled'}>🚀 Register Agent On-Chain</button>
</div>
`;
body.querySelector('[data-role="back"]').addEventListener('click', () => {
@@ -1673,23 +1733,49 @@ export class RegisterUI {
(via Sign-In-with-Solana). If you haven't, <a class="erc8004-link" href="/login.html">link it first</a>.
</div>
+ <div class="deploy-phase-track" data-role="phase-track" hidden aria-live="polite">
+ <div class="deploy-phase deploy-phase--pending" data-phase="prepare">
+ <span class="deploy-phase-dot" aria-hidden="true"></span>
+ <div class="deploy-phase-content">
+ <span class="deploy-phase-label">Prepare</span>
+ <span class="deploy-phase-hint">Pinning metadata to IPFS and generating the Metaplex Core mint</span>
+ </div>
+ </div>
+ <div class="deploy-phase deploy-phase--pending" data-phase="sign">
+ <span class="deploy-phase-dot" aria-hidden="true"></span>
+ <div class="deploy-phase-content">
+ <span class="deploy-phase-label">Sign</span>
+ <span class="deploy-phase-hint">Phantom (or Backpack) will request one transaction — approve to mint the agent NFT</span>
+ </div>
+ </div>
+ <div class="deploy-phase deploy-phase--pending" data-phase="confirm">
+ <span class="deploy-phase-dot" aria-hidden="true"></span>
+ <div class="deploy-phase-content">
+ <span class="deploy-phase-label">Confirm</span>
+ <span class="deploy-phase-hint">Waiting for the Solana transaction to finalize</span>
+ </div>
+ </div>
+ </div>
+
<div class="erc8004-log" data-role="log"></div>
- <div class="erc8004-result" data-role="result" style="display:none">
- <h4 class="erc8004-h4">✓ Agent registered</h4>
+ <div class="erc8004-result deploy-result" data-role="result" style="display:none">
+ <div class="deploy-result-badge" data-role="res-badge"></div>
+ <h4 class="erc8004-h4 deploy-result-heading">Agent minted on Solana</h4>
<dl class="erc8004-result-dl">
<dt>Asset</dt> <dd data-role="res-id"></dd>
<dt>Network</dt> <dd data-role="res-uri"></dd>
<dt>Tx Signature</dt><dd data-role="res-tx"></dd>
</dl>
<div class="erc8004-row">
- <a class="erc8004-btn" data-role="view-explorer" target="_blank" rel="noopener">View on explorer ↗</a>
+ <a class="erc8004-btn btn btn--secondary" data-role="view-explorer" target="_blank" rel="noopener">Explorer ↗</a>
+ <a class="erc8004-btn btn btn--secondary" href="/showcase">Browse showcase ↗</a>
</div>
</div>
<div class="erc8004-wizard-nav">
- <button class="erc8004-btn" data-role="back">← Back</button>
- <button class="erc8004-btn erc8004-btn--primary" data-role="deploy" ${hasSolanaWallet ? '' : 'disabled'}>🚀 Mint on ${esc(chainLabel)}</button>
+ <button class="erc8004-btn btn btn--secondary" data-role="back">← Back</button>
+ <button class="erc8004-btn erc8004-btn--primary btn btn--primary" data-role="deploy" ${hasSolanaWallet ? '' : 'disabled'}>🚀 Mint on ${esc(chainLabel)}</button>
</div>
`;
body.querySelector('[data-role="back"]').addEventListener('click', () => {
@@ -1720,6 +1806,9 @@ export class RegisterUI {
return;
}
+ const setPhase = this._makePhaseTracker(body);
+ setPhase('prepare');
+
const network = _solanaNetwork(this.selectedChainId);
const synthAgent = {
id: this._backendAgentId || 'wizard',
@@ -1729,10 +1818,13 @@ export class RegisterUI {
};
say(`Connecting Solana wallet…`);
+ setPhase('sign');
try {
const result = await runSolanaDeploy({ agent: synthAgent, network });
+ setPhase('confirm');
say(`Minted asset ${result.assetPubkey}`);
say(`Tx ${result.txSignature}`);
+ setPhase('done');
body.querySelector('[data-role="result"]').style.display = '';
body.querySelector('[data-role="res-id"]').textContent = result.assetPubkey;
@@ -1743,6 +1835,18 @@ export class RegisterUI {
result.txSignature,
);
+ const badgeEl = body.querySelector('[data-role="res-badge"]');
+ if (badgeEl) {
+ const cluster = network === 'devnet' ? 'devnet' : 'mainnet';
+ const caip2 = cluster === 'devnet'
+ ? 'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1'
+ : 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp';
+ badgeEl.innerHTML = onchainBadgeHTML(
+ { onchain: { family: 'solana', chain: caip2, cluster, contract_or_mint: result.assetPubkey, tx_hash: result.txSignature } },
+ { size: 'md', showChain: true },
+ );
+ }
+
this.onRegistered({
agentId: result.agent?.id || result.assetPubkey,
txHash: result.txSignature,
@@ -1751,13 +1855,13 @@ export class RegisterUI {
} catch (err) {
if (err?.code === 'forbidden') {
say(
- 'Your Solana wallet is not linked to this account. Sign in with your Solana wallet first.',
+ 'Wallet not linked — sign in with your Solana wallet first, then retry.',
true,
);
} else if (err?.code === 'payment_required') {
say(`${err.message || 'Paid plan required'} — upgrade to use 5+ char vanity prefixes.`, true);
} else {
- say('Solana deploy failed: ' + (err.message || String(err)), true);
+ say(_classifyDeployError(err.message || String(err), err), true);
}
deployBtn.disabled = false;
}
@@ -1789,6 +1893,55 @@ export class RegisterUI {
return `<span class="erc8004-muted">Not selected</span>`;
}
+ /**
+ * Drives the deploy-phase-track indicator in Step 4.
+ * Returns (phaseName) => void to advance to a given phase.
+ * Pass 'done' to mark all phases complete.
+ */
+ _makePhaseTracker(body) {
+ const track = body.querySelector('[data-role="phase-track"]');
+ if (!track) return () => {};
+ const order = ['prepare', 'sign', 'confirm'];
+ return (phase) => {
+ track.hidden = false;
+ if (phase === 'done') {
+ track.querySelectorAll('[data-phase]').forEach((el) => {
+ el.classList.remove('deploy-phase--pending', 'deploy-phase--active');
+ el.classList.add('deploy-phase--done');
+ });
+ return;
+ }
+ const idx = order.indexOf(phase);
+ track.querySelectorAll('[data-phase]').forEach((el) => {
+ const pi = order.indexOf(el.dataset.phase);
+ el.classList.toggle('deploy-phase--done', pi < idx);
+ el.classList.toggle('deploy-phase--active', pi === idx);
+ el.classList.toggle('deploy-phase--pending', pi > idx);
+ });
+ };
+ }
+
+ /**
+ * Wrap say() with keyword-based phase advancement so the phase tracker
+ * automatically advances when registerAgent / runSolanaDeploy emit known
+ * status strings. setPhase is always called explicitly at the right points
+ * too — the keyword detection is a belt-and-suspenders safety net.
+ */
+ _phaseAwareSay(say, setPhase) {
+ return (msg, err = false) => {
+ say(msg, err);
+ if (err) return;
+ const m = String(msg || '').toLowerCase();
+ if (m.includes('sign') || m.includes('approv') || m.includes('phantom') ||
+ m.includes('wallet') || m.includes('metamask')) {
+ setPhase('sign');
+ } else if (m.includes('wait') || m.includes('confirm') || m.includes('broadcast') ||
+ m.includes('mining') || m.includes('block') || m.includes('finali')) {
+ setPhase('confirm');
+ }
+ };
+ }
+
_wireExportOptions(body) {
const buildJSON = () => {
const identityAddr = REGISTRY_DEPLOYMENTS[this.selectedChainId].identityRegistry;
@@ -1896,6 +2049,10 @@ export class RegisterUI {
return;
}
+ const setPhase = this._makePhaseTracker(body);
+ const phaseSay = this._phaseAwareSay(say, setPhase);
+ setPhase('prepare');
+
try {
// Ensure we're on the target chain
if (this.wallet && this.wallet.chainId !== this.selectedChainId) {
@@ -1904,8 +2061,9 @@ export class RegisterUI {
this.wallet.chainId = this.selectedChainId;
}
- const result = await this._doRegister(say);
+ const result = await this._doRegister(phaseSay);
+ setPhase('done');
body.querySelector('[data-role="result"]').style.display = '';
body.querySelector('[data-role="res-id"]').textContent = String(result.agentId);
body.querySelector('[data-role="res-uri"]').textContent = result.registrationUrl;
@@ -1920,6 +2078,14 @@ export class RegisterUI {
result.txHash,
);
+ const badgeEl = body.querySelector('[data-role="res-badge"]');
+ if (badgeEl) {
+ badgeEl.innerHTML = onchainBadgeHTML(
+ { agentId: String(result.agentId), chainId: this.selectedChainId },
+ { size: 'md', showChain: true },
+ );
+ }
+
this.onRegistered({ ...result, chainId: this.selectedChainId });
await this._linkAgentToAccount({
agentId: result.agentId,
@@ -1928,7 +2094,9 @@ export class RegisterUI {
});
this._refreshStats();
} catch (err) {
- say('Registration failed: ' + (err.shortMessage || err.message || String(err)), true);
+ const raw = err.shortMessage || err.message || String(err);
+ const errMsg = _classifyDeployError(raw, err);
+ say(errMsg, true);
deployBtn.disabled = false;
}
}
@@ -2241,8 +2409,8 @@ export class RegisterUI {
<div class="erc8004-qr-canvas-wrap" data-role="canvas"></div>
<p class="erc8004-muted erc8004-small erc8004-qr-url">${esc(url)}</p>
<div class="erc8004-row" style="justify-content:center">
- <button class="erc8004-btn erc8004-btn--primary" data-role="download">Download PNG</button>
- <button class="erc8004-btn" data-role="copy">Copy Link</button>
+ <button class="erc8004-btn erc8004-btn--primary btn btn--primary" data-role="download">Download PNG</button>
+ <button class="erc8004-btn btn btn--secondary" data-role="copy">Copy Link</button>
</div>
</div>
`;
@@ -2329,22 +2497,22 @@ export class RegisterUI {
<div data-panel="wc" class="is-active">
<p class="erc8004-muted erc8004-small">Drop into any HTML page. Self-contained, no build step.</p>
<textarea class="erc8004-code" data-role="code-wc" readonly rows="4">${esc(snippetWC)}</textarea>
- <button class="erc8004-btn erc8004-btn--primary" data-copy="wc">Copy</button>
+ <button class="erc8004-btn erc8004-btn--primary btn btn--primary" data-copy="wc">Copy</button>
</div>
<div data-panel="if" hidden>
<p class="erc8004-muted erc8004-small">Works everywhere iframes do — Notion, Ghost, WordPress, Substack.</p>
<textarea class="erc8004-code" data-role="code-if" readonly rows="4">${esc(snippetIframe)}</textarea>
- <button class="erc8004-btn erc8004-btn--primary" data-copy="if">Copy</button>
+ <button class="erc8004-btn erc8004-btn--primary btn btn--primary" data-copy="if">Copy</button>
</div>
<div data-panel="sh" hidden>
<p class="erc8004-muted erc8004-small">Paste anywhere (Discord, Slack, X, Farcaster) — OG preview + Twitter Player Card auto-render.</p>
<textarea class="erc8004-code" data-role="code-sh" readonly rows="2">${esc(pageUrl)}</textarea>
- <button class="erc8004-btn erc8004-btn--primary" data-copy="sh">Copy</button>
+ <button class="erc8004-btn erc8004-btn--primary btn btn--primary" data-copy="sh">Copy</button>
</div>
<div data-panel="oe" hidden>
<p class="erc8004-muted erc8004-small">For apps that consume <a href="https://oembed.com" target="_blank" rel="noopener">oEmbed</a> directly (Notion, some CMSes).</p>
<textarea class="erc8004-code" data-role="code-oe" readonly rows="2">${esc(oembedUrl)}</textarea>
- <button class="erc8004-btn erc8004-btn--primary" data-copy="oe">Copy</button>
+ <button class="erc8004-btn erc8004-btn--primary btn btn--primary" data-copy="oe">Copy</button>
</div>
</div>
<details class="erc8004-embed-policy">
@@ -2455,8 +2623,8 @@ export class RegisterUI {
<div class="erc8004-log" data-role="log"></div>
<div class="erc8004-row" style="justify-content:flex-end">
- <button class="erc8004-btn" data-role="cancel">Cancel</button>
- <button class="erc8004-btn erc8004-btn--primary" data-role="save">Save on-chain</button>
+ <button class="erc8004-btn btn btn--secondary" data-role="cancel">Cancel</button>
+ <button class="erc8004-btn erc8004-btn--primary btn btn--primary" data-role="save">Save on-chain</button>
</div>
</div>
`;
@@ -2627,8 +2795,8 @@ export class RegisterUI {
</label>
<div class="erc8004-log" data-role="log"></div>
<div class="erc8004-row" style="justify-content:flex-end">
- <button class="erc8004-btn" data-role="cancel">Cancel</button>
- <button class="erc8004-btn erc8004-btn--primary" data-role="go">Transfer</button>
+ <button class="erc8004-btn btn btn--secondary" data-role="cancel">Cancel</button>
+ <button class="erc8004-btn erc8004-btn--primary btn btn--primary" data-role="go">Transfer</button>
</div>
</div>
`;
@@ -2709,8 +2877,8 @@ export class RegisterUI {
</label>
<div class="erc8004-log" data-role="log"></div>
<div class="erc8004-row" style="justify-content:flex-end">
- <button class="erc8004-btn" data-role="cancel">Cancel</button>
- <button class="erc8004-btn erc8004-btn--primary" data-role="go">Deploy</button>
+ <button class="erc8004-btn btn btn--secondary" data-role="cancel">Cancel</button>
+ <button class="erc8004-btn erc8004-btn--primary btn btn--primary" data-role="go">Deploy</button>
</div>
</div>
`;
@@ -2796,7 +2964,7 @@ export class RegisterUI {
</p>
<div class="erc8004-row">
<input class="erc8004-input" name="q" placeholder="Agent ID · 0x address · ENS · tx hash · agent://chain/id" />
- <button class="erc8004-btn erc8004-btn--primary" data-role="go">Search</button>
+ <button class="erc8004-btn erc8004-btn--primary btn btn--primary" data-role="go">Search</button>
</div>
<div class="erc8004-filter-chips" data-role="chips">
<button class="erc8004-chip ${this._searchFilter === 'all' ? 'erc8004-chip--active' : ''}" data-filter="all">All</button>
diff --git a/src/erc8004/reputation-panel.js b/src/erc8004/reputation-panel.js
index f8bf55cfa..5cf07ef95 100644
--- a/src/erc8004/reputation-panel.js
+++ b/src/erc8004/reputation-panel.js
@@ -10,7 +10,7 @@
* Writes (only when signed-in visitor has a wallet):
* • submitReputation(agentId, score, comment) — the "vouch" CTA
*
- * Mounted from agent-home.html when the agent has chain_id and
+ * Mounted on agent pages when the agent has chain_id and
* erc8004_agent_id, so visitors see real on-chain reputation rather
* than a generic identity card.
*/
@@ -19,6 +19,7 @@ import { JsonRpcProvider, BrowserProvider } from 'ethers';
import { CHAIN_META, switchChain, txExplorerUrl } from './chain-meta.js';
import { REGISTRY_DEPLOYMENTS } from './abi.js';
import { submitReputation, stakeReputation, getTotalStake, getReputation, getRecentReviews } from './reputation.js';
+import { log } from '../shared/log.js';
const REVIEWS_LOOKBACK_BLOCKS = 50_000;
const MIN_STAKE_ETH = 0.001;
@@ -103,7 +104,7 @@ export class ReputationPanel {
}).catch(() => 0n),
]);
} catch (err) {
- console.warn('[reputation-panel] getReputation failed:', err?.message);
+ log.warn('[reputation-panel] getReputation failed:', err?.message);
this._renderEmpty('Could not read reputation from the chain.');
return;
}
diff --git a/src/erc8004/showcase.js b/src/erc8004/showcase.js
index 4323388e0..1a1f2e063 100644
--- a/src/erc8004/showcase.js
+++ b/src/erc8004/showcase.js
@@ -11,12 +11,27 @@
import { CHAIN_META, supportedChainIds } from './chain-meta.js';
import { resolveURI } from '../ipfs.js';
+import { skeletonHTML, emptyStateHTML, errorStateHTML, ensureStateKitStyles } from '../shared/state-kit.js';
+import { onchainBadgeHTML, ensureOnchainBadgeStyles } from '../shared/onchain-badge.js';
+ensureStateKitStyles();
+ensureOnchainBadgeStyles();
const PAGE_SIZE = 24;
const NET_KEY = '3dagent.showcase.net';
const CHAINS_KEY = '3dagent.showcase.chains';
const SORT_KEY = '3dagent.showcase.sort';
+// Returns true if a URL contains signed/expiring query params (GitHub JWT,
+// S3/R2 presigned) — these reliably 404 after the token expires, so we
+// skip rendering the image rather than logging a spurious network error.
+function hasExpiringSignature(url) {
+ if (!url) return false;
+ try {
+ const p = new URL(url).searchParams;
+ return p.has('jwt') || p.has('X-Amz-Signature') || p.has('X-Goog-Signature');
+ } catch { return false; }
+}
+
const esc = (s) =>
String(s ?? '').replace(
/[&<>"']/g,
@@ -401,34 +416,21 @@ class ShowcasePage {
_renderResults({ skeleton = false } = {}) {
const out = this.container.querySelector('[data-role="results"]');
if (skeleton) {
- out.innerHTML = `
- <div class="showcase-grid" aria-busy="true">
- ${Array.from(
- { length: 8 },
- () => `
- <div class="showcase-card showcase-card--skel">
- <div class="showcase-skel-img"></div>
- <div class="showcase-skel-line"></div>
- <div class="showcase-skel-line showcase-skel-line--short"></div>
- </div>
- `,
- ).join('')}
- </div>
- `;
+ out.setAttribute('aria-busy', 'true');
+ out.innerHTML = `<div class="showcase-grid">${skeletonHTML(8, 'card')}</div>`;
return;
}
+ out.removeAttribute('aria-busy');
+
if (!this._items.length) {
- out.innerHTML = `
- <div class="showcase-empty">
- <div class="showcase-empty-art">✨</div>
- <h3>No three.wss found.</h3>
- <p class="showcase-muted">
- Try a different chain filter, flip to ${this._net === 'mainnet' ? 'Testnet' : 'Mainnet'}, or
- <a href="/deploy">deploy your own</a>.
- </p>
- </div>
- `;
+ const altNet = this._net === 'mainnet' ? 'Testnet' : 'Mainnet';
+ out.innerHTML = emptyStateHTML({
+ title: 'No agents found',
+ body: `Try a different chain filter, flip to ${altNet}, or <a href="/deploy">deploy your own</a>.`,
+ actions: [{ label: 'Deploy an agent', href: '/deploy', primary: true }],
+ live: true,
+ });
return;
}
@@ -442,15 +444,12 @@ class ShowcasePage {
_renderError(message) {
const out = this.container.querySelector('[data-role="results"]');
- out.innerHTML = `
- <div class="showcase-empty showcase-empty--error">
- <div class="showcase-empty-art">⚠️</div>
- <h3>Couldn't load the directory.</h3>
- <p class="showcase-muted">${esc(message)}</p>
- <button type="button" class="showcase-btn" data-role="retry">Retry</button>
- </div>
- `;
- out.querySelector('[data-role="retry"]').addEventListener('click', () =>
+ out.removeAttribute('aria-busy');
+ out.innerHTML = errorStateHTML({
+ title: "Couldn't load the directory",
+ body: esc(message),
+ });
+ out.querySelector('[data-sk-retry]').addEventListener('click', () =>
this._resetAndLoad(),
);
}
@@ -482,7 +481,7 @@ class ShowcasePage {
function renderCard(a) {
const chainMeta = CHAIN_META[a.chainId];
const chainShort = chainMeta?.shortName || a.chainName || `#${a.chainId}`;
- const img = a.image ? resolveURI(a.image) : '';
+ const img = (a.image && !hasExpiringSignature(a.image)) ? resolveURI(a.image) : '';
const title = esc(a.name || `Agent #${a.agentId}`);
const descLine = a.description
? `<p class="showcase-card-desc">${esc(truncate(a.description, 140))}</p>`
@@ -491,6 +490,8 @@ function renderCard(a) {
? `<a class="showcase-card-owner" href="${esc(a.ownerExplorerUrl || '#')}" target="_blank" rel="noopener" title="${esc(a.owner)}">Owner ${esc(shortAddr(a.owner))} ↗</a>`
: '';
+ const badgeHtml = onchainBadgeHTML(a, { size: 'sm', showChain: true });
+
const tags = [];
tags.push(`<span class="showcase-tag showcase-tag--3d">3D</span>`);
if (a.x402Support) tags.push(`<span class="showcase-tag showcase-tag--x402">x402 💳</span>`);
@@ -516,6 +517,7 @@ function renderCard(a) {
<div class="showcase-card-head">
<a class="showcase-card-title" href="${esc(a.viewerUrl)}">${title}</a>
<span class="showcase-card-id">#${esc(a.agentId)}</span>
+ ${badgeHtml}
</div>
${descLine}
<div class="showcase-card-tags">${tags.join('')}</div>