@provable-games/budokan-sdk 0.1.25 → 0.1.26

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 { j as BudokanClientConfig, B as BudokanClient, T as Tournament, b as PaginatedResult, e as TournamentListParams, p as Phase, o 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, r as PlayerRewards, t as WSEventMessage, s as WSChannel, C as ConnectionMode } from './player-P6Dd1lNb.cjs';
3
+ import { l as BudokanClientConfig, B as BudokanClient, T as Tournament, b as PaginatedResult, e as TournamentListParams, k as Phase, q 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, r as PlayerRewards, t as WSEventMessage, s as WSChannel, C as ConnectionMode } from './player-CbAYHoW8.cjs';
4
4
  import 'starknet';
5
5
  import '@provable-games/metagame-sdk';
6
6
 
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 { j as BudokanClientConfig, B as BudokanClient, T as Tournament, b as PaginatedResult, e as TournamentListParams, p as Phase, o 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, r as PlayerRewards, t as WSEventMessage, s as WSChannel, C as ConnectionMode } from './player-P6Dd1lNb.js';
3
+ import { l as BudokanClientConfig, B as BudokanClient, T as Tournament, b as PaginatedResult, e as TournamentListParams, k as Phase, q 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, r as PlayerRewards, t as WSEventMessage, s as WSChannel, C as ConnectionMode } from './player-CbAYHoW8.js';
4
4
  import 'starknet';
5
5
  import '@provable-games/metagame-sdk';
6
6
 
package/dist/react.js CHANGED
@@ -197,12 +197,37 @@ function snakeToCamel(obj) {
197
197
  return obj;
198
198
  }
199
199
 
200
+ // src/phase/index.ts
201
+ function tournamentPhase(t, nowSeconds) {
202
+ const createdAt = Number(t.createdAtOnchain ?? NaN);
203
+ if (!Number.isFinite(createdAt)) return null;
204
+ const regStartDelay = Number(t.registrationStartDelay ?? t.schedule?.registrationStartDelay ?? 0);
205
+ const regEndDelay = Number(t.registrationEndDelay ?? t.schedule?.registrationEndDelay ?? 0);
206
+ const gameStartDelay = Number(t.gameStartDelay ?? t.schedule?.gameStartDelay ?? 0);
207
+ const gameEndDelay = Number(t.gameEndDelay ?? t.schedule?.gameEndDelay ?? 0);
208
+ const submissionDuration = Number(t.submissionDuration ?? t.schedule?.submissionDuration ?? 0);
209
+ const now = Math.floor(Date.now() / 1e3);
210
+ const hasReg = regStartDelay > 0 || regEndDelay > 0;
211
+ const regStart = createdAt + regStartDelay;
212
+ const regEnd = regStart + regEndDelay;
213
+ const gameStart = createdAt + gameStartDelay;
214
+ const gameEnd = gameStart + gameEndDelay;
215
+ const subEnd = gameEnd + submissionDuration;
216
+ if (hasReg && now < regStart) return "scheduled";
217
+ if (hasReg && now < regEnd) return "registration";
218
+ if (now < gameStart) return "staging";
219
+ if (now < gameEnd) return "live";
220
+ if (now < subEnd) return "submission";
221
+ return "finalized";
222
+ }
223
+
200
224
  // src/api/tournaments.ts
201
225
  function normalizeTournament(raw) {
202
226
  const t = snakeToCamel(raw);
203
227
  const id = t.id ?? t.tournamentId;
204
228
  const protocolFeeShare = t.protocolFeeShare ?? t.entryFee?.protocolFeeShare ?? null;
205
- return { ...t, id, tournamentId: id, protocolFeeShare };
229
+ const phase = t.phase ?? tournamentPhase(t);
230
+ return { ...t, id, tournamentId: id, protocolFeeShare, phase };
206
231
  }
207
232
  function fetchOpts(ctx) {
208
233
  return {
@@ -527,7 +552,7 @@ var WSManager = class {
527
552
  // src/chains/constants.ts
528
553
  var CHAINS = {
529
554
  mainnet: {
530
- rpcUrl: "https://api.cartridge.gg/x/starknet/mainnet/rpc/v0_10",
555
+ rpcUrl: "https://rpc.provable.games/rpc",
531
556
  apiBaseUrl: "https://budokan-api-production.up.railway.app",
532
557
  wsUrl: "wss://budokan-api-production.up.railway.app/ws",
533
558
  budokanAddress: "0x0596ced030e74ebc37f33607f07ecd5a62eff22cdc4ae31fe2d724040c1bdc0b",
@@ -927,6 +952,14 @@ function parseTournament(raw, entryCount, protocolFeeShare = null) {
927
952
  entryFeeExtension,
928
953
  entryRequirement,
929
954
  leaderboardConfig: { ascending, gameMustBeOver },
955
+ phase: tournamentPhase({
956
+ createdAtOnchain: createdAtStr,
957
+ registrationStartDelay,
958
+ registrationEndDelay,
959
+ gameStartDelay,
960
+ gameEndDelay,
961
+ submissionDuration
962
+ }),
930
963
  entryCount,
931
964
  prizeCount: 0,
932
965
  // Not available from viewer