Skip to Content

useConditions

The useConditions hook is used to fetch Conditions of a specific game.

ℹ️

Hook represents a logic wrapper over TanStack Query’s useQuery hook. Explore TanStack Query docs  to understand what data the hook returns.

Usage

import { useConditions } from '@azuro-org/sdk' const { data, isFetching, error } = useConditions(props)

Props

{ gameId: string | bigint | string[] | bigint[] // single game ID or array of game IDs onlyActiveOrStopped?: boolean // if true, returns only active or stopped conditions chainId?: ChainId query?: QueryParameter<ConditionDetailedData[]> // useQuery params }
type ChainId = | 100 // Gnosis | 137 // Polygon | 80002 // Polygon Amoy | 88888 // Chiliz | 88882 // Chiliz Spicy | 8453 // Base | 84532 // Base Sepolia
⚠️

gameId property is not the same as id. Each game fetched using useGames hook contains the gameId:

import { useGame } from '@azuro-org/sdk' const { data: games } = useGames() const gameId = games[0]?.gameId const { data } = useConditions({ gameId })

Return Value

UseQueryResult<ConditionDetailedData[]>
import { type UseQueryResult } from '@tanstack/react-query' type ConditionDetailedData = { conditionId: string gameId: string state: ConditionState outcomes: Array<{ outcomeId: string odds: string }> wonOutcomeIds?: string[] isExpressForbidden: boolean margin: string reinforcement: string virtualFund: string affiliate: string turnover: string wonOutcome?: string core: { address: string type: CoreType liquidityPoolAddress: string } } enum ConditionState { Created = 'Created', Active = 'Active', Stopped = 'Stopped', Resolved = 'Resolved', Canceled = 'Canceled', Paused = 'Paused' }
Last updated on