UNPKG

@azuro-org/toolkit

Version:

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

44 lines (43 loc) 1.2 kB
import { BetStatus as GraphBetStatus } from '../../docs/bets/types'; import { BetOrderState, GameState } from '../../global'; export declare enum BetStatus { Accepted = 0, Live = 1, PendingResolution = 2, Resolved = 3, Canceled = 4, Preparing = 5, Rejected = 6 } type Game = { state: GameState; startsAt: string; }; type Props = { games: Game[]; orderState: BetOrderState | null; graphStatus: GraphBetStatus | null; }; /** * Determines the current status of a bet based on order state, on-chain status, and game states. * Returns a unified bet status that combines API order state and blockchain data. * * - Docs: https://gem.azuro.org/hub/apps/toolkit/bet/getBetStatus * * @example * import { getBetStatus, BetStatus } from '@azuro-org/toolkit' * * const games = [ * { state: GameState.Live, startsAt: '1234567890' }, * ] * const orderState = BetOrderState.Sent * const graphStatus = GraphBetStatus.Accepted * * const status = getBetStatus({ games, orderState, graphStatus }) * * if (status === BetStatus.Live) { * console.log('Bet is live!') * } * */ export declare const getBetStatus: (props: Props) => BetStatus; export {};