Skip to content

docs(evm): interactive Sei-accurate JSON-RPC explorer on /evm/reference#30

Open
alexander-sei wants to merge 11 commits into
mainfrom
docs/evm-rpc-explorer
Open

docs(evm): interactive Sei-accurate JSON-RPC explorer on /evm/reference#30
alexander-sei wants to merge 11 commits into
mainfrom
docs/evm-rpc-explorer

Conversation

@alexander-sei

Copy link
Copy Markdown
Collaborator

Summary

Replaces the static per-category method accordions on /evm/reference with an interactive JSON-RPC explorer, and rebuilds the underlying method catalog from Sei's actual evmrpc implementation instead of the cosmos/evm dataset the original component shipped with.

  • New snippet snippets/rpc-methods-viewer.jsx: Sei-branded (Sei Maroon), theme-aware, responsive explorer with search, namespace filters, a network switcher (mainnet / testnet / custom), live Run request, and cURL / JavaScript / Python / Go / Rust / C# code generation.
  • evm/reference.mdx: embeds the explorer (mode: 'wide') above the preserved authoritative prose — request/response format, network endpoints, filter & subscription limits, and the full deprecated sei_*/sei2_* legacy surface + addr-precompile address resolution + deprecation errors.

Why

The original explorer's method data came from cosmos/evm and was inaccurate for Sei — e.g. it marked eth_call, eth_getCode, eth_getTransactionReceipt, and eth_getLogs as empty stubs (they're fully supported on Sei) and included engine/clique/les/miner/admin namespaces Sei doesn't run.

The method audit

The catalog (118 methods — 33 supported, 51 limited, 34 unavailable) was derived from an audit of sei-protocol/sei-chain/evmrpc — the endpoints.go/server.go registration map, the explicit rpc_unsupported.go rejections, and every namespace handler — with per-method verification against source. Each method is labelled Supported / Limited / Unavailable with Sei-specific notes where relevant:

  • eth_coinbase → fee-collector address; eth_getProof → IAVL (not MPT) proof; eth_gasPrice/eth_maxPriorityFeePerGas → Sei congestion heuristics; instant-finality block tags.
  • Explicitly Unavailable (verified): eth_blobBaseFee, eth_syncing, eth_newPendingTransactionFilter, web3_sha3, net_listening, net_peerCount, and the admin/miner/clique/engine/les/personal namespaces.
  • Sei extensions surfaced: eth_getNonce, eth_estimateGasAfterCalls, eth_getVMError, debug_traceStateAccess, plus the deprecated sei_*/sei2_* methods (with a deprecation banner).

Verification

Rendered the page in mint dev and drove it with headless Chrome: explorer mounts with no runtime errors, lists 84 callable methods by default, the select → params → Sei-note → run → code flow works, the deprecation banner fires for sei_*, and dark / light / mobile all render correctly.

Reviewer notes

  • Per-method detail now lives in the (client-rendered) explorer, so it no longer appears in llms.txt/llms-full.txt or static SEO the way the old accordions did. If we want to retain AI/AEO visibility, a follow-up could add a collapsed static method table per namespace generated from the same dataset.
  • Mintlify snippet constraints honored: arrow-function export, and all constants/helpers/data declared inside the component (module-scope consts throw at runtime).

🤖 Generated with Claude Code

Replace the static per-category method accordions on /evm/reference with an
interactive explorer (snippets/rpc-methods-viewer.jsx), and rebuild the method
catalog from Sei's actual evmrpc implementation rather than the cosmos/evm
dataset the component originally shipped with.

What changed
- New snippet: Sei-branded, theme-aware, responsive explorer with search,
  namespace filters, network switcher (mainnet/testnet/custom), live "Run
  request", and cURL/JS/Python/Go/Rust/C# code generation.
- Reference page: embed the explorer (mode: wide) above the preserved
  authoritative prose (request/response format, network endpoints, filter
  limits, and the full deprecated sei_*/sei2_* legacy surface + address
  resolution precompile + deprecation errors).

Why
- The original viewer's data was from cosmos/evm and was wrong for Sei (e.g.
  eth_call/eth_getCode/eth_getTransactionReceipt/eth_getLogs marked as empty
  stubs, plus engine/clique/les/miner/admin namespaces Sei doesn't run).

