-
e.stopPropagation()}
- style={{
- background: mbg,
- borderRadius: 16,
- border: `1px solid #1f1d1b`,
- width: 320, maxWidth: "100%",
- maxHeight: "calc(100% - 8px)",
- overflowY: "auto",
- boxShadow: "0 24px 80px rgba(0,0,0,0.85)",
- }}
- >
- {/* Header */}
-
-
- {isSign ? "Sign" : "Review"}
-
-
-
-
- {/* Demo banner */}
-
-
-
- DEMO · Not a real {isSign ? "signature" : "transaction"}
-
-
-
- {/* Preview */}
-
- {renderPreview()}
-
-
- {/* Field rows */}
-
-
-
- 0x71Dc…7244
- >
- }
- />
- {!isSign && (
-
-
- 0x71Dc…7244
-
- >
- }
- />
- )}
-
-
- Base
- >
- }
- />
- {!isSign && (
- {"< $0.01"}}
- />
- )}
-
-
- {/* Buttons */}
-
-
-
-
-
-
- );
- };
-
-
- const examples = [
- {
- prompt: "Find the best USDC vault on Base and deposit 100 USDC",
- events: [
- { delay: 380, type: "thinking" },
- { delay: 600, type: "tool", tool: { server: "morpho", action: "query_vaults", args: { chain: "base", asset: "USDC", sort: "apy_desc" } } },
- { delay: 500, type: "text", text: "Steakhouse USDC has the best yield. Preparing deposit through the available Morpho path..." },
- { delay: 300, type: "rows", rows: [
- { token: "Morpho · Steakhouse USDC", amount: "8.42% APY", value: "$24.1M TVL · winner" },
- { token: "Morpho · Re7 USDC", amount: "7.91% APY", value: "$18.7M TVL" },
- { token: "Morpho · Flagship USDC", amount: "7.34% APY", value: "$42.1M TVL" },
- ]},
- { delay: 500, type: "tool", tool: { server: "morpho", action: "prepare_deposit", args: { vault: "Steakhouse USDC", amount: "100 USDC" } } },
- { delay: 350, type: "tool", tool: { server: "base-mcp", action: "send_calls", args: { chain: "base", calls: "[approve, deposit]" } } },
- { delay: 450, type: "approval", preview: { type: "deposit", asset: "USDC", amount: "100", usdValue: "~$100.00", vault: "Steakhouse USDC", apy: "8.42%" } },
- { delay: 1100, type: "confirm", text: "Deposited 100 USDC into Steakhouse USDC · earning 8.42% APY" },
- ],
- },
- {
- prompt: "Supply 0.5 ETH as collateral and borrow 1000 USDC",
- events: [
- { delay: 380, type: "thinking" },
- { delay: 550, type: "tool", tool: { server: "morpho", action: "query_markets", args: { chain: "base", collateral: "ETH", loan: "USDC" } } },
- { delay: 500, type: "text", text: "Found Morpho ETH/USDC market on Base. Batching supply + borrow..." },
- { delay: 500, type: "tool", tool: { server: "morpho", action: "prepare_supply_collateral", args: { asset: "ETH", amount: "0.5", borrow: "1000 USDC" } } },
- { delay: 350, type: "tool", tool: { server: "base-mcp", action: "send_calls", args: { chain: "base", calls: "[supplyCollateral, borrow]" } } },
- { delay: 450, type: "approval", preview: { type: "borrow", collateralAsset: "ETH", collateralAmount: "0.5", loanAsset: "USDC", loanAmount: "1000", healthFactor: "2.1" } },
- { delay: 1100, type: "confirm", text: "Supplied 0.5 ETH · borrowed 1000 USDC · health factor 2.1" },
- ],
- },
- {
- prompt: "Repay all my Morpho USDC debt",
- events: [
- { delay: 380, type: "thinking" },
- { delay: 550, type: "tool", tool: { server: "morpho", action: "get_positions", args: { market: "ETH/USDC", chain: "base" } } },
- { delay: 500, type: "text", text: "You owe 1002.14 USDC including accrued interest. Preparing full repayment..." },
- { delay: 500, type: "tool", tool: { server: "morpho", action: "prepare_repay", args: { amount: "1002.14 USDC", market: "ETH/USDC" } } },
- { delay: 350, type: "tool", tool: { server: "base-mcp", action: "send_calls", args: { chain: "base", calls: "[approve, repayAll]" } } },
- { delay: 450, type: "approval", preview: { type: "repay", asset: "USDC", amount: "1002.14", usdValue: "~$1,002.14", market: "Morpho ETH/USDC" } },
- { delay: 1100, type: "confirm", text: "Repaid 1002.14 USDC · Morpho position closed" },
- ],
- },
- ];
-
- const [activeIdx, setActiveIdx] = useState(null);
- const [eventIdx, setEventIdx] = useState(0);
- const [modalPreview, setModalPreview] = useState(null);
- const scrollRef = useRef(null);
- const timersRef = useRef([]);
-
- const clearTimers = () => { timersRef.current.forEach(clearTimeout); timersRef.current = []; };
-
- useEffect(() => { if (scrollRef.current) scrollRef.current.scrollTop = scrollRef.current.scrollHeight; }, [eventIdx, activeIdx]);
- useEffect(() => () => clearTimers(), []);
-
- const pick = (idx) => {
- if (activeIdx !== null) return;
- setActiveIdx(idx);
- setEventIdx(0);
- clearTimers();
- let cumulative = 0;
- const events = examples[idx].events;
- for (let i = 0; i < events.length; i++) {
- cumulative += events[i].delay;
- timersRef.current.push(setTimeout(() => setEventIdx(i + 1), cumulative));
- if (events[i].type === "approval") break;
- }
- };
-
- const reset = () => { clearTimers(); setActiveIdx(null); setEventIdx(0); setModalPreview(null); };
-
- const handleConfirm = () => {
- setModalPreview(null);
- clearTimers();
- if (activeIdx !== null) setEventIdx(examples[activeIdx].events.length);
- };
-
- const ex = activeIdx !== null ? examples[activeIdx] : null;
-
- const TrafficLights = () => (
- selection to JSX snippets. (Cross-tab
-// sync would require wrapping this in another visible Tabs block.)
-export const AuthApprovalDemo = ({ client = "Claude" }) => {
- const sans = "ui-sans-serif,system-ui,-apple-system,'Segoe UI',Roboto,sans-serif";
-
- const c = {
- bg: "#0a0a0a",
- cardBorder: "#1c1c1c",
- rowBorder: "#1f1f1f",
- text: "#ffffff",
- muted: "#9a9a9a",
- dim: "#6b6b6b",
- accent: "#a796f7",
- accentRing: "#c8bcff",
- btnDark: "#1c1c1c",
- iconBlue: "#2a64ff",
- iconBlue2: "#5b8eff",
- permIconBg: "#1c1c1c",
- permIconFg: "#d2d2d2",
- };
-
- const permissions = [
- { label: "View address, balances & activity." },
- { label: "Prepare transactions for you to review." }
- ];
-
- const EyeIcon = () => (
-
- );
- const SendIcon = () => (
-
- );
- const SignIcon = () => (
-
- );
- const ChainIcon = () => (
-
- );
- const icons = [, , , ];
-
- return (
-
-
-
-
- {/* Signed-in row */}
-
-
-
- Signed in as 0x71Dc…7244
-
-
-
- {/* Body */}
-
- {/* Icons */}
-
-
-
- Allow {client} to access your account.
-
-
-
- By continuing, you allow {client} to:
-
-
-
- {permissions.map((p, i) => (
-
-
- {icons[i]}
-
-
- {p.label}
-
-
- ))}
-
-
-
-
-
-
-
-
-
-
-
-
-
- Preview · Shown in Base Account on first wallet-tool use
-
-
- );
-};
diff --git a/docs/snippets/DataFetchingDemo.jsx b/docs/snippets/DataFetchingDemo.jsx
deleted file mode 100644
index d4d44889e..000000000
--- a/docs/snippets/DataFetchingDemo.jsx
+++ /dev/null
@@ -1,255 +0,0 @@
-
-export const DataFetchingDemo = () => {
- const sans = "ui-sans-serif,system-ui,-apple-system,'Segoe UI',Roboto,sans-serif";
- const serif = "'Tiempos Headline','Iowan Old Style','Source Serif Pro',ui-serif,Georgia,serif";
- const mono = "ui-monospace,'SF Mono','Cascadia Code',Menlo,Monaco,Consolas,monospace";
-
- const c = {
- bg: "#1f1e1d", header: "#262624", border: "#34322f", inputBg: "#2a2926",
- text: "#f5f4ed", body: "#e8e4dc", muted: "#a8a39d", dim: "#6b6663",
- accent: "#D97757", bubble: "#2c2b28", bubbleText: "#f5f4ed",
- code: "#e89972", codeBg: "rgba(217,119,87,0.12)",
- toolBg: "#272622", toolBorder: "#3a3835", success: "#a3c585",
- };
-
- const examples = [
- {
- prompt: "What's my balance on Base?",
- events: [
- { delay: 380, type: "thinking" },
- { delay: 550, type: "tool", tool: { server: "base-mcp", action: "get_portfolio", args: { chain: "base" } } },
- { delay: 600, type: "text", text: "Your current portfolio on Base:" },
- { delay: 250, type: "rows", rows: [
- { token: "USDC", amount: "245.80", value: "$245.80" },
- { token: "ETH", amount: "0.0412", value: "$148.33" },
- { token: "WETH", amount: "0.0100", value: "$36.02" },
- ]},
- { delay: 400, type: "confirm", text: "Total: $430.15 on Base" },
- ],
- },
- {
- prompt: "What tokens do I have in my wallet?",
- events: [
- { delay: 380, type: "thinking" },
- { delay: 550, type: "tool", tool: { server: "base-mcp", action: "get_wallets", args: {} } },
- { delay: 600, type: "tool", tool: { server: "base-mcp", action: "get_portfolio", args: { chain: "base" } } },
- { delay: 500, type: "text", text: "Tokens in your wallet on Base:" },
- { delay: 250, type: "rows", rows: [
- { token: "USDC", amount: "245.80", value: "$245.80" },
- { token: "ETH", amount: "0.0412", value: "$148.33" },
- { token: "WETH", amount: "0.0100", value: "$36.02" },
- ]},
- { delay: 400, type: "confirm", text: "3 tokens found on Base" },
- ],
- },
- {
- prompt: "What's my total balance across all chains?",
- events: [
- { delay: 380, type: "thinking" },
- { delay: 550, type: "tool", tool: { server: "base-mcp", action: "get_portfolio", args: {} } },
- { delay: 500, type: "text", text: "Your balances across supported networks:" },
- { delay: 250, type: "rows", rows: [
- { token: "Base", amount: "$430.15", value: "USDC · ETH · WETH" },
- { token: "Ethereum", amount: "$284.20", value: "ETH · USDC" },
- ]},
- { delay: 400, type: "confirm", text: "Total: $714.35 across all chains" },
- ],
- },
- ];
-
- const [activeIdx, setActiveIdx] = useState(null);
- const [eventIdx, setEventIdx] = useState(0);
- const scrollRef = useRef(null);
- const timersRef = useRef([]);
-
- const clearTimers = () => { timersRef.current.forEach(clearTimeout); timersRef.current = []; };
-
- useEffect(() => { if (scrollRef.current) scrollRef.current.scrollTop = scrollRef.current.scrollHeight; }, [eventIdx, activeIdx]);
- useEffect(() => () => clearTimers(), []);
-
- const pick = (idx) => {
- if (activeIdx !== null) return;
- setActiveIdx(idx);
- setEventIdx(0);
- clearTimers();
- let cumulative = 0;
- examples[idx].events.forEach((e, i) => {
- cumulative += e.delay;
- timersRef.current.push(setTimeout(() => setEventIdx(i + 1), cumulative));
- });
- };
-
- const reset = () => { clearTimers(); setActiveIdx(null); setEventIdx(0); };
- const ex = activeIdx !== null ? examples[activeIdx] : null;
-
- const TrafficLights = () => (
-
-
-
-
-
- );
-
- const UserBubble = ({ children }) => (
-
- );
-
- const ToolCall = ({ tool, completed }) => (
-
-
-
- {completed
- ?
- : }
-
-
- {tool.server}
- ·
- {tool.action}
- (
- {Object.entries(tool.args).map(([k, v], i, arr) => (
- {k}: "{v}"{i < arr.length - 1 && , }
- ))}
- )
-
-
-
- );
-
- const Thinking = () => (
-
-
- {[0, 1, 2].map(i => )}
-
- Thinking
-
- );
-
- const ResponseText = ({ children, top }) => (
- {children}
- );
-
- const ResponseRows = ({ rows }) => (
-
- {rows.map((r, i) => (
-
- •
- {r.token}
- {r.amount}
- {r.value}
-
- ))}
-
- );
-
- const Confirm = ({ text }) => (
-
- );
-
- const ChipBtn = ({ onClick, children }) => {
- const [hover, setHover] = useState(false);
- return (
-
- );
- };
-
- const renderEvents = () => {
- if (!ex) return null;
- const shown = ex.events.slice(0, eventIdx);
- return shown.map((event, i) => {
- if (event.type === "thinking") {
- if (i < shown.length - 1) return null;
- return ;
- }
- if (event.type === "tool") {
- const hasLater = shown.slice(i + 1).some(e => e.type !== "thinking");
- return ;
- }
- if (event.type === "text") return {event.text};
- if (event.type === "rows") return ;
- if (event.type === "confirm") return ;
- return null;
- });
- };
-
- return (
-
-
-
-
-
-
Base MCP
-
▾
-
- {activeIdx !== null && (
-
- )}
-
-
-
- {!ex && (
-
-
- Check your wallet balance once mcp.base.org is connected:
-
-
- {examples.map((e, i) => pick(i)}>{e.prompt})}
-
-
- )}
- {ex && <>
{ex.prompt}{renderEvents()}>}
-
-
-
-
-
-
Write a message...
-
Sonnet 4.6 ▾
-
-
-
- Demo · Read-only — no approval required to check balances
-
-
-
- );
-};
diff --git a/docs/snippets/SignMessagesDemo.jsx b/docs/snippets/SignMessagesDemo.jsx
deleted file mode 100644
index ac798edb1..000000000
--- a/docs/snippets/SignMessagesDemo.jsx
+++ /dev/null
@@ -1,730 +0,0 @@
-export const SignMessagesDemo = () => {
- const sans = "ui-sans-serif,system-ui,-apple-system,'Segoe UI',Roboto,sans-serif";
- const serif = "'Tiempos Headline','Iowan Old Style','Source Serif Pro',ui-serif,Georgia,serif";
- const mono = "ui-monospace,'SF Mono','Cascadia Code',Menlo,Monaco,Consolas,monospace";
-
- const c = {
- bg: "#1f1e1d", header: "#262624", border: "#34322f", inputBg: "#2a2926",
- text: "#f5f4ed", body: "#e8e4dc", muted: "#a8a39d", dim: "#6b6663",
- accent: "#D97757", bubble: "#2c2b28", bubbleText: "#f5f4ed",
- code: "#e89972", codeBg: "rgba(217,119,87,0.12)",
- toolBg: "#272622", toolBorder: "#3a3835", success: "#a3c585",
- };
-
-
-
-
- // Shared Base Account "Review" modal + Approve Transaction button used
- // across the ai-agents demos. Supports asset-transfer previews (send, swap,
- // deposit, borrow, repay) and signing previews (sign-message, sign-siwe,
- // sign-permit). Positioned absolute inside the parent demo container so it
- // doesn't fight with the Mintlify navbar's z-index.
-
- const ACCENT = "#D97757";
-
- const tokenBg = (ticker) => {
- if (!ticker) return ACCENT;
- const t = ticker.toUpperCase();
- if (t === "USDC") return "#2775CA";
- if (t === "ETH" || t === "WETH") return "#627EEA";
- if (t === "CBBTC" || t === "BTC") return "#F7931A";
- if (t === "DEGEN") return "#A06CFF";
- if (t === "POL") return "#8247E5";
- return ACCENT;
- };
-
- const tokenGlow = (ticker) => {
- if (!ticker) return "rgba(217,119,87,0.14)";
- const t = ticker.toUpperCase();
- if (t === "USDC") return "rgba(39,117,202,0.14)";
- if (t === "ETH" || t === "WETH") return "rgba(98,126,234,0.14)";
- if (t === "CBBTC" || t === "BTC") return "rgba(247,147,26,0.14)";
- if (t === "DEGEN") return "rgba(160,108,255,0.14)";
- return "rgba(217,119,87,0.14)";
- };
-
- const BigTokenAvatar = ({ ticker }) => (
-
-
- {(ticker || "??").slice(0, 2).toUpperCase()}
-
-
- );
-
- const SmallTokenAvatar = ({ ticker }) => (
-
-
- {(ticker || "??").slice(0, 2).toUpperCase()}
-
-
- );
-
- // Wallet avatar — wow-face emoji style in a blue gradient circle
- const CBAvatar = () => (
-
-
-
-
-
- );
-
- // Sign-icon avatar for signing flows — pen-on-paper in a purple gradient circle
- const SignAvatar = () => (
-
- );
-
- const ApprovalButton = ({ preview, onApprove, label }) => {
- const [hover, setHover] = useState(false);
- return (
-
-
-
- );
- };
-
- const TxModal = ({ preview, onConfirm, onCancel }) => {
- const mbg = "#0a0a0a";
- const mcard = "#1a1816";
- const mhair = "#1f1d1b";
- const mwhite = "#ffffff";
- const mvalue = "#a09b95";
- const msub = "#7a7470";
-
- const isSign = preview.type && preview.type.startsWith("sign");
-
- const renderPreview = () => {
- if (preview.type === "send") return (
-
-
-
-
-
- {preview.amount} {preview.asset}
-
- {preview.usdValue && (
-
- {preview.usdValue}
-
- )}
-
-
- To
- {preview.to}
-
-
- );
-
- if (preview.type === "swap") return (
-
-
-
-
-
You send
-
- {preview.fromAmount} {preview.fromAsset}
-
-
- {preview.fromUsd && (
-
{preview.fromUsd}
- )}
-
-
-
-
-
-
You receive
-
- {preview.toAmount} {preview.toAsset}
-
-
- {preview.toUsd && (
-
{preview.toUsd}
- )}
-
-
- );
-
- if (preview.type === "deposit") return (
-
-
-
-
-
You deposit
-
- {preview.amount} {preview.asset}
-
-
- {preview.usdValue && (
-
{preview.usdValue}
- )}
-
-
-
Into
-
-
{preview.vault}
- {preview.apy && (
-
{preview.apy} APY
- )}
-
-
-
- );
-
- if (preview.type === "borrow") return (
-
-
-
-
-
Supply collateral
-
- {preview.collateralAmount} {preview.collateralAsset}
-
-
-
-
-
-
-
You borrow
-
- {preview.loanAmount} {preview.loanAsset}
-
-
-
- {preview.healthFactor && (
-
- Health factor
- {preview.healthFactor}
-
- )}
-
- );
-
- if (preview.type === "repay") return (
-
-
-
-
-
You repay
-
- {preview.amount} {preview.asset}
-
-
- {preview.usdValue && (
-
{preview.usdValue}
- )}
-
-
- To market
- {preview.market}
-
-
- );
-
- if (preview.type === "sign-message") return (
-
-
-
-
-
- Sign message
-
-
- personal_sign
-
-
- "{preview.message}"
-
-
- );
-
- if (preview.type === "sign-siwe") return (
-
-
-
-
-
- Sign in with Ethereum
-
-
- EIP-4361 · session login
-
-
-
- Domain
- {preview.domain}
-
-
- );
-
- if (preview.type === "sign-permit") return (
-
-
-
-
-
- Approve token spending
-
-
- EIP-712 · Permit2
-
-
-
-
Token
-
-
- {preview.token}
-
-
-
- Spender
- {preview.spender}
-
- {preview.amount && (
-
- Allowance
- {preview.amount}
-
- )}
-
- );
-
- return null;
- };
-
- const FieldRow = ({ label, right }) => (
-
- );
-
- return (
-
-
e.stopPropagation()}
- style={{
- background: mbg,
- borderRadius: 16,
- border: `1px solid #1f1d1b`,
- width: 320, maxWidth: "100%",
- maxHeight: "calc(100% - 8px)",
- overflowY: "auto",
- boxShadow: "0 24px 80px rgba(0,0,0,0.85)",
- }}
- >
- {/* Header */}
-
-
- {isSign ? "Sign" : "Review"}
-
-
-
-
- {/* Demo banner */}
-
-
-
- DEMO · Not a real {isSign ? "signature" : "transaction"}
-
-
-
- {/* Preview */}
-
- {renderPreview()}
-
-
- {/* Field rows */}
-
-
-
- 0x71Dc…7244
- >
- }
- />
- {!isSign && (
-
-
- 0x71Dc…7244
-
- >
- }
- />
- )}
-
-
- Base
- >
- }
- />
- {!isSign && (
- {"< $0.01"}}
- />
- )}
-
-
- {/* Buttons */}
-
-
-
-
-
-
- );
- };
-
-
- const examples = [
- {
- prompt: "Sign this message: I accept the terms of service",
- events: [
- { delay: 380, type: "thinking" },
- { delay: 600, type: "tool", tool: { server: "base-mcp", action: "sign", args: { type: "personal_sign", data: { message: "I accept the terms of service" } } } },
- { delay: 500, type: "text", text: "Signing with your Base Account. Approve to generate signature:" },
- { delay: 250, type: "approval", preview: { type: "sign-message", message: "I accept the terms of service" } },
- { delay: 1100, type: "confirm", text: "Signed · sig 0x4f2a…c38e9b…8c91" },
- ],
- },
- {
- prompt: "Sign in to this app with my Base Account",
- events: [
- { delay: 380, type: "thinking" },
- { delay: 600, type: "tool", tool: { server: "base-mcp", action: "sign", args: { type: "personal_sign", data: { message: "SIWE challenge for app.example.com" } } } },
- { delay: 500, type: "text", text: "Signing in to app.example.com using Sign-In with Ethereum (SIWE):" },
- { delay: 250, type: "approval", preview: { type: "sign-siwe", domain: "app.example.com" } },
- { delay: 1100, type: "confirm", text: "Signed in to app.example.com · session valid" },
- ],
- },
- {
- prompt: "Sign a Uniswap permit2 authorization",
- events: [
- { delay: 380, type: "thinking" },
- { delay: 600, type: "tool", tool: { server: "base-mcp", action: "sign", args: { type: "typed_data", data: { primaryType: "PermitSingle", domain: { name: "Permit2", chainId: 8453 }, types: "{...}", message: "1000 USDC to Uniswap" } } } },
- { delay: 500, type: "text", text: "Signing typed Permit2 data for Uniswap. Review and approve:" },
- { delay: 250, type: "approval", preview: { type: "sign-permit", token: "USDC", spender: "Uniswap", amount: "1000 USDC" } },
- { delay: 1100, type: "confirm", text: "Permit2 signature returned for Uniswap" },
- ],
- },
- ];
-
- const [activeIdx, setActiveIdx] = useState(null);
- const [eventIdx, setEventIdx] = useState(0);
- const [modalPreview, setModalPreview] = useState(null);
- const scrollRef = useRef(null);
- const timersRef = useRef([]);
-
- const clearTimers = () => { timersRef.current.forEach(clearTimeout); timersRef.current = []; };
-
- useEffect(() => { if (scrollRef.current) scrollRef.current.scrollTop = scrollRef.current.scrollHeight; }, [eventIdx, activeIdx]);
- useEffect(() => () => clearTimers(), []);
-
- const pick = (idx) => {
- if (activeIdx !== null) return;
- setActiveIdx(idx);
- setEventIdx(0);
- clearTimers();
- let cumulative = 0;
- const events = examples[idx].events;
- for (let i = 0; i < events.length; i++) {
- cumulative += events[i].delay;
- timersRef.current.push(setTimeout(() => setEventIdx(i + 1), cumulative));
- if (events[i].type === "approval") break;
- }
- };
-
- const reset = () => { clearTimers(); setActiveIdx(null); setEventIdx(0); setModalPreview(null); };
-
- const handleConfirm = () => {
- setModalPreview(null);
- clearTimers();
- if (activeIdx !== null) setEventIdx(examples[activeIdx].events.length);
- };
-
- const ex = activeIdx !== null ? examples[activeIdx] : null;
-
- const TrafficLights = () => (
-
-
-
-
-
- );
-
- const UserBubble = ({ children }) => (
-
- );
-
- const formatArgValue = (value) => (
- value && typeof value === "object" ? JSON.stringify(value) : `"${value}"`
- );
-
- const ToolCall = ({ tool, completed }) => (
-
-
-
- {completed
- ?
- : }
-
-
- {tool.server}
- ·
- {tool.action}
- (
- {Object.entries(tool.args).map(([k, v], i, arr) => (
- {k}: {formatArgValue(v)}{i < arr.length - 1 && , }
- ))}
- )
-
-
-
- );
-
- const Thinking = () => (
-
-
- {[0, 1, 2].map(i => )}
-
- Thinking
-
- );
-
- const ResponseText = ({ children, top }) => (
- {children}
- );
-
- const Confirm = ({ text }) => (
-
- );
-
- const ChipBtn = ({ onClick, children }) => {
- const [hover, setHover] = useState(false);
- return (
-
- );
- };
-
- const renderEvents = () => {
- if (!ex) return null;
- const shown = ex.events.slice(0, eventIdx);
- return shown.map((event, i) => {
- if (event.type === "thinking") {
- if (i < shown.length - 1) return null;
- return ;
- }
- if (event.type === "tool") {
- const hasLater = shown.slice(i + 1).some(e => e.type !== "thinking");
- return ;
- }
- if (event.type === "text") return {event.text};
- if (event.type === "approval") return ;
- if (event.type === "confirm") return ;
- return null;
- });
- };
-
- return (
-
- {modalPreview &&
setModalPreview(null)} />}
-
-
-
-
-
Base MCP
-
▾
-
- {activeIdx !== null && (
-
- )}
-
-
-
- {!ex && (
-
-
- Sign messages and typed data once mcp.base.org is connected:
-
-
- {examples.map((e, i) => pick(i)}>{e.prompt})}
-
-
- )}
- {ex && <>
{ex.prompt}{renderEvents()}>}
-
-
-
-
-
-
Write a message...
-
Sonnet 4.6 ▾
-
-
-
- Demo · Every signature requires your approval in Base Account
-
-
-
- );
-};
diff --git a/docs/snippets/TradeExecutionDemo.jsx b/docs/snippets/TradeExecutionDemo.jsx
deleted file mode 100644
index 4a8e4e399..000000000
--- a/docs/snippets/TradeExecutionDemo.jsx
+++ /dev/null
@@ -1,727 +0,0 @@
-export const TradeExecutionDemo = () => {
- const sans = "ui-sans-serif,system-ui,-apple-system,'Segoe UI',Roboto,sans-serif";
- const serif = "'Tiempos Headline','Iowan Old Style','Source Serif Pro',ui-serif,Georgia,serif";
- const mono = "ui-monospace,'SF Mono','Cascadia Code',Menlo,Monaco,Consolas,monospace";
-
- const c = {
- bg: "#1f1e1d", header: "#262624", border: "#34322f", inputBg: "#2a2926",
- text: "#f5f4ed", body: "#e8e4dc", muted: "#a8a39d", dim: "#6b6663",
- accent: "#D97757", bubble: "#2c2b28", bubbleText: "#f5f4ed",
- code: "#e89972", codeBg: "rgba(217,119,87,0.12)",
- toolBg: "#272622", toolBorder: "#3a3835", success: "#a3c585",
- };
-
-
-
-
- // Shared Base Account "Review" modal + Approve Transaction button used
- // across the ai-agents demos. Supports asset-transfer previews (send, swap,
- // deposit, borrow, repay) and signing previews (sign-message, sign-siwe,
- // sign-permit). Positioned absolute inside the parent demo container so it
- // doesn't fight with the Mintlify navbar's z-index.
-
- const ACCENT = "#D97757";
-
- const tokenBg = (ticker) => {
- if (!ticker) return ACCENT;
- const t = ticker.toUpperCase();
- if (t === "USDC") return "#2775CA";
- if (t === "ETH" || t === "WETH") return "#627EEA";
- if (t === "CBBTC" || t === "BTC") return "#F7931A";
- if (t === "DEGEN") return "#A06CFF";
- if (t === "POL") return "#8247E5";
- return ACCENT;
- };
-
- const tokenGlow = (ticker) => {
- if (!ticker) return "rgba(217,119,87,0.14)";
- const t = ticker.toUpperCase();
- if (t === "USDC") return "rgba(39,117,202,0.14)";
- if (t === "ETH" || t === "WETH") return "rgba(98,126,234,0.14)";
- if (t === "CBBTC" || t === "BTC") return "rgba(247,147,26,0.14)";
- if (t === "DEGEN") return "rgba(160,108,255,0.14)";
- return "rgba(217,119,87,0.14)";
- };
-
- const BigTokenAvatar = ({ ticker }) => (
-
-
- {(ticker || "??").slice(0, 2).toUpperCase()}
-
-
- );
-
- const SmallTokenAvatar = ({ ticker }) => (
-
-
- {(ticker || "??").slice(0, 2).toUpperCase()}
-
-
- );
-
- // Wallet avatar — wow-face emoji style in a blue gradient circle
- const CBAvatar = () => (
-
-
-
-
-
- );
-
- // Sign-icon avatar for signing flows — pen-on-paper in a purple gradient circle
- const SignAvatar = () => (
-
- );
-
- const ApprovalButton = ({ preview, onApprove, label }) => {
- const [hover, setHover] = useState(false);
- return (
-
-
-
- );
- };
-
- const TxModal = ({ preview, onConfirm, onCancel }) => {
- const mbg = "#0a0a0a";
- const mcard = "#1a1816";
- const mhair = "#1f1d1b";
- const mwhite = "#ffffff";
- const mvalue = "#a09b95";
- const msub = "#7a7470";
-
- const isSign = preview.type && preview.type.startsWith("sign");
-
- const renderPreview = () => {
- if (preview.type === "send") return (
-
-
-
-
-
- {preview.amount} {preview.asset}
-
- {preview.usdValue && (
-
- {preview.usdValue}
-
- )}
-
-
- To
- {preview.to}
-
-
- );
-
- if (preview.type === "swap") return (
-
-
-
-
-
You send
-
- {preview.fromAmount} {preview.fromAsset}
-
-
- {preview.fromUsd && (
-
{preview.fromUsd}
- )}
-
-
-
-
-
-
You receive
-
- {preview.toAmount} {preview.toAsset}
-
-
- {preview.toUsd && (
-
{preview.toUsd}
- )}
-
-
- );
-
- if (preview.type === "deposit") return (
-
-
-
-
-
You deposit
-
- {preview.amount} {preview.asset}
-
-
- {preview.usdValue && (
-
{preview.usdValue}
- )}
-
-
-
Into
-
-
{preview.vault}
- {preview.apy && (
-
{preview.apy} APY
- )}
-
-
-
- );
-
- if (preview.type === "borrow") return (
-
-
-
-
-
Supply collateral
-
- {preview.collateralAmount} {preview.collateralAsset}
-
-
-
-
-
-
-
You borrow
-
- {preview.loanAmount} {preview.loanAsset}
-
-
-
- {preview.healthFactor && (
-
- Health factor
- {preview.healthFactor}
-
- )}
-
- );
-
- if (preview.type === "repay") return (
-
-
-
-
-
You repay
-
- {preview.amount} {preview.asset}
-
-
- {preview.usdValue && (
-
{preview.usdValue}
- )}
-
-
- To market
- {preview.market}
-
-
- );
-
- if (preview.type === "sign-message") return (
-
-
-
-
-
- Sign message
-
-
- personal_sign
-
-
- "{preview.message}"
-
-
- );
-
- if (preview.type === "sign-siwe") return (
-
-
-
-
-
- Sign in with Ethereum
-
-
- EIP-4361 · session login
-
-
-
- Domain
- {preview.domain}
-
-
- );
-
- if (preview.type === "sign-permit") return (
-
-
-
-
-
- Approve token spending
-
-
- EIP-712 · Permit2
-
-
-
-
Token
-
-
- {preview.token}
-
-
-
- Spender
- {preview.spender}
-
- {preview.amount && (
-
- Allowance
- {preview.amount}
-
- )}
-
- );
-
- return null;
- };
-
- const FieldRow = ({ label, right }) => (
-
- );
-
- return (
-
-
e.stopPropagation()}
- style={{
- background: mbg,
- borderRadius: 16,
- border: `1px solid #1f1d1b`,
- width: 320, maxWidth: "100%",
- maxHeight: "calc(100% - 8px)",
- overflowY: "auto",
- boxShadow: "0 24px 80px rgba(0,0,0,0.85)",
- }}
- >
- {/* Header */}
-
-
- {isSign ? "Sign" : "Review"}
-
-
-
-
- {/* Demo banner */}
-
-
-
- DEMO · Not a real {isSign ? "signature" : "transaction"}
-
-
-
- {/* Preview */}
-
- {renderPreview()}
-
-
- {/* Field rows */}
-
-
-
- 0x71Dc…7244
- >
- }
- />
- {!isSign && (
-
-
- 0x71Dc…7244
-
- >
- }
- />
- )}
-
-
- Base
- >
- }
- />
- {!isSign && (
- {"< $0.01"}}
- />
- )}
-
-
- {/* Buttons */}
-
-
-
-
-
-
- );
- };
-
-
- const examples = [
- {
- prompt: "Send 10 USDC to alice.base.eth",
- events: [
- { delay: 380, type: "thinking" },
- { delay: 600, type: "tool", tool: { server: "base-mcp", action: "send", args: { recipient: "alice.base.eth", asset: "USDC", amount: "10", chain: "base" } } },
- { delay: 500, type: "text", text: "Resolved alice.base.eth → 0x71C7…976F. Approve to send:" },
- { delay: 250, type: "approval", preview: { type: "send", asset: "USDC", amount: "10", usdValue: "~$10.00", to: "alice.base.eth" } },
- { delay: 1100, type: "confirm", text: "Sent 10 USDC to alice.base.eth" },
- ],
- },
- {
- prompt: "Send 50 DEGEN to bob.base.eth",
- events: [
- { delay: 380, type: "thinking" },
- { delay: 550, type: "tool", tool: { server: "base-mcp", action: "search_tokens", args: { query: "DEGEN", chain: "base" } } },
- { delay: 500, type: "text", text: "Found DEGEN at 0x4ed4…9fa2 with 18 decimals. Sending to bob.base.eth..." },
- { delay: 400, type: "tool", tool: { server: "base-mcp", action: "send", args: { recipient: "bob.base.eth", asset: "0x4ed4…9fa2", decimals: "18", amount: "50", chain: "base" } } },
- { delay: 250, type: "approval", preview: { type: "send", asset: "DEGEN", amount: "50", usdValue: "~$0.45", to: "bob.base.eth" } },
- { delay: 1100, type: "confirm", text: "Sent 50 DEGEN to bob.base.eth" },
- ],
- },
- {
- prompt: "Send 0.01 ETH to jesse.base.eth",
- events: [
- { delay: 380, type: "thinking" },
- { delay: 600, type: "tool", tool: { server: "base-mcp", action: "send", args: { recipient: "jesse.base.eth", asset: "ETH", amount: "0.01", chain: "base" } } },
- { delay: 500, type: "text", text: "Resolved jesse.base.eth → 0xd8dA…6045. Approve to send:" },
- { delay: 250, type: "approval", preview: { type: "send", asset: "ETH", amount: "0.01", usdValue: "~$25.40", to: "jesse.base.eth" } },
- { delay: 1100, type: "confirm", text: "Sent 0.01 ETH to jesse.base.eth" },
- ],
- },
- ];
-
- const [activeIdx, setActiveIdx] = useState(null);
- const [eventIdx, setEventIdx] = useState(0);
- const [modalPreview, setModalPreview] = useState(null);
- const scrollRef = useRef(null);
- const timersRef = useRef([]);
-
- const clearTimers = () => { timersRef.current.forEach(clearTimeout); timersRef.current = []; };
-
- useEffect(() => { if (scrollRef.current) scrollRef.current.scrollTop = scrollRef.current.scrollHeight; }, [eventIdx, activeIdx]);
- useEffect(() => () => clearTimers(), []);
-
- const pick = (idx) => {
- if (activeIdx !== null) return;
- setActiveIdx(idx);
- setEventIdx(0);
- clearTimers();
- let cumulative = 0;
- const events = examples[idx].events;
- for (let i = 0; i < events.length; i++) {
- cumulative += events[i].delay;
- timersRef.current.push(setTimeout(() => setEventIdx(i + 1), cumulative));
- if (events[i].type === "approval") break;
- }
- };
-
- const reset = () => { clearTimers(); setActiveIdx(null); setEventIdx(0); setModalPreview(null); };
-
- const handleConfirm = () => {
- setModalPreview(null);
- clearTimers();
- if (activeIdx !== null) setEventIdx(examples[activeIdx].events.length);
- };
-
- const ex = activeIdx !== null ? examples[activeIdx] : null;
-
- const TrafficLights = () => (
-
-
-
-
-
- );
-
- const UserBubble = ({ children }) => (
-
- );
-
- const ToolCall = ({ tool, completed }) => (
-
-
-
- {completed
- ?
- : }
-
-
- {tool.server}
- ·
- {tool.action}
- (
- {Object.entries(tool.args).map(([k, v], i, arr) => (
- {k}: "{v}"{i < arr.length - 1 && , }
- ))}
- )
-
-
-
- );
-
- const Thinking = () => (
-
-
- {[0, 1, 2].map(i => )}
-
- Thinking
-
- );
-
- const ResponseText = ({ children, top }) => (
- {children}
- );
-
- const Confirm = ({ text }) => (
-
- );
-
- const ChipBtn = ({ onClick, children }) => {
- const [hover, setHover] = useState(false);
- return (
-
- );
- };
-
- const renderEvents = () => {
- if (!ex) return null;
- const shown = ex.events.slice(0, eventIdx);
- return shown.map((event, i) => {
- if (event.type === "thinking") {
- if (i < shown.length - 1) return null;
- return ;
- }
- if (event.type === "tool") {
- const hasLater = shown.slice(i + 1).some(e => e.type !== "thinking");
- return ;
- }
- if (event.type === "text") return {event.text};
- if (event.type === "approval") return ;
- if (event.type === "confirm") return ;
- return null;
- });
- };
-
- return (
-
- {modalPreview &&
setModalPreview(null)} />}
-
-
-
-
-
Base MCP
-
▾
-
- {activeIdx !== null && (
-
- )}
-
-
-
- {!ex && (
-
-
- Send tokens to any address or name once mcp.base.org is connected:
-
-
- {examples.map((e, i) => pick(i)}>{e.prompt})}
-
-
- )}
- {ex && <>
{ex.prompt}{renderEvents()}>}
-
-
-
-
-
-
Write a message...
-
Sonnet 4.6 ▾
-
-
-
- Demo · Every send requires your approval in Base Account
-
-
-
- );
-};
diff --git a/docs/snippets/TradingQuickstartDemo.jsx b/docs/snippets/TradingQuickstartDemo.jsx
deleted file mode 100644
index a0652ee91..000000000
--- a/docs/snippets/TradingQuickstartDemo.jsx
+++ /dev/null
@@ -1,745 +0,0 @@
-export const TradingQuickstartDemo = () => {
- const sans = "ui-sans-serif,system-ui,-apple-system,'Segoe UI',Roboto,sans-serif";
- const serif = "'Tiempos Headline','Iowan Old Style','Source Serif Pro',ui-serif,Georgia,serif";
- const mono = "ui-monospace,'SF Mono','Cascadia Code',Menlo,Monaco,Consolas,monospace";
-
- const c = {
- bg: "#1f1e1d", header: "#262624", border: "#34322f", inputBg: "#2a2926",
- text: "#f5f4ed", body: "#e8e4dc", muted: "#a8a39d", dim: "#6b6663",
- accent: "#D97757", bubble: "#2c2b28", bubbleText: "#f5f4ed",
- code: "#e89972", codeBg: "rgba(217,119,87,0.12)",
- toolBg: "#272622", toolBorder: "#3a3835", success: "#a3c585",
- };
-
-
-
-
- // Shared Base Account "Review" modal + Approve Transaction button used
- // across the ai-agents demos. Supports asset-transfer previews (send, swap,
- // deposit, borrow, repay) and signing previews (sign-message, sign-siwe,
- // sign-permit). Positioned absolute inside the parent demo container so it
- // doesn't fight with the Mintlify navbar's z-index.
-
- const ACCENT = "#D97757";
-
- const tokenBg = (ticker) => {
- if (!ticker) return ACCENT;
- const t = ticker.toUpperCase();
- if (t === "USDC") return "#2775CA";
- if (t === "ETH" || t === "WETH") return "#627EEA";
- if (t === "CBBTC" || t === "BTC") return "#F7931A";
- if (t === "DEGEN") return "#A06CFF";
- if (t === "POL") return "#8247E5";
- return ACCENT;
- };
-
- const tokenGlow = (ticker) => {
- if (!ticker) return "rgba(217,119,87,0.14)";
- const t = ticker.toUpperCase();
- if (t === "USDC") return "rgba(39,117,202,0.14)";
- if (t === "ETH" || t === "WETH") return "rgba(98,126,234,0.14)";
- if (t === "CBBTC" || t === "BTC") return "rgba(247,147,26,0.14)";
- if (t === "DEGEN") return "rgba(160,108,255,0.14)";
- return "rgba(217,119,87,0.14)";
- };
-
- const BigTokenAvatar = ({ ticker }) => (
-
-
- {(ticker || "??").slice(0, 2).toUpperCase()}
-
-
- );
-
- const SmallTokenAvatar = ({ ticker }) => (
-
-
- {(ticker || "??").slice(0, 2).toUpperCase()}
-
-
- );
-
- // Wallet avatar — wow-face emoji style in a blue gradient circle
- const CBAvatar = () => (
-
-
-
-
-
- );
-
- // Sign-icon avatar for signing flows — pen-on-paper in a purple gradient circle
- const SignAvatar = () => (
-
- );
-
- const ApprovalButton = ({ preview, onApprove, label }) => {
- const [hover, setHover] = useState(false);
- return (
-
-
-
- );
- };
-
- const TxModal = ({ preview, onConfirm, onCancel }) => {
- const mbg = "#0a0a0a";
- const mcard = "#1a1816";
- const mhair = "#1f1d1b";
- const mwhite = "#ffffff";
- const mvalue = "#a09b95";
- const msub = "#7a7470";
-
- const isSign = preview.type && preview.type.startsWith("sign");
-
- const renderPreview = () => {
- if (preview.type === "send") return (
-
-
-
-
-
- {preview.amount} {preview.asset}
-
- {preview.usdValue && (
-
- {preview.usdValue}
-
- )}
-
-
- To
- {preview.to}
-
-
- );
-
- if (preview.type === "swap") return (
-
-
-
-
-
You send
-
- {preview.fromAmount} {preview.fromAsset}
-
-
- {preview.fromUsd && (
-
{preview.fromUsd}
- )}
-
-
-
-
-
-
You receive
-
- {preview.toAmount} {preview.toAsset}
-
-
- {preview.toUsd && (
-
{preview.toUsd}
- )}
-
-
- );
-
- if (preview.type === "deposit") return (
-
-
-
-
-
You deposit
-
- {preview.amount} {preview.asset}
-
-
- {preview.usdValue && (
-
{preview.usdValue}
- )}
-
-
-
Into
-
-
{preview.vault}
- {preview.apy && (
-
{preview.apy} APY
- )}
-
-
-
- );
-
- if (preview.type === "borrow") return (
-
-
-
-
-
Supply collateral
-
- {preview.collateralAmount} {preview.collateralAsset}
-
-
-
-
-
-
-
You borrow
-
- {preview.loanAmount} {preview.loanAsset}
-
-
-
- {preview.healthFactor && (
-
- Health factor
- {preview.healthFactor}
-
- )}
-
- );
-
- if (preview.type === "repay") return (
-
-
-
-
-
You repay
-
- {preview.amount} {preview.asset}
-
-
- {preview.usdValue && (
-
{preview.usdValue}
- )}
-
-
- To market
- {preview.market}
-
-
- );
-
- if (preview.type === "sign-message") return (
-
-
-
-
-
- Sign message
-
-
- personal_sign
-
-
- "{preview.message}"
-
-
- );
-
- if (preview.type === "sign-siwe") return (
-
-
-
-
-
- Sign in with Ethereum
-
-
- EIP-4361 · session login
-
-
-
- Domain
- {preview.domain}
-
-
- );
-
- if (preview.type === "sign-permit") return (
-
-
-
-
-
- Approve token spending
-
-
- EIP-712 · Permit2
-
-
-
-
Token
-
-
- {preview.token}
-
-
-
- Spender
- {preview.spender}
-
- {preview.amount && (
-
- Allowance
- {preview.amount}
-
- )}
-
- );
-
- return null;
- };
-
- const FieldRow = ({ label, right }) => (
-
- );
-
- return (
-
-
e.stopPropagation()}
- style={{
- background: mbg,
- borderRadius: 16,
- border: `1px solid #1f1d1b`,
- width: 320, maxWidth: "100%",
- maxHeight: "calc(100% - 8px)",
- overflowY: "auto",
- boxShadow: "0 24px 80px rgba(0,0,0,0.85)",
- }}
- >
- {/* Header */}
-
-
- {isSign ? "Sign" : "Review"}
-
-
-
-
- {/* Demo banner */}
-
-
-
- DEMO · Not a real {isSign ? "signature" : "transaction"}
-
-
-
- {/* Preview */}
-
- {renderPreview()}
-
-
- {/* Field rows */}
-
-
-
- 0x71Dc…7244
- >
- }
- />
- {!isSign && (
-
-
- 0x71Dc…7244
-
- >
- }
- />
- )}
-
-
- Base
- >
- }
- />
- {!isSign && (
- {"< $0.01"}}
- />
- )}
-
-
- {/* Buttons */}
-
-
-
-
-
-
- );
- };
-
-
- const examples = [
- {
- prompt: "Swap 100 USDC for ETH on Base",
- events: [
- { delay: 380, type: "thinking" },
- { delay: 600, type: "tool", tool: { server: "base-mcp", action: "swap", args: { fromAsset: "USDC", toAsset: "ETH", amount: "100", chain: "base" } } },
- { delay: 500, type: "text", text: "Quote ready: 0.03512 ETH · price impact 0.09%. Approve to swap:" },
- { delay: 250, type: "approval", preview: { type: "swap", fromAsset: "USDC", fromAmount: "100", fromUsd: "~$100.00", toAsset: "ETH", toAmount: "0.03512", toUsd: "~$100.00" } },
- { delay: 1100, type: "confirm", text: "Swapped 100 USDC → 0.03512 ETH" },
- ],
- },
- {
- prompt: "Swap 0.05 ETH to USDC on Base",
- events: [
- { delay: 380, type: "thinking" },
- { delay: 600, type: "tool", tool: { server: "base-mcp", action: "swap", args: { fromAsset: "ETH", toAsset: "USDC", amount: "0.05", chain: "base" } } },
- { delay: 600, type: "text", text: "Swap request ready: estimated 179.41 USDC. Approve to swap:" },
- { delay: 450, type: "approval", preview: { type: "swap", fromAsset: "ETH", fromAmount: "0.05", fromUsd: "~$179.50", toAsset: "USDC", toAmount: "179.41", toUsd: "~$179.41" } },
- { delay: 1100, type: "confirm", text: "Swapped 0.05 ETH → 179.41 USDC" },
- ],
- },
- {
- prompt: "Convert 200 USDC to cbBTC",
- events: [
- { delay: 380, type: "thinking" },
- { delay: 550, type: "tool", tool: { server: "base-mcp", action: "search_tokens", args: { query: "cbBTC", chain: "base" } } },
- { delay: 500, type: "tool", tool: { server: "base-mcp", action: "swap", args: { fromAsset: "USDC", toAsset: "cbBTC", amount: "200", chain: "base" } } },
- { delay: 500, type: "text", text: "Quote ready: 0.00210 cbBTC at current rates. Approve to swap:" },
- { delay: 250, type: "approval", preview: { type: "swap", fromAsset: "USDC", fromAmount: "200", fromUsd: "~$200.00", toAsset: "cbBTC", toAmount: "0.00210", toUsd: "~$199.50" } },
- { delay: 1100, type: "confirm", text: "Swapped 200 USDC → 0.00210 cbBTC" },
- ],
- },
- ];
-
- const [activeIdx, setActiveIdx] = useState(null);
- const [eventIdx, setEventIdx] = useState(0);
- const [modalPreview, setModalPreview] = useState(null);
- const scrollRef = useRef(null);
- const timersRef = useRef([]);
-
- const clearTimers = () => { timersRef.current.forEach(clearTimeout); timersRef.current = []; };
-
- useEffect(() => { if (scrollRef.current) scrollRef.current.scrollTop = scrollRef.current.scrollHeight; }, [eventIdx, activeIdx]);
- useEffect(() => () => clearTimers(), []);
-
- const pick = (idx) => {
- if (activeIdx !== null) return;
- setActiveIdx(idx);
- setEventIdx(0);
- clearTimers();
- let cumulative = 0;
- const events = examples[idx].events;
- for (let i = 0; i < events.length; i++) {
- cumulative += events[i].delay;
- timersRef.current.push(setTimeout(() => setEventIdx(i + 1), cumulative));
- if (events[i].type === "approval") break;
- }
- };
-
- const reset = () => { clearTimers(); setActiveIdx(null); setEventIdx(0); setModalPreview(null); };
-
- const handleConfirm = () => {
- setModalPreview(null);
- clearTimers();
- if (activeIdx !== null) setEventIdx(examples[activeIdx].events.length);
- };
-
- const ex = activeIdx !== null ? examples[activeIdx] : null;
-
- const TrafficLights = () => (
-
-
-
-
-
- );
-
- const UserBubble = ({ children }) => (
-
- );
-
- const ToolCall = ({ tool, completed }) => (
-
-
-
- {completed
- ?
- : }
-
-
- {tool.server}
- ·
- {tool.action}
- (
- {Object.entries(tool.args).map(([k, v], i, arr) => (
- {k}: "{v}"{i < arr.length - 1 && , }
- ))}
- )
-
-
-
- );
-
- const Thinking = () => (
-
-
- {[0, 1, 2].map(i => )}
-
- Thinking
-
- );
-
- const ResponseText = ({ children, top }) => (
- {children}
- );
-
- const ResponseRows = ({ rows }) => (
-
- {rows.map((r, i) => (
-
- •
- {r.token}
- {r.amount}
- {r.value}
-
- ))}
-
- );
-
- const Confirm = ({ text }) => (
-
- );
-
- const ChipBtn = ({ onClick, children }) => {
- const [hover, setHover] = useState(false);
- return (
-
- );
- };
-
- const renderEvents = () => {
- if (!ex) return null;
- const shown = ex.events.slice(0, eventIdx);
- return shown.map((event, i) => {
- if (event.type === "thinking") {
- if (i < shown.length - 1) return null;
- return ;
- }
- if (event.type === "tool") {
- const hasLater = shown.slice(i + 1).some(e => e.type !== "thinking");
- return ;
- }
- if (event.type === "text") return {event.text};
- if (event.type === "rows") return ;
- if (event.type === "approval") return ;
- if (event.type === "confirm") return ;
- return null;
- });
- };
-
- return (
-
- {modalPreview &&
setModalPreview(null)} />}
-
-
-
-
-
Base MCP
-
▾
-
- {activeIdx !== null && (
-
- )}
-
-
-
- {!ex && (
-
-
- Swap any token on Base once mcp.base.org is connected:
-
-
- {examples.map((e, i) => pick(i)}>{e.prompt})}
-
-
- )}
- {ex && <>
{ex.prompt}{renderEvents()}>}
-
-
-
-
-
-
Write a message...
-
Sonnet 4.6 ▾
-
-
-
- Demo · Every swap requires your approval in Base Account
-
-
-
- );
-};
diff --git a/docs/snippets/TruncatedPrompt.jsx b/docs/snippets/TruncatedPrompt.jsx
deleted file mode 100644
index 33bde1410..000000000
--- a/docs/snippets/TruncatedPrompt.jsx
+++ /dev/null
@@ -1,116 +0,0 @@
-export const TruncatedPrompt = ({ description, children }) => {
- const extractText = (node) => {
- if (node == null || typeof node === "boolean") return "";
- if (typeof node === "string" || typeof node === "number") return String(node);
- if (Array.isArray(node)) return node.map(extractText).join("");
- if (typeof node === "object" && node.props) {
- const inner = extractText(node.props.children);
- if (node.type === "code") return "`" + inner + "`";
- return inner;
- }
- return "";
- };
-
- const text = extractText(children).replace(/\s+/g, " ").trim();
-
- const [expanded, setExpanded] = useState(false);
- const [copied, setCopied] = useState(false);
- const timeoutRef = useRef(null);
-
- useEffect(() => () => { if (timeoutRef.current) clearTimeout(timeoutRef.current); }, []);
-
- const handleCopy = () => {
- navigator.clipboard.writeText(text).then(() => {
- setCopied(true);
- if (timeoutRef.current) clearTimeout(timeoutRef.current);
- timeoutRef.current = setTimeout(() => setCopied(false), 1500);
- }).catch(() => {});
- };
-
- const mono = "ui-monospace,'SF Mono','Cascadia Code',Menlo,Monaco,Consolas,monospace";
- const sans = "ui-sans-serif,system-ui,-apple-system,'Segoe UI',Roboto,sans-serif";
-
- return (
-
- {description && (
-
- {description}
-
- )}
-
-
-
-
-
setExpanded(e => !e)}
- style={{
- flex: 1, minWidth: 0,
- fontFamily: mono, fontSize: 13, lineHeight: 1.55,
- cursor: "pointer",
- whiteSpace: expanded ? "pre-wrap" : "nowrap",
- overflow: expanded ? "visible" : "hidden",
- textOverflow: expanded ? "clip" : "ellipsis",
- wordBreak: expanded ? "break-word" : "normal",
- }}
- >
- {text}
-
-
-
-
-
- );
-};
diff --git a/docs/snippets/WalletSetupDemo.jsx b/docs/snippets/WalletSetupDemo.jsx
deleted file mode 100644
index 8a7ae409d..000000000
--- a/docs/snippets/WalletSetupDemo.jsx
+++ /dev/null
@@ -1,895 +0,0 @@
-export const WalletSetupDemo = () => {
- const sans = "ui-sans-serif,system-ui,-apple-system,'Segoe UI',Roboto,sans-serif";
- const serif = "'Tiempos Headline','Iowan Old Style','Source Serif Pro',ui-serif,Georgia,serif";
- const mono = "ui-monospace,'SF Mono','Cascadia Code',Menlo,Monaco,Consolas,monospace";
-
- const c = {
- bg: "#1f1e1d",
- header: "#262624",
- border: "#34322f",
- inputBg: "#2a2926",
- text: "#f5f4ed",
- body: "#e8e4dc",
- muted: "#a8a39d",
- dim: "#6b6663",
- accent: "#D97757",
- bubble: "#2c2b28",
- bubbleText: "#f5f4ed",
- code: "#e89972",
- codeBg: "rgba(217,119,87,0.12)",
- toolBg: "#272622",
- toolBorder: "#3a3835",
- success: "#a3c585",
- };
-
-
-
-
- // Shared Base Account "Review" modal + Approve Transaction button used
- // across the ai-agents demos. Supports asset-transfer previews (send, swap,
- // deposit, borrow, repay) and signing previews (sign-message, sign-siwe,
- // sign-permit). Positioned absolute inside the parent demo container so it
- // doesn't fight with the Mintlify navbar's z-index.
-
- const ACCENT = "#D97757";
-
- const tokenBg = (ticker) => {
- if (!ticker) return ACCENT;
- const t = ticker.toUpperCase();
- if (t === "USDC") return "#2775CA";
- if (t === "ETH" || t === "WETH") return "#627EEA";
- if (t === "CBBTC" || t === "BTC") return "#F7931A";
- if (t === "DEGEN") return "#A06CFF";
- if (t === "POL") return "#8247E5";
- return ACCENT;
- };
-
- const tokenGlow = (ticker) => {
- if (!ticker) return "rgba(217,119,87,0.14)";
- const t = ticker.toUpperCase();
- if (t === "USDC") return "rgba(39,117,202,0.14)";
- if (t === "ETH" || t === "WETH") return "rgba(98,126,234,0.14)";
- if (t === "CBBTC" || t === "BTC") return "rgba(247,147,26,0.14)";
- if (t === "DEGEN") return "rgba(160,108,255,0.14)";
- return "rgba(217,119,87,0.14)";
- };
-
- const BigTokenAvatar = ({ ticker }) => (
-
-
- {(ticker || "??").slice(0, 2).toUpperCase()}
-
-
- );
-
- const SmallTokenAvatar = ({ ticker }) => (
-
-
- {(ticker || "??").slice(0, 2).toUpperCase()}
-
-
- );
-
- // Wallet avatar — wow-face emoji style in a blue gradient circle
- const CBAvatar = () => (
-
-
-
-
-
- );
-
- // Sign-icon avatar for signing flows — pen-on-paper in a purple gradient circle
- const SignAvatar = () => (
-
- );
-
- const ApprovalButton = ({ preview, onApprove, label }) => {
- const [hover, setHover] = useState(false);
- return (
-
-
-
- );
- };
-
- const TxModal = ({ preview, onConfirm, onCancel }) => {
- const mbg = "#0a0a0a";
- const mcard = "#1a1816";
- const mhair = "#1f1d1b";
- const mwhite = "#ffffff";
- const mvalue = "#a09b95";
- const msub = "#7a7470";
-
- const isSign = preview.type && preview.type.startsWith("sign");
-
- const renderPreview = () => {
- if (preview.type === "send") return (
-
-
-
-
-
- {preview.amount} {preview.asset}
-
- {preview.usdValue && (
-
- {preview.usdValue}
-
- )}
-
-
- To
- {preview.to}
-
-
- );
-
- if (preview.type === "swap") return (
-
-
-
-
-
You send
-
- {preview.fromAmount} {preview.fromAsset}
-
-
- {preview.fromUsd && (
-
{preview.fromUsd}
- )}
-
-
-
-
-
-
You receive
-
- {preview.toAmount} {preview.toAsset}
-
-
- {preview.toUsd && (
-
{preview.toUsd}
- )}
-
-
- );
-
- if (preview.type === "deposit") return (
-
-
-
-
-
You deposit
-
- {preview.amount} {preview.asset}
-
-
- {preview.usdValue && (
-
{preview.usdValue}
- )}
-
-
-
Into
-
-
{preview.vault}
- {preview.apy && (
-
{preview.apy} APY
- )}
-
-
-
- );
-
- if (preview.type === "borrow") return (
-
-
-
-
-
Supply collateral
-
- {preview.collateralAmount} {preview.collateralAsset}
-
-
-
-
-
-
-
You borrow
-
- {preview.loanAmount} {preview.loanAsset}
-
-
-
- {preview.healthFactor && (
-
- Health factor
- {preview.healthFactor}
-
- )}
-
- );
-
- if (preview.type === "repay") return (
-
-
-
-
-
You repay
-
- {preview.amount} {preview.asset}
-
-
- {preview.usdValue && (
-
{preview.usdValue}
- )}
-
-
- To market
- {preview.market}
-
-
- );
-
- if (preview.type === "sign-message") return (
-
-
-
-
-
- Sign message
-
-
- personal_sign
-
-
- "{preview.message}"
-
-
- );
-
- if (preview.type === "sign-siwe") return (
-
-
-
-
-
- Sign in with Ethereum
-
-
- EIP-4361 · session login
-
-
-
- Domain
- {preview.domain}
-
-
- );
-
- if (preview.type === "sign-permit") return (
-
-
-
-
-
- Approve token spending
-
-
- EIP-712 · Permit2
-
-
-
-
Token
-
-
- {preview.token}
-
-
-
- Spender
- {preview.spender}
-
- {preview.amount && (
-
- Allowance
- {preview.amount}
-
- )}
-
- );
-
- return null;
- };
-
- const FieldRow = ({ label, right }) => (
-
- );
-
- return (
-
-
e.stopPropagation()}
- style={{
- background: mbg,
- borderRadius: 16,
- border: `1px solid #1f1d1b`,
- width: 320, maxWidth: "100%",
- maxHeight: "calc(100% - 8px)",
- overflowY: "auto",
- boxShadow: "0 24px 80px rgba(0,0,0,0.85)",
- }}
- >
- {/* Header */}
-
-
- {isSign ? "Sign" : "Review"}
-
-
-
-
- {/* Demo banner */}
-
-
-
- DEMO · Not a real {isSign ? "signature" : "transaction"}
-
-
-
- {/* Preview */}
-
- {renderPreview()}
-
-
- {/* Field rows */}
-
-
-
- 0x71Dc…7244
- >
- }
- />
- {!isSign && (
-
-
- 0x71Dc…7244
-
- >
- }
- />
- )}
-
-
- Base
- >
- }
- />
- {!isSign && (
- {"< $0.01"}}
- />
- )}
-
-
- {/* Buttons */}
-
-
-
-
-
-
- );
- };
-
-
- const examples = [
- {
- prompt: "Send 5 USDC to jesse.base.eth",
- events: [
- { delay: 380, type: "thinking" },
- { delay: 600, type: "tool", tool: { server: "base-mcp", action: "send", args: { recipient: "jesse.base.eth", asset: "USDC", amount: "5", chain: "base" } } },
- { delay: 550, type: "text", text: "Resolved jesse.base.eth → 0xd8dA…6045. Approve to send:" },
- { delay: 250, type: "approval", preview: { type: "send", asset: "USDC", amount: "5", usdValue: "$5.00", to: "jesse.base.eth" } },
- { delay: 1100, type: "confirm", text: "Sent 5 USDC to jesse.base.eth" },
- ],
- },
- {
- prompt: "Swap 0.05 ETH to USDC on Base",
- events: [
- { delay: 380, type: "thinking" },
- { delay: 600, type: "tool", tool: { server: "base-mcp", action: "swap", args: { fromAsset: "ETH", toAsset: "USDC", amount: "0.05", chain: "base" } } },
- { delay: 600, type: "text", text: "Swap request ready: estimated 179.41 USDC. Approve to swap:" },
- { delay: 450, type: "approval", preview: { type: "swap", fromAsset: "ETH", fromAmount: "0.05", fromUsd: "~$179.50", toAsset: "USDC", toAmount: "179.41", toUsd: "~$179.41" } },
- { delay: 1100, type: "confirm", text: "Swapped 0.05 ETH → 179.41 USDC" },
- ],
- },
- {
- prompt: "Find the highest paying USDC yield on Base and deposit 100",
- events: [
- { delay: 380, type: "thinking" },
- { delay: 600, type: "tool", tool: { server: "morpho", action: "query_vaults", args: { chain: "base", asset: "USDC", sort: "apy_desc" } } },
- { delay: 700, type: "tool", tool: { server: "moonwell", action: "list_markets", args: { asset: "USDC", chain: "base" } } },
- { delay: 600, type: "text", text: "Compared Morpho vaults and Moonwell markets — top USDC yields on Base:" },
- { delay: 250, type: "rows", rows: [
- { token: "Morpho · Steakhouse USDC", amount: "8.42% APY", value: "$24.1M TVL · winner" },
- { token: "Morpho · Re7 USDC", amount: "7.91% APY", value: "$18.7M TVL" },
- { token: "Moonwell · USDC market", amount: "5.13% APY", value: "$41.2M supplied" },
- ]},
- { delay: 700, type: "tool", tool: { server: "morpho", action: "prepare_deposit", args: { vault: "Steakhouse USDC", amount: "100 USDC" } } },
- { delay: 500, type: "tool", tool: { server: "base-mcp", action: "send_calls", args: { chain: "base", calls: "[approve, deposit]" } } },
- { delay: 450, type: "approval", preview: { type: "deposit", asset: "USDC", amount: "100", usdValue: "~$100.00", vault: "Steakhouse USDC", apy: "8.42%" } },
- { delay: 1100, type: "confirm", text: "Deposited 100 USDC into Steakhouse USDC · earning 8.42% APY" },
- ],
- },
- {
- prompt: "What chains are supported by Base MCP?",
- events: [
- { delay: 380, type: "thinking" },
- { delay: 500, type: "tool", tool: { server: "base-mcp", action: "get_wallets", args: {} } },
- { delay: 500, type: "text", text: "Base MCP currently supports 7 mainnets and 1 testnet:" },
- { delay: 200, type: "rows", rows: [
- { token: "Base", amount: "Mainnet", value: "" },
- { token: "Arbitrum", amount: "Mainnet", value: "" },
- { token: "Optimism", amount: "Mainnet", value: "" },
- { token: "Polygon", amount: "Mainnet", value: "" },
- { token: "BNB Chain", amount: "Mainnet", value: "" },
- { token: "Avalanche", amount: "Mainnet", value: "" },
- { token: "Ethereum", amount: "Mainnet", value: "" },
- { token: "Base Sepolia", amount: "Testnet", value: "" },
- ]},
- ],
- },
- ];
-
- const [activeIdx, setActiveIdx] = useState(null);
- const [eventIdx, setEventIdx] = useState(0);
- const [modalPreview, setModalPreview] = useState(null);
- const scrollRef = useRef(null);
- const timersRef = useRef([]);
-
- const clearTimers = () => { timersRef.current.forEach(clearTimeout); timersRef.current = []; };
-
- useEffect(() => { if (scrollRef.current) scrollRef.current.scrollTop = scrollRef.current.scrollHeight; }, [eventIdx, activeIdx]);
- useEffect(() => () => clearTimers(), []);
-
- const pick = (idx) => {
- if (activeIdx !== null) return;
- setActiveIdx(idx);
- setEventIdx(0);
- clearTimers();
- let cumulative = 0;
- const events = examples[idx].events;
- // Schedule events up to and including the approval step. After that, the
- // demo pauses and waits for the user to actually click Confirm in the modal.
- for (let i = 0; i < events.length; i++) {
- cumulative += events[i].delay;
- timersRef.current.push(setTimeout(() => setEventIdx(i + 1), cumulative));
- if (events[i].type === "approval") break;
- }
- };
-
- const reset = () => { clearTimers(); setActiveIdx(null); setEventIdx(0); setModalPreview(null); };
-
- const handleConfirm = () => {
- setModalPreview(null);
- clearTimers();
- if (activeIdx !== null) setEventIdx(examples[activeIdx].events.length);
- };
-
- const ex = activeIdx !== null ? examples[activeIdx] : null;
-
- // ----- UI bits -----
-
- const TrafficLights = () => (
-
-
-
-
-
- );
-
- const UserBubble = ({ children }) => (
-
- );
-
- const ToolCall = ({ tool, completed }) => (
-
-
-
- {completed ? (
-
- ) : (
-
- )}
-
-
- {tool.server}
- ·
- {tool.action}
- (
- {Object.entries(tool.args).map(([k, v], i, arr) => (
-
- {k}:
- "{v}"
- {i < arr.length - 1 && , }
-
- ))}
- )
-
-
-
- );
-
- const Thinking = () => (
-
-
- {[0, 1, 2].map(i => (
-
- ))}
-
- Thinking
-
- );
-
- const ResponseText = ({ children, top }) => (
- {children}
- );
-
- const ResponseRows = ({ rows }) => (
-
- {rows.map((r, i) => (
-
- •
- {r.token}
- {r.amount}
- {r.value}
-
- ))}
-
- );
-
- const Confirm = ({ text }) => (
-
- );
-
- const ChipBtn = ({ onClick, children }) => {
- const [hover, setHover] = useState(false);
- return (
-
- );
- };
-
-
- // Render the events shown so far for the active example
- const renderEvents = () => {
- if (!ex) return null;
- const shown = ex.events.slice(0, eventIdx);
- return shown.map((event, i) => {
- if (event.type === "thinking") {
- if (i < shown.length - 1) return null;
- return ;
- }
- if (event.type === "tool") {
- const hasLater = shown.slice(i + 1).some(e => e.type !== "thinking");
- return ;
- }
- if (event.type === "text") return {event.text};
- if (event.type === "rows") return ;
- if (event.type === "approval") return ;
- if (event.type === "confirm") return ;
- return null;
- });
- };
-
- return (
-
- {/* keyframes + responsive */}
-
-
- {/* Transaction approval modal */}
- {modalPreview && (
-
setModalPreview(null)}
- />
- )}
-
- {/* Header */}
-
-
-
- Base MCP
-
-
▾
-
- {activeIdx !== null && (
-
- )}
-
-
- {/* Chat area */}
-
- {!ex && (
-
-
- Try asking your assistant once mcp.base.org is connected:
-
-
- {examples.map((e, i) => (
- pick(i)}>{e.prompt}
- ))}
-
-
- )}
-
- {ex && (
- <>
-
{ex.prompt}
- {renderEvents()}
- >
- )}
-
-
- {/* Input area */}
-
-
-
-
- Write a message...
-
-
- Base MCP ▾
-
-
-
-
- Demo · Every write action requires your approval in Base Account
-
-
-
- );
-};
diff --git a/docs/snippets/X402PaymentsDemo.jsx b/docs/snippets/X402PaymentsDemo.jsx
deleted file mode 100644
index 732aca9ad..000000000
--- a/docs/snippets/X402PaymentsDemo.jsx
+++ /dev/null
@@ -1,473 +0,0 @@
-export const X402PaymentsDemo = () => {
- const sans = "ui-sans-serif,system-ui,-apple-system,'Segoe UI',Roboto,sans-serif";
- const serif = "'Tiempos Headline','Iowan Old Style','Source Serif Pro',ui-serif,Georgia,serif";
- const mono = "ui-monospace,'SF Mono','Cascadia Code',Menlo,Monaco,Consolas,monospace";
-
- const c = {
- bg: "#1f1e1d", header: "#262624", border: "#34322f", inputBg: "#2a2926",
- text: "#f5f4ed", body: "#e8e4dc", muted: "#a8a39d", dim: "#6b6663",
- accent: "#D97757", bubble: "#2c2b28", bubbleText: "#f5f4ed",
- code: "#e89972", codeBg: "rgba(217,119,87,0.12)",
- toolBg: "#272622", toolBorder: "#3a3835", success: "#a3c585",
- };
-
- const ACCENT = "#D97757";
-
- const CBAvatar = () => (
-
-
-
-
-
- );
-
- const SignAvatar = () => (
-
- );
-
- const ApprovalButton = ({ preview, onApprove }) => {
- const [hover, setHover] = useState(false);
- return (
-
-
-
- );
- };
-
- const TxModal = ({ preview, onConfirm, onCancel }) => {
- const mbg = "#0a0a0a";
- const mcard = "#1a1816";
- const mhair = "#1f1d1b";
- const mwhite = "#ffffff";
- const mvalue = "#a09b95";
- const msub = "#7a7470";
-
- const DetailRow = ({ label, value, monoValue }) => (
-
- {label}
- {value}
-
- );
-
- const FieldRow = ({ label, right }) => (
-
- );
-
- return (
-
-
e.stopPropagation()}
- style={{
- background: mbg,
- borderRadius: 16,
- border: `1px solid ${mhair}`,
- width: 320, maxWidth: "100%",
- maxHeight: "calc(100% - 8px)",
- overflowY: "auto",
- boxShadow: "0 24px 80px rgba(0,0,0,0.85)",
- }}
- >
-
-
-
-
-
- DEMO · Not a real signature
-
-
-
-
-
-
-
-
-
- Sign x402 payment
-
-
- Payment authorization
-
-
-
-
-
-
-
-
-
-
-
- 0x71Dc…7244
- >
- }
- />
-
-
- {preview.network}
- >
- }
- />
-
-
-
-
-
-
-
-
- );
- };
-
- const examples = [
- {
- prompt: "Call this x402 endpoint and pay up to 0.05 USDC",
- events: [
- { delay: 380, type: "thinking" },
- { delay: 650, type: "tool", tool: { server: "base-mcp", action: "initiate_x402_request", args: { url: "https://api.example.com/report", method: "GET", maxPayment: "0.05" } } },
- { delay: 600, type: "text", text: "The endpoint requested 0.02 USDC on Base, within your cap. Sign the payment authorization to continue:" },
- { delay: 250, type: "approval", preview: { type: "sign-x402", amount: "0.02 USDC", endpoint: "api.example.com/report", network: "Base", requestId: "req_x402_7fa" } },
- { delay: 550, type: "tool", tool: { server: "base-mcp", action: "complete_x402_request", args: { requestId: "req_x402_7fa" } } },
- { delay: 500, type: "text", text: "Paid request completed. Response summary:" },
- { delay: 250, type: "rows", rows: [
- { token: "Status", amount: "200 OK", value: "request replayed with x402 payment" },
- { token: "Cost", amount: "0.02 USDC", value: "paid on Base" },
- { token: "Data", amount: "ready", value: "report payload returned" },
- ]},
- { delay: 400, type: "confirm", text: "x402 request complete" },
- ],
- },
- {
- prompt: "POST this payload and cap the x402 payment at 1 USDC",
- events: [
- { delay: 380, type: "thinking" },
- { delay: 650, type: "tool", tool: { server: "base-mcp", action: "initiate_x402_request", args: { url: "https://data.example.com/query", method: "POST", maxPayment: "1.00", body: { query: "base activity" } } } },
- { delay: 600, type: "text", text: "Payment required: 0.15 USDC on Base Sepolia. Sign the wallet authorization before the request is replayed." },
- { delay: 250, type: "approval", preview: { type: "sign-x402", amount: "0.15 USDC", endpoint: "data.example.com/query", network: "Base Sepolia", requestId: "req_x402_91c" } },
- { delay: 550, type: "tool", tool: { server: "base-mcp", action: "complete_x402_request", args: { requestId: "req_x402_91c" } } },
- { delay: 500, type: "text", text: "The paid API returned structured JSON:" },
- { delay: 250, type: "rows", rows: [
- { token: "Rows", amount: "128", value: "matching activity records" },
- { token: "Window", amount: "24h", value: "latest Base activity" },
- { token: "Cost", amount: "0.15 USDC", value: "below the 1.00 USDC cap" },
- ]},
- { delay: 400, type: "confirm", text: "POST request paid and completed" },
- ],
- },
- ];
-
- const [activeIdx, setActiveIdx] = useState(null);
- const [eventIdx, setEventIdx] = useState(0);
- const [modalPreview, setModalPreview] = useState(null);
- const scrollRef = useRef(null);
- const timersRef = useRef([]);
-
- const clearTimers = () => { timersRef.current.forEach(clearTimeout); timersRef.current = []; };
-
- useEffect(() => { if (scrollRef.current) scrollRef.current.scrollTop = scrollRef.current.scrollHeight; }, [eventIdx, activeIdx]);
- useEffect(() => () => clearTimers(), []);
-
- const scheduleFrom = (idx, start) => {
- let cumulative = 0;
- const events = examples[idx].events;
- for (let i = start; i < events.length; i++) {
- cumulative += events[i].delay;
- timersRef.current.push(setTimeout(() => setEventIdx(i + 1), cumulative));
- if (events[i].type === "approval") break;
- }
- };
-
- const pick = (idx) => {
- if (activeIdx !== null) return;
- setActiveIdx(idx);
- setEventIdx(0);
- clearTimers();
- scheduleFrom(idx, 0);
- };
-
- const handleConfirm = () => {
- setModalPreview(null);
- if (activeIdx === null) return;
- clearTimers();
- scheduleFrom(activeIdx, eventIdx);
- };
-
- const reset = () => { clearTimers(); setActiveIdx(null); setEventIdx(0); setModalPreview(null); };
- const ex = activeIdx !== null ? examples[activeIdx] : null;
-
- const TrafficLights = () => (
-
-
-
-
-
- );
-
- const UserBubble = ({ children }) => (
-
- );
-
- const formatArgValue = (value) => {
- if (value && typeof value === "object") return JSON.stringify(value);
- if (typeof value === "string") return `"${value}"`;
- return String(value);
- };
-
- const ToolCall = ({ tool, completed }) => (
-
-
-
- {completed
- ?
- : }
-
-
- {tool.server}
- ·
- {tool.action}
- (
- {Object.entries(tool.args).map(([k, v], i, arr) => (
- {k}: {formatArgValue(v)}{i < arr.length - 1 && , }
- ))}
- )
-
-
-
- );
-
- const Thinking = () => (
-
-
- {[0, 1, 2].map(i => )}
-
- Thinking
-
- );
-
- const ResponseText = ({ children, top }) => (
- {children}
- );
-
- const ResponseRows = ({ rows }) => (
-
- {rows.map((r, i) => (
-
- •
- {r.token}
- {r.amount}
- {r.value}
-
- ))}
-
- );
-
- const Confirm = ({ text }) => (
-
- );
-
- const ChipBtn = ({ onClick, children }) => {
- const [hover, setHover] = useState(false);
- return (
-
- );
- };
-
- const renderEvents = () => {
- if (!ex) return null;
- const shown = ex.events.slice(0, eventIdx);
- return shown.map((event, i) => {
- if (event.type === "thinking") {
- if (i < shown.length - 1) return null;
- return ;
- }
- if (event.type === "tool") {
- const hasLater = shown.slice(i + 1).some(e => e.type !== "thinking");
- return ;
- }
- if (event.type === "approval") return ;
- if (event.type === "text") return {event.text};
- if (event.type === "rows") return ;
- if (event.type === "confirm") return ;
- return null;
- });
- };
-
- return (
-
- {modalPreview &&
setModalPreview(null)} />}
-
-
-
-
-
Base MCP
-
▾
-
- {activeIdx !== null && (
-
- )}
-
-
-
- {!ex && (
-
-
- Try asking your assistant once mcp.base.org is connected:
-
-
- {examples.map((e, i) => pick(i)}>{e.prompt})}
-
-
- )}
- {ex && <>
{ex.prompt}{renderEvents()}>}
-
-
-
-
-
-
Write a message...
-
Sonnet 4.6 ▾
-
-
-
- Demo · x402 payments require a wallet signature in Base Account
-
-
-
- );
-};