UNPKG

@lido-sdk/react

Version:

This project is being slowly deprecated and may not receive further updates. Check out [modern Lido SDK](https://github.com/lidofinance/lido-ethereum-sdk/pulls) to access latest functionality. It is actively maintained and is built for interacting with Li

13 lines (10 loc) 509 B
import invariant from 'tiny-invariant'; import { useLidoSWR } from './useLidoSWR.js'; const useContractEstimateGasSWR = (props) => { const { shouldFetch = true, params = [], contract, method, config } = props; invariant(method != null, 'Method is required'); return useLidoSWR(shouldFetch && contract ? [contract, method, ...params] : null, (contract, method, ...params) => { return contract.estimateGas[method](...params); }, config); }; export { useContractEstimateGasSWR };