useResolvedMarkets
The useResolvedMarkets
hook is wrapper over useConditions
. It obtains resolved conditions and groups prematch and live markets. Should be used to show game results.
Usage
import { useResolvedMarkets } from '@azuro-org/sdk'
const { data, isFetching, error } = useResolvedMarkets({ gameId: '...' })
Props
{
gameId: string
chainId?: ChainId
query?: QueryParameter<ConditionsQuery['conditions']>
}
type ChainId =
| 100 // Gnosis
| 137 // Polygon
| 80002 // Polygon Amoy
| 88888 // Chiliz
| 88882 // Chiliz Spicy
| 8453 // Base
| 84532 // Base Sepolia
Return Value
UseQueryResult<GameMarkets>
import { type UseQueryResult } from '@tanstack/react-query'
type GameMarkets = Market[]
type Market = {
marketKey: string
name: string
description: string
conditions: Condition[]
}
type Condition = {
conditionId: string
state: ConditionState
margin: string
isExpressForbidden: boolean
outcomes: MarketOutcome[]
}
type MarketOutcome = {
selectionName: string
odds: number
gameId: string
isExpressForbidden: boolean
isWon?: boolean
} & Selection
type Selection = {
conditionId: string
outcomeId: string
}