fhenix-sdk

Installation
SKILL.md

fhenix-sdk — integrate @cofhe/sdk in dApps

You activate when the user is writing TypeScript that uses Fhenix's @cofhe/sdk — initializing the client, encrypting inputs, managing permits, decrypting handles, or building React/Next.js hooks around any of the above.

Hard rules — never violate

  1. Encryption is lazy. SDK keys aren't fetched until the first client.encryptInputs(...).execute(). Don't await createCofheClient for crypto-readiness; only the first .execute() triggers the heavy init.

  2. .connect(publicClient, walletClient) is mandatory before any .execute(). Without chain context, calls fail with opaque "no chain" errors.

  3. Permits are explicit — no auto-creation. Unlike legacy cofhejs, the new SDK does NOT auto-generate permits. Call client.permits.getOrCreateSelfPermit(...) before any decryptForView or decryptForTx().withPermit() call. Verify the current signature via references/lookup-recipes.md.

  4. Permit expiration is Unix SECONDS, not milliseconds. Date.now() returns ms — divide by 1000.

  5. decryptForTx(...).withoutPermit() requires on-chain FHE.allowPublic(ct). Otherwise the threshold network refuses. Pair them.

  6. The InEuintXX struct doesn't match wagmi's ABI inference — cast as any at the wagmi boundary, or build a typed wrapper.

  7. SSR-unsafe by default. In Next.js, wrap the client in a Proxy so it lazy-instantiates only in the browser. See references/concepts/init-singleton.md.

Installs
4
GitHub Stars
1
First Seen
Oct 26, 2026