Developer Hub
🔮 For applications
SDK
Data Hooks
useGameMarkets

Wrapper over useConditions for groupping conditions by market.

Usage

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

Props

{
  gameId: string
  gameStatus: GameStatus // game status from `useGameStatus` hook or 'getGameStatus' function
  filter?: {
    outcomeIds?: string[]
  }
  livePollInterval?: number // live conditions can 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: string
  lpAddress: string
  coreAddress: string
  status: ConditionStatus
  gameId: string | bigint
} & Selection
 
type Market = {
  name: string
  description: string
  outcomeRows: MarketOutcome[][]
}