useEstimateGasCost

A hook to estimate the gas cost in ether and wei for a given transaction.

Example

import { useEstimateGasCost } from "thirdweb/react";
const { mutate: estimateGasCost, data: gasEstimate } =
useEstimateGas();
// later
const estimatedGas = await estimateGasCost(tx);
console.log("gas cost in ether", estimatedGas.ether);
function useEstimateGasCost(): UseMutationResult<
Error,
>;

Returns

let returnType: UseMutationResult<
Error,
>;

A mutation object to estimate gas cost.