Skip to main content

Documentation 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.

The mock contracts emit structured logs for every FHE operation. This makes it easy to see what your contracts are doing under the hood during tests. Wraps a block of code with logging enabled and prints a labeled box around the output. The name appears as the header so you can identify which call produced which operations.
await cofhe.mocks.withLogs('counter.increment()', async () => {
  await walletClient.writeContract({
    ...counterContract,
    functionName: 'increment',
  });
});
withLogs enables logging before the closure runs and disables it after, so only operations from within that block appear in the output. The previous on/off state is restored when it returns.

enableLogs() / disableLogs() — manual

For finer-grained control, you can enable and disable logging manually:
await cofhe.mocks.enableLogs();

await walletClient.writeContract({
  ...counterContract,
  functionName: 'increment',
});

await cofhe.mocks.disableLogs();

Default behavior

Logging is controlled by the cofhe.logMocks config option (see Getting Started → Configuration). When the option is true (the default), mock-contract log events are emitted; when false, they’re suppressed even if you call enableLogs(). withLogs, enableLogs, and disableLogs only flip the runtime gate at the mock-contract level — they do not override the config.