getAvailableFreebets
Retrieves available freebets for a bettor that can be applied to specific bet selections.
Returns null if no freebets are available for the given selections.
Usage
import { getAvailableFreebets, type GetAvailableFreebetsResult } from '@azuro-org/toolkit'
const freebets: GetAvailableFreebetsResult = await getAvailableFreebets({
chainId: 137,
account: '0x...',
affiliate: '0x...',
selections: [{...}],
})Props
type GetAvailableFreebetsParams = {
chainId: ChainId
account: Address // user's address
affiliate: Address // your affiliate address
selections: Selection[]
}type Selection = {
outcomeId: string
conditionId: string
}
type ChainId =
| 100 // Gnosis
| 137 // Polygon
| 80002 // Polygon Amoy
| 88888 // Chiliz
| 88882 // Chiliz Spicy
| 8453 // Base
| 84532 // Base Sepolia
import { type Address } from 'viem'Return Value
type GetAvailableFreebetsResult = Freebet[] | nullenum 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
}
} & BonusBaseLast updated on