{s}omniamarkets

@somnia-chain/markets-sdk


@somnia-chain/markets-sdk / index / BinaryMarket

Type Alias: BinaryMarket

BinaryMarket = BaseMarket & object

Defined in: query.ts:206

A binary (YES/NO outcome) order-book market — the binary CLOB.

Type Declaration

marketType

marketType: "BINARY"

marketId

marketId: string

bytes32 marketId (== id).

marketAddress

marketAddress: string

yesTokenId

yesTokenId: string

This market's YES/NO position ids on the ERC-6909 outcome-token singleton, as decimal strings (the indexer stores uint256 ids as strings).

noTokenId

noTokenId: string

collateral

collateral: string

asset

asset: string

question

question: string

status

status: BinaryMarketStatus

oracleQuestion

oracleQuestion: string | null

The canonical oracle question string (as registered on-chain); may differ from the display question. Null on markets indexed before this field.

oracleQuestionId?

optional oracleQuestionId?: string | null

Oracle question id the market binds to (uint256 as a decimal string, from BinaryMarketsModule.MarketCreated). null when discovered via the realtime tail or indexed before this field (filled on the next snapshot).

strike

strike: string

tradingStart

tradingStart: string

expiry

expiry: string

winningOutcome

winningOutcome: number | null

Winning outcome (0 = YES, 1 = NO) — DERIVED by the indexer from a one-hot payout vector (Oracle v2 resolves with vectors; a one-hot vector has a unique winner). Null until Resolved and on non-one-hot (void/partial) vectors — the binary-compat field, kept alongside the vector below.

payoutNumerators?

optional payoutNumerators?: string[] | null

Per-outcome payout numerators the market settled to (Oracle v2 vector resolution; uint256s as decimal strings — one-hot on a win, uniform on a void; raw Σ == payoutDenominator). Null until Resolved / on markets indexed before the vector fields existed.

payoutDenominator?

optional payoutDenominator?: string | null

Denominator the numerators are scaled against (PAYOUT_VECTOR_DENOMINATOR = 10_000_000; decimal string). Null until Resolved.

resolvedAtBlock

resolvedAtBlock: string | null

Block the market resolved at; null until Resolved.

resolvedAtTimestamp

resolvedAtTimestamp: string | null

Timestamp (unix seconds) the market resolved at; null until Resolved.

createdByTx

createdByTx: string | null

Tx hash the market was created in; null on markets indexed before this field.

creator?

optional creator?: string | null

Wallet that invoked createMarket (lowercased, from BinaryMarketsModule.MarketCreated). null when discovered via the realtime tail or indexed before this field (filled on the next snapshot).

voided

voided: boolean

backing

backing: string

nonce?

optional nonce?: string | null

The pool's market nonce this market is bound to (settlement-extraction v2). A pool serves successive markets; (poolAddress, nonce) disambiguates them and encodes the outcome ids. null on markets indexed before v2 / discovered via a live event that doesn't carry it (filled on the next snapshot).

RECYCLE CAVEAT: poolAddress is a TIME-VARYING 1:1 binding — the same pool address serves different markets over time (never concurrently). Always key a market by marketId, never by poolAddress alone; use nonce to tell which of a pool's markets a given outcome id belongs to.

finalized?

optional finalized?: boolean | null

Whether this market's backing has been finalized onto the BinarySettlement singleton (settlement-extraction v2). True once finalizeMarket swept the pool's backing over; redemption is served by settlement thereafter. null when unknown (pre-v2 / not yet snapshotted).

netBacking?

optional netBacking?: string | null

The NET collateral backing recorded on the settlement singleton after finalize (post fee-skim on resolution; gross on void), decimal string. This is the authoritative post-finalize backing: BinaryMarket.backing() reads 0 once finalized, so redemption UIs should prefer netBacking when set. null until finalize / on pre-v2 markets.

context?

optional context?: string | null

Opaque creator-supplied metadata bytes (hex, 0x-prefixed; '0x' when empty). The chain attaches no semantics — off-chain data only. Set once at creation. null on non-binary markets / markets indexed before this field existed.

intervalSec?

optional intervalSec?: string | null

Series cadence in seconds (900=15m, 3600=1h, 14400=4h, 86400=24h). DERIVED by the indexer from the market's own window (expiry − tradingStart) — a series' FIRST market is a bootstrap partial whose window is shorter than the steady-state cadence. null on SPOT / PERP.

operatorId?

optional operatorId?: number | null

Origin operator id the market was created under (from BinaryMarketsModule.MarketCreated). null when discovered via the realtime tail (filled on the next snapshot).

venueId?

optional venueId?: string | null

Origin venue id within the operator, contract-generated opaque bytes32 hex. null when discovered via the realtime tail (filled on the next snapshot — the live MarketCreator.MarketCreated event doesn't carry it).