@azuro-org/toolkit
Version:
This framework-agnostic package provides essential utilities for building applications on the Azuro Protocol.
47 lines (46 loc) • 1.44 kB
TypeScript
import type { Address } from 'viem';
import type { BetOrderData } from './types';
import { type BetOrderState, type BetOrderResult } from '../../global';
import { type ChainId } from '../../config';
export type GetBetsByBettorParams = {
chainId: ChainId;
bettor: Address;
affiliate?: Address;
result?: BetOrderResult | BetOrderResult[];
state?: BetOrderState | BetOrderState[];
isRedeemed?: boolean;
offset?: number;
/** default: 100 */
limit?: number;
};
export type GetBetsByBettorResponse = {
orders: BetOrderData[];
};
export type GetBetsByBettorResult = (BetOrderData & {
lpAddress: Address;
})[] | null;
/**
* Retrieves all bet orders for a specific bettor address with optional filtering.
* Supports pagination and filtering by state, result, affiliate, and redemption status.
*
* - Docs: https://gem.azuro.org/hub/apps/toolkit/bet/getBetsByBettor
*
* @example
* import { getBetsByBettor } from '@azuro-org/toolkit'
*
* const chainId = 137
* const bettor = '0x...'
*
* // Get all bets
* const allBets = await getBetsByBettor({ chainId, bettor })
*
* // Get only redeemable bets
* const redeemableBets = await getBetsByBettor({
* chainId,
* bettor,
* result: [BetOrderResult.Won, BetOrderResult.Canceled],
* isRedeemed: false,
* limit: 1000,
* })
* */
export declare const getBetsByBettor: (props: GetBetsByBettorParams) => Promise<GetBetsByBettorResult>;