⚠️
Important! We’ve moved to V3! This documentation is for V2 only and will be updated in May.
Developer Hub
🔮 For applications
Toolkit
Cashout
getPrecalculatedCashouts

Provides approximate precalculated cashout values, intended for use in the client's bets view.

ℹ️

You can find more information Here.

Usage

import { getPrecalculatedCashouts } from '@azuro-org/toolkit'
 
 
const { possibleWin, outcomes } = bet // user's bet
const cashouts = await getPrecalculatedCashouts({
  chainId: 137,
  conditionIds: outcomes.map(({ conditionId }) => conditionId),
})

Props

{
  chainId: ChainId
  conditionIds: string[]
}
type ChainId = 
  | 100     // Gnosis
  | 137     // Polygon
  | 80002   // Polygon Amoy
  | 88888   // Chiliz
  | 88882   // Chiliz Spicy
  | 8453    // Base
  | 84532   // Base Sepolia

Return Value

type GetPrecalculatedCashouts = {
  margin: string
  marginMin: string
  availables: {
    conditionId: string
    available: boolean // Indicates whether cashout is available for the provided condition
    outcomes: {
      outcomeId: number
      price: string
    }[]
  }[]
} | null