@provable-games/budokan-sdk 0.1.17 → 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.
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { T as Tournament, L as LeaderboardEntry, P as PrizeAggregation, a as Prize, b as PaginatedResult, Q as QualificationEntry, R as Registration, c as RewardClaim, d as RewardClaimSummary, e as TournamentListParams, f as PlayerStats, g as PlayerTournamentParams, h as PlayerTournament, i as PlatformStats, A as ActivityParams, j as ActivityEvent, k as PrizeStats, W as WSSubscribeOptions, l as WSEventHandler } from './client-CP4dxHGv.cjs';
2
- export { B as BudokanClient, m as BudokanClientConfig, C as ConnectionMode, n as ConnectionStatus, o as ConnectionStatusState, D as DataSource, G as GameConfig, p as LeaderboardConfig, q as Phase, S as Schedule, r as WSChannel, s as WSEventMessage, t as WSMessage, u as WSSubscribeMessage, v as WSUnsubscribeMessage, w as createBudokanClient } from './client-CP4dxHGv.cjs';
1
+ import { T as Tournament, P as PrizeAggregation, a as Prize, b as PaginatedResult, Q as QualificationEntry, R as Registration, c as RewardClaim, d as RewardClaimSummary, e as TournamentListParams, f as PlayerStats, g as PlayerTournamentParams, h as PlayerTournament, i as PlatformStats, A as ActivityParams, j as ActivityEvent, k as PrizeStats, W as WSSubscribeOptions, l as WSEventHandler } from './client-C4PUxzuO.cjs';
2
+ export { B as BudokanClient, m as BudokanClientConfig, C as ConnectionMode, n as ConnectionStatus, o as ConnectionStatusState, D as DataSource, G as GameConfig, L as LeaderboardConfig, p as LeaderboardEntry, q as Phase, S as Schedule, r as WSChannel, s as WSEventMessage, t as WSMessage, u as WSSubscribeMessage, v as WSUnsubscribeMessage, w as createBudokanClient } from './client-C4PUxzuO.cjs';
3
3
  export { EntryFee } from '@provable-games/metagame-sdk';
4
4
  import 'starknet';
5
5
 
