fhevm-frontend

fhevm-frontend is a cursor rule for Cursor from zunmax/fhevm-skill. It costs 536 tokens per session (4,780 once invoked), scanned A, original, MIT.

A set of coding rules for building front ends for Zama FHEVM applications with React, Next.js or Vite. FHEVM lets smart contracts work with encrypted values, while the rules cover both Zama's newer high-level SDK and older low-level tools.

In plain words
What is it for?
Use it when writing TypeScript, JavaScript, React or Next.js files that import Zama FHEVM packages, encrypt user input, decrypt results, connect signers, or work with confidential tokens and contracts.
Why use it?
It helps developers choose the correct SDK and follow the required patterns when connecting a web interface to confidential blockchain contracts. It also makes the differences between the newer and legacy SDKs clear.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it when writing TypeScript, JavaScript, React or Next.js files that import Zama FHEVM packages, encrypt user input, decrypt results, connect signers, or work with confidential tokens and contracts.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/zunmax/fhevm-skill/fhevm-frontend
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/zunmax/fhevm-skill

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for fhevm-frontend

README.md
[![agentmods](https://agentmods.dev/badge/rules/zunmax/fhevm-skill/fhevm-frontend/github.svg)](https://agentmods.dev/rules/zunmax/fhevm-skill/fhevm-frontend)
Your own site
<a href="https://agentmods.dev/rules/zunmax/fhevm-skill/fhevm-frontend"><img src="https://agentmods.dev/badge/rules/zunmax/fhevm-skill/fhevm-frontend/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for fhevm-frontend

Your own site · 80×15
<a href="https://agentmods.dev/rules/zunmax/fhevm-skill/fhevm-frontend"><img src="https://agentmods.dev/badge/rules/zunmax/fhevm-skill/fhevm-frontend.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 536 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 4,780 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00536 $0.04780
Opus 5.5 $0.00214 $0.01912
Sonnet 5.5 $0.00107 $0.00956
Haiku 4.5 $0.00054 $0.00478

Measured 1mo ago against content hash b612047c9de3, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

fhevm-frontend scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/fhevm-frontend.mdc · 337 lines

How it starts

The opening of the file, as written. The whole thing — 337 lines — stays where its author put it; the contents beside it link to each section on GitHub.

FHEVM Frontend SDK Rules

SDK Choice (NEW vs LEGACY)

Two SDK families ship from npm; both are supported.

  • New high-level SDK (@zama-fhe/sdk@^3.0.0 + @zama-fhe/react-sdk@^3.0.0, node >= 22): use for confidential ERC-7984 dApps. Provides ZamaSDK orchestrator, Token API (shield / unshield / confidentialTransfer / balanceOf), session model with one-signature decrypt unlock, RelayerWeb / RelayerNode / RelayerCleartext, signer adapters (ViemSigner / EthersSigner / WagmiSigner), storage adapters, delegated decryption, activity feeds, 59 React hooks. Detail in .cursor/references/zama-sdk-overview.md and the other zama-sdk-*.md files.
  • Legacy primitive SDK (@zama-fhe/[email protected] exact): use for raw createInstance / createEncryptedInput / createEIP712 against custom non-ERC-7984 confidential contracts (voting, sealed auctions). Still required as a transitive install for the contract toolchain. This file's lower sections cover its surface.

Encrypt + Decrypt Quick Reference (new SDK)

/* Encrypt user input (browser, React) - "use client" required in Next.js */
import { useEncrypt } from "@zama-fhe/react-sdk";
const { mutateAsync: encrypt } = useEncrypt();
const { handles, inputProof } = await encrypt({
  values: [{ value: 1000n, type: "euint64" }],
  contractAddress, userAddress,
});

/* Decrypt confidential token balance - one EIP-712 prompt, then silent. Returns bigint. */
const balance = await token.balanceOf();
const handle  = await token.confidentialBalanceOf();   /* raw bytes32 handle */
import { useConfidentialBalance } from "@zama-fhe/react-sdk";
const { data } = useConfidentialBalance({ tokenAddress: cUSDT });

/* Decrypt arbitrary handles (custom contract) */
await sdk.allow([contract.address]);
const values = await sdk.userDecrypt([{ handle, contractAddress: contract.address }]);
const cleartext = values[handle];   /* bare Record */

/* Public decrypt (3-step bound flow) */
import { usePublicDecrypt } from "@zama-fhe/react-sdk";
const { mutateAsync: publicDecrypt } = usePublicDecrypt();
const { clearValues } = await publicDecrypt({ handles: [handle] });

Read the full file on GitHub · 337 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 337 lines · 536 tokens per session scan A b612047c9de3

Subscribe to this mod's changes

fhevm-frontend is a cursor rule published in the GitHub repository zunmax/fhevm-skill (2 stars, last pushed 4mo ago), licensed MIT. It adds 536 tokens to every session and 4,780 once invoked, about $0.0021 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.