@@ -13,50 +13,52 @@ import { Popover, PopoverDisclosure, usePopoverStore } from "@ariakit/react/popo
13
13
import { useQuery } from "@tanstack/react-query" ;
14
14
15
15
// Test functions for trace and archive support
16
+
16
17
const testTraceSupport = async ( rpcUrl ) => {
17
- const payload = {
18
+ // Test trace support (with fake tx hash)
19
+ const tracePayload = {
18
20
jsonrpc : "2.0" ,
19
21
method : "debug_traceTransaction" ,
20
- params : [
21
- "0x5a5efc6dd80fd85b291d0c2f79a1c88f2cb36aa9e5bd1951972e8b4cf5d9b17b"
22
- ] ,
22
+ params : [ "0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef" , { } ] ,
23
23
id : 1 ,
24
24
} ;
25
25
26
26
try {
27
- const response = await fetch ( rpcUrl , {
27
+
28
+ const traceRes = await fetch ( rpcUrl , {
28
29
method : "POST" ,
29
30
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" ;
32
36
33
- const data = await response . json ( ) ;
34
- return data . result ? "supported" : "not-supported" ;
35
37
} catch ( error ) {
36
38
return "error" ;
37
39
}
38
40
} ;
39
41
40
42
const testArchiveSupport = async ( rpcUrl ) => {
41
- const payload = {
43
+ // Test archive support
44
+ const archivePayload = {
42
45
jsonrpc : "2.0" ,
43
46
method : "eth_getBalance" ,
44
- params : [
45
- "0x742d35Cc6634C0532925a3b844Bc454e4438f44e" ,
46
- "0x0"
47
- ] ,
47
+ params : [ "0x0000000000000000000000000000000000000000" , "0x1" ] ,
48
48
id : 1 ,
49
49
} ;
50
50
51
51
try {
52
- const response = await fetch ( rpcUrl , {
52
+
53
+ const archiveRes = await fetch ( rpcUrl , {
53
54
method : "POST" ,
54
55
headers : { "Content-Type" : "application/json" } ,
55
- body : JSON . stringify ( payload ) ,
56
- } ) ;
56
+ body : JSON . stringify ( archivePayload ) ,
57
+ } ) . then ( r => r . json ( ) ) ;
57
58
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
+
60
62
} catch ( error ) {
61
63
return "error" ;
62
64
}
0 commit comments