Developer Hub
🔮 For applications
SDK
Utils
calcPrematchOdds

Calculates the pre-match odds value for specific selections at which the bet can be placed on. If the current odds value is lower than the specified value, the bet cannot be placed and will be rejected by the contract.

Usage

import { calcPrematchOdds } from '@azuro-org/sdk'
 
const prematchOdds = await calcPrematchOdds({
  betAmount: '1' // 1 USDT
  selections: [ { conditionId, outcomeId, coreAddress } ],
  chainId: 80002,
})
ℹ️

Except of Single and Combo bets for Batch bet we use different amount structure batchBetAmounts.

The batchBetAmounts is an object where the key combination is determined by the concatenation of conditionId and outcomeId, the value is bet amount for outcome:

const selectionAmount = batchBetAmounts[`${conditionId}-${outcomeId}`]

Props

import { type Config } from 'wagmi'
 
{
  config: Config
  selections: Selection[]
  chainId: ChainId
  betAmount?: string // single and combo bet amount
  batchBetAmounts?: Record<string, string> // batch bet amounts
}
type ChainId = 100 | 137 | 80002 | 88888 | 88882
 
type Selection = {
  conditionId: string
  outcomeId: string
  coreAddress: string
}

Return Value

Promise<number>