Skip to main content
The React integration lives in @cypher-zk/sdk/react. It wraps a CypherClient instance in context so every component can call hooks without passing the client around manually.

Install dependencies

Set up the provider

TypeScript
Add to your root layout:
TypeScript

Read-only mode

Use readonlyWallet when the user isn’t connected yet. It lets fetch hooks run without a signer. Mutation hooks throw a ReadonlyWalletError (with code === "READONLY_WALLET") so the UI can detect the case and show a “connect wallet” prompt instead of a generic error.
TypeScript
See Errors → ReadonlyWalletError for the full type and handling pattern.

Tuning RPC throughput

The SDK batches every bulk read (client.markets.byIds, client.marketQuestions.fetchMany, useMarketQuestions, …) into chunks of ≤100 pubkeys with bounded concurrency and exponential-backoff retries. Defaults are conservative enough for free-tier RPCs. On a paid plan (Helius, Triton) you can raise concurrency for snappier list views:
TypeScript
See CypherClientOptions.rpcOptions for the full shape.

Access the client directly

Inside any component, useCypherClient() returns the client from context:
TypeScript
useCypherClient() throws if called outside <CypherProvider>. Make sure the hook is inside the provider tree.

Building with AI

If you use an AI coding agent (Claude, Cursor, etc.), the cypher-skill gives it deep context about the SDK - provider wiring, hook patterns, encryption flows, and common pitfalls.

Add cypher-skill to your project - covers CypherProvider setup, all React hooks, onProgress patterns, x25519 secret persistence, and market phase gating.

What’s next