diff --git a/cmds/modify-l1_cmds/network-key.js b/cmds/modify-l1_cmds/network-key.js index b0992dc..c8c9b69 100644 --- a/cmds/modify-l1_cmds/network-key.js +++ b/cmds/modify-l1_cmds/network-key.js @@ -87,7 +87,7 @@ exports.handler = async function (argv) { // set gas if not provided gasPrices = await eth.fetchGasGwei(); if (argv.gas === 30000) { - argv.gas = gasPrices.safeGasPrice; + argv.gas = gasPrices.proposeGasPrice; } // Create and Send Tx diff --git a/utils/eth.js b/utils/eth.js index 9952fbc..c067b8d 100644 --- a/utils/eth.js +++ b/utils/eth.js @@ -4,6 +4,7 @@ const files = require("./files"); const { Accounts } = require("web3-eth-accounts"); const { env } = require("yargs"); const ob = require("urbit-ob"); +const sleep = (delay) => new Promise((resolve) => setTimeout(resolve, delay)); function initWeb3(argv) { if (argv.useMainnet) { @@ -117,11 +118,15 @@ async function fetchGasGwei() { const proposeGasPrice = response.data.result.ProposeGasPrice; const baseFee = response.data.result.suggestBaseFee; return { - safeGasPrice: Web3.utils.toBN(parseFloat(safeGasPrice) * 1e9).toNumber(), + safeGasPrice: Web3.utils + .toBN(Math.round(parseFloat(safeGasPrice) * 1e9)) + .toNumber(), proposeGasPrice: Web3.utils - .toBN(parseFloat(proposeGasPrice) * 1e9) + .toBN(Math.round(parseFloat(proposeGasPrice) * 1e9)) + .toNumber(), + baseFee: Web3.utils + .toBN(Math.round(parseFloat(baseFee) * 1e9)) .toNumber(), - baseFee: Web3.utils.toBN(parseFloat(baseFee) * 1e9).toNumber(), }; } catch (error) { console.error("Error fetching gas prices:", error);