Extended Hardhat toolbox for viem
- Install
bun add @ensdomains/hardhat-toolbox-viem-extended hardhat @nomicfoundation/hardhat-viem hardhat-deploy
-
Apply type-extensions patch for
@nomicfoundation/hardhat-viem
-
Import into hardhat config
import "@ensdomains/hardhat-toolbox-viem-extended";
- (optional) Register your config
const config = {
/* Your config here */
} satisfies HardhatUserConfig;
declare module "@nomicfoundation/hardhat-viem/types.js" {
interface Register {
config: typeof config;
}
}
Registering your config currently enables:
- Typed
getNamedClients()
command
Main deploy function.
Parameters:
contractName
: Name of the contractargs
: Argument array for contract constructoroptions
: Options inherited from@nomicfoundation/hardhat-viem
Returns: DeployResult
Gets contract, or if none available returns null.
Parameters:
contractName
: Name of the contractclient
: (optional) Keyed client to use
Returns: GetContractReturnType | null
Gets contract, or if none available throws error.
Parameters:
contractName
: Name of the contractclient
: (optional) Keyed client to use
Returns: GetContractReturnType
Waits for a transaction receipt, and throws error if the transaction reverted.
Parameters:
hash
: Transaction hash
Returns: WaitForTransactionReceiptReturnType
Gets named accounts as wallet clients, from values defined in config.
Returns: { [key: string]: Client }
Gets all unnamed accounts as wallet clients.
Returns: Client[]