I want to be able to fork more chains (ethereum, bsc, etc.) than just one on my system.
Hardhat doc shows, how to fork 1 chain npx hardhat node --fork https://...
and it works fine.
But I would like to fork them programmatically on a Nodejs script.
When I try to fork a chain on NodeJs like below, it does not work. What can I do?
Thanks!
`hre.config.networks.networks = {
hardhat: {
forking: {
url: http://localhost:8545
},
}
}
await hre.network.provider.request({
method: "hardhat_reset",
params: [
{
forking: {
jsonRpcUrl: http://localhost:8545,
chainId: chainObj.chain_id,
blockNumber: blockNumber,
},
},
],
});
`