The useStatuses
Hook monitors the statuses for the provided selections.
Conditions have a status that indicates their current state. For instance, ConditionStatus.Created
signifies the condition is available for betting, while ConditionStatus.Paused
indicates it has temporarily stopped accepting bets.
Usage
⚠️
Before utilizing useStatuses
, it is essential to initialize event watchers and the SocketProvider
:
import { ChainProvider, SocketProvider, useWatchers } from '@azuro-org/sdk'
export function Watchers() {
useWatchers()
return null
}
function Providers(props: { children: React.ReactNode }) {
const { children } = props
return (
<ChainProvider>
<SocketProvider>
{children}
</SocketProvider>
<Watchers />
</ChainProvider>
)
}
import { useStatuses } from '@azuro-org/sdk'
const { statuses, loading } = useStatuses({
selections: [
{
conditionId: '486903008559711340',
outcomeId: '29',
coreAddress: '0x34nsf41f...',
},
],
})
ℹ️
The statuses
is an object where the key combination corresponds to conditionId
:
statuses[conditionId]
Props
{
selections: Selection[]
}
type Selection = {
conditionId: string
outcomeId: string
coreAddress: string
}
Return Value
{
statuses: Record<string, ConditionStatus>
loading: boolean
}