Connect provider to hardhat built-in network #3076
-
I know I can use localhost with If I do this: const provider = new ethers.providers.JsonRpcProvider();
const deployer = new ethers.Wallet(
process.env.ADMIN_PRIVATE_KEY!,
provider
);
console.log(provider.connection);
console.log(await deployer.getBalance()); |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
This is not possible because the in-process network doesn't open an HTTP connection. So your options are:
|
Beta Was this translation helpful? Give feedback.
This is not possible because the in-process network doesn't open an HTTP connection. So your options are:
ethers.provider
from thehardhat-ethers
pluginnetwork.provider
withethers.Web3Provider
.network.provider
is an EIP-1193 provider so you can pass it to that ethers's provider.