You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm running multiple hardhat nodes in different ports like: 0.0.0.0:8545, ...:8546, ...
My scripts is something like this and I use it in a nestjs project
import * as hre from 'hardhat';
async execute(port: number, from: string, to: string, txData: any) {
// const provider = new hre.ethers.JsonRpcProvider(`http://0.0.00:${port}`);
// change hre.ethers.provider => provider
const sender = await hre.ethers.getImpersonatedSigner(from);
const txData = {
to: to,
data: txData,
};
const tx = await sender.sendTransaction(txData);
}
Type 'JsonRpcProvider' is missing the following properties from type 'HardhatEthersProvider': _hardhatProvider, _networkName, _isHardhatNetworkCached, _latestBlockNumberPolled, and 25 more
My issue is: I can't change hre.ethers.provider to my custom provider, it always point to the default network came from hardhat config is localhost1. Is there anyway to set provider for hre?
I know we can change provider of sender by sender.connect(provider), but hre.ethers.getImpersonatedSigner still point to localhost1 and I will get error unknown account. I want to change provider inside hre.
Search terms
No response
The text was updated successfully, but these errors were encountered:
No, that's not possible right now, and it won't be possible without a breaking change. The alternative is to manually create and use those ethers providers, as you mentioned, but that means not using any of the helpers under hre.ethers.
Describe the feature
I'm running multiple hardhat nodes in different ports like: 0.0.0.0:8545, ...:8546, ...
My scripts is something like this and I use it in a nestjs project
hardhat.config.js
I tried:
and the issue is:
My issue is: I can't change hre.ethers.provider to my custom provider, it always point to the default network came from hardhat config is localhost1. Is there anyway to set provider for hre?
I know we can change provider of sender by
sender.connect(provider)
, buthre.ethers.getImpersonatedSigner
still point to localhost1 and I will get errorunknown account
. I want to change provider inside hre.Search terms
No response
The text was updated successfully, but these errors were encountered: