Skip to Content
Developer HubSDKFreebetuseAvailableFreebets

useAvailableFreebets

The useAvailableFreebets hook returns all freebets that can be used based on the provided bet information (selections).

ℹ️

You can find more information Here.

Usage

import { useAvailableFreebets } from '@azuro-org/sdk' const { data: freebets, isFetching: isFreebetsFetching } = useAvailableFreebets({ account: '0x...', // user's address affiliate: '0x...', // your affiliate address selections: [...] })

Props

account: Address affiliate: Address selections: Selection[] chainId?: ChainId query?: QueryParameterWithSelect<UseAvailableFreebetsQueryFnData, TData>
type Selection = { outcomeId: string conditionId: string } enum BonusType { FreeBet = 'FreeBet', } enum BonusStatus { Used = 'Used', Available = 'Available', } enum FreebetType { OnlyWin = 'OnlyWin', AllWin = 'AllWin', } enum BetRestrictionType { Ordinar = 'Ordinar', Combo = 'Combo', } enum EventRestrictionState { Live = 'Live', Prematch = 'Prematch', } type BonusBase = { id: string type: BonusType, amount: string status: BonusStatus chainId: ChainId expiresAt: number usedAt: number createdAt: number } type Freebet = { type: BonusType.FreeBet params: { isBetSponsored: boolean isFeeSponsored: boolean isSponsoredBetReturnable: boolean } settings: { type: FreebetType feeSponsored: boolean betRestriction: { type: BetRestrictionType | undefined minOdds: string maxOdds: string | undefined } eventRestriction: { state: EventRestrictionState | undefined } periodOfValidityMs: number } } & BonusBase
type UseAvailableFreebetsQueryFnData = Freebet[]

Return Value

UseQueryResult<Freebet[]>
import { type UseQueryResult } from '@tanstack/react-query'

Query Options Helper

getUseAvailableFreebetsQueryOptions lets you build query options outside a component — useful for prefetching, SSR, or composing queries.

import { getUseAvailableFreebetsQueryOptions } from '@azuro-org/sdk' const options = getUseAvailableFreebetsQueryOptions({ ...props, chainId }) await queryClient.prefetchQuery(options)
type GetUseAvailableFreebetsQueryOptionsProps = UseAvailableFreebetsProps & { chainId: ChainId }
Last updated on