Skip to main content

Constants

TypeScript
import {
  PROGRAM_ID,
  MIN_BET_USDC,
  MIN_CREATOR_BOND,
  ODDS_SCALE,
  // ...
} from "@cypher-zk/sdk";
ConstantValueDescription
PROGRAM_IDPublicKeyCypher program ID (sourced from synced IDL)
MIN_BET_USDC1_000_000nMinimum bet - $1.00 USDC
MIN_CREATOR_BOND20_000_000nMinimum creator bond - $20.00 USDC
ODDS_SCALE1_000_000_000nFixed-point scale for entryOdds and payoutRatio
MAX_QUESTION_BYTES200Maximum question string length in bytes
MIN_OUTCOMES_MULTI2Minimum outcomes for a MultiOutcome market
MAX_OUTCOMES_MULTI4Maximum outcomes for a MultiOutcome market
MIN_CHALLENGE_PERIOD_SECS86400Minimum challenge window - 24 hours
MAX_CHALLENGE_PERIOD_SECS172800Maximum challenge window - 48 hours
DEFAULT_RESOLUTION_WINDOW_SECS6048007 days after close time for resolver to post outcome
DEFAULT_CLAIM_PERIOD_SECS120960014 days after resolution for winners to claim
DEFAULT_REFUND_PERIOD_SECS120960014 days after resolution deadline for refunds
MAX_PROTOCOL_FEE_BPS1001% maximum protocol fee
MAX_LP_FEE_BPS5005% maximum LP fee
BPS_DENOMINATOR10_000nDenominator for basis-point fee math

Enums

MarketState

ValueNameDescription
0ActiveBetting is open
1ClosedMarket was cancelled
2ResolvedOutcome posted, payouts open
3UnresolvedResolver missed deadline, refunds open
4PendingResolutionMPC reveal ran, in challenge window
TypeScript
import { MarketState } from "@cypher-zk/sdk";

if (market.state === MarketState.Active) { /* ... */ }

MarketType

ValueNameDescription
0YesNoTwo outcomes: NO (0) and YES (1)
1MultiOutcomeTwo to four named outcomes

MarketCategory

ValueName
0Crypto
1Politics
2Sports
3Tech
4Economy
5Culture
6Beyond

PDAs

All PDA derivation helpers accept an optional programId argument for non-default deployments.
TypeScript
import {
  globalStatePda,
  marketPda,
  marketVaultPda,
  positionPda,
  userStatePda,
  lpPositionPda,
  marketQuestionPda,
  arciumSignerPda,
} from "@cypher-zk/sdk";
FunctionSeedsDescription
globalStatePda(programId?)["global_state"]Singleton protocol config
marketPda(marketId, programId?)["market", id_u64_LE]One per market ID
marketVaultPda(market, programId?)["market_vault", market]SPL token vault holding stakes
positionPda(market, user, betIndex?, programId?)["position", market, user, betIndex_u64_LE]One per bet (defaults betIndex to 0n)
userStatePda(user, programId?)["user_state", user]Per-user bet index counter
lpPositionPda(market, creator, programId?)["lp-position", market, creator]Creator bond + LP fees
marketQuestionPda(market, programId?)["market_question", market]Question text for v0.2+ markets
arciumSignerPda(programId?)["ArciumSignerAccount"]Arcium CPI authority for callbacks

Usage

TypeScript
const [marketAddress, bump] = marketPda(42n);
const [positionAddress] = positionPda(marketAddress, userPublicKey, 0n);

Known mints

Always read globalState.acceptedMint at runtime instead of hardcoding. The mint differs between devnet and mainnet.
ConstantMintNetwork
KNOWN_MINTS.devnetCSDC8AF9BABN...Devnet (Cypher Coin)
KNOWN_MINTS.mainnetUSDCEPjFWdd5...Mainnet (Circle USDC)
These are informational only. They are not used in any action path.