@cypher-zk/sdk is the official TypeScript library for interacting with the Cyphers prediction market protocol on Solana. It wraps every on-chain instruction in a strongly-typed API, ships pre-built React hooks backed by TanStack Query, and exposes Arcium MPC encryption helpers so your users’ bet amounts and sides remain private end-to-end.
The package is split into three import paths to keep bundle sizes lean. Most frontend applications only need the main entry point and the React subpath.
Installation
Install the SDK and its required peer dependencies:Import subpaths
The package exposes three named subpaths. Import only what your environment needs.| Subpath | What it provides | Use in |
|---|---|---|
@cypher-zk/sdk | CypherClient, types, constants, PDA helpers, utilities | Any JS/TS environment |
@cypher-zk/sdk/react | CypherProvider, all React hooks, query-key factories | Browser / React apps |
@cypher-zk/sdk/node | Reserved for future Node-only admin utilities | Do not import in browser code |
Quick start
The minimal setup for a React application - create the client once and share it through the provider:useMarkets() or usePlaceBet(). See the React Hooks reference for a complete list.
What the SDK covers
CypherClient
The core client class. Exposes namespaced fetch methods, raw instruction builders, and high-level action helpers. Start here.
React Hooks
Fourteen hooks for reading market state and submitting transactions, all backed by TanStack Query with automatic cache invalidation.
Actions
High-level action functions -
createMarket, placeBet, resolveMarket, claimPayout, and more. Each returns a progress-emitting promise.Utilities
Fee calculators, market-phase helpers, question label parsers, Arcium encryption functions, and on-chain event parsers.
Key constants
A selection of the most commonly referenced constants exported from@cypher-zk/sdk:
| Constant | Value | Description |
|---|---|---|
PROGRAM_ID | cyphPe923…oh2B | Deployed Cyphers program address |
MIN_BET_USDC | 1_000_000n | Minimum bet ($1 USDC, 6 decimals) |
MIN_CREATOR_BOND | 20_000_000n | Minimum market creation bond ($20 USDC) |
ODDS_SCALE | 1_000_000_000n | Fixed-point scale for odds values (1e9) |
MAX_PROTOCOL_FEE_BPS | 100 | Maximum protocol fee (1%) |
MAX_LP_FEE_BPS | 500 | Maximum LP fee (5%) |
DEFAULT_RESOLUTION_WINDOW_SECS | 604_800 | Default resolution window (7 days) |