@@ -44,10 +44,6 @@ declare function getTournaments(baseUrl: string, params?: TournamentListParams,
44
44
  * Fetch a single tournament by ID.
45
45
  */
46
46
  declare function getTournament(baseUrl: string, tournamentId: string, ctx?: ApiContext$3): Promise<Tournament>;
47
- /**
48
- * Fetch the leaderboard for a tournament.
49
- */
50
- declare function getTournamentLeaderboard(baseUrl: string, tournamentId: string, ctx?: ApiContext$3): Promise<LeaderboardEntry[]>;
51
47
  /**
52
48
  * Fetch registrations for a tournament.
53
49
  */
@@ -208,4 +204,4 @@ interface ChainConfig {
208
204
  declare const CHAINS: Record<string, ChainConfig>;
209
205
  declare function getChainConfig(chain: string): ChainConfig | undefined;
210
206
 
211
- export { ActivityEvent, ActivityParams, BudokanApiError, BudokanConnectionError, BudokanError, BudokanTimeoutError, CHAINS, type ChainConfig, DataSourceError, LeaderboardEntry, PaginatedResult, PlatformStats, PlayerStats, PlayerTournament, PlayerTournamentParams, Prize, PrizeAggregation, PrizeStats, QualificationEntry, Registration, RewardClaim, RewardClaimSummary, RpcError, Tournament, TournamentListParams, TournamentNotFoundError, WSEventHandler, WSManager, WSSubscribeOptions, camelToSnake, getActivity, getActivityStats, getChainConfig, getGameStats, getGameTournaments, getPlayerStats, getPlayerTournaments, getPrizeStats, getTournament, getTournamentLeaderboard, getTournamentPrizeAggregation, getTournamentPrizes, getTournamentQualifications, getTournamentRegistrations, getTournamentRewardClaims, getTournamentRewardClaimsSummary, getTournaments, normalizeAddress, snakeToCamel, withRetry };
207
+ export { ActivityEvent, ActivityParams, BudokanApiError, BudokanConnectionError, BudokanError, BudokanTimeoutError, CHAINS, type ChainConfig, DataSourceError, PaginatedResult, PlatformStats, PlayerStats, PlayerTournament, PlayerTournamentParams, Prize, PrizeAggregation, PrizeStats, QualificationEntry, Registration, RewardClaim, RewardClaimSummary, RpcError, Tournament, TournamentListParams, TournamentNotFoundError, WSEventHandler, WSManager, WSSubscribeOptions, camelToSnake, getActivity, getActivityStats, getChainConfig, getGameStats, getGameTournaments, getPlayerStats, getPlayerTournaments, getPrizeStats, getTournament, getTournamentPrizeAggregation, getTournamentPrizes, getTournamentQualifications, getTournamentRegistrations, getTournamentRewardClaims, getTournamentRewardClaimsSummary, getTournaments, normalizeAddress, snakeToCamel, withRetry };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { T as Tournament, L as LeaderboardEntry, P as PrizeAggregation, a as Prize, b as PaginatedResult, Q as QualificationEntry, R as Registration, c as RewardClaim, d as RewardClaimSummary, e as TournamentListParams, f as PlayerStats, g as PlayerTournamentParams, h as PlayerTournament, i as PlatformStats, A as ActivityParams, j as ActivityEvent, k as PrizeStats, W as WSSubscribeOptions, l as WSEventHandler } from './client-CP4dxHGv.js';
2
- export { B as BudokanClient, m as BudokanClientConfig, C as ConnectionMode, n as ConnectionStatus, o as ConnectionStatusState, D as DataSource, G as GameConfig, p as LeaderboardConfig, q as Phase, S as Schedule, r as WSChannel, s as WSEventMessage, t as WSMessage, u as WSSubscribeMessage, v as WSUnsubscribeMessage, w as createBudokanClient } from './client-CP4dxHGv.js';
1
+ import { T as Tournament, P as PrizeAggregation, a as Prize, b as PaginatedResult, Q as QualificationEntry, R as Registration, c as RewardClaim, d as RewardClaimSummary, e as TournamentListParams, f as PlayerStats, g as PlayerTournamentParams, h as PlayerTournament, i as PlatformStats, A as ActivityParams, j as ActivityEvent, k as PrizeStats, W as WSSubscribeOptions, l as WSEventHandler } from './client-C4PUxzuO.js';
2
+ export { B as BudokanClient, m as BudokanClientConfig, C as ConnectionMode, n as ConnectionStatus, o as ConnectionStatusState, D as DataSource, G as GameConfig, L as LeaderboardConfig, p as LeaderboardEntry, q as Phase, S as Schedule, r as WSChannel, s as WSEventMessage, t as WSMessage, u as WSSubscribeMessage, v as WSUnsubscribeMessage, w as createBudokanClient } from './client-C4PUxzuO.js';
3
3
  export { EntryFee } from '@provable-games/metagame-sdk';
4
4
  import 'starknet';
5
5
 
@@ -44,10 +44,6 @@ declare function getTournaments(baseUrl: string, params?: TournamentListParams,
44
44
  * Fetch a single tournament by ID.
45
45
  */
46
46
  declare function getTournament(baseUrl: string, tournamentId: string, ctx?: ApiContext$3): Promise<Tournament>;
47
- /**
48
- * Fetch the leaderboard for a tournament.
49
- */
50
- declare function getTournamentLeaderboard(baseUrl: string, tournamentId: string, ctx?: ApiContext$3): Promise<LeaderboardEntry[]>;
51
47
  /**
52
48
  * Fetch registrations for a tournament.
53
49
  */
@@ -208,4 +204,4 @@ interface ChainConfig {
208
204
  declare const CHAINS: Record<string, ChainConfig>;
209
205
  declare function getChainConfig(chain: string): ChainConfig | undefined;
210
206
 
211
- export { ActivityEvent, ActivityParams, BudokanApiError, BudokanConnectionError, BudokanError, BudokanTimeoutError, CHAINS, type ChainConfig, DataSourceError, LeaderboardEntry, PaginatedResult, PlatformStats, PlayerStats, PlayerTournament, PlayerTournamentParams, Prize, PrizeAggregation, PrizeStats, QualificationEntry, Registration, RewardClaim, RewardClaimSummary, RpcError, Tournament, TournamentListParams, TournamentNotFoundError, WSEventHandler, WSManager, WSSubscribeOptions, camelToSnake, getActivity, getActivityStats, getChainConfig, getGameStats, getGameTournaments, getPlayerStats, getPlayerTournaments, getPrizeStats, getTournament, getTournamentLeaderboard, getTournamentPrizeAggregation, getTournamentPrizes, getTournamentQualifications, getTournamentRegistrations, getTournamentRewardClaims, getTournamentRewardClaimsSummary, getTournaments, normalizeAddress, snakeToCamel, withRetry };
207
+ export { ActivityEvent, ActivityParams, BudokanApiError, BudokanConnectionError, BudokanError, BudokanTimeoutError, CHAINS, type ChainConfig, DataSourceError, PaginatedResult, PlatformStats, PlayerStats, PlayerTournament, PlayerTournamentParams, Prize, PrizeAggregation, PrizeStats, QualificationEntry, Registration, RewardClaim, RewardClaimSummary, RpcError, Tournament, TournamentListParams, TournamentNotFoundError, WSEventHandler, WSManager, WSSubscribeOptions, camelToSnake, getActivity, getActivityStats, getChainConfig, getGameStats, getGameTournaments, getPlayerStats, getPlayerTournaments, getPrizeStats, getTournament, getTournamentPrizeAggregation, getTournamentPrizes, getTournamentQualifications, getTournamentRegistrations, getTournamentRewardClaims, getTournamentRewardClaimsSummary, getTournaments, normalizeAddress, snakeToCamel, withRetry };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { CairoCustomEnum, num } from 'starknet';
1
+ import { num, CairoCustomEnum } from 'starknet';
2
2
 
3
3
  // src/errors/index.ts
4
4
  var BudokanError = class extends Error {
@@ -250,13 +250,6 @@ async function getTournament(baseUrl, tournamentId, ctx) {
250
250
  );
251
251
  return normalizeTournament(result.data);
252
252
  }
253
- async function getTournamentLeaderboard(baseUrl, tournamentId, ctx) {
254
- const result = await apiFetch(
255
- `${baseUrl}/tournaments/${tournamentId}/leaderboard`,
256
- fetchOpts(ctx)
257
- );
258
- return result.data.map((item) => snakeToCamel(item));
259
- }
260
253
  async function getTournamentRegistrations(baseUrl, tournamentId, params, ctx) {
261
254
  const qs = buildQueryString({
262
255
  player_address: params?.playerAddress,
@@ -598,15 +591,15 @@ var CHAINS = {
598
591
  rpcUrl: "https://api.cartridge.gg/x/starknet/mainnet/rpc/v0_10",
599
592
  apiBaseUrl: "https://budokan-api-production.up.railway.app",
600
593
  wsUrl: "wss://budokan-api-production.up.railway.app/ws",
601
- budokanAddress: "0x00f4941e73cc38f67f79ae1f7cdae48f28ca5a6c0e013f6136818e777f61c6ee",
602
- viewerAddress: "0x027c264f4417dfd25d0626bce7304e9b3140ab06afeaf639b2678d2a05f1beb3"
594
+ budokanAddress: "0x0596ced030e74ebc37f33607f07ecd5a62eff22cdc4ae31fe2d724040c1bdc0b",
595
+ viewerAddress: "0x013c8239361fdbd7ec26db2c83f4ff270c5bba83a0bc105b4005b676ff57fdbe"
603
596
  },
604
597
  sepolia: {
605
598
  rpcUrl: "https://starknet-sepolia.public.blastapi.io",
606
599
  apiBaseUrl: "https://budokan-api-sepolia.up.railway.app",
607
600
  wsUrl: "wss://budokan-api-sepolia.up.railway.app/ws",
608
- budokanAddress: "0x0169083e63f3caff2c15f83eb238b1f4ab8f74903c0e6b5d433b448972c578d4",
609
- viewerAddress: "0x02cc4473948170cf42c2f3abc6391fd4401650375ee8e4661b7b6966cda4f15e"
601
+ budokanAddress: "0x017750a167b7c4968249d7db06dccc8b3908ef8954cb40cfe4d3c651ca0dcd1d",
602
+ viewerAddress: "0x03d5febe0042b943967074f4ebd850a6b5d50850cd3fb84fbd0eb66dadd9ddec"
610
603
  }
611
604
  };
612
605
  function getChainConfig(chain) {
@@ -4508,22 +4501,14 @@ var BudokanClient = class {
4508
4501
  return budokanTournamentDistributionShares(contract, tournamentId);
4509
4502
  }
4510
4503
  /**
4511
- * Fetch the leaderboard for a tournament.
4512
- * Supports RPC fallback when API is unavailable.
4504
+ * Fetch the leaderboard for a tournament from the on-chain viewer
4505
+ * contract. Live leaderboard data for UIs is best sourced via
4506
+ * denshokan-sdk's `useLiveLeaderboard`; this method is kept for
4507
+ * one-shot RPC reads (e.g. server-side scoring scripts).
4513
4508
  */
4514
4509
  async getTournamentLeaderboard(tournamentId) {
4515
- const rpcFallback = async () => {
4516
- const contract = await this.getViewerContract();
4517
- return viewerLeaderboard(contract, tournamentId, 0, 1e3);
4518
- };
4519
- if (this.resolvedConfig.primarySource === "rpc") {
4520
- return rpcFallback();
4521
- }
4522
- return withFallback(
4523
- () => getTournamentLeaderboard(this.resolvedConfig.apiBaseUrl, tournamentId, this.apiCtx),
4524
- rpcFallback,
4525
- this.connectionStatus
4526
- );
4510
+ const contract = await this.getViewerContract();
4511
+ return viewerLeaderboard(contract, tournamentId, 0, 1e3);
4527
4512
  }
4528
4513
  /**
4529
4514
  * Fetch registrations for a tournament.
@@ -4767,6 +4752,6 @@ function createBudokanClient(config) {
4767
4752
  return new BudokanClient(config);
4768
4753
  }
4769
4754
 
4770
- export { BudokanApiError, BudokanClient, BudokanConnectionError, BudokanError, BudokanTimeoutError, CHAINS, ConnectionStatus, DataSourceError, RpcError, TournamentNotFoundError, WSManager, camelToSnake, createBudokanClient, getActivity, getActivityStats, getChainConfig, getGameStats, getGameTournaments, getPlayerStats, getPlayerTournaments, getPrizeStats, getTournament, getTournamentLeaderboard, getTournamentPrizeAggregation, getTournamentPrizes, getTournamentQualifications, getTournamentRegistrations, getTournamentRewardClaims, getTournamentRewardClaimsSummary, getTournaments, normalizeAddress, snakeToCamel, withRetry };
4755
+ export { BudokanApiError, BudokanClient, BudokanConnectionError, BudokanError, BudokanTimeoutError, CHAINS, ConnectionStatus, DataSourceError, RpcError, TournamentNotFoundError, WSManager, camelToSnake, createBudokanClient, getActivity, getActivityStats, getChainConfig, getGameStats, getGameTournaments, getPlayerStats, getPlayerTournaments, getPrizeStats, getTournament, getTournamentPrizeAggregation, getTournamentPrizes, getTournamentQualifications, getTournamentRegistrations, getTournamentRewardClaims, getTournamentRewardClaimsSummary, getTournaments, normalizeAddress, snakeToCamel, withRetry };
4771
4756
  //# sourceMappingURL=index.js.map
4772
4757
  //# sourceMappingURL=index.js.map