diff --git a/src/components/RpcTable.tsx b/src/components/RpcTable.tsx index ea2faaccd..daf1d2418 100644 --- a/src/components/RpcTable.tsx +++ b/src/components/RpcTable.tsx @@ -1,6 +1,7 @@ import React, { useContext, useEffect, useState } from "react"; import { Button, + Skeleton, Table, TableContainer, Tbody, @@ -19,8 +20,8 @@ async function checkRpc(chainId: number, rpc: string) { const provider = new JsonRpcProvider(rpc, chainId, { staticNetwork: true }); const blockNumber = await provider.getBlockNumber(); return { blockNumber, latency: Date.now() - now }; - } catch { - return null; + } catch (error) { + return { error }; } } @@ -63,12 +64,24 @@ export const RpcTable = ({ - {mergedRpcs.map(({ rpcUrl, blockNumber, latency }) => { + {mergedRpcs.map(({ rpcUrl, blockNumber, latency, error }) => { return ( {rpcUrl} - {blockNumber ?? "?"} - {latency ?? "?"} ms + + {blockNumber || error ? ( + blockNumber ?? "Unavailable" + ) : ( + + )} + + + {latency || error ? ( + <>{latency ?? "?"} ms + ) : ( + + )} + {!isConnected ? (