Skip to content

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

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

feat: runnable code & sandbox embeds for EVM examples#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 new interactive content — runnable code on the EVM example pages.

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/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.

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