@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
- Next.js app router
- Vite / CRA
TypeScript
TypeScript
Read-only mode
UsereadonlyWallet 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
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
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.), thecypher-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
- Query hooks - fetch markets, positions, global state
- Mutation hooks - place bets, claim, resolve