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

Returns the calculated cashout, intended to provide the exact cashout value for a specific bet.

ℹ️

You can find more information Here.

Usage

import { getCalculatedCashout } from '@azuro-org/toolkit'
 
 
const { id } = bet // user's bet
const cashout = await getCalculatedCashout({
  chainId: 137,
  betCoreAddress: '0x...',
  account: '0x...',
  graphBetId: id,
})

Props

{
  chainId: ChainId
  account: Address
  graphBetId: string // bet id from graph
}
type ChainId = 
  | 100     // Gnosis
  | 137     // Polygon
  | 80002   // Polygon Amoy
  | 88888   // Chiliz
  | 88882   // Chiliz Spicy
  | 8453    // Base
  | 84532   // Base Sepolia
 
import { type Address } from 'viem'

Return Value

type GetCalculatedCashout = {
  calculationId: string // calculation id, needed for createCashout
  account: string
  environment: Environment
  tokenId: string // bet token id from graph
  cashoutAmount: string
  cashoutOdds: string
  expiredAt: number // cashout expired at
  approveExpiredAt: number // sigh cashout type data expired at
  isLive: boolean
} | null