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

14 lines (11 loc) 521 B
import invariant from 'tiny-invariant'; import { useLidoSWR } from './useLidoSWR.js'; const useContractSWR = (props) => { const { shouldFetch = true, params = [], contract, method, config } = props; invariant(contract != null, 'Contract is required'); invariant(method != null, 'Method is required'); return useLidoSWR(shouldFetch ? [contract, method, ...params] : null, (contract, method, ...params) => { return contract[method](...params); }, config); }; export { useContractSWR };