github NomicFoundation/hardhat @nomicfoundation/hardhat-viem@2.0.0

latest releases: hardhat@2.22.4, @nomiclabs/hardhat-solhint@3.1.0, @nomicfoundation/hardhat-viem@2.0.2...
2 months ago

This release introduces compatibility with Viem 2.

The release introduces a breaking change in the API: publicClient and walletClient have been consolidated into a single client parameter for the deployContract, sendDeploymentTransaction, and getContractAt APIs. This modification is in alignment with Viem's update to the getContract API.

For users upgrading from an earlier version of hardhat-viem, please update your code as follows:

// Deploying a contract with the updated API
const contract = await hre.viem.deployContract(
  contractName,
  constructorArgs,
- { publicClient, walletClient }
+ { client: { publicClient, walletClient } }
);

// Sending a deployment transaction with the updated API
const { contract, deploymentTransaction } = await hre.viem.sendDeploymentTransaction(
  contractName,
  constructorArgs,
- { publicClient, walletClient }
+ { client: { publicClient, walletClient } }
  );

// Accessing a contract at a specific address with the updated API
const contract = await hre.viem.getContractAt(
  contractName,
  address,
- { publicClient, walletClient }
+ { client: { publicClient, walletClient } }
);

Don't miss a new hardhat release

NewReleases is sending notifications on new releases.