@knine-sdk/react
Version:
React helpers for Knine Finance projects. Part of Knine JS SDK
21 lines (14 loc) • 847 B
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
var invariant = require('tiny-invariant');
var useWrapperSWR = require('./useWrapperSWR.js');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var invariant__default = /*#__PURE__*/_interopDefaultLegacy(invariant);
const useContractEstimateGasSWR = (props) => {
const { shouldFetch = true, params = [], contract, method, config } = props;
invariant__default["default"](method != null, 'Method is required');
return useWrapperSWR.useWrapperSWR(shouldFetch && contract ? [contract, method, ...params] : null, (contract, method, ...params) => {
return contract.estimateGas[method](...params);
}, config);
};
exports.useContractEstimateGasSWR = useContractEstimateGasSWR;