2

I used the example from the Hardhat docs to impersonate an account on a forked network:

await hre.network.provider.request({ method: "hardhat_impersonateAccount", params: ["0x...."]} )

However, I get "Error: Returned error: unknown account". How should this be done correctly? Thanks

0

try

import { network, ethers, waffle } from "hardhat";
await network.provider.request({
      method: "hardhat_impersonateAccount",
      params: ["0x..........................."],
    });

if you use hardhat-ethers

 const signer = await ethers.provider.getSigner(
      "0x..........................."
    );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.