puzzle-pieceHooks

React hooks for shielded transactions and signed reads

seismic-react provides four hooks that mirror wagmi's hook API but route through Seismic's shielded transport layer. Each hook wraps the corresponding seismic-viem client or contract method, handling encryption, signing, and decryption automatically.

Hook Comparison

seismic-react Hook
wagmi Equivalent
Purpose

useShieldedWallet

useAccount + useWalletClient

Access shielded public and wallet clients

useShieldedContract

useContract

Get a ShieldedContract instance

useShieldedWriteContract

useWriteContract

Send encrypted write transactions

useSignedReadContract

useReadContract

Execute authenticated read calls

circle-info

All hooks require ShieldedWalletProvider context. Calling any hook outside the provider tree will throw an error.

Common Patterns

Wallet check

Always verify the wallet is loaded before calling contract methods:

const { walletClient, loaded } = useShieldedWallet()

if (!loaded) return <div>Loading wallet...</div>
if (!walletClient) return <div>Please connect your wallet</div>

Loading states

The write and read hooks expose isLoading so you can disable buttons or show spinners:

Error handling

Every hook returns an error field. Check it after operations complete:

Pages

Page
Description

Access shielded wallet and public clients from context

Get a ShieldedContract instance for reads and writes

Send encrypted write transactions

Execute authenticated read calls

See Also

Last updated