Skip to main content

Install

bun add @cypher-zk/sdk @solana/web3.js
Pin @solana/web3.js to ^1.95.4. The SDK is not compatible with @solana/web3.js v2 or @solana/kit.

Import paths

The package ships three entry points. Only import what you need.
PathUse for
@cypher-zk/sdkCore client, actions, account types, utilities
@cypher-zk/sdk/reactReact hooks (usePlaceBet, useMarkets, etc.)
Never import @cypher-zk/sdk/react in a Node.js script - it pulls in React and TanStack Query which are browser-only.

Buffer polyfill (Next.js / Vite)

The SDK uses Node’s Buffer internally. In browser bundlers, Buffer is not available by default.
Create src/lib/buffer-polyfill.ts and import it at the top of your root layout:
TypeScript
// src/lib/buffer-polyfill.ts
import { Buffer } from "buffer";
if (typeof window !== "undefined") {
  window.Buffer = window.Buffer ?? Buffer;
}
TypeScript
// src/app/layout.tsx
import "@/lib/buffer-polyfill";
Then add to next.config.ts:
TypeScript
const nextConfig = {
  experimental: {
    turbo: {
      resolveAlias: {
        buffer: "buffer",
      },
    },
  },
};

What’s next

  • Quickstart - initialize the client and place your first bet
  • React setup - wire up CypherProvider in your app