AzuroSDKProvider
The AzuroSDKProvider
is the root context provider that enables all AzuroSDK functionality. It wraps and combines the following internal providers:
- ChainProvider
- FeedSocketProvider
- GameUpdatesProvider
- ConditionUpdatesProvider
- LiveStatisticsSocketProvider
- BetslipProvider
Usage
Wrap your app with AzuroSDKProvider
inside a WagmiProvider
and QueryClientProvider
.
import { AzuroSDKProvider } from '@azuro-org/sdk'
import { WagmiProvider, createConfig } from 'wagmi'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { polygonAmoy } from 'viem/chains'
const wagmiConfig = createConfig(config)
const queryClient = new QueryClient()
function Providers(props: { children: React.ReactNode }) {
const { children } = props
return (
<WagmiProvider config={wagmiConfig}>
<QueryClientProvider client={queryClient}>
<AzuroSDKProvider initialChainId={polygonAmoy.id}>
{children}
</AzuroSDKProvider>
</QueryClientProvider>
</WagmiProvider>
)
}
⚠️
AzuroSDKProvider
must be used inside a WagmiProvider
. Without Wagmi context, the SDK will not function.
After setup, you can access AzuroSDK data and functionality using hooks:
import { useChain, useBaseBetslip, useDetailedBetslip } from '@azuro-org/sdk'
const { ... } = useChain()
const { ... } = useBaseBetslip()
const { ... } = useDetailedBetslip()
Props
{
children: React.ReactNode
initialChainId: ChainId // your initial chain id
}
type ChainId =
| 100 // Gnosis
| 137 // Polygon
| 80002 // Polygon Amoy
| 88888 // Chiliz
| 88882 // Chiliz Spicy
| 8453 // Base
| 84532 // Base Sepolia