@provable-games/budokan-sdk 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client-BtC3ngNe.d.cts +448 -0
- package/dist/client-BtC3ngNe.d.ts +448 -0
- package/dist/index.cjs +2553 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +205 -0
- package/dist/index.d.ts +205 -0
- package/dist/index.js +2519 -0
- package/dist/index.js.map +1 -0
- package/dist/react.cjs +2776 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.d.cts +160 -0
- package/dist/react.d.ts +160 -0
- package/dist/react.js +2760 -0
- package/dist/react.js.map +1 -0
- package/package.json +1 -1
package/dist/react.d.cts
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { m as BudokanClientConfig, B as BudokanClient, T as Tournament, b as PaginatedResult, e as TournamentListParams, L as LeaderboardEntry, h as PlayerTournament, f as PlayerStats, g as PlayerTournamentParams, c as RewardClaim, d as RewardClaimSummary, k as PrizeStats, a as Prize, Q as QualificationEntry, s as WSEventMessage, r as WSChannel, C as ConnectionMode } from './client-BtC3ngNe.cjs';
|
|
4
|
+
|
|
5
|
+
interface BudokanProviderProps {
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
config?: BudokanClientConfig;
|
|
8
|
+
client?: BudokanClient;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Provides a BudokanClient instance to all child components via React context.
|
|
12
|
+
* Supply either a `config` prop to auto-create a client, or an existing `client` instance.
|
|
13
|
+
*/
|
|
14
|
+
declare function BudokanProvider({ children, config, client: existingClient }: BudokanProviderProps): react_jsx_runtime.JSX.Element;
|
|
15
|
+
/**
|
|
16
|
+
* Access the BudokanClient instance from context.
|
|
17
|
+
* Must be used within a BudokanProvider.
|
|
18
|
+
*/
|
|
19
|
+
declare function useBudokanClient(): BudokanClient;
|
|
20
|
+
|
|
21
|
+
interface UseTournamentsResult {
|
|
22
|
+
tournaments: PaginatedResult<Tournament> | null;
|
|
23
|
+
loading: boolean;
|
|
24
|
+
error: Error | null;
|
|
25
|
+
refetch: () => void;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Hook to fetch a paginated list of tournaments.
|
|
29
|
+
*/
|
|
30
|
+
declare function useTournaments(params?: TournamentListParams): UseTournamentsResult;
|
|
31
|
+
interface UseTournamentResult {
|
|
32
|
+
tournament: Tournament | null;
|
|
33
|
+
loading: boolean;
|
|
34
|
+
error: Error | null;
|
|
35
|
+
refetch: () => void;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Hook to fetch a single tournament by ID.
|
|
39
|
+
*/
|
|
40
|
+
declare function useTournament(tournamentId: string | undefined): UseTournamentResult;
|
|
41
|
+
|
|
42
|
+
interface UseLeaderboardResult {
|
|
43
|
+
leaderboard: LeaderboardEntry[] | null;
|
|
44
|
+
loading: boolean;
|
|
45
|
+
error: Error | null;
|
|
46
|
+
refetch: () => void;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Hook to fetch the leaderboard for a tournament.
|
|
50
|
+
*/
|
|
51
|
+
declare function useLeaderboard(tournamentId: string | undefined): UseLeaderboardResult;
|
|
52
|
+
|
|
53
|
+
interface UsePlayerResult {
|
|
54
|
+
tournaments: PaginatedResult<PlayerTournament> | null;
|
|
55
|
+
stats: PlayerStats | null;
|
|
56
|
+
loading: boolean;
|
|
57
|
+
error: Error | null;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Hook to fetch a player's tournament history and stats.
|
|
61
|
+
*/
|
|
62
|
+
declare function usePlayer(address: string | undefined): UsePlayerResult;
|
|
63
|
+
interface UsePlayerStatsResult {
|
|
64
|
+
stats: PlayerStats | null;
|
|
65
|
+
loading: boolean;
|
|
66
|
+
error: Error | null;
|
|
67
|
+
refetch: () => void;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Hook to fetch stats for a player.
|
|
71
|
+
*/
|
|
72
|
+
declare function usePlayerStats(address: string | undefined): UsePlayerStatsResult;
|
|
73
|
+
interface UsePlayerTournamentsResult {
|
|
74
|
+
tournaments: PaginatedResult<PlayerTournament> | null;
|
|
75
|
+
loading: boolean;
|
|
76
|
+
error: Error | null;
|
|
77
|
+
refetch: () => void;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Hook to fetch tournaments a player has registered for.
|
|
81
|
+
*/
|
|
82
|
+
declare function usePlayerTournaments(address: string | undefined, params?: PlayerTournamentParams): UsePlayerTournamentsResult;
|
|
83
|
+
|
|
84
|
+
interface UseRewardClaimsResult {
|
|
85
|
+
rewardClaims: PaginatedResult<RewardClaim> | null;
|
|
86
|
+
loading: boolean;
|
|
87
|
+
error: Error | null;
|
|
88
|
+
refetch: () => void;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Hook to fetch reward claims for a tournament.
|
|
92
|
+
*/
|
|
93
|
+
declare function useRewardClaims(tournamentId: string | undefined): UseRewardClaimsResult;
|
|
94
|
+
interface UseRewardClaimsSummaryResult {
|
|
95
|
+
summary: RewardClaimSummary | null;
|
|
96
|
+
loading: boolean;
|
|
97
|
+
error: Error | null;
|
|
98
|
+
refetch: () => void;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Hook to fetch reward claims summary for a tournament.
|
|
102
|
+
*/
|
|
103
|
+
declare function useRewardClaimsSummary(tournamentId: string | undefined): UseRewardClaimsSummaryResult;
|
|
104
|
+
|
|
105
|
+
interface UsePrizesResult {
|
|
106
|
+
prizes: Prize[] | null;
|
|
107
|
+
loading: boolean;
|
|
108
|
+
error: Error | null;
|
|
109
|
+
refetch: () => void;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Hook to fetch prizes for a tournament.
|
|
113
|
+
*/
|
|
114
|
+
declare function usePrizes(tournamentId: string | undefined): UsePrizesResult;
|
|
115
|
+
interface UsePrizeStatsResult {
|
|
116
|
+
prizeStats: PrizeStats | null;
|
|
117
|
+
loading: boolean;
|
|
118
|
+
error: Error | null;
|
|
119
|
+
refetch: () => void;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Hook to fetch platform-wide prize stats.
|
|
123
|
+
*/
|
|
124
|
+
declare function usePrizeStats(): UsePrizeStatsResult;
|
|
125
|
+
|
|
126
|
+
interface UseQualificationsResult {
|
|
127
|
+
qualifications: PaginatedResult<QualificationEntry> | null;
|
|
128
|
+
loading: boolean;
|
|
129
|
+
error: Error | null;
|
|
130
|
+
refetch: () => void;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Hook to fetch qualification entries for a tournament.
|
|
134
|
+
*/
|
|
135
|
+
declare function useQualifications(tournamentId: string | undefined): UseQualificationsResult;
|
|
136
|
+
|
|
137
|
+
interface UseSubscriptionResult {
|
|
138
|
+
lastMessage: WSEventMessage | null;
|
|
139
|
+
isConnected: boolean;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Hook to subscribe to WebSocket channels for real-time updates.
|
|
143
|
+
* Automatically connects and subscribes on mount, and cleans up on unmount.
|
|
144
|
+
*/
|
|
145
|
+
declare function useSubscription(channels: WSChannel[], tournamentIds?: string[]): UseSubscriptionResult;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Hook returning the current WebSocket connection status and datasource mode.
|
|
149
|
+
*
|
|
150
|
+
* `datasourceMode` indicates how data is being fetched:
|
|
151
|
+
* - `"api"` — API is available and being used
|
|
152
|
+
* - `"rpc-fallback"` — API is down, using direct on-chain RPC calls
|
|
153
|
+
* - `"offline"` — both API and RPC are unavailable
|
|
154
|
+
*/
|
|
155
|
+
declare function useConnectionStatus(): {
|
|
156
|
+
isConnected: boolean;
|
|
157
|
+
datasourceMode: ConnectionMode;
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
export { BudokanProvider, type BudokanProviderProps, type UseLeaderboardResult, type UsePlayerResult, type UsePlayerStatsResult, type UsePlayerTournamentsResult, type UsePrizeStatsResult, type UsePrizesResult, type UseQualificationsResult, type UseRewardClaimsResult, type UseRewardClaimsSummaryResult, type UseSubscriptionResult, type UseTournamentResult, type UseTournamentsResult, useBudokanClient, useConnectionStatus, useLeaderboard, usePlayer, usePlayerStats, usePlayerTournaments, usePrizeStats, usePrizes, useQualifications, useRewardClaims, useRewardClaimsSummary, useSubscription, useTournament, useTournaments };
|
package/dist/react.d.ts
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { m as BudokanClientConfig, B as BudokanClient, T as Tournament, b as PaginatedResult, e as TournamentListParams, L as LeaderboardEntry, h as PlayerTournament, f as PlayerStats, g as PlayerTournamentParams, c as RewardClaim, d as RewardClaimSummary, k as PrizeStats, a as Prize, Q as QualificationEntry, s as WSEventMessage, r as WSChannel, C as ConnectionMode } from './client-BtC3ngNe.js';
|
|
4
|
+
|
|
5
|
+
interface BudokanProviderProps {
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
config?: BudokanClientConfig;
|
|
8
|
+
client?: BudokanClient;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Provides a BudokanClient instance to all child components via React context.
|
|
12
|
+
* Supply either a `config` prop to auto-create a client, or an existing `client` instance.
|
|
13
|
+
*/
|
|
14
|
+
declare function BudokanProvider({ children, config, client: existingClient }: BudokanProviderProps): react_jsx_runtime.JSX.Element;
|
|
15
|
+
/**
|
|
16
|
+
* Access the BudokanClient instance from context.
|
|
17
|
+
* Must be used within a BudokanProvider.
|
|
18
|
+
*/
|
|
19
|
+
declare function useBudokanClient(): BudokanClient;
|
|
20
|
+
|
|
21
|
+
interface UseTournamentsResult {
|
|
22
|
+
tournaments: PaginatedResult<Tournament> | null;
|
|
23
|
+
loading: boolean;
|
|
24
|
+
error: Error | null;
|
|
25
|
+
refetch: () => void;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Hook to fetch a paginated list of tournaments.
|
|
29
|
+
*/
|
|
30
|
+
declare function useTournaments(params?: TournamentListParams): UseTournamentsResult;
|
|
31
|
+
interface UseTournamentResult {
|
|
32
|
+
tournament: Tournament | null;
|
|
33
|
+
loading: boolean;
|
|
34
|
+
error: Error | null;
|
|
35
|
+
refetch: () => void;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Hook to fetch a single tournament by ID.
|
|
39
|
+
*/
|
|
40
|
+
declare function useTournament(tournamentId: string | undefined): UseTournamentResult;
|
|
41
|
+
|
|
42
|
+
interface UseLeaderboardResult {
|
|
43
|
+
leaderboard: LeaderboardEntry[] | null;
|
|
44
|
+
loading: boolean;
|
|
45
|
+
error: Error | null;
|
|
46
|
+
refetch: () => void;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Hook to fetch the leaderboard for a tournament.
|
|
50
|
+
*/
|
|
51
|
+
declare function useLeaderboard(tournamentId: string | undefined): UseLeaderboardResult;
|
|
52
|
+
|
|
53
|
+
interface UsePlayerResult {
|
|
54
|
+
tournaments: PaginatedResult<PlayerTournament> | null;
|
|
55
|
+
stats: PlayerStats | null;
|
|
56
|
+
loading: boolean;
|
|
57
|
+
error: Error | null;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Hook to fetch a player's tournament history and stats.
|
|
61
|
+
*/
|
|
62
|
+
declare function usePlayer(address: string | undefined): UsePlayerResult;
|
|
63
|
+
interface UsePlayerStatsResult {
|
|
64
|
+
stats: PlayerStats | null;
|
|
65
|
+
loading: boolean;
|
|
66
|
+
error: Error | null;
|
|
67
|
+
refetch: () => void;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Hook to fetch stats for a player.
|
|
71
|
+
*/
|
|
72
|
+
declare function usePlayerStats(address: string | undefined): UsePlayerStatsResult;
|
|
73
|
+
interface UsePlayerTournamentsResult {
|
|
74
|
+
tournaments: PaginatedResult<PlayerTournament> | null;
|
|
75
|
+
loading: boolean;
|
|
76
|
+
error: Error | null;
|
|
77
|
+
refetch: () => void;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Hook to fetch tournaments a player has registered for.
|
|
81
|
+
*/
|
|
82
|
+
declare function usePlayerTournaments(address: string | undefined, params?: PlayerTournamentParams): UsePlayerTournamentsResult;
|
|
83
|
+
|
|
84
|
+
interface UseRewardClaimsResult {
|
|
85
|
+
rewardClaims: PaginatedResult<RewardClaim> | null;
|
|
86
|
+
loading: boolean;
|
|
87
|
+
error: Error | null;
|
|
88
|
+
refetch: () => void;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Hook to fetch reward claims for a tournament.
|
|
92
|
+
*/
|
|
93
|
+
declare function useRewardClaims(tournamentId: string | undefined): UseRewardClaimsResult;
|
|
94
|
+
interface UseRewardClaimsSummaryResult {
|
|
95
|
+
summary: RewardClaimSummary | null;
|
|
96
|
+
loading: boolean;
|
|
97
|
+
error: Error | null;
|
|
98
|
+
refetch: () => void;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Hook to fetch reward claims summary for a tournament.
|
|
102
|
+
*/
|
|
103
|
+
declare function useRewardClaimsSummary(tournamentId: string | undefined): UseRewardClaimsSummaryResult;
|
|
104
|
+
|
|
105
|
+
interface UsePrizesResult {
|
|
106
|
+
prizes: Prize[] | null;
|
|
107
|
+
loading: boolean;
|
|
108
|
+
error: Error | null;
|
|
109
|
+
refetch: () => void;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Hook to fetch prizes for a tournament.
|
|
113
|
+
*/
|
|
114
|
+
declare function usePrizes(tournamentId: string | undefined): UsePrizesResult;
|
|
115
|
+
interface UsePrizeStatsResult {
|
|
116
|
+
prizeStats: PrizeStats | null;
|
|
117
|
+
loading: boolean;
|
|
118
|
+
error: Error | null;
|
|
119
|
+
refetch: () => void;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Hook to fetch platform-wide prize stats.
|
|
123
|
+
*/
|
|
124
|
+
declare function usePrizeStats(): UsePrizeStatsResult;
|
|
125
|
+
|
|
126
|
+
interface UseQualificationsResult {
|
|
127
|
+
qualifications: PaginatedResult<QualificationEntry> | null;
|
|
128
|
+
loading: boolean;
|
|
129
|
+
error: Error | null;
|
|
130
|
+
refetch: () => void;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Hook to fetch qualification entries for a tournament.
|
|
134
|
+
*/
|
|
135
|
+
declare function useQualifications(tournamentId: string | undefined): UseQualificationsResult;
|
|
136
|
+
|
|
137
|
+
interface UseSubscriptionResult {
|
|
138
|
+
lastMessage: WSEventMessage | null;
|
|
139
|
+
isConnected: boolean;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Hook to subscribe to WebSocket channels for real-time updates.
|
|
143
|
+
* Automatically connects and subscribes on mount, and cleans up on unmount.
|
|
144
|
+
*/
|
|
145
|
+
declare function useSubscription(channels: WSChannel[], tournamentIds?: string[]): UseSubscriptionResult;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Hook returning the current WebSocket connection status and datasource mode.
|
|
149
|
+
*
|
|
150
|
+
* `datasourceMode` indicates how data is being fetched:
|
|
151
|
+
* - `"api"` — API is available and being used
|
|
152
|
+
* - `"rpc-fallback"` — API is down, using direct on-chain RPC calls
|
|
153
|
+
* - `"offline"` — both API and RPC are unavailable
|
|
154
|
+
*/
|
|
155
|
+
declare function useConnectionStatus(): {
|
|
156
|
+
isConnected: boolean;
|
|
157
|
+
datasourceMode: ConnectionMode;
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
export { BudokanProvider, type BudokanProviderProps, type UseLeaderboardResult, type UsePlayerResult, type UsePlayerStatsResult, type UsePlayerTournamentsResult, type UsePrizeStatsResult, type UsePrizesResult, type UseQualificationsResult, type UseRewardClaimsResult, type UseRewardClaimsSummaryResult, type UseSubscriptionResult, type UseTournamentResult, type UseTournamentsResult, useBudokanClient, useConnectionStatus, useLeaderboard, usePlayer, usePlayerStats, usePlayerTournaments, usePrizeStats, usePrizes, useQualifications, useRewardClaims, useRewardClaimsSummary, useSubscription, useTournament, useTournaments };
|