Developer Hub
🔮 For applications
SDK
Data Hooks
useGameMarkets

Wrapper over useConditions for groupping conditions by market.

Usage

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

Props

{
  gameId: string
  gameStatus: GameStatus // game status from `useGameStatus` hook or 'getGameStatus' function
  filter?: {
    outcomeIds?: string[]
  }
}
 
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/data'
 
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[][]
}