Skip to content

feat: runnable code & sandbox embeds for EVM examples#32

Open
alexander-sei wants to merge 1 commit into
mainfrom
docs/runnable-code-sandboxes
Open

feat: runnable code & sandbox embeds for EVM examples#32
alexander-sei wants to merge 1 commit into
mainfrom
docs/runnable-code-sandboxes

Conversation

@alexander-sei

Copy link
Copy Markdown
Collaborator

What is the purpose of the change?

Adds new interactive content — runnable code on the EVM example pages. This closes the biggest gap from the Sei-vs-Solana docs review (roadmap P0.2, "make code runnable"): Sei's examples were copy-paste only, while Solana lets developers run code in the browser.

Describe the changes to the documentation

Two new self-contained Mintlify snippets, wired into five existing EVM example pages. Target audience: EVM developers evaluating or building on Sei who want to try calls and deploy contracts without leaving the docs.

snippets/run-snippet.jsx — Tier 1: read-only "Run" buttons

  • Click-to-run read-only JSON-RPC issued straight from the browser to Sei's public RPC. Sei's endpoints send access-control-allow-origin: *, so no proxy is needed. Hex results auto-decode to decimal; copy + request-timing included.
  • Added as "Try It Live" on the viem and ethers quickstarts (eth_blockNumber, eth_chainId, eth_getBalance).

snippets/sandbox-embed.jsx — Tier 2 & 3: click-to-load editor embeds

  • Tier 2 (CodeSandbox) — editable, anonymously-runnable viem/ethers TypeScript reading Sei testnet, on the viem and ethers quickstarts.
  • Tier 3 (Remix IDE) — compile + deploy Solidity to Sei testnet from the browser, on deploy-verify (Counter), erc20 (OpenZeppelin ERC-20), and erc721 (OpenZeppelin ERC-721), each paired with the existing AddSeiButton for adding Sei testnet to a wallet.
  • The iframe src is deferred until the reader clicks, so pages pay nothing on load.

Notes

  • Verified locally via mint dev + headless Chrome: all five pages return HTTP 200, every component mounts, zero page errors, iframes deferred. Tier 1 click→fetch→decode confirmed live against mainnet; Tier 2 confirmed to execute anonymously in an incognito context (real testnet RPC calls); Tier 3 Remix confirmed to load the preloaded contract and frame inside Mintlify with no CSP/X-Frame refusal.
  • Mintlify constraints respected: no npm imports, named exports, all declarations inside the component. Surfaces use theme-agnostic translucent inline styles because Mintlify doesn't apply dark:bg-* / dark:border-* to custom-snippet container <div>s (only dark:text-* works).
  • Follow-ups (not in this PR): the two CodeSandbox sandboxes (cgtx45, qs82lw) were created anonymously via the Define API and should be re-created under a Sei-owned CodeSandbox account for durability/branding. Tier-2 for the python quickstart (web3.py can't run in CodeSandbox's JS-only browser bundler) and a multicall example were intentionally deferred.

🤖 Generated with Claude Code

Close the "static vs interactive" gap with Solana's docs (roadmap P0.2)
by making the EVM example pages runnable.

- RunSnippet: click-to-run read-only JSON-RPC straight against Sei's
  public RPC (CORS-open, no proxy), with hex->decimal decoding. Wired
  into the viem and ethers quickstarts as "Try It Live".
- SandboxEmbed: click-to-load iframe wrapper for external sandboxes.
  Tier 2 (CodeSandbox) on the viem/ethers quickstarts for editable,
  anonymously-runnable viem/ethers TypeScript; Tier 3 (Remix) on
  deploy-verify/erc20/erc721 to compile + deploy Solidity to Sei
  testnet, paired with AddSeiButton.

Surfaces use theme-agnostic translucent styles (Mintlify does not apply
dark:bg-* to custom-snippet divs). No npm imports; all declarations live
inside the component per Mintlify's runtime rules.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mintlify

mintlify Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
sei-docs 🟢 Ready View Preview Jun 20, 2026, 11:58 AM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@cursor

cursor Bot commented Jun 20, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Documentation and client-side read-only RPC plus third-party iframe embeds only; no backend, auth, or on-chain logic changes in this repo.

Overview
Adds browser-runnable EVM example flows so readers can try Sei without only copy-pasting code.

Two new Mintlify snippets drive the UX: RunSnippet posts read-only JSON-RPC to Sei’s public RPC from the page (with timing, copy, and hex→decimal decode), and SandboxEmbed lazy-loads CodeSandbox or Remix iframes only after a click so initial page load stays light.

viem and ethers quickstarts gain Try It Live RPC buttons plus Edit and run CodeSandbox embeds. deploy-verify, erc20, and erc721 gain Remix sections with preloaded contracts (Counter, OpenZeppelin DemoToken / DemoNFT), wallet setup via existing AddSeiButton, and deploy instructions for Sei testnet.

Reviewed by Cursor Bugbot for commit aeaec89. Bugbot is set up for automated code reviews on this repo. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant