The AzuroSDKProvider
serves as the central component that encompasses all providers:
Usage
Wrap your application in AzuroSDKProvider
.
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} initialLiveState={true}>
{children}
</AzuroSDKProvider>
</QueryClientProvider>
</WagmiProvider>
)
}
⚠️
The AzuroSDKProvider
requires access to the Wagmi context.
Following the setup, you gain access to all the data provided by the providers:
import { useChain, useApolloClients, useSocket, useBaseBetslip, useDetailedBetslip } from '@azuro-org/sdk'
const { ... } = useChain()
const { ... } = useApolloClients()
const { ... } = useSocket()
const { ... } = useBaseBetslip()
const { ... } = useDetailedBetslip()
Props
{
children: React.ReactNode
affiliate?: Address // only for freeBets fetching in betslip context
initialChainId: ChainId // your initial chain id
}
type ChainId = 100 | 137 | 80002 | 88888 | 88882