UNPKG

@azuro-org/toolkit

Version:

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

59 lines (58 loc) 1.76 kB
import { type GameState, OrderDirection } from '../../global'; import type { ChainId } from '../../config'; import { type GameData, GameOrderBy } from './types'; export type GetSportsParams = { chainId: ChainId; gameState: GameState.Live | GameState.Prematch; sportIds?: (string | number) | (string | number)[]; sportSlug?: string; countrySlug?: string; leagueSlug?: string; /** Filter for leagues, if not set, returns all leagues */ topLeagueFilter?: 'All' | 'TopOnly' | 'NonTop'; /** Number of games per league, default and minimum: 10 */ numberOfGames?: number; orderBy?: GameOrderBy; orderDir?: OrderDirection; }; export type SportData = { id: number; slug: string; name: string; sportId: string; turnover: string; countries: { slug: string; name: string; turnover: string; leagues: { slug: string; name: string; turnover: string; isTopLeague: boolean; topWeight?: number; games: GameData[]; }[]; }[]; }; type GetSportsResponse = { sports: SportData[]; }; export type GetSportsResult = GetSportsResponse['sports']; /** * Fetches a complete sports hierarchy including countries, leagues, and games. * Returns nested structure with all games organized by sport, country, and league. * * - Docs: https://gem.azuro.org/hub/apps/toolkit/feed/getSports * * @example * import { GameState, getSports } from '@azuro-org/toolkit' * * const sports = await getSports({ * chainId: 137, * states: [GameState.Prematch, GameState.Live], * numberOfGames: 50, * }) * */ export declare const getSports: (props: GetSportsParams) => Promise<GetSportsResult>; export {};