UNPKG

@azuro-org/sdk

Version:

One-stop solution for building betting dApps on the Azuro Protocol.

46 lines (45 loc) 1.18 kB
import { type Selection } from '@azuro-org/toolkit'; export type UseOddsProps = { selections: Selection[]; }; /** * Watch real-time odds updates for multiple selections (betslip). * Subscribes to condition updates via websocket and calculates total odds with slippage protection. * * Returns individual odds for each selection and combined total odds. * * - Docs: https://gem.azuro.org/hub/apps/sdk/watch/useOdds * * @example * import { useOdds } from '@azuro-org/sdk' * * // ... * * const selections = [ * { conditionId: '123...', outcomeId: '1' }, * { conditionId: '456...', outcomeId: '2' } * ] * const { data, isFetching } = useOdds({ selections }) * const { odds, totalOdds } = data * * * return selections.map(({ conditionId, outcomeId }) => { * const key = `${conditionId}-${outcomeId}` * * return ( * <SelectionView * key={key} * conditionId={conditionId} * outcomeId={outcomeId} * odds={odds[key]} * /> * ) * } * */ export declare const useOdds: ({ selections }: UseOddsProps) => { data: { odds: Record<string, number>; totalOdds: number; }; isFetching: boolean; };