@somnia-chain/markets-sdk / index / getMarketByPool
Function: getMarketByPool()
getMarketByPool(
pool,indexerUrl):Promise<Market|null>
Defined in: query.ts:2813
Resolve a market by its pool address (one query; no live watch), as the
discriminated Market union — null if no market rests on that pool.
For spot/perp the pool address IS the market id, but binary markets are keyed
by bytes32 marketId, so this looks them up by the poolAddress column.
RECYCLE CAVEAT (settlement-extraction v2): a binary pool serves SUCCESSIVE
markets, so several binary rows can share one poolAddress. This returns the
NEWEST (the pool's current/latest binding). To address a specific past market
of a recycled pool, key by marketId (or match nonce) instead.
Parameters
pool
string
indexerUrl
string
Returns
Promise<Market | null>