@@ -13,50 +13,52 @@ import { Popover, PopoverDisclosure, usePopoverStore } from "@ariakit/react/popo
1313import { useQuery } from "@tanstack/react-query" ;
1414
1515// Test functions for trace and archive support
16+
1617const testTraceSupport = async ( rpcUrl ) => {
17- const payload = {
18+ // Test trace support (with fake tx hash)
19+ const tracePayload = {
1820 jsonrpc : "2.0" ,
1921 method : "debug_traceTransaction" ,
20- params : [
21- "0x5a5efc6dd80fd85b291d0c2f79a1c88f2cb36aa9e5bd1951972e8b4cf5d9b17b"
22- ] ,
22+ params : [ "0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef" , { } ] ,
2323 id : 1 ,
2424 } ;
2525
2626 try {
27- const response = await fetch ( rpcUrl , {
27+
28+ const traceRes = await fetch ( rpcUrl , {
2829 method : "POST" ,
2930 headers : { "Content-Type" : "application/json" } ,
30- body : JSON . stringify ( payload ) ,
31- } ) ;
31+ body : JSON . stringify ( tracePayload ) ,
32+ } ) . then ( r => r . json ( ) ) ;
33+
34+ const traceSupported = ! traceRes . error ?. message . includes ( "method" || "API" ) ;
35+ return traceSupported ? "supported" : "not-supported" ;
3236
33- const data = await response . json ( ) ;
34- return data . result ? "supported" : "not-supported" ;
3537 } catch ( error ) {
3638 return "error" ;
3739 }
3840} ;
3941
4042const testArchiveSupport = async ( rpcUrl ) => {
41- const payload = {
43+ // Test archive support
44+ const archivePayload = {
4245 jsonrpc : "2.0" ,
4346 method : "eth_getBalance" ,
44- params : [
45- "0x742d35Cc6634C0532925a3b844Bc454e4438f44e" ,
46- "0x0"
47- ] ,
47+ params : [ "0x0000000000000000000000000000000000000000" , "0x1" ] ,
4848 id : 1 ,
4949 } ;
5050
5151 try {
52- const response = await fetch ( rpcUrl , {
52+
53+ const archiveRes = await fetch ( rpcUrl , {
5354 method : "POST" ,
5455 headers : { "Content-Type" : "application/json" } ,
55- body : JSON . stringify ( payload ) ,
56- } ) ;
56+ body : JSON . stringify ( archivePayload ) ,
57+ } ) . then ( r => r . json ( ) ) ;
5758
58- const data = await response . json ( ) ;
59- return data . result ? "supported" : "not-supported" ;
59+ const archiveSupported = ! ! archiveRes . result ;
60+ return archiveSupported ? "supported" : "not-supported" ;
61+
6062 } catch ( error ) {
6163 return "error" ;
6264 }
0 commit comments