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

Sends live bet order.

Usage

import { getBetTypedData, createBet } from '@azuro-org/toolkit'
 
 
const typedData = getBetTypedData({
  account: '0xlkns...',
  clientData: {...},
  bet: {...},
})
 
const signature = await walletClient.data.signTypedData(typedData)
 
const createdOrder = await createBet({
  clientData: {...},
  bet: {...},
  signature,
})

Props

{
  clientData: BetClientData
  bet: {
    conditionId: string | bigint
    outcomeId: string | number | bigint
    minOdds: string | bigint
    amount: string | bigint
    nonce: string | number | bigint
  }
  signature: Hex // signed typed data
}
type BetClientData = {
  attention: string
  affiliate: Address
  core: Address
  expiresAt: number
  chainId: ChainId
  relayerFeeAmount: string
  isBetSponsored: boolean
  isFeeSponsored: boolean
  isSponsoredBetReturnable: boolean
}

Return Value

type CreateLiveBetResponse = {
  id: string
  state: BetState
  errorMessage?: string
  error?: string
}
 
enum LiveBetState {
  Created = 'Created',
  Pending = 'Pending',
  Sent = 'Sent',
  Accepted = 'Accepted',
  Rejected = 'Rejected'
}