File tree Expand file tree Collapse file tree 1 file changed +21
-3
lines changed
apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/(chainPage)/components/client Expand file tree Collapse file tree 1 file changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -32,18 +32,21 @@ function useChainStatswithRPC(_rpcUrl: string) {
3232 method : "POST" ,
3333 body : JSON . stringify ( {
3434 jsonrpc : "2.0" ,
35- method : "eth_blockNumber " ,
36- params : [ ] ,
35+ method : "eth_getBlockByNumber " ,
36+ params : [ "latest" , false ] ,
3737 id : 1 ,
3838 } ) ,
3939 } ) ;
4040
4141 const json = await res . json ( ) ;
4242 const latency = ( performance . now ( ) - startTimeStamp ) . toFixed ( 0 ) ;
4343
44+ const blockNumber = Number . parseInt ( json . result . number , 16 ) ;
45+ const blockGasLimit = Number . parseInt ( json . result . gasLimit , 16 ) ;
4446 return {
4547 latency,
46- blockNumber : Number . parseInt ( json . result , 16 ) ,
48+ blockNumber,
49+ blockGasLimit,
4750 } ;
4851 } ,
4952 refetchInterval : ( query ) => {
@@ -115,6 +118,21 @@ export function ChainLiveStats(props: { rpc: string }) {
115118 </ div >
116119 ) }
117120 </ PrimaryInfoItem >
121+
122+ { /* Block Gas Limit */ }
123+ < PrimaryInfoItem title = "Block Gas Limit" titleIcon = { < PulseDot /> } >
124+ { stats . isError ? (
125+ < p className = "fade-in-0 animate-in text-destructive-text" > N/A</ p >
126+ ) : stats . data ? (
127+ < p className = "fade-in-0 animate-in" >
128+ { stats . data . blockGasLimit ?? "N/A" }
129+ </ p >
130+ ) : (
131+ < div className = "flex h-[28px] w-[140px] py-1" >
132+ < Skeleton className = "h-full w-full" />
133+ </ div >
134+ ) }
135+ </ PrimaryInfoItem >
118136 </ >
119137 ) ;
120138}
You can’t perform that action at this time.
0 commit comments