While running the staging test, I faced the following issue: cannot estimate gas; the transaction may fail or may require a manual gas limit. I looked into the repo, someone already has updated the FundMe.staging.test.js and added the gasLimit while calling the withdraw function.
await fundMe.withdraw({
gasLimit: 100000,
})
This solution did not resolve the above issue, so I did some research about it and found the solution and that is to specify the gaskey/value to network inside the hardhat.config file.
The following files have been updated:
1. FundMe.staging.test.js
removed the gasLimit from the withdraw function while calling.
await fundMe.withdraw();
2. hardhat.config
added the gas key/value to rinkeby network.
networks: {
rinkeby: {
url: process.env.RPC_URL,
accounts: [process.env.PRIVATE_KEY],
chainId: 4,
blockConfirmations: 6,
gas: 6000000, // gas added here
},
},
While running the staging test, I faced the following issue: cannot estimate gas; the transaction may fail or may require a manual gas limit. I looked into the repo, someone already has updated the
FundMe.staging.test.js
and added thegasLimit
while calling thewithdraw
function.This solution did not resolve the above issue, so I did some research about it and found the solution and that is to specify the
gas
key/value
to network inside the hardhat.config file.The following files have been updated:
1. FundMe.staging.test.js
removed the gasLimit from the withdraw function while calling.
2. hardhat.config
added the gas key/value to rinkeby network.