hoodquidity/apps/web/src/hooks/useChainStats.ts
Денис Зефиров dba2811447 Hoodquidity: liquidity campaigns for Robinhood Chain stock token markets
Full build: Vite/React acid-terminal frontend (BEARER design system,
Panchang/Sentient/Fragment Mono, neon layer, palette audit script),
HoodquidityVaults Foundry contracts (single+dual deposits via Chainlink-style
feeds, hybrid exit, 10% platform fee, boost, Genesis LP), Reown AppKit wallet
connect with Robinhood Chain testnet (46630), live data from Dexscreener and
onchain reads, partner portal, design-sync setup for claude.ai/design.

Deploy: static via Forgejo Actions platform, BUILD_DIR=apps/web/dist (.env).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 08:32:28 +04:00

27 lines
752 B
TypeScript

import { useQuery } from "@tanstack/react-query";
import { createPublicClient, http, formatGwei } from "viem";
import { mainnet } from "viem/chains";
import { STATS_RPC_URL } from "@/lib/chain";
const statsClient = createPublicClient({
chain: mainnet,
transport: http(STATS_RPC_URL),
});
/** Live L1 stats shown in the status strip. */
export function useChainStats() {
return useQuery({
queryKey: ["chain-stats"],
queryFn: async () => {
const [blockNumber, gasPrice] = await Promise.all([
statsClient.getBlockNumber(),
statsClient.getGasPrice(),
]);
return {
blockNumber: Number(blockNumber),
gasGwei: Number(formatGwei(gasPrice)),
};
},
refetchInterval: 15_000,
});
}