UNPKG

@azuro-org/toolkit

Version:

This framework-agnostic package provides essential utilities for building applications on the Azuro Protocol.

78 lines (77 loc) 2.46 kB
import { type Address } from 'viem'; import { type ChainId } from '../../config'; import { BonusStatus, type BonusType, type Bonus, type FreebetType, type BetRestrictionType, type EventRestrictionState } from '../../global'; export type RawBonus = { id: string; bonusType: BonusType; freebetParam: { isBetSponsored: true; isFeeSponsored: true; isSponsoredBetReturnable: true; settings: { bonusType: FreebetType; feeSponsored: boolean; betRestriction: { betType: BetRestrictionType | 'All'; minOdds: string; maxOdds?: string; }; eventRestriction: { eventStatus: EventRestrictionState | 'All'; eventFilter?: { exclude: boolean; filter: [ { sportId: string; leagues: string[]; markets: { marketId: number; gamePeriodId: number; gameTypeId: number; }[]; } ]; }; }; periodOfValidityMs: 86400000; }; }; address: string; amount: string; status: BonusStatus; network: string; currency: string; expiresAt: string; usedAt: string; createdAt: string; publicCustomData: Record<string, string> | null; }; export type GetBonusesResult = Bonus[] | null; /** @deprecated use GetBonusesResult instead */ export type GetBonuses = Bonus[] | null; export type GetBonusesParams = { chainId: ChainId; account: Address; affiliate: Address; bonusStatus?: BonusStatus; }; /** * Fetches all bonuses for a bettor account filtered by status. * By default, retrieves only available bonuses. Returns null if no bonuses are found. * * - Docs: https://gem.azuro.org/hub/apps/toolkit/bonus/getBonuses * * @example * import { getBonuses, BonusStatus } from '@azuro-org/toolkit' * * const account = userWallet?.address * const affiliate = '0x123...' * * const bonuses = await getBonuses({ * chainId: 100, * account, * affiliate, * bonusStatus: BonusStatus.Available * }) * */ export declare const getBonuses: (props: GetBonusesParams) => Promise<GetBonusesResult>;