Skip to content

@nomicfoundation/hardhat-viem@2.0.0

Compare
Choose a tag to compare
@schaable schaable released this 21 Feb 01:48
· 407 commits to main since this release

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 } }
);