@somnia-chain/markets-sdk


@somnia-chain/markets-sdk / react / useLiveBinaryOrderBookByMarket

Function: useLiveBinaryOrderBookByMarket()

useLiveBinaryOrderBookByMarket(marketId, depth?): BinaryOrderBook

Defined in: packages/sdk/src/hooks.ts:390

The locally-materialized resting book of a binary MARKET, resolved by its marketId (4-sided) — mirrors useLiveBinaryOrderBook but keyed on the market rather than the pool. Because a BinaryPool is recycled across markets, this returns an EMPTY book once the given market is no longer the pool's current binding, so a stale page never shows the successor market's orders. Watches the market's pool while mounted (once the market is known to the live store).

Background acquisition failures use the configured debug/console warning channel. Use the corresponding useWatchMarketResult/useWatchUserResult/useWatchPriceResult hook for inline error UI. The owner supplies blockNumber as an applied-event watermark. Heads alone do not advance it. Expiry remains a wall-clock projection.

Parameters

marketId

string | undefined

depth?

number = 10

Returns

BinaryOrderBook

Throws

No Markets provider is mounted.