I created a forked mainnet off Ethereum mainnet using my alchemy address and created the fork using Hardhat, I was able to see the fake contracts in the forked mainnet.
I'm running the following code using Hardhat and ethers on my Visual Studio code:
//Lesson 61 - Connecting to Mainnet Fork
it("Send a transaction / swaps a Token", async () => {
//const hre = require("hardhat")
//const hre = require("hardhat");
//const assert = require("assert");
const [ownerSigner] = await ethers.providers.getSigners();
console.log(ownerSigner); //Not working..!!
});
I ran npx hardhat test and I get the following error:
Read and Write to the Blockchain ✔ connects to a provider, factory, token, and a router 1937067327436140972299 This is amount.string ✔ Gets the Price of amountsOut (2639ms) 1) Send a transaction / swaps a Token
2 passing (3s) 1 failing
- Read and Write to the Blockchain Send a transaction / swaps a Token: TypeError: ethers.providers.getSigners is not a function at Context. (C:\Users\User\flashloanTest\hardhatTest\test\sendSwapTX.js:86:58) at processImmediate (node:internal/timers:478:21)
I've been struggling with this for a day now, any ideas please? High appreciate your help.
thanks in advance.