@azuro-org/sdk
Version:
One-stop solution for building betting dApps on the Azuro Protocol.
30 lines (29 loc) • 1.12 kB
TypeScript
import { ConditionState, type GameMarkets } from '@azuro-org/toolkit';
export type UseActiveMarketProps = {
markets: GameMarkets;
};
/**
* Manages active market selection and automatically switches to the next available market when conditions become
* inactive. Tracks condition states across all markets and provides organized market data.
*
* Returns active market key, condition index, and organized market structures for navigation.
*
* - Docs: https://gem.azuro.org/hub/apps/sdk/watch/useActiveMarket
*
* @example
* import { useActiveMarket } from '@azuro-org/sdk'
*
* const { data, isFetching } = useActiveMarket({ markets })
* const { activeMarketKey, activeConditionIndex, otherMarkets, states } = data
* */
export declare const useActiveMarket: ({ markets }: UseActiveMarketProps) => {
data: {
states: Record<string, ConditionState>;
marketsByKey: Record<string, import("@azuro-org/toolkit").Market>;
activeMarketKey: string;
activeConditionIndex: number;
otherMarkets: string[];
sortedMarketKeys: string[];
};
isFetching: boolean;
};