fhenix-client-sdk-decryption-view
Installation
SKILL.md
Fhenix Client SDK — Decrypt to View
Overview
decryptForView(ctHash, utype) reveals a confidential value locally so you can show it in the UI. It always uses a permit (no .withoutPermit() mode) and does not return an on-chain-verifiable signature — for that, use decryptForTx (see fhenix-client-sdk-decryption-tx).
Flow
- Read the encrypted handle (
ctHash) from your contract (view return, event arg, or stored value). - Ensure an active permit authorizes decryption of that value.
- Call
decryptForView(ctHash, utype).execute()→ returns a UI-friendly scalar.
import { FheTypes } from '@cofhe/sdk';
await client.connect(publicClient, walletClient);
await client.permits.getOrCreateSelfPermit();