Calculates the minimum and maximum bet amount for given selections. This utility replaces the deprecated getMaxBet function (removed in v6) and provides more comprehensive bet calculation data including minimum bet limits and maximum payout.

User’s account is required to provide the correct maximum bet amount. It may be undefined if the user isn’t logged in.

Usage

import { getBetCalculation, type GetBetCalculationResult } from '@azuro-org/toolkit'
 
const account = userWallet?.address
const selections = [
  { conditionId: '1', outcomeId: '1' },
]
 
const { minBet, maxBet, maxPayout }: GetBetCalculationResult = await getBetCalculation({
  chainId: appChain.id,
  selections,
  account
})

Props

{
  chainId: ChainId
  selections: Selection[]
  account: Address | undefined
}
type Selection = {
  outcomeId: string
  conditionId: string
}

Return Value

type GetBetCalculationResult = {
  /** if `minBet` is `undefined`, there is no bottom limit */
  minBet: number | undefined
  maxBet: number
  maxPayout: `${number}`
}