Skip to main content
conn.cofhe.mocks exposes Viem contract descriptors for every deployed mock contract and helpers for reading the on-chain plaintext that the mock task manager stores. None of this requires the SDK client — the mocks are reachable from any Viem publicClient / walletClient.

Contract descriptors

Each mock is exposed as a synchronous { address, abi } object — spread it directly into Viem’s readContract / writeContract:

Calling a mock directly

This is the lowest-friction way to assert mock state without going through the SDK.

Reading plaintext values

Because MockTaskManager stores plaintext values on-chain, you can read the underlying plaintext of any encrypted handle directly in tests — no permit needed.

getPlaintext(ctHash)

Returns the plaintext bigint for a given ciphertext hash. Accepts either a bigint or a hex string.

expectPlaintext(ctHash, expected)

Assertion shorthand — throws if the on-chain plaintext doesn’t match expected:
getPlaintext and expectPlaintext only work on the in-process Hardhat network where MockTaskManager.mockStorage exists. They will throw on real CoFHE networks.

Re-deploying mocks mid-test

Normally you don’t need this — mocks are deployed automatically on every network.connect(). For advanced scenarios where you want to reset mock state inside a single test: