* Add mapping * Basic modal with gas price * Fetch gas price from etherscan * Only 4 decimals * Make /gas a page * Create gas endpoint * Show USD value * Built switch * Linting * Make ETH the default * Prettier pls * Fix styles * Fix corner * Border color change * Add useGas query * Add defaults * Fetch data only once * Use try/catch and promise.all * Consistent naming * Move default inside parenthesis * Use parenthesis * Prettier pls * Add undefined to possible type * Fix error status * Add key directly to query * Add links to portal * Add tooltips * Add disclaimer * Add ethereum badge * Add external link icon * Make Switch smaller * Use semantic borderColor
15 lines
261 B
TypeScript
15 lines
261 B
TypeScript
import { useQuery } from "react-query";
|
|
|
|
export function useGas() {
|
|
return useQuery(
|
|
["gas-price", "ethereum"],
|
|
async () => {
|
|
const res = await fetch(`/api/gas`);
|
|
return res.json();
|
|
},
|
|
{
|
|
refetchInterval: 10000,
|
|
},
|
|
);
|
|
}
|