@azuro-org/sdk
Version:
One-stop solution for building betting dApps on the Azuro Protocol.
39 lines (38 loc) • 1.3 kB
TypeScript
import { type ChainId } from '@azuro-org/toolkit';
import { type InfiniteData, type UseInfiniteQueryResult } from '@tanstack/react-query';
import { type Address } from 'viem';
import { type Bet, BetType, type InfiniteQueryParameters } from '../../global';
type UseBetsResult = {
bets: Bet[];
nextPage: number | undefined;
};
export type UseBetsProps = {
filter: {
bettor: Address;
affiliate?: string;
type?: BetType;
};
chainId?: ChainId;
itemsPerPage?: number;
query?: InfiniteQueryParameters<UseBetsResult>;
};
export type UseBets = (props: UseBetsProps) => UseInfiniteQueryResult<InfiniteData<UseBetsResult>>;
/**
* Fetches betting history for a specific bettor with infinite scroll pagination.
* Supports filtering by bet type (Unredeemed, Accepted, Settled, CashedOut, Pending).
*
* Returns detailed bet information including outcomes, game data, odds, and settlement status.
*
* - Docs: https://gem.azuro.org/hub/apps/sdk/data-hooks/useBets
*
* @example
* import { useBets } from '@azuro-org/sdk'
*
* const { data, isFetching, hasNextPage, fetchNextPage } = useBets({
* filter: { bettor: '0x...' },
* })
*
* const allBets = data?.pages.flatMap(page => page.bets) || []
* */
export declare const useBets: UseBets;
export {};