Portfolio & Decryption
View your holdings and batch-decrypt every confidential balance with a single signature.
The Portfolio shows everything you hold across the registry and lets you reveal every confidential balance with a single signature.
Batch decryption
Decrypting balances one-by-one would prompt your wallet once per token. Instead, the portfolio uses useConfidentialBalances to cover many wrappers under a single EIP-712 permit — one click, one signature, every official balance revealed.
decrypt-all.tsx
import { useConfidentialBalances } from '@zama-fhe/react-sdk';
import { formatUnits } from 'viem';
import { useState } from 'react';
function DecryptAll({ wrappers }: { wrappers: `0x${string}`[] }) {
const [decryptRequested, setDecryptRequested] = useState(false);
const { data: balances } = useConfidentialBalances({
tokenAddresses: wrappers,
enabled: decryptRequested, // one permit covers all
});
if (!decryptRequested) {
return <button onClick={() => setDecryptRequested(true)}>Decrypt All</button>;
}
return (
<ul>
{wrappers.map((w) => (
<li key={w}>{formatUnits(balances?.[w.toLowerCase()] ?? 0n, 6)}</li>
))}
</ul>
);
}Three kinds of holdings
- Official wrappers — verified registry pairs, batch-decrypted together.
- Custom wrappers — your locally-added pairs that support shield/unshield.
- Custom decrypt-only — confidential tokens with no ERC-20 underlying; each card runs its own per-row decrypt.
Session reset:the wallet menu's "Reset Decryption Session" wipes cached FHE permits app-wide. The next decrypt then prompts for a fresh wallet signature — useful if you switch accounts or want to re-arm every gate at once.
