CypherClient is the SDK entrypoint. Construction is cheap and synchronous - no RPC calls until you call a method.
TypeScript
Constructor options
A
@solana/web3.js Connection pointed at your target cluster. Pin @solana/web3.js to ^1.95.4 - the SDK is not compatible with v2 or @solana/kit.An Anchor-compatible wallet. Use
keypairToWallet(keypair) for scripts, or pass a browser wallet adapter directly (they already implement the Wallet interface). Use readonlyWallet(pubkey) when the user is not connected.Cluster preset for Arcium-specific configuration. If omitted, the SDK infers from the connection’s RPC URL. Pass a full
ClusterConfig to override the RPC, Arcium cluster offset, or expected mint.Commitment used by the underlying Anchor provider. Defaults to
"confirmed".Override the program ID. Only needed for local redeployments with a fresh keypair. Defaults to the ID from the synced IDL.
The SPL token program owning the accepted mint. Defaults to auto-detection on the first
globalState.fetch(). Pass TOKEN_2022_PROGRAM_ID explicitly to skip the detection RPC call.Extra options forwarded to the Anchor provider (e.g.,
skipPreflight).Namespaces
CypherClient exposes high-level namespaces as read-only properties.
client
actions
placeBet(inputs)
createMarket(inputs)
createMarketMulti(inputs)
cancelMarket(inputs)
withdrawCreatorFunds(inputs)
resolveMarket(inputs)
claimPayout(inputs)
claimRefund(inputs)
flagResolution(inputs)
finalizeResolution(inputs)
adminOverrideResolution(inputs)
markets
positions
globalState
lpPositions
marketQuestions
events
client.actions
High-level action helpers. Each orchestrates a full flow: validate → encrypt (if needed) → build instructions → send transaction → await Arcium callback → refetch.
client.markets
Account fetch helpers for MarketAccount.
| Method | Description |
|---|---|
fetch(marketId) | Fetch by numeric ID |
fetchByPda(pda) | Fetch by public key |
all() | All markets |
byCreator(creator) | Filter by creator |
byState(state) | Filter by state enum value |
client.positions
Account fetch helpers for EncryptedPositionAccount.
| Method | Description |
|---|---|
fetch(market, user, betIndex?) | Single position (defaults betIndex to 0n) |
byUser(user) | All positions across all markets |
forMarket(market) | All positions on a single market |
client.globalState
| Method | Description |
|---|---|
fetch(opts?) | Fetch singleton GlobalState (cached per client instance) |
invalidate() | Clear cache; next fetch() hits RPC |
{ refresh: true } to bypass the cache: client.globalState.fetch({ refresh: true }).
client.lpPositions
| Method | Description |
|---|---|
fetch(market, creator) | LP position for a market/creator pair |
byProvider(provider) | All LP positions for a creator |
client.marketQuestions
| Method | Description |
|---|---|
fetch(market) | Fetch the MarketQuestion PDA for a market (v0.2+ markets only) |
client.events
| Method | Description |
|---|---|
subscribeAll(callback, opts?) | WebSocket subscription to all events |
subscribe(name, callback, opts?) | Typed subscription to a single event name |
onMarketCreated(callback, opts?) | Convenience typed listener |
onBetPlaced(callback, opts?) | Convenience typed listener |
onMarketResolved(callback, opts?) | Convenience typed listener |
onMarketCancelled(callback, opts?) | Convenience typed listener |
onCreatorWithdrawn(callback, opts?) | Convenience typed listener |
onPayoutClaimed(callback, opts?) | Convenience typed listener |
onRefundClaimed(callback, opts?) | Convenience typed listener |
pollEvents(opts?) | Poll-based event fetch (no WebSocket required) |
parseLogs(logs) | Parse raw transaction log strings into typed events |
Wallet helpers
keypairToWallet
Wraps aKeypair as an Anchor-compatible Wallet. Use this for Node scripts, tests, and CLIs.
TypeScript
readonlyWallet
Creates a wallet that can sign nothing - only fetch operations work. CallingsignTransaction or signAllTransactions throws. Use it before the user connects their browser wallet.
TypeScript