Skip to main content
added 122 characters in body
Source Link

For anyone looking for the answer, actually for some reason even tho it IS indeed the hardhat local that is running the test in the background, .getDefaultProvider().getNetwork() shows "homestead" chainId 1, and getBalance of an address will show 0 eth...

ButSo in reality its still running the test with hardhat local.order to access provider when testing locally without a network specified, you should use ethers.provider.getBalance(xxx) and not ethers.getDefaultProvider().getBalance(xxx)

For anyone looking for the answer, actually for some reason even tho it IS indeed the hardhat local that is running the test in the background, .getDefaultProvider().getNetwork() shows "homestead" chainId 1, and getBalance of an address will show 0 eth...

But in reality its still running the test with hardhat local.

For anyone looking for the answer, actually for some reason even tho it IS indeed the hardhat local that is running the test in the background, .getDefaultProvider().getNetwork() shows "homestead" chainId 1, and getBalance of an address will show 0 eth...

So in order to access provider when testing locally without a network specified, you should use ethers.provider.getBalance(xxx) and not ethers.getDefaultProvider().getBalance(xxx)

Source Link

For anyone looking for the answer, actually for some reason even tho it IS indeed the hardhat local that is running the test in the background, .getDefaultProvider().getNetwork() shows "homestead" chainId 1, and getBalance of an address will show 0 eth...

But in reality its still running the test with hardhat local.