@azuro-org/sdk
Version:
One-stop solution for building betting dApps on the Azuro Protocol.
53 lines (52 loc) • 2.23 kB
TypeScript
import { type ChainId, OrderDirection, GameOrderBy, type GetGamesByFiltersResult } from '@azuro-org/toolkit';
import { type UseQueryResult } from '@tanstack/react-query';
import { type SportHub, type QueryParameterWithSelect } from '../../global';
export type UseGamesQueryFnData = GetGamesByFiltersResult;
export type UseGamesProps<TData = UseGamesQueryFnData> = {
filter?: {
sportHub?: SportHub;
sportSlug?: string;
sportIds?: Array<string | number>;
leagueSlug?: string;
};
/** page number (1-based), default: 1 */
page?: number;
/** items per page, default: 100 */
perPage?: number;
orderBy?: GameOrderBy;
orderDir?: OrderDirection;
isLive?: boolean;
chainId?: ChainId;
query?: QueryParameterWithSelect<UseGamesQueryFnData, TData>;
};
export type GetUseGamesQueryOptionsProps<TData = UseGamesQueryFnData> = UseGamesProps<TData> & {
chainId: ChainId;
};
export declare const getUseGamesQueryOptions: <TData = UseGamesQueryFnData>(params: GetUseGamesQueryOptionsProps<TData>) => import("@tanstack/query-core").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("@azuro-org/toolkit").PaginatedGamesResponse, Error, TData, readonly unknown[]>, "queryFn"> & {
queryFn?: import("@tanstack/query-core").QueryFunction<import("@azuro-org/toolkit").PaginatedGamesResponse, readonly unknown[], never> | undefined;
} & {
queryKey: readonly unknown[] & {
[dataTagSymbol]: import("@azuro-org/toolkit").PaginatedGamesResponse;
[dataTagErrorSymbol]: Error;
};
};
/**
* Fetches a list of games with optional filtering and sorting.
* Supports filtering by sport, league, game state (live/prematch), and more.
*
* Use `isLive` prop to switch between live and prematch games.
*
* - Docs: https://gem.azuro.org/hub/apps/sdk/data-hooks/useGames
*
* @example
* import { useGames } from '@azuro-org/sdk'
*
* const { data, isLoading } = useGames({
* filter: { sportSlug: 'football' },
* perPage: 50,
* isLive: false
* })
*
* const { games, page, total, totalPages } = data || {}
* */
export declare const useGames: <TData = UseGamesQueryFnData>(props?: UseGamesProps<TData>) => UseQueryResult<TData>;