Method catalog (118 methods: 33 supported, 51 limited, 34 unavailable) was
derived from an audit of sei-protocol/sei-chain evmrpc (registration map,
rpc_unsupported.go, per-namespace handlers) with per-method verification, and
labels each method supported/limited/unavailable with Sei-specific notes
(IAVL proofs, fee-collector coinbase, instant-finality block tags, gas-price
heuristics) and a deprecation banner for sei_*/sei2_*.

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

cursor Bot commented Jun 17, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Documentation and a client-side docs widget only; no chain or server changes. Browser RPC calls may fail on CORS, which the UI already surfaces.

Overview
Adds an interactive JSON-RPC explorer at the top of /evm/reference via a new Mintlify snippet (RPCMethodsViewer), replacing the old table-of-contents–driven layout while keeping legacy sei_* prose below.

The explorer ships a Sei-specific method catalog (~118 methods) with Supported / Limited / Unavailable labels, namespace filters, mainnet/testnet/custom endpoints, live Run request, and multi-language snippets (including WebSocket paths for eth_subscribe). Deprecated and unavailable methods stay hidden unless toggled.

evm/reference.mdx is reworked in parallel: network endpoint table, filter/subscription limits, instant-finality block-tag note, and expanded static accordions per method (parameters, example JSON, Sei-specific behavior) so the page stays copy-friendly and partially indexable alongside the client-rendered UI.

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

Comment thread snippets/rpc-methods-viewer.jsx
Comment thread snippets/rpc-methods-viewer.jsx
Comment thread snippets/rpc-methods-viewer.jsx Outdated
Comment thread snippets/rpc-methods-viewer.jsx Outdated
… audit

Keep the agent/LLM-readable static endpoint reference on /evm/reference
alongside the interactive explorer, instead of replacing it. Regenerated the
"Standard Ethereum endpoints" section from the verified evmrpc audit so it now
covers every available, non-deprecated method.

- 48 methods across 9 categories (Send transactions, Transaction lookup,
  Account information, Block information, Blockchain information, Filters &
  subscriptions, Simulation, Transaction pool, Debugging & tracing).
- Each entry: support status (Supported/Limited), description, Sei-specific
  behavior note, a Name/Type/Description parameter table, and a copy-paste
  JSON-RPC example request.
- Adds methods the previous list was missing (e.g. eth_getNonce,
  eth_estimateGasAfterCalls, eth_getVMError, eth_createAccessList,
  eth_feeHistory, eth_subscribe/unsubscribe, debug_traceStateAccess,
  txpool_content) and drops ones Sei doesn't serve.
- Deprecated sei_*/sei2_* remain documented separately under Sei custom
  endpoints.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Comment thread snippets/rpc-methods-viewer.jsx Outdated
Comment thread snippets/rpc-methods-viewer.jsx Outdated
Fixes all 6 issues flagged on PR #30:

1. WebSocket methods emit HTTP snippets — eth_subscribe/eth_unsubscribe now
   emit real WebSocket examples for ALL languages (JS, Python, Go, Rust, C#,
   cURL/wscat), not just JS + cURL.
2. WebSocket examples ignore method params — WS snippets now build from the
   actual method.name + buildParams output instead of a hardcoded
   eth_subscribe/['newHeads'] payload.
3. Custom RPC used mainnet WebSocket — custom networks now derive their WS
   endpoint from the entered HTTP URL (http->ws, https->wss) via
   deriveWsEndpoint; falls back to a clear placeholder, never mainnet.
4. Cleared params reverted to examples — buildParams now only falls back to the
   catalog example when a field is untouched (undefined); a field cleared to ''
   stays empty for run + code generation.
5. Go snippets invalid for object params — Go generator now POSTs a raw JSON
   body string (backtick raw literal) instead of embedding JSON inside a
   []interface{} composite literal.
6. C# snippets invalid for object params — C# generator now sends an escaped
   JSON string via StringContent instead of new object[] { <raw JSON> }.

Also hardened Python (json.loads so boolean/null/object params are valid
Python) and Rust (serde_json::from_str on a raw JSON body). Verified with
headless Chrome against mint dev: object-param methods produce valid Go/C#/
Python, WS methods produce WebSocket snippets in every language with the
correct derived endpoint, and clearing a filled param drops it from the
request. No runtime errors.

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

Copy link
Copy Markdown
Collaborator Author

Addressed all 6 Cursor Bugbot findings in snippets/rpc-methods-viewer.jsx (commit 40a34bf), each verified with headless Chrome against mint dev:

