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?: QueryParameter<Freebet[]>
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

Return Value

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