@provable-games/budokan-sdk 0.1.22 → 0.1.24
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/README.md +32 -0
- package/dist/index.cjs +1494 -320
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +538 -3
- package/dist/index.d.ts +538 -3
- package/dist/index.js +1475 -322
- package/dist/index.js.map +1 -1
- package/dist/{client-DlXvzneQ.d.cts → player-C2GE9Lop.d.cts} +65 -5
- package/dist/{client-DlXvzneQ.d.ts → player-C2GE9Lop.d.ts} +65 -5
- package/dist/react.cjs +1194 -352
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +45 -2
- package/dist/react.d.ts +45 -2
- package/dist/react.js +1195 -354
- package/dist/react.js.map +1 -1
- package/package.json +5 -7
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 { i as BudokanClientConfig, B as BudokanClient, T as Tournament, b as PaginatedResult, e as TournamentListParams, m as Phase, l as LeaderboardEntry, R as Registration, c as RewardClaim, d as RewardClaimSummary, g as PrizeStats, a as Prize, P as PrizeAggregation, Q as QualificationEntry, f as PlatformStats, o as WSEventMessage,
|
|
3
|
+
import { i as BudokanClientConfig, B as BudokanClient, T as Tournament, b as PaginatedResult, e as TournamentListParams, m as Phase, l as LeaderboardEntry, R as Registration, c as RewardClaim, d as RewardClaimSummary, g as PrizeStats, a as Prize, P as PrizeAggregation, Q as QualificationEntry, f as PlatformStats, o as PlayerRewards, q as WSEventMessage, p as WSChannel, C as ConnectionMode } from './player-C2GE9Lop.cjs';
|
|
4
4
|
import 'starknet';
|
|
5
5
|
import '@provable-games/metagame-sdk';
|
|
6
6
|
|
|
@@ -200,6 +200,49 @@ interface UseActivityStatsResult {
|
|
|
200
200
|
*/
|
|
201
201
|
declare function useActivityStats(): UseActivityStatsResult;
|
|
202
202
|
|
|
203
|
+
interface UsePlayerRewardsResult {
|
|
204
|
+
rewards: PlayerRewards | null;
|
|
205
|
+
loading: boolean;
|
|
206
|
+
error: Error | null;
|
|
207
|
+
refetch: () => Promise<void>;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Aggregate a player's placement/earnings data across finalized Budokan
|
|
211
|
+
* tournaments they currently hold tokens in.
|
|
212
|
+
*
|
|
213
|
+
* Composition:
|
|
214
|
+
*
|
|
215
|
+
* denshokan useTokens (current ownership)
|
|
216
|
+
* ↓ group by contextId (= tournament id)
|
|
217
|
+
* budokan useTournaments({ tournamentIds })
|
|
218
|
+
* ↓ filter to finalized
|
|
219
|
+
* for each finalized tournament (parallel):
|
|
220
|
+
* budokan getTournamentPrizes — full prize records
|
|
221
|
+
* budokan getTournamentRewardClaims — paginated, all pages
|
|
222
|
+
* denshokan getTokenRanks (bulk) — final ranks for owned tokens
|
|
223
|
+
* ↓ filter ranks to paid positions (max position derived from prizes
|
|
224
|
+
* + entry-fee distribution_count)
|
|
225
|
+
*
|
|
226
|
+
* Per-tournament failures are tolerated: a 5xx on one tournament's prize/
|
|
227
|
+
* claim/rank fetch skips that tournament and continues, rather than
|
|
228
|
+
* failing the whole hook. Failures are logged via `console.warn`.
|
|
229
|
+
*
|
|
230
|
+
* Why source ownership from denshokan: PR #243 dropped
|
|
231
|
+
* `registrations.player_address` because the indexed value goes stale on
|
|
232
|
+
* transfer. The contract keys registrations by token_id only, so the only
|
|
233
|
+
* trustworthy answer to "what tournaments has this wallet placed in" is
|
|
234
|
+
* to ask denshokan who currently holds Budokan-minted tokens.
|
|
235
|
+
*
|
|
236
|
+
* Staleness: the hook only re-fetches when the player's owned token set
|
|
237
|
+
* changes (transfers/new mints) or when the underlying tournament list
|
|
238
|
+
* changes. It does *not* observe time-based finalization transitions on
|
|
239
|
+
* its own — if a tournament's submission window closes while the
|
|
240
|
+
* consumer is mounted, call `refetch()` to pick up the new placement.
|
|
241
|
+
*
|
|
242
|
+
* Pass `undefined` to skip fetching.
|
|
243
|
+
*/
|
|
244
|
+
declare function usePlayerRewards(address: string | undefined): UsePlayerRewardsResult;
|
|
245
|
+
|
|
203
246
|
interface UseSubscriptionResult {
|
|
204
247
|
lastMessage: WSEventMessage | null;
|
|
205
248
|
isConnected: boolean;
|
|
@@ -223,4 +266,4 @@ declare function useConnectionStatus(): {
|
|
|
223
266
|
datasourceMode: ConnectionMode;
|
|
224
267
|
};
|
|
225
268
|
|
|
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 };
|
|
269
|
+
export { BudokanProvider, type BudokanProviderProps, type UseActivityStatsResult, type UseLeaderboardResult, type UsePlayerRewardsResult, 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, usePlayerRewards, 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 { i as BudokanClientConfig, B as BudokanClient, T as Tournament, b as PaginatedResult, e as TournamentListParams, m as Phase, l as LeaderboardEntry, R as Registration, c as RewardClaim, d as RewardClaimSummary, g as PrizeStats, a as Prize, P as PrizeAggregation, Q as QualificationEntry, f as PlatformStats, o as WSEventMessage,
|
|
3
|
+
import { i as BudokanClientConfig, B as BudokanClient, T as Tournament, b as PaginatedResult, e as TournamentListParams, m as Phase, l as LeaderboardEntry, R as Registration, c as RewardClaim, d as RewardClaimSummary, g as PrizeStats, a as Prize, P as PrizeAggregation, Q as QualificationEntry, f as PlatformStats, o as PlayerRewards, q as WSEventMessage, p as WSChannel, C as ConnectionMode } from './player-C2GE9Lop.js';
|
|
4
4
|
import 'starknet';
|
|
5
5
|
import '@provable-games/metagame-sdk';
|
|
6
6
|
|
|
@@ -200,6 +200,49 @@ interface UseActivityStatsResult {
|
|
|
200
200
|
*/
|
|
201
201
|
declare function useActivityStats(): UseActivityStatsResult;
|
|
202
202
|
|
|
203
|
+
interface UsePlayerRewardsResult {
|
|
204
|
+
rewards: PlayerRewards | null;
|
|
205
|
+
loading: boolean;
|
|
206
|
+
error: Error | null;
|
|
207
|
+
refetch: () => Promise<void>;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Aggregate a player's placement/earnings data across finalized Budokan
|
|
211
|
+
* tournaments they currently hold tokens in.
|
|
212
|
+
*
|
|
213
|
+
* Composition:
|
|
214
|
+
*
|
|
215
|
+
* denshokan useTokens (current ownership)
|
|
216
|
+
* ↓ group by contextId (= tournament id)
|
|
217
|
+
* budokan useTournaments({ tournamentIds })
|
|
218
|
+
* ↓ filter to finalized
|
|
219
|
+
* for each finalized tournament (parallel):
|
|
220
|
+
* budokan getTournamentPrizes — full prize records
|
|
221
|
+
* budokan getTournamentRewardClaims — paginated, all pages
|
|
222
|
+
* denshokan getTokenRanks (bulk) — final ranks for owned tokens
|
|
223
|
+
* ↓ filter ranks to paid positions (max position derived from prizes
|
|
224
|
+
* + entry-fee distribution_count)
|
|
225
|
+
*
|
|
226
|
+
* Per-tournament failures are tolerated: a 5xx on one tournament's prize/
|
|
227
|
+
* claim/rank fetch skips that tournament and continues, rather than
|
|
228
|
+
* failing the whole hook. Failures are logged via `console.warn`.
|
|
229
|
+
*
|
|
230
|
+
* Why source ownership from denshokan: PR #243 dropped
|
|
231
|
+
* `registrations.player_address` because the indexed value goes stale on
|
|
232
|
+
* transfer. The contract keys registrations by token_id only, so the only
|
|
233
|
+
* trustworthy answer to "what tournaments has this wallet placed in" is
|
|
234
|
+
* to ask denshokan who currently holds Budokan-minted tokens.
|
|
235
|
+
*
|
|
236
|
+
* Staleness: the hook only re-fetches when the player's owned token set
|
|
237
|
+
* changes (transfers/new mints) or when the underlying tournament list
|
|
238
|
+
* changes. It does *not* observe time-based finalization transitions on
|
|
239
|
+
* its own — if a tournament's submission window closes while the
|
|
240
|
+
* consumer is mounted, call `refetch()` to pick up the new placement.
|
|
241
|
+
*
|
|
242
|
+
* Pass `undefined` to skip fetching.
|
|
243
|
+
*/
|
|
244
|
+
declare function usePlayerRewards(address: string | undefined): UsePlayerRewardsResult;
|
|
245
|
+
|
|
203
246
|
interface UseSubscriptionResult {
|
|
204
247
|
lastMessage: WSEventMessage | null;
|
|
205
248
|
isConnected: boolean;
|
|
@@ -223,4 +266,4 @@ declare function useConnectionStatus(): {
|
|
|
223
266
|
datasourceMode: ConnectionMode;
|
|
224
267
|
};
|
|
225
268
|
|
|
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 };
|
|
269
|
+
export { BudokanProvider, type BudokanProviderProps, type UseActivityStatsResult, type UseLeaderboardResult, type UsePlayerRewardsResult, 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, usePlayerRewards, usePrizeAggregation, usePrizeStats, usePrizes, useQualifications, useRegistrations, useRegistrationsByOwner, useRewardClaims, useRewardClaimsSummary, useSubscription, useTournament, useTournamentCount, useTournaments, useTournamentsByOwner, useTournamentsByOwnerCount };
|