# Finding Fix
1 WebSocket methods emit HTTP snippets eth_subscribe/eth_unsubscribe now emit real WebSocket examples for all languages (JS, Python, Go, Rust, C#, cURL/wscat)
2 WebSocket examples ignore method params WS snippets build from method.name + buildParams output instead of a hardcoded eth_subscribe/['newHeads'] payload
3 Custom RPC uses mainnet WebSocket custom networks derive their WS endpoint from the entered HTTP URL (http→ws, https→wss) via deriveWsEndpoint; never falls back to mainnet
4 Cleared params revert to examples buildParams only uses the catalog example when a field is untouched (undefined); a field cleared to '' stays empty
5 Go snippets invalid object params Go generator POSTs a raw JSON body (backtick raw-string literal) instead of embedding JSON in a []interface{} literal
6 C# snippets invalid object params C# generator sends an escaped JSON string via StringContent instead of new object[] { <raw JSON> }

Also hardened Python (json.loads so true/false/null/object params are valid Python) and Rust (serde_json::from_str on a raw JSON body).

Verification (headless): object-param methods (eth_call) produce compilable Go/C#/Python; WS methods produce WebSocket snippets in every language using the correct derived endpoint; filling then clearing a param drops it from the request and code. 0 runtime errors.

Comment thread snippets/rpc-methods-viewer.jsx
Comment thread snippets/rpc-methods-viewer.jsx
Comment thread snippets/rpc-methods-viewer.jsx
Addresses review feedback on the explorer UX:

- Default view now lists only available, current methods (supported + limited,
  48 total). The deprecated sei_*/sei2_* extensions and unavailable methods are
  hidden by default and revealed via the renamed "Show deprecated & unavailable
  methods" toggle. Namespace pills for deprecated/unavailable namespaces only
  appear when the toggle is on; selecting one then collapsing resets to All.
- Header is now always stacked (title row, then controls row) instead of a
  single space-between row, so a long RPC URL no longer cramps or breaks the
  layout. Endpoint code wraps with overflow-wrap as a safety net.
- Updated the reference page legend to describe the new default and toggle.

Verified with headless Chrome: default shows 48 methods with no sei/sei2/
unavailable and pills excluding them; toggle reveals all 118; a long custom
URL produces no horizontal overflow; no runtime errors.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Comment thread snippets/rpc-methods-viewer.jsx
…styles

- Reorder the detail panel so the request (code example) sits above the
  Run button and Result, matching natural request → response reading order.
- Add a TypeScript code-example tab (HTTP: typed fetch with RpcResponse<T> +
  ethers v6; WebSocket: typed MessageEvent handler).
- Compactness/readability pass (behavior-preserving): introduce a shared `bd`
  border constant (replaces 13 repeated literals), a shared `fieldStyle` for
  the param input/textarea (collapsing duplicated props), and a single
  `CodeBlock` component reused for both the request and result panes.

Verified with mint dev + headless Chrome: explorer mounts, 48 available
methods by default, params/request/result render, all language tabs (incl.
TypeScript) work, no runtime errors. Note: Mintlify snippets must stay .jsx —
.tsx is not supported by the snippet loader (verified).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Clarify eth_subscribe docs and example (make clear the filter only applies to logs and switch example to 'logs'), and remove the MDX 'mode: wide' setting. In the RPC explorer component, prevent sending an extraneous subscription filter unless the first param is 'logs' (buildParams). Drive the responsive layout from the explorer element's own width (added rootRef + ResizeObserver, 768px stack threshold) instead of the viewport. Fix stale examples by clearing debounced params synchronously on method select, use raw triple-quoted strings in Python/websocket snippets to avoid escaping issues, and simplify/refactor the params + WebSocket message rendering for a clearer UI.
const [network, setNetwork] = useState('mainnet');
const [customEndpoint, setCustomEndpoint] = useState('');
const endpoint = network === 'custom' ? customEndpoint : NETWORKS[network].http;
const wsEndpoint = network === 'custom' ? deriveWsEndpoint(customEndpoint) : NETWORKS[network].ws;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Custom mode wrong WebSocket URL

Medium Severity

In custom network mode, WebSocket examples for eth_subscribe and eth_unsubscribe are built by flipping the HTTP URL’s scheme on the same host. Sei uses separate HTTP and WebSocket hostnames, so a pasted mainnet HTTP RPC URL yields a WebSocket URL on the wrong host.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit e3935ce. Configure here.

'func main() {',
'\tbody := []byte(' + BT + bodyJson + BT + ')',
`\tresp, _ := http.Post("${url}", "application/json", bytes.NewBuffer(body))`,
'\tdefer resp.Body.Close()',

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Generated Go snippet nil panic

Low Severity

The generated Go HTTP example calls defer resp.Body.Close() immediately after http.Post, with the error return discarded. When Post fails, resp is nil and that defer panics.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit e3935ce. Configure here.

Strip a number of long explanatory comments from the EVM RPC explorer snippet and remove a doc sentence about the generated catalog in the reference page. Tidy several inline comments and shorten wording (no behavior changes), and adjust the explorer container size from 80vh/minHeight 640 to 96vh/minHeight 768 to give the UI more vertical room. Overall cleanup only; no functional logic changes.
} finally {
setIsLoading(false);
}
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Run result wrong method

Medium Severity

The live Run request handler always applies the fetched JSON to requestResult when the network call finishes, without checking that the user still has the same RPC method selected. Switching methods while a request is in flight can show another method’s response under the current method.

Fix in Cursor Fix in Web

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

// eth_subscribe: the optional filter only applies to the logs stream.
if (method.name === 'eth_subscribe' && params[0] !== 'logs') params.length = 1;
while (params.length && isEmptyValue(params[params.length - 1])) params.pop();
return params;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cleared params skip examples

Medium Severity

In buildParams, a parameter field cleared to an empty string is sent as "" instead of falling back to the catalog example, while only trailing empty values are dropped. Cleared middle arguments (e.g. a block tag on eth_call) can produce invalid JSON-RPC params for Run request and generated snippets.

Fix in Cursor Fix in Web

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

Comment thread snippets/rpc-methods-viewer.jsx Outdated
}
}, [endpoint]);

useEffect(() => { validateEndpoint(); }, [validateEndpoint]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Endpoint check race condition

Low Severity

validateEndpoint issues a probe fetch whenever the endpoint changes but does not ignore late responses from an earlier URL. Rapid network or custom-endpoint changes can leave the Live/Offline indicator reflecting a stale reachability result.

Fix in Cursor Fix in Web

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

{['mainnet', 'testnet', 'custom'].map((n) => (
<button
key={n}
onClick={() => { setNetwork(n); setConnection('idle'); }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Network switch keeps old RPC result

Medium Severity

Changing the network segment (mainnet, testnet, custom) or editing the custom HTTP URL does not reset requestResult. A successful Run request from one endpoint can stay visible under another network label, which misrepresents which chain answered the call.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 697f79b. Configure here.

Comment thread snippets/rpc-methods-viewer.jsx Outdated
}

// curl (default)
return `curl -s -X POST ${url} \\\n -H "Content-Type: application/json" \\\n -d '${bodyJson}'`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

cURL snippet breaks on apostrophes

Low Severity

The default cURL generator wraps bodyJson in single quotes (-d '…'). Any apostrophe in user-edited parameter values terminates the shell string and yields a broken, non-runnable command when copied from the explorer.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 697f79b. Configure here.

return parseValue(v !== undefined ? v : (p.example || ''));
});
// eth_subscribe: the optional filter only applies to the logs stream.
if (method.name === 'eth_subscribe' && params[0] !== 'logs') params.length = 1;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

eth_subscribe logs match is brittle

Low Severity

For eth_subscribe, the optional log filter is kept only when params[0] === 'logs' with exact, case-sensitive equality. Values like Logs or logs with surrounding whitespace drop the filter from generated WebSocket payloads even when the user intended a logs subscription.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 697f79b. Configure here.

…amples

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- reword stale "six languages" intro to avoid pinning a count
- defer the RPC connectivity ping until the user engages the console
  (no outbound request on a plain page view)
- fix dead isMutation personal_* check
- make the Kotlin WebSocket snippet compile (explicit CompletionStage return)
- associate param inputs with their labels (htmlFor/id) for a11y

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.

There are 9 total unresolved issues (including 8 from previous reviews).

Fix All in Cursor

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

Reviewed by Cursor Bugbot for commit 3e446eb. Configure here.

const meta = NAMESPACE_META[selectedNamespace];
if (meta && (meta.deprecated || meta.unavailable)) setSelectedNamespace('all');
}
}}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hidden method stays selected

Medium Severity

Unchecking Show deprecated & unavailable methods removes entries from the method list via isHiddenByDefault, but selectedMethod is not cleared when the current method becomes hidden. The detail pane can still show deprecated sei_*/sei2_* or unavailable methods with Try it while the list no longer lists them.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 3e446eb. 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