Developer Hub
🔮 For applications
Toolkit
Utils
groupConditionsByMarket

Creates markets from subgraph conditions.

Usage

import { groupConditionsByMarket, PrematchConditionsQuery } from '@azuro-org/toolkit'
 
const conditions: PrematchConditionsQuery['conditions'] = [...]
 
const markets = groupConditionsByMarket(conditions)

Props

type ConditionsQuery = (PrematchConditionsQuery | LiveConditionsQuery)['conditions']
import { PrematchConditionsQuery, LiveConditionsQuery } from '@azuro-org/toolkit'

Return Value

type GameMarkets = Market[]
type Market = {
  marketKey: string
  name: string
  description: string
  outcomeRows: MarketOutcome[][]
}
 
type MarketOutcome = {
  selectionName: string
  odds?: number
  lpAddress: string
  coreAddress: string
  status: ConditionStatus
  gameId: string
  isExpressForbidden: boolean
  isWon?: boolean
} & Selection
 
type Selection = {
  conditionId: string
  outcomeId: string
  coreAddress: string
}