@provable-games/budokan-sdk 0.1.16 → 0.1.18

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.
@@ -227,7 +227,7 @@ interface PaginatedResult<T> {
227
227
  offset: number;
228
228
  }
229
229
 
230
- type WSChannel = "tournaments" | "registrations" | "leaderboards" | "prizes" | "rewards" | "metrics";
230
+ type WSChannel = "tournaments" | "registrations" | "prizes" | "rewards" | "metrics";
231
231
  interface WSSubscribeMessage {
232
232
  type: "subscribe";
233
233
  channels: WSChannel[];
@@ -387,8 +387,10 @@ declare class BudokanClient {
387
387
  */
388
388
  getTournamentDistributionShares(tournamentId: string): Promise<number[]>;
389
389
  /**
390
- * Fetch the leaderboard for a tournament.
391
- * Supports RPC fallback when API is unavailable.
390
+ * Fetch the leaderboard for a tournament from the on-chain viewer
391
+ * contract. Live leaderboard data for UIs is best sourced via
392
+ * denshokan-sdk's `useLiveLeaderboard`; this method is kept for
393
+ * one-shot RPC reads (e.g. server-side scoring scripts).
392
394
  */
393
395
  getTournamentLeaderboard(tournamentId: string): Promise<LeaderboardEntry[]>;
394
396
  /**
@@ -500,4 +502,4 @@ declare class BudokanClient {
500
502
  */
501
503
  declare function createBudokanClient(config: BudokanClientConfig): BudokanClient;
502
504
 
503
- export { type ActivityParams as A, BudokanClient as B, type ConnectionMode as C, type DataSource as D, type GameConfig as G, type LeaderboardEntry as L, type PrizeAggregation as P, type QualificationEntry as Q, type Registration as R, type Schedule as S, type Tournament as T, type WSSubscribeOptions as W, type Prize as a, type PaginatedResult as b, type RewardClaim as c, type RewardClaimSummary as d, type TournamentListParams as e, type PlayerStats as f, type PlayerTournamentParams as g, type PlayerTournament as h, type PlatformStats as i, type ActivityEvent as j, type PrizeStats as k, type WSEventHandler as l, type BudokanClientConfig as m, ConnectionStatus as n, type ConnectionStatusState as o, type LeaderboardConfig as p, type Phase as q, type WSChannel as r, type WSEventMessage as s, type WSMessage as t, type WSSubscribeMessage as u, type WSUnsubscribeMessage as v, createBudokanClient as w };
505
+ export { type ActivityParams as A, BudokanClient as B, type ConnectionMode as C, type DataSource as D, type GameConfig as G, type LeaderboardConfig as L, type PrizeAggregation as P, type QualificationEntry as Q, type Registration as R, type Schedule as S, type Tournament as T, type WSSubscribeOptions as W, type Prize as a, type PaginatedResult as b, type RewardClaim as c, type RewardClaimSummary as d, type TournamentListParams as e, type PlayerStats as f, type PlayerTournamentParams as g, type PlayerTournament as h, type PlatformStats as i, type ActivityEvent as j, type PrizeStats as k, type WSEventHandler as l, type BudokanClientConfig as m, ConnectionStatus as n, type ConnectionStatusState as o, type LeaderboardEntry as p, type Phase as q, type WSChannel as r, type WSEventMessage as s, type WSMessage as t, type WSSubscribeMessage as u, type WSUnsubscribeMessage as v, createBudokanClient as w };
@@ -227,7 +227,7 @@ interface PaginatedResult<T> {
227
227
  offset: number;
228
228
  }
229
229
 
230
- type WSChannel = "tournaments" | "registrations" | "leaderboards" | "prizes" | "rewards" | "metrics";
230
+ type WSChannel = "tournaments" | "registrations" | "prizes" | "rewards" | "metrics";
231
231
  interface WSSubscribeMessage {
232
232
  type: "subscribe";
233
233
  channels: WSChannel[];
@@ -387,8 +387,10 @@ declare class BudokanClient {
387
387
  */
388
388
  getTournamentDistributionShares(tournamentId: string): Promise<number[]>;
389
389
  /**
390
- * Fetch the leaderboard for a tournament.
391
- * Supports RPC fallback when API is unavailable.
390
+ * Fetch the leaderboard for a tournament from the on-chain viewer
391
+ * contract. Live leaderboard data for UIs is best sourced via
392
+ * denshokan-sdk's `useLiveLeaderboard`; this method is kept for
393
+ * one-shot RPC reads (e.g. server-side scoring scripts).
392
394
  */
393
395
  getTournamentLeaderboard(tournamentId: string): Promise<LeaderboardEntry[]>;
394
396
  /**
@@ -500,4 +502,4 @@ declare class BudokanClient {
500
502
  */
501
503
  declare function createBudokanClient(config: BudokanClientConfig): BudokanClient;
502
504
 
503
- export { type ActivityParams as A, BudokanClient as B, type ConnectionMode as C, type DataSource as D, type GameConfig as G, type LeaderboardEntry as L, type PrizeAggregation as P, type QualificationEntry as Q, type Registration as R, type Schedule as S, type Tournament as T, type WSSubscribeOptions as W, type Prize as a, type PaginatedResult as b, type RewardClaim as c, type RewardClaimSummary as d, type TournamentListParams as e, type PlayerStats as f, type PlayerTournamentParams as g, type PlayerTournament as h, type PlatformStats as i, type ActivityEvent as j, type PrizeStats as k, type WSEventHandler as l, type BudokanClientConfig as m, ConnectionStatus as n, type ConnectionStatusState as o, type LeaderboardConfig as p, type Phase as q, type WSChannel as r, type WSEventMessage as s, type WSMessage as t, type WSSubscribeMessage as u, type WSUnsubscribeMessage as v, createBudokanClient as w };
505
+ export { type ActivityParams as A, BudokanClient as B, type ConnectionMode as C, type DataSource as D, type GameConfig as G, type LeaderboardConfig as L, type PrizeAggregation as P, type QualificationEntry as Q, type Registration as R, type Schedule as S, type Tournament as T, type WSSubscribeOptions as W, type Prize as a, type PaginatedResult as b, type RewardClaim as c, type RewardClaimSummary as d, type TournamentListParams as e, type PlayerStats as f, type PlayerTournamentParams as g, type PlayerTournament as h, type PlatformStats as i, type ActivityEvent as j, type PrizeStats as k, type WSEventHandler as l, type BudokanClientConfig as m, ConnectionStatus as n, type ConnectionStatusState as o, type LeaderboardEntry as p, type Phase as q, type WSChannel as r, type WSEventMessage as s, type WSMessage as t, type WSSubscribeMessage as u, type WSUnsubscribeMessage as v, createBudokanClient as w };
package/dist/index.cjs CHANGED
@@ -252,13 +252,6 @@ async function getTournament(baseUrl, tournamentId, ctx) {
252
252
  );
253
253
  return normalizeTournament(result.data);
254
254
  }
255
- async function getTournamentLeaderboard(baseUrl, tournamentId, ctx) {
256
- const result = await apiFetch(
257
- `${baseUrl}/tournaments/${tournamentId}/leaderboard`,
258
- fetchOpts(ctx)
259
- );
260
- return result.data.map((item) => snakeToCamel(item));
261
- }
262
255
  async function getTournamentRegistrations(baseUrl, tournamentId, params, ctx) {
263
256
  const qs = buildQueryString({
264
257
  player_address: params?.playerAddress,
@@ -600,15 +593,15 @@ var CHAINS = {
600
593
  rpcUrl: "https://api.cartridge.gg/x/starknet/mainnet/rpc/v0_10",
601
594
  apiBaseUrl: "https://budokan-api-production.up.railway.app",
602
595
  wsUrl: "wss://budokan-api-production.up.railway.app/ws",
603
- budokanAddress: "0x0765e6f07c1a5cebe08aba7f840741242dffb1ed77ac619120501f540ec9a52a",
604
- viewerAddress: "0x0232fb32bd06e38f3555000f255c01812198418d5fced3b6246900725bf2f4d1"
596
+ budokanAddress: "0x0596ced030e74ebc37f33607f07ecd5a62eff22cdc4ae31fe2d724040c1bdc0b",
597
+ viewerAddress: "0x013c8239361fdbd7ec26db2c83f4ff270c5bba83a0bc105b4005b676ff57fdbe"
605
598
  },
606
599
  sepolia: {
607
600
  rpcUrl: "https://starknet-sepolia.public.blastapi.io",
608
601
  apiBaseUrl: "https://budokan-api-sepolia.up.railway.app",
609
602
  wsUrl: "wss://budokan-api-sepolia.up.railway.app/ws",
610
- budokanAddress: "0x0105573bf9184f0a3da78dda70a87055e6aafc7b3fb6e331732a0d25675b7be5",
611
- viewerAddress: "0x0414fe2f48db1e3598a83f017d17b4d06cec180b160141fea9244054267c1ff1"
603
+ budokanAddress: "0x017750a167b7c4968249d7db06dccc8b3908ef8954cb40cfe4d3c651ca0dcd1d",
604
+ viewerAddress: "0x03d5febe0042b943967074f4ebd850a6b5d50850cd3fb84fbd0eb66dadd9ddec"
612
605
  }
613
606
  };
614
607
  function getChainConfig(chain) {
@@ -4510,22 +4503,14 @@ var BudokanClient = class {
4510
4503
  return budokanTournamentDistributionShares(contract, tournamentId);
4511
4504
  }
4512
4505
  /**
4513
- * Fetch the leaderboard for a tournament.
4514
- * Supports RPC fallback when API is unavailable.
4506
+ * Fetch the leaderboard for a tournament from the on-chain viewer
4507
+ * contract. Live leaderboard data for UIs is best sourced via
4508
+ * denshokan-sdk's `useLiveLeaderboard`; this method is kept for
4509
+ * one-shot RPC reads (e.g. server-side scoring scripts).
4515
4510
  */
4516
4511
  async getTournamentLeaderboard(tournamentId) {
4517
- const rpcFallback = async () => {
4518
- const contract = await this.getViewerContract();
4519
- return viewerLeaderboard(contract, tournamentId, 0, 1e3);
4520
- };
4521
- if (this.resolvedConfig.primarySource === "rpc") {
4522
- return rpcFallback();
4523
- }
4524
- return withFallback(
4525
- () => getTournamentLeaderboard(this.resolvedConfig.apiBaseUrl, tournamentId, this.apiCtx),
4526
- rpcFallback,
4527
- this.connectionStatus
4528
- );
4512
+ const contract = await this.getViewerContract();
4513
+ return viewerLeaderboard(contract, tournamentId, 0, 1e3);
4529
4514
  }
4530
4515
  /**
4531
4516
  * Fetch registrations for a tournament.
@@ -4791,7 +4776,6 @@ exports.getPlayerStats = getPlayerStats;
4791
4776
  exports.getPlayerTournaments = getPlayerTournaments;
4792
4777
  exports.getPrizeStats = getPrizeStats;
4793
4778
  exports.getTournament = getTournament;
4794
- exports.getTournamentLeaderboard = getTournamentLeaderboard;
4795
4779
  exports.getTournamentPrizeAggregation = getTournamentPrizeAggregation;
4796
4780
  exports.getTournamentPrizes = getTournamentPrizes;
4797
4781
  exports.getTournamentQualifications = getTournamentQualifications;