The plugin extends every Hardhat 3 connection with aDocumentation Index
Fetch the complete documentation index at: https://fhenix-docs-hardhat-3-plugin.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
cofhe namespace. There are three ways to create and connect a CofheClient from a test, in increasing order of control.
Batteries included (recommended)
cofhe.createClientWithBatteries(walletClient?) is the one-call setup. It:
- Creates a CoFHE config with
environment: 'hardhat'. - Creates a
CofheClient. - Connects it using the wallet client you pass (or the first wallet client on the connection if you don’t).
- Generates and signs a self permit so the client can immediately decrypt encrypted values.
Because the self permit is created up-front, encrypt / decrypt / decryptForView / decryptForTx all work immediately without any additional setup.
Manual setup
For more control — custom config options, multiple signers, adjustingencryptDelay — set up the client step by step.
Create config
cofhe.createConfig wraps createCofheConfig from @cofhe/sdk/node with two Hardhat-3-specific additions:- Sets
environment: 'hardhat'automatically. - Defaults
mocks.encryptDelayto0so tests run without artificial wait times.
API summary
| Method | Returns | Description |
|---|---|---|
cofhe.createConfig(overrides?) | Promise<CofheConfig> | CoFHE config pre-wired for the Hardhat mock environment (environment: 'hardhat', mocks.encryptDelay: 0). |
cofhe.createClient(config) | CofheClient | Unconnected client. Call client.connect(publicClient, walletClient) before use. |
cofhe.createClientWithBatteries(walletClient?) | Promise<CofheClient> | Fully configured + connected + self-permit signed. Defaults to the first wallet client on the connection. |