Hook is used for fetch the Conditions
of specific game.
Hook represents a logic wrapper over standard Apollo's useQuery
hook. Explore Apollo's docs (opens in a new tab) to understand what data the hooks return.
⚠️
The Hook should be used if useGameMarkets
doesn't suit your needs. Here (opens in a new tab) is an example demonstrating usage, employing the useGameMarkets
hook.
Usage
import { useConditions } from '@azuro-org/data'
const { loading, error, data } = useConditions(props)
const conditions = data?.conditions
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 } = useConditions({ gameId })
Return Value
{
loading: boolean
error: Error | null
data: {
conditions: Array<{
id: string
conditionId: string
status
core: {
address: string
liquidityPool: {
address: string
}
}
outcomes: Array<{
outcomeId: string
odds: string
}>
}>
}
}