SDK
Data Hooks
useGameMarkets

Wrapper over useConditions for groupping conditions by market.

Usage

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

Props

{
  gameId: string | bigint
  filter?: {
    outcomeIds?: string[]
  }
}
⚠️

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, data } = useGames()
 
const gameId = data?.games[0]?.gameId
 
const { loading, error, data } = useGame({ gameId })

Return Value

{
  loading: boolean
  error: Error | null
  data: 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[][]
}