Last updated
import { useGetGasPrice } from "@cometh/connect-react-hooks";
import { formatEther } from "viem";
export const GasPriceDisplay = () => {
const { data: gasPrice, isLoading, error } = useGetGasPrice();
if (isLoading) return <p>Loading gas prices...</p>;
if (error) return <p>Error fetching gas prices: {error.message}</p>;
return (
<div>
<h2>Current Gas Prices</h2>
<p>Max Fee Per Gas: {formatEther(gasPrice.maxFeePerGas)} ETH</p>
<p>Max Priority Fee Per Gas: {formatEther(gasPrice.maxPriorityFeePerGas)} ETH</p>
</div>
);
};