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
- Install the SDK Package:
npm install @azuro-org/toolkit
. - 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 {
GnosisDevXDAI = 'GnosisDevXDAI',
GnosisXDAI = 'GnosisXDAI',
PolygonUSDT = 'PolygonUSDT',
PolygonAmoyAZUSD = 'PolygonAmoyAZUSD',
PolygonAmoyUSDT = 'PolygonAmoyUSDT',
ChilizWCHZ = 'ChilizWCHZ',
ChilizSpicyWCHZ = 'ChilizSpicyWCHZ'
}
Development mode
To enable Development mode set the AZURO_UNSTABLE_DEV_ENABLED
env variable to true
it will change polygonAmoy
and gnosis
to dev mode:
- contracts addresses to dev mode (opens in a new tab)
- all endpoint getters to dev mode (opens in a new tab)
Constants
import {
MARGIN_DECIMALS, // marginality decimals
ODDS_DECIMALS, // odds decimals
MIN_LIVE_BET_AMOUNT, // min amount for live bet
LIVE_BET_DATA_TYPES, // data types for sign typed data
LIVE_TYPED_DATA_DOMAIN_NAME, // typed data domain name
LIVE_TYPED_DATA_DOMAIN_VERSION, // typed data domain version
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'