Skip to content

feat: runnable code & sandbox embeds across the EVM docs#32

Open
alexander-sei wants to merge 2 commits into
mainfrom
docs/runnable-code-sandboxes
Open

feat: runnable code & sandbox embeds across the EVM docs#32
alexander-sei wants to merge 2 commits into
mainfrom
docs/runnable-code-sandboxes

Conversation

@alexander-sei

@alexander-sei alexander-sei commented Jun 20, 2026

Copy link
Copy Markdown
Collaborator

What is the purpose of the change?

Adds interactive, runnable content across the EVM docs — read-only "Run" buttons and click-to-load editor/deploy embeds — so developers can try JSON-RPC calls and deploy contracts without leaving the docs.

Originally scoped to 5 example pages; now extended across the EVM examples, the Smart Contracts group, and the debugging page — 18 pages total, built from two self-contained Mintlify snippets plus the existing AddSeiButton.

Snippets

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 (endpoints send access-control-allow-origin: *, so no proxy is needed). Hex results auto-decode to decimal; copy + request-timing included; RPC errors surface in a dedicated panel.

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

  • Tier 2 (CodeSandbox) — editable, anonymously-runnable viem/ethers TypeScript reading Sei testnet.
  • Tier 3 (Remix IDE) — compile + deploy Solidity to Sei testnet from the browser; the Solidity source is base64-encoded directly into the Remix URL, so each embed is self-contained with nothing to host. Paired with AddSeiButton.
  • The iframe src is deferred until the reader clicks, so pages pay nothing on load.

Pages wired

Examples (evm/evm-parity/examples/)

  • Tier 1 + Tier 2: viem-quickstart, ethers-quickstart
  • Tier 1 Run: transaction-lifecycle, multicall (raw eth_call to Multicall3 at 0xcA11…CA11), error-handling (a real revert + a real RPC argument error), wagmi-react, sei-precompiles (Bank precompile)
  • Tier 3 Remix deploy: deploy-verify (Counter), erc20 (OZ ERC-20), erc721 (OZ ERC-721), erc1155 (OZ ERC-1155)

Smart Contracts group (evm/*)

  • evm-general, evm-hardhat, evm-foundry: Tier-1 eth_chainId checks (testnet + mainnet, to validate the RPC endpoints used in config) + Tier-3 Remix "no-install deploy" (Counter)
  • python-quickstart: Tier-1 reads mirroring the web3.py example (chain_id / block_number / get_balance)
  • evm-wizard: Tier-3 Remix (sample OZ ERC-20 — paste in your wizard output and deploy)
  • evm-verify-contracts: Tier-3 Remix (Counter) inside the Remix verification section

Debugging (evm/debugging-contracts)

  • Tier-1 diagnostics mapping the page's cast commands: cast chain-id / gas-price / nonce / balance

Intentionally skipped: pointer-contracts (no clean anonymous read — needs a user-supplied CosmWasm address) and solidity-resources (links page). No new Tier-2 (CodeSandbox) embeds were added on the additional pages.

Notes / verification

  • Verified via mint dev + headless Chrome: all 18 pages return HTTP 200, every component mounts, zero page errors, zero console errors. Interactive checks: multicall Run → live eth_call decoded to the current block number (~300 ms); error-handling Run → red "execution reverted" panel; Remix embeds load the preloaded contract and frame inside Mintlify with no CSP/X-Frame refusal. Every wired RPC call confirmed live against Sei mainnet/testnet.
  • 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 is deferred (web3.py can't run in CodeSandbox's JS-only browser bundler).

🤖 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/iframe embeds only; no backend, auth, or on-chain protocol changes.

Overview
Adds two Mintlify-friendly React snippets so readers can try Sei EVM without leaving the docs: RunSnippet posts read-only JSON-RPC to public Sei RPC from the browser (hex decode, timing, copy), and SandboxEmbed click-loads CodeSandbox or Remix iframes so pages stay light until opened.

Those widgets are wired through a broad set of EVM MDX pages—quickstarts (viem, ethers, Python), parity examples (multicall, precompiles, wagmi, errors, tx lifecycle), toolchain guides (Foundry, Hardhat, general), debugging cast diagnostics, deploy/verify, contract wizard, and ERC token pages—often alongside existing AddSeiButton and preloaded Remix contracts (Counter, OpenZeppelin ERC-20/721/1155).

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

…M pages

Extends the Tier-1 RunSnippet (read-only JSON-RPC) and Tier-3 Remix deploy embeds beyond the initial 5 example pages:

- examples: erc1155 (Remix deploy), transaction-lifecycle, multicall, error-handling, wagmi-react, sei-precompiles (RunSnippet)
- smart contracts: evm-general, evm-hardhat, evm-foundry, evm-wizard, evm-verify-contracts (Remix deploy), python-quickstart (RunSnippet)
- debugging-contracts: RunSnippet diagnostics mapping cast chain-id/gas-price/nonce/balance

All RPC calls verified live against Sei mainnet; all pages render with zero errors via mint dev.

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

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 0a5a915. Configure here.


<RunSnippet
method="eth_call"
params={[{ to: '0x0000000000000000000000000000000000001001', data: '0x5b43bc99000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000047573656900000000000000000000000000000000000000000000000000000000' }, 'latest']}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bank precompile call data wrong

Medium Severity

The RunSnippet eth_call data for Bank.name('usei') is not valid ABI encoding: the string length word and the "usei" bytes are merged (…000475736569… instead of a 0x04 length word followed by 75736569), so the live widget is unlikely to succeed or match the page’s description of a SEI name response.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 0a5a915. Configure here.

@alexander-sei alexander-sei changed the title feat: runnable code & sandbox embeds for EVM examples feat: runnable code & sandbox embeds across the EVM docs Jun 25, 2026
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