Skip to content

Tests Fail when using hardhat-viem plugin #874

Open
@zdenham

Description

Workaround: (maintainer edit for visibility)

As of 0.8.12, viem should work with coverage if you set an environment variable before the command as below:

SOLIDITY_COVERAGE=true npx hardhat coverage

----- Original Issue -----

Using hardhat viem:

const token = await hre.viem.getContractAt(
    'MyContract',
    contractAddress,
    {
        walletClient,
    }
  );

Overriding the wallet client to test calling a contract from a different EOA doesn't seem to work properly (only when using solidity coverage)

await token.write.mint(); // does not call with the context of the `walletClient`

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions