From b67665283f29a7c9ae1a462cdb72ed4f180c09fc Mon Sep 17 00:00:00 2001 From: gozzy Date: Fri, 2 Dec 2022 08:16:35 +0000 Subject: [PATCH] oracle legacy flag & improve fallback pricing --- cli.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cli.js b/cli.js index adce12a..3df6892 100755 --- a/cli.js +++ b/cli.js @@ -706,17 +706,18 @@ async function fetchGasPrice() { } // Bump fees for Ethereum network try { + const isLegacy = true const oracle = new GasPriceOracle(options); - const gas = await oracle.gasPrices(); - + const gas = await oracle.gasPrices({ isLegacy }); + if (netId === 1) { return gasPricesETH(gas.instant); } else { return gasPrices(gas.instant) } } catch(e) { - const web3GasPrice = await web3.eth.getGasPrice(); - return web3GasPrice; + const wei = await web3.eth.getGasPrice(); + return wei / web3.utils.unitMap.gwei; } } catch (err) { throw new Error(`Method fetchGasPrice has error ${err.message}`);