Hi there, I was able to retrieve gasPrice using the code given below in the hardhat console, however, the returned value is for Ethereum network when I actually specified the network to be bsctestnet. Wondering how I can get gasPrice for bsctestnet instead of ethereum.

Jun 10, 2021, 2:54 AM
var providers = ethers.providers;
var provider = providers.getDefaultProvider();
provider.getGasPrice().then(function(gasPrice) {
gasPriceString = gasPrice.toString();
console.log("Current gas price: " + gasPriceString);
});
I could tell it's the number from Ethereum, because await provider.getBlockNumber(); returns a number close to 12604172 which is the block height of Ethereum mainnet.
Jun 10, 2021, 2:55 AM

© 2024 Draquery.com All rights reserved.