Developer Hub
🔮 For applications
Toolkit
Overview

Overview

This package provides helpers to develop an app using Azuro Protocol.

Npm Package

https://www.npmjs.com/package/@azuro-org/toolkit (opens in a new tab)

Installation

  1. Install the SDK Package: npm install @azuro-org/toolkit.
  2. Install Peer Dependencies:
@apollo/client@^3.8.0-beta.7
@azuro-org/dictionaries@^3.0.12
viem@^2.17.3
@wagmi/core@^2.11.7
ℹ️

In the future, you may come across the following types often enough, so we've decided to explain them from the get-go:

  • Selection: Represents the user's choice, main data for bet and odds calculation, etc.
type Selection = {
  outcomeId: string
  conditionId: string
  coreAddress: string
}
  • ChainData: Chain data with endpoints and contracts, etc.
type ChainData = {
  chain: Chain,
  graphql: {
    prematch: string,
    live: string,
  }
  socket: string
  api: string
  environment: Environment
  contracts: Contracts
  betToken: BetToken
}
import { type Chain } from 'viem/chains'
import { type Address } from 'viem'
 
type BetToken = {
  address: Address
  symbol: string
  decimals: number
}
 
type Contracts = {
  lp: {
    address: Address
    abi: typeof lpAbi
  }
  prematchCore: {
    address: Address
    abi: typeof prematchCoreAbi
  }
  prematchComboCore: {
    address: Address
    abi: typeof prematchComboCoreAbi
  }
  proxyFront: {
    address: Address
    abi: typeof proxyFrontAbi
  }
  liveRelayer?: {
    address: Address
  }
  liveCore?: {
    address: Address
    abi: typeof liveCoreAbi
  }
}
 
enum Environment {
  GnosisXDAI = 'GnosisXDAI',
  PolygonUSDT = 'PolygonUSDT',
  PolygonAmoyAZUSD = 'PolygonAmoyAZUSD',
  ChilizWCHZ = 'ChilizWCHZ',
  ChilizSpicyWCHZ = 'ChilizSpicyWCHZ'
}

Constants

import {
  ODDS_DECIMALS, // odds decimals
  MIN_LIVE_BET_AMOUNT, // min amount for live bet
 
  deBridgeUrl, // deBridge api endpoint for creating order
  deBridgeTxUrl, // deBridge tx api endpoint for checking order status
 
  liveHostAddress, // address of HostCore contract
  liveSupportedChains, // array of chain ids that supported live betting
  chainsData, // supported chains data with endpoints, contracts and etc.
 
 
  environments, // environments by chain id
} from '@azuro-org/toolkit'

ABI

import { lpAbi, liveCoreAbi, prematchComboCoreAbi, prematchCoreAbi, proxyFrontAbi, freeBetAbi } from '@azuro-org/toolkit'

GraphQL

Queries and Fragments for sending GraphQL request.

import {
  // Only for live QraphQL endpoint
  type LiveConditionFragment,
  LiveConditionFragmentDoc,
 
  type LiveConditionQueryVariables,
  type LiveConditionQuery,
  type LiveConditionQueryResult,
  LiveConditionDocument,
 
  type LiveConditionsQueryVariables,
  type LiveConditionsQuery,
  type LiveConditionsQueryResult,
  LiveConditionsDocument,
 
 
  // Only for prematch QraphQL endpoint
  type PrematchConditionFragment,
  PrematchConditionFragmentDoc,
 
  type BettorFragment,
  BettorFragmentDoc,
 
  type LiveBetFragment,
  LiveBetFragmentDoc,
 
  type PrematchBetFragment,
  PrematchBetFragmentDoc,
 
  type BettorsQueryVariables,
  type BettorsQuery,
  type BettorsQueryResult,
  BettorsDocument,
 
  type PrematchConditionQueryVariables,
  type PrematchConditionQuery,
  type PrematchConditionQueryResult,
  PrematchConditionDocument,
 
  type PrematchConditionsQueryVariables,
  type PrematchConditionsQuery,
  type PrematchConditionsQueryResult,
  PrematchConditionsDocument,
 
  type GameBetsQueryVariables,
  type GameBetsQuery,
  type GameBetsQueryResult,
  GameBetsDocument,
 
  type LiveBetsQueryVariables,
  type LiveBetsQuery,
  type LiveBetsQueryResult,
  LiveBetsDocument,
 
  type PrematchBetsQueryVariables,
  type PrematchBetsQuery,
  type PrematchBetsQueryResult,
  PrematchBetsDocument,
 
 
  // Could be use for live and prematch QraphQL endpoints
  type MainGameInfoFragment,
  MainGameInfoFragmentDoc,
 
  type GameQueryVariables,
  type GameQuery,
  type GameQueryResult,
  GameDocument,
 
  type GamesQueryVariables,
  type GamesQuery,
  type GamesQueryResult,
  GamesDocument,
  
  type NavigationQueryVariables,
  type NavigationQuery,
  type NavigationQueryResult,
  NavigationDocument,
 
  type SportsQueryVariables,
  type SportsQuery,
  type SportsQueryResult,
  SportsDocument,
 
  type SportsNavigationQueryVariables,
  type SportsNavigationQuery,
  type SportsNavigationQueryResult,
  SportsNavigationDocument,
} from '@azuro-org/toolkit'