github NomicFoundation/hardhat hardhat@3.0.0-next.12

This Hardhat 3 Alpha release adds a new plugin, @nomicfoundation/hardhat-viem-matchers, to our Viem toolbox and Viem starter project. The plugin provides Ethereum-specific testing assertion functions that work with Viem.

The new @nomicfoundation/hardhat-viem-matchers plugin is included automatically when you install a new Viem project with hardhat —init.

Here is an example of using the balancesHaveChanged matcher:

const { viem } = await hre.network.connect();

const [bobWalletClient, aliceWalletClient] = await viem.getWalletClients();

await viem.assertions.balancesHaveChanged(
  bobWalletClient.sendTransaction({
    to: aliceWalletClient.account.address,
    value: 1000000000000000n,
  }),
  [
    {
      address: aliceWalletClient.account.address,
      amount: 1000000000000000n,
    },
  ],
);

See the README.md for reference documentation: https://github.com/NomicFoundation/hardhat/blob/v-next/v-next/hardhat-viem-matchers/README.md#reference

Changes

  • b86a3a1: Add a new Hardhat plugin providing assertion testing helpers for viem (#6574)

💡 The Nomic Foundation is hiring! Check our open positions.


Don't miss a new hardhat release

NewReleases is sending notifications on new releases.