Developer Hub
🔮 For applications
SDK
Cashout
usePrecalculatedCashouts

This hook retrieves a list of approximate precalculated cashouts for a specific bettor and is intended for use in the client's bets view.

ℹ️

You can find more information Here.

Usage

import { usePrecalculatedCashouts } from '@azuro-org/sdk'
 
 
const bet = {...}
 
const { data, isFetching: isCashoutFetching } = usePrecalculatedCashouts({
  bet
})
 
const { cashoutAmount, isAvailable: isCashoutAvailable } = data
ℹ️

You can find a usage example in our demo (opens in a new tab).

Props

  bet: Pick<Bet, 'tokenId' | 'amount' | 'outcomes' | 'status' | 'totalOdds' | 'freebetId'>
  chainId?: ChainId
  query?: QueryParameter<PrecalculatedCashoutsQueryData>
type ChainId = 
  | 100     // Gnosis
  | 137     // Polygon
  | 80002   // Polygon Amoy
  | 88888   // Chiliz
  | 88882   // Chiliz Spicy
  | 8453    // Base
  | 84532   // Base Sepolia
 
type PrecalculatedCashoutsQueryData = {
  margin: string,
  minMargin: string,
  cashouts: Record<string, PrecalculatedCashout>
} | undefined
 
type PrecalculatedCashout = {
  isAvailable: boolean
  odds: string
} & Selection
 
type Selection = {
  outcomeId: string
  conditionId: string
}

Return Value

UseQueryResult<{ isAvailable: boolean, cashoutAmount: number | undefined }>
import { type UseQueryResult } from '@tanstack/react-query'