Skip to content

Commit 3e446eb

Browse files
alexander-seiclaude
andcommitted
fix(evm-explorer): address review feedback
- 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>
1 parent 2cabffb commit 3e446eb

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

‎evm/reference.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ keywords: ['json-rpc', 'api reference', 'evm endpoints', 'blockchain api', 'sei
77

88
import { RPCMethodsViewer } from '/snippets/rpc-methods-viewer.jsx';
99

10-
Sei fully supports the standard Ethereum JSON-RPC API, so existing EVM tooling (ethers.js, viem, Hardhat, Foundry, etc.) works out of the box. Use the explorer below to browse every method Sei exposes, inspect parameters, run requests against a live endpoint, and copy ready-to-use snippets in six languages. The authoritative prose for the request format, the deprecated `sei_*`/`sei2_*` extensions, and address resolution follows underneath.
10+
Sei fully supports the standard Ethereum JSON-RPC API, so existing EVM tooling (ethers.js, viem, Hardhat, Foundry, etc.) works out of the box. Use the explorer below to browse every method Sei exposes, inspect parameters, run requests against a live endpoint, and copy ready-to-use snippets in a range of popular languages. The authoritative prose for the request format, the deprecated `sei_*`/`sei2_*` extensions, and address resolution follows underneath.
1111

1212
<RPCMethodsViewer />
1313

‎snippets/rpc-methods-viewer.jsx‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ const deriveWsEndpoint = (httpUrl) => {
223223
};
224224

225225
const isWsOnly = (name) => name === 'eth_subscribe' || name === 'eth_unsubscribe';
226-
const isMutation = (name) => name === 'eth_sendRawTransaction' || name === 'eth_sendTransaction' || name === 'eth_signTransaction' || name === 'eth_sign' || name === 'sei_sign' || name === 'sei_associate' || name === 'personal';
226+
const isMutation = (name) => name === 'eth_sendRawTransaction' || name === 'eth_sendTransaction' || name === 'eth_signTransaction' || name === 'eth_sign' || name === 'sei_sign' || name === 'sei_associate' || name.startsWith('personal_');
227227

228228
const [theme, setTheme] = useState('dark');
229229
const [isMobile, setIsMobile] = useState(false);
@@ -235,6 +235,7 @@ const isMutation = (name) => name === 'eth_sendRawTransaction' || name === 'eth_
235235
const endpoint = network === 'custom' ? customEndpoint : NETWORKS[network].http;
236236
const wsEndpoint = network === 'custom' ? deriveWsEndpoint(customEndpoint) : NETWORKS[network].ws;
237237
const [connection, setConnection] = useState('idle'); // idle | ok | fail
238+
const [consoleActive, setConsoleActive] = useState(false); // true once the user engages the console; gates the connectivity ping so a page view alone doesn't hit the RPC
238239

239240
const [searchTerm, setSearchTerm] = useState('');
240241
const [selectedNamespace, setSelectedNamespace] = useState('all');
@@ -292,7 +293,7 @@ const isMutation = (name) => name === 'eth_sendRawTransaction' || name === 'eth_
292293
}
293294
}, [endpoint]);
294295

295-
useEffect(() => { validateEndpoint(); }, [validateEndpoint]);
296+
useEffect(() => { if (consoleActive) validateEndpoint(); }, [validateEndpoint, consoleActive]);
296297

297298
const allMethods = useMemo(() => SEI_RPC_METHODS.map((m) => ({ ...m, meta: NAMESPACE_META[m.namespace] || { label: m.namespace, color: '#6b7280' } })), []);
298299

@@ -321,6 +322,7 @@ const isMutation = (name) => name === 'eth_sendRawTransaction' || name === 'eth_
321322
const counts = useMemo(() => allMethods.reduce((a, m) => ((a[m.status] = (a[m.status] || 0) + 1), a), {}), [allMethods]);
322323

323324
const selectMethod = (m) => {
325+
setConsoleActive(true);
324326
setSelectedMethod(m);
325327
setParamValues({});
326328
// Clear synchronously so examples don't reuse the previous method's values.
@@ -490,15 +492,17 @@ const isMutation = (name) => name === 'eth_sendRawTransaction' || name === 'eth_
490492
'import java.net.URI',
491493
'import java.net.http.*',
492494
'import java.util.concurrent.CompletableFuture',
495+
'import java.util.concurrent.CompletionStage',
493496
'',
494497
'val done = CompletableFuture<Void>()',
495498
'HttpClient.newHttpClient().newWebSocketBuilder()',
496499
` .buildAsync(URI.create("${ws}"), object : WebSocket.Listener {`,
497500
' override fun onOpen(ws: WebSocket) {',
498501
` ws.sendText("${csBody}", true); ws.request(1)`,
499502
' }',
500-
' override fun onText(ws: WebSocket, data: CharSequence, last: Boolean) =',
501-
' run { println(data); done.complete(null); null }',
503+
' override fun onText(ws: WebSocket, data: CharSequence, last: Boolean): CompletionStage<*>? {',
504+
' println(data); done.complete(null); ws.request(1); return null',
505+
' }',
502506
' }).join()',
503507
'done.join()',
504508
].join('\n');
@@ -939,14 +943,16 @@ const isMutation = (name) => name === 'eth_sendRawTransaction' || name === 'eth_
939943
{m.params.map((p) => {
940944
const ex = p.example || '';
941945
const big = ex.trim().startsWith('{') || ex.trim().startsWith('[') || (p.type || '').toLowerCase().includes('object');
946+
const fieldId = `rpc-param-${p.name}`;
942947
const field = {
948+
id: fieldId,
943949
value: paramValues[p.name] !== undefined ? paramValues[p.name] : '',
944950
onChange: (e) => setParamValues((prev) => ({ ...prev, [p.name]: e.target.value })),
945951
placeholder: ex,
946952
};
947953
return (
948954
<div key={p.name}>
949-
<label style={{ fontSize: 11, color: c.faint, fontFamily: mono, display: 'block', marginBottom: 3 }}>{p.name}</label>
955+
<label htmlFor={fieldId} style={{ fontSize: 11, color: c.faint, fontFamily: mono, display: 'block', marginBottom: 3 }}>{p.name}</label>
950956
{big
951957
? <textarea rows={2} {...field} style={{ ...fieldStyle, resize: 'vertical' }} />
952958
: <input {...field} style={fieldStyle} />}

0 commit comments

Comments
 (0)