Skip to Content
Developer HubSDKData HooksuseActiveConditions

useActiveConditions

The useActiveConditions hook is wrapper over useConditions for getting active conditions.

Usage

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

Props

{ gameId: string | bigint | string[] | bigint[] extended?: boolean // opt-in: include new conditions/markets not present in the dictionaries package chainId?: ChainId query?: QueryParameter<ConditionDetailedData[]> // useQuery params }
⚠️

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
ℹ️

extended — when to enable it

Optional, defaults to false. When true, the API additionally returns new-generation conditions and outcomes alongside the standard set. You can detect a new condition by its first character: conditionId[0] === '5'.

Titles are returned directly in the response. Each condition exposes title (the market name), and each outcome exposes its own title — see ConditionDetailedData.title and OutcomeData.title below. @azuro-org/toolkit and @azuro-org/sdk already handle grouping, sorting, and rendering of new markets out of the box.

  • If your app reads market/outcome metadata only from this hook’s response (no direct use of @azuro-org/dictionaries), enabling the flag is safe — new markets will appear automatically.
  • If your app reads from @azuro-org/dictionaries directly, note that new condition and outcome IDs are not in the dictionaries package — their titles live only on the API. Use the title fields returned by this hook.

If you only have a conditionId later (e.g. in a betslip, history, or activity feed) and need to fetch its market title, call getConditionsState — its ConditionStateData now exposes title for the condition and each outcome. The SDK’s useConditionsState wraps that endpoint under the hood.

Return Value

UseQueryResult<ConditionDetailedData[]>
import { type UseQueryResult } from '@tanstack/react-query' type ConditionDetailedData = { id: string conditionId: string state: ConditionState title: string // market title isExpressForbidden: boolean isPrematchEnabled: boolean isLiveEnabled: boolean hidden?: boolean margin: string outcomes: OutcomeData[] game: { gameId: string sport: { sportId: string } } wonOutcomeIds: string[] sort: `${number}` /** Modern ("5...") conditions only: used for market grouping */ marketId?: string | null marketVarietyId?: string | null } type OutcomeData = { title: string // outcome title outcomeId: string odds: string sort: `${number}` /** Modern ("5...") conditions only: numeric handicap/line value, e.g. "-2.5" / "+2.5" */ point?: string | null } enum ConditionState { Created = 'Created', Active = 'Active', Stopped = 'Stopped', Resolved = 'Resolved', Canceled = 'Canceled', Paused = 'Paused' }
Last updated on