@provable-games/budokan-sdk 0.1.18 → 0.1.20

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/react.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode } from 'react';
3
- import { m as BudokanClientConfig, B as BudokanClient, T as Tournament, b as PaginatedResult, e as TournamentListParams, q as Phase, p as LeaderboardEntry, R as Registration, h as PlayerTournament, f as PlayerStats, g as PlayerTournamentParams, c as RewardClaim, d as RewardClaimSummary, k as PrizeStats, a as Prize, P as PrizeAggregation, Q as QualificationEntry, i as PlatformStats, s as WSEventMessage, r as WSChannel, C as ConnectionMode } from './client-C4PUxzuO.cjs';
3
+ import { j as BudokanClientConfig, B as BudokanClient, T as Tournament, b as PaginatedResult, e as TournamentListParams, n as Phase, m as LeaderboardEntry, R as Registration, c as RewardClaim, d as RewardClaimSummary, h as PrizeStats, a as Prize, P as PrizeAggregation, Q as QualificationEntry, f as PlatformStats, p as WSEventMessage, o as WSChannel, C as ConnectionMode } from './client-CoWIQozF.cjs';
4
4
  import 'starknet';
5
5
  import '@provable-games/metagame-sdk';
6
6
 
@@ -52,10 +52,6 @@ interface UseTournamentCountResult {
52
52
  * Hook to fetch the total count of tournaments matching a phase filter.
53
53
  */
54
54
  declare function useTournamentCount(phase?: Phase): UseTournamentCountResult;
55
- /**
56
- * Hook to fetch the total count of tournaments a player is registered for.
57
- */
58
- declare function usePlayerTournamentCount(address: string | undefined, phase?: Phase): UseTournamentCountResult;
59
55
 
60
56
  interface UseLeaderboardResult {
61
57
  leaderboard: LeaderboardEntry[] | null;
@@ -78,7 +74,6 @@ interface UseRegistrationsResult {
78
74
  * Hook to fetch registrations for a tournament.
79
75
  */
80
76
  declare function useRegistrations(tournamentId: string | undefined, params?: {
81
- playerAddress?: string;
82
77
  gameTokenIds?: string[];
83
78
  hasSubmitted?: boolean;
84
79
  isBanned?: boolean;
@@ -86,36 +81,43 @@ declare function useRegistrations(tournamentId: string | undefined, params?: {
86
81
  offset?: number;
87
82
  }): UseRegistrationsResult;
88
83
 
89
- interface UsePlayerResult {
90
- tournaments: PaginatedResult<PlayerTournament> | null;
91
- stats: PlayerStats | null;
92
- loading: boolean;
93
- error: Error | null;
94
- }
95
84
  /**
96
- * Hook to fetch a player's tournament history and stats.
85
+ * Tournaments where `owner` currently holds at least one Budokan-minted token.
86
+ * Stitches denshokan ownership → unique `contextId`s → `useTournaments`
87
+ * filtered by those IDs. Stays correct under transfers; transferred tokens
88
+ * drop out of the result, received tokens appear.
89
+ *
90
+ * Requires the consuming app to wrap its tree in a `DenshokanProvider`
91
+ * alongside the `BudokanProvider`.
97
92
  */
98
- declare function usePlayer(address: string | undefined, params?: PlayerTournamentParams): UsePlayerResult;
99
- interface UsePlayerStatsResult {
100
- stats: PlayerStats | null;
101
- loading: boolean;
102
- error: Error | null;
103
- refetch: () => Promise<void>;
104
- }
93
+ declare function useTournamentsByOwner(owner: string | undefined, params?: {
94
+ phase?: Phase;
95
+ limit?: number;
96
+ offset?: number;
97
+ sort?: TournamentListParams["sort"];
98
+ includePrizeSummary?: TournamentListParams["includePrizeSummary"];
99
+ }): UseTournamentsResult;
105
100
  /**
106
- * Hook to fetch stats for a player.
101
+ * Count of tournaments where `owner` currently holds a Budokan-minted token.
102
+ * When `phase` is omitted the count comes for free from the denshokan result;
103
+ * when phase-filtered it makes a second `useTournaments` call (with limit=1)
104
+ * and reads `.total`.
107
105
  */
108
- declare function usePlayerStats(address: string | undefined): UsePlayerStatsResult;
109
- interface UsePlayerTournamentsResult {
110
- tournaments: PaginatedResult<PlayerTournament> | null;
111
- loading: boolean;
112
- error: Error | null;
113
- refetch: () => Promise<void>;
114
- }
106
+ declare function useTournamentsByOwnerCount(owner: string | undefined, params?: {
107
+ phase?: Phase;
108
+ }): UseTournamentCountResult;
115
109
  /**
116
- * Hook to fetch tournaments a player has registered for.
110
+ * Registrations in `tournamentId` for tokens that `owner` currently holds.
111
+ * Source of truth is denshokan ownership scoped to the tournament's
112
+ * `contextId`; registration metadata (ban / submission / entry-number) is
113
+ * fetched by `gameTokenIds` filter against the tournament.
117
114
  */
118
- declare function usePlayerTournaments(address: string | undefined, params?: PlayerTournamentParams): UsePlayerTournamentsResult;
115
+ declare function useRegistrationsByOwner(tournamentId: string | undefined, owner: string | undefined, params?: {
116
+ hasSubmitted?: boolean;
117
+ isBanned?: boolean;
118
+ limit?: number;
119
+ offset?: number;
120
+ }): UseRegistrationsResult;
119
121
 
120
122
  interface UseRewardClaimsResult {
121
123
  rewardClaims: PaginatedResult<RewardClaim> | null;
@@ -221,4 +223,4 @@ declare function useConnectionStatus(): {
221
223
  datasourceMode: ConnectionMode;
222
224
  };
223
225
 
224
- export { BudokanProvider, type BudokanProviderProps, type UseActivityStatsResult, type UseLeaderboardResult, type UsePlayerResult, type UsePlayerStatsResult, type UsePlayerTournamentsResult, type UsePrizeAggregationResult, type UsePrizeStatsResult, type UsePrizesResult, type UseQualificationsResult, type UseRegistrationsResult, type UseRewardClaimsResult, type UseRewardClaimsSummaryResult, type UseSubscriptionResult, type UseTournamentCountResult, type UseTournamentResult, type UseTournamentsResult, useActivityStats, useBudokanClient, useConnectionStatus, useLeaderboard, usePlayer, usePlayerStats, usePlayerTournamentCount, usePlayerTournaments, usePrizeAggregation, usePrizeStats, usePrizes, useQualifications, useRegistrations, useRewardClaims, useRewardClaimsSummary, useSubscription, useTournament, useTournamentCount, useTournaments };
226
+ export { BudokanProvider, type BudokanProviderProps, type UseActivityStatsResult, type UseLeaderboardResult, type UsePrizeAggregationResult, type UsePrizeStatsResult, type UsePrizesResult, type UseQualificationsResult, type UseRegistrationsResult, type UseRewardClaimsResult, type UseRewardClaimsSummaryResult, type UseSubscriptionResult, type UseTournamentCountResult, type UseTournamentResult, type UseTournamentsResult, useActivityStats, useBudokanClient, useConnectionStatus, useLeaderboard, usePrizeAggregation, usePrizeStats, usePrizes, useQualifications, useRegistrations, useRegistrationsByOwner, useRewardClaims, useRewardClaimsSummary, useSubscription, useTournament, useTournamentCount, useTournaments, useTournamentsByOwner, useTournamentsByOwnerCount };
package/dist/react.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode } from 'react';
3
- import { m as BudokanClientConfig, B as BudokanClient, T as Tournament, b as PaginatedResult, e as TournamentListParams, q as Phase, p as LeaderboardEntry, R as Registration, h as PlayerTournament, f as PlayerStats, g as PlayerTournamentParams, c as RewardClaim, d as RewardClaimSummary, k as PrizeStats, a as Prize, P as PrizeAggregation, Q as QualificationEntry, i as PlatformStats, s as WSEventMessage, r as WSChannel, C as ConnectionMode } from './client-C4PUxzuO.js';
3
+ import { j as BudokanClientConfig, B as BudokanClient, T as Tournament, b as PaginatedResult, e as TournamentListParams, n as Phase, m as LeaderboardEntry, R as Registration, c as RewardClaim, d as RewardClaimSummary, h as PrizeStats, a as Prize, P as PrizeAggregation, Q as QualificationEntry, f as PlatformStats, p as WSEventMessage, o as WSChannel, C as ConnectionMode } from './client-CoWIQozF.js';
4
4
  import 'starknet';
5
5
  import '@provable-games/metagame-sdk';
6
6
 
@@ -52,10 +52,6 @@ interface UseTournamentCountResult {
52
52
  * Hook to fetch the total count of tournaments matching a phase filter.
53
53
  */
54
54
  declare function useTournamentCount(phase?: Phase): UseTournamentCountResult;
55
- /**
56
- * Hook to fetch the total count of tournaments a player is registered for.
57
- */
58
- declare function usePlayerTournamentCount(address: string | undefined, phase?: Phase): UseTournamentCountResult;
59
55
 
60
56
  interface UseLeaderboardResult {
61
57
  leaderboard: LeaderboardEntry[] | null;
@@ -78,7 +74,6 @@ interface UseRegistrationsResult {
78
74
  * Hook to fetch registrations for a tournament.
79
75
  */
80
76
  declare function useRegistrations(tournamentId: string | undefined, params?: {
81
- playerAddress?: string;
82
77
  gameTokenIds?: string[];
83
78
  hasSubmitted?: boolean;
84
79
  isBanned?: boolean;
@@ -86,36 +81,43 @@ declare function useRegistrations(tournamentId: string | undefined, params?: {
86
81
  offset?: number;
87
82
  }): UseRegistrationsResult;
88
83
 
89
- interface UsePlayerResult {
90
- tournaments: PaginatedResult<PlayerTournament> | null;
91
- stats: PlayerStats | null;
92
- loading: boolean;
93
- error: Error | null;
94
- }
95
84
  /**
96
- * Hook to fetch a player's tournament history and stats.
85
+ * Tournaments where `owner` currently holds at least one Budokan-minted token.
86
+ * Stitches denshokan ownership → unique `contextId`s → `useTournaments`
87
+ * filtered by those IDs. Stays correct under transfers; transferred tokens
88
+ * drop out of the result, received tokens appear.
89
+ *
90
+ * Requires the consuming app to wrap its tree in a `DenshokanProvider`
91
+ * alongside the `BudokanProvider`.
97
92
  */
98
- declare function usePlayer(address: string | undefined, params?: PlayerTournamentParams): UsePlayerResult;
99
- interface UsePlayerStatsResult {
100
- stats: PlayerStats | null;
101
- loading: boolean;
102
- error: Error | null;
103
- refetch: () => Promise<void>;
104
- }
93
+ declare function useTournamentsByOwner(owner: string | undefined, params?: {
94
+ phase?: Phase;
95
+ limit?: number;
96
+ offset?: number;
97
+ sort?: TournamentListParams["sort"];
98
+ includePrizeSummary?: TournamentListParams["includePrizeSummary"];
99
+ }): UseTournamentsResult;
105
100
  /**
106
- * Hook to fetch stats for a player.
101
+ * Count of tournaments where `owner` currently holds a Budokan-minted token.
102
+ * When `phase` is omitted the count comes for free from the denshokan result;
103
+ * when phase-filtered it makes a second `useTournaments` call (with limit=1)
104
+ * and reads `.total`.
107
105
  */
108
- declare function usePlayerStats(address: string | undefined): UsePlayerStatsResult;
109
- interface UsePlayerTournamentsResult {
110
- tournaments: PaginatedResult<PlayerTournament> | null;
111
- loading: boolean;
112
- error: Error | null;
113
- refetch: () => Promise<void>;
114
- }
106
+ declare function useTournamentsByOwnerCount(owner: string | undefined, params?: {
107
+ phase?: Phase;
108
+ }): UseTournamentCountResult;
115
109
  /**
116
- * Hook to fetch tournaments a player has registered for.
110
+ * Registrations in `tournamentId` for tokens that `owner` currently holds.
111
+ * Source of truth is denshokan ownership scoped to the tournament's
112
+ * `contextId`; registration metadata (ban / submission / entry-number) is
113
+ * fetched by `gameTokenIds` filter against the tournament.
117
114
  */
118
- declare function usePlayerTournaments(address: string | undefined, params?: PlayerTournamentParams): UsePlayerTournamentsResult;
115
+ declare function useRegistrationsByOwner(tournamentId: string | undefined, owner: string | undefined, params?: {
116
+ hasSubmitted?: boolean;
117
+ isBanned?: boolean;
118
+ limit?: number;
119
+ offset?: number;
120
+ }): UseRegistrationsResult;
119
121
 
120
122
  interface UseRewardClaimsResult {
121
123
  rewardClaims: PaginatedResult<RewardClaim> | null;
@@ -221,4 +223,4 @@ declare function useConnectionStatus(): {
221
223
  datasourceMode: ConnectionMode;
222
224
  };
223
225
 
224
- export { BudokanProvider, type BudokanProviderProps, type UseActivityStatsResult, type UseLeaderboardResult, type UsePlayerResult, type UsePlayerStatsResult, type UsePlayerTournamentsResult, type UsePrizeAggregationResult, type UsePrizeStatsResult, type UsePrizesResult, type UseQualificationsResult, type UseRegistrationsResult, type UseRewardClaimsResult, type UseRewardClaimsSummaryResult, type UseSubscriptionResult, type UseTournamentCountResult, type UseTournamentResult, type UseTournamentsResult, useActivityStats, useBudokanClient, useConnectionStatus, useLeaderboard, usePlayer, usePlayerStats, usePlayerTournamentCount, usePlayerTournaments, usePrizeAggregation, usePrizeStats, usePrizes, useQualifications, useRegistrations, useRewardClaims, useRewardClaimsSummary, useSubscription, useTournament, useTournamentCount, useTournaments };
226
+ export { BudokanProvider, type BudokanProviderProps, type UseActivityStatsResult, type UseLeaderboardResult, type UsePrizeAggregationResult, type UsePrizeStatsResult, type UsePrizesResult, type UseQualificationsResult, type UseRegistrationsResult, type UseRewardClaimsResult, type UseRewardClaimsSummaryResult, type UseSubscriptionResult, type UseTournamentCountResult, type UseTournamentResult, type UseTournamentsResult, useActivityStats, useBudokanClient, useConnectionStatus, useLeaderboard, usePrizeAggregation, usePrizeStats, usePrizes, useQualifications, useRegistrations, useRegistrationsByOwner, useRewardClaims, useRewardClaimsSummary, useSubscription, useTournament, useTournamentCount, useTournaments, useTournamentsByOwner, useTournamentsByOwnerCount };