Retrieves all of a user's bonuses (currently limited to freebets).
ℹ️
You can find more information Here.
Usage
import { getBonuses } from '@azuro-org/toolkit'
const bonuses = await getBonuses({
chainId: 137
account: '0x...'
affiliate: '0x...'
})
Props
{
chainId: ChainId
account: Address // user's address
affiliate: Address // your affiliate address
}
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
ℹ️
Currently, the only available bonus type is freebet.
Promise<Bonus[] | null>
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 Bonus = Freebet