Files
js/@3rdweb-sdk/react/hooks/useGas.ts
T
Jonas Daniels c65366365e show contract name in dashboard instead "custom" when possible (#373)
* show contract name in dashboard instead "custom" when possible

* fix typescript issue
2022-08-12 15:43:40 -07:00

17 lines
363 B
TypeScript

import { useQuery } from "@tanstack/react-query";
export type GasEstimate = { gasPrice: number; ethPrice: number };
export function useGas() {
return useQuery(
["gas-price", "ethereum"],
async () => {
const res = await fetch(`/api/gas`);
return res.json() as Promise<GasEstimate>;
},
{
refetchInterval: 60_000,
},
);
}