Developer Hub
🔮 For applications
SDK
Data Hooks
useActiveMarkets

Wrapper over useActiveConditions for groupping active conditions by market.

Usage

import { useActiveMarkets } from '@azuro-org/sdk'
 
const { loading, error, markets } = useActiveMarkets(props)

Props

{
  gameId: string
  gameStatus: GameStatus // game status from `useGameStatus` hook or 'getGameStatus' function
  filter?: {
    outcomeIds?: string[]
    maxMargin?: number // max marginality
  }
  livePollInterval?: number // live conditions could be created at any time, and here, you can specify how frequently to check for new live conditions **measured in milliseconds**
}
 
enum GameStatus {
  Created,
  Live,
  Resolved,
  Canceled,
  Paused,
  PendingResolution,
}
⚠️

gameId property is not the same as id. Each game fetched using useGames hook contains the gameId:

import { useGame } from '@azuro-org/sdk'
 
const { loading, error, games } = useGames()
 
const gameId = games?.[0]?.gameId

Return Value

{
  loading: boolean
  error: Error | null
  markets: Market[]
}
type Selection = {
  conditionId: string | bigint
  outcomeId: string | bigint
}
 
type MarketOutcome = {
  selectionName: string
  odds?: number
  lpAddress: string
  coreAddress: string
  status: ConditionStatus
  gameId: string
  isExpressForbidden: boolean
} & Selection
 
type Market = {
  name: string
  description: string
  outcomeRows: MarketOutcome[][]
}