UNPKG

@dydxfoundation/governance

Version:
15 lines (14 loc) 566 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getGasPrice = exports.estimateGas = void 0; const DEFAULT_SURPLUS = 30; // 30% const estimateGas = async (tx, config, gasSurplus) => { const estimatedGas = await config.provider.estimateGas(tx); return estimatedGas.add(estimatedGas.mul(gasSurplus || DEFAULT_SURPLUS).div(100)); }; exports.estimateGas = estimateGas; const getGasPrice = async (config) => { const gasPrice = await config.provider.getGasPrice(); return gasPrice; }; exports.getGasPrice = getGasPrice;