@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.
@@ -56,7 +56,18 @@ interface Tournament {
56
56
  hasEntryRequirement: boolean | null;
57
57
  schedule: Schedule | null;
58
58
  gameConfig: GameConfig | null;
59
+ /** Built-in entry fee (EntryFeeKind::BuiltIn). Null for free OR extension-fee tournaments. */
59
60
  entryFee: EntryFee | null;
61
+ /**
62
+ * Discriminates the on-chain `EntryFeeKind`: `"builtin"` (see `entryFee`),
63
+ * `"extension"` (see `entryFeeExtension`), or `null` when there's no fee.
64
+ */
65
+ entryFeeKind: "builtin" | "extension" | null;
66
+ /** External entry-fee extension (EntryFeeKind::Extension). Set only when entryFeeKind === "extension". */
67
+ entryFeeExtension: {
68
+ address: string;
69
+ config: string[];
70
+ } | null;
60
71
  entryRequirement: EntryRequirement | null;
61
72
  leaderboardConfig: LeaderboardConfig | null;
62
73
  entryCount: number;
@@ -156,8 +167,14 @@ interface Prize {
156
167
  prizeId: string;
157
168
  tournamentId: string;
158
169
  payoutPosition: number;
159
- tokenAddress: string;
160
- tokenType: "erc20" | "erc721";
170
+ /** Token contract for built-in prizes; `null` for `tokenType === "extension"`. */
171
+ tokenAddress: string | null;
172
+ /**
173
+ * `erc20` / `erc721` are built-in token prizes. `extension` is an external
174
+ * `IPrizeExtension` prize (the #269 path): the token fields below are null
175
+ * and `extensionAddress` / `extensionConfig` are populated instead.
176
+ */
177
+ tokenType: "erc20" | "erc721" | "extension";
161
178
  amount: string | null;
162
179
  tokenId: string | null;
163
180
  distributionType: string | null;
@@ -167,6 +184,10 @@ interface Prize {
167
184
  distributionShares: number[] | null;
168
185
  distributionCount: number | null;
169
186
  sponsorAddress: string;
187
+ /** Extension contract address; only set when `tokenType === "extension"`. */
188
+ extensionAddress: string | null;
189
+ /** Opaque `Span<felt252>` config; only set when `tokenType === "extension"`. */
190
+ extensionConfig: string[] | null;
170
191
  }
171
192
  /**
172
193
  * Discriminator for `RewardClaim.claimKind`. Picks one of the six terminal
@@ -175,11 +196,11 @@ interface Prize {
175
196
  * variant-specific fields below are populated only for the kinds that carry
176
197
  * them; the two pure-marker creator kinds leave all four nullable fields null.
177
198
  */
178
- type RewardClaimKind = "prize_single" | "prize_distributed" | "entry_fee_position" | "entry_fee_tournament_creator" | "entry_fee_game_creator" | "entry_fee_refund";
199
+ type RewardClaimKind = "prize_single" | "prize_distributed" | "entry_fee_position" | "entry_fee_tournament_creator" | "entry_fee_game_creator" | "entry_fee_refund" | "prize_extension" | "entry_fee_extension";
179
200
  interface RewardClaim {
180
201
  tournamentId: string;
181
202
  claimKind: RewardClaimKind;
182
- /** Populated for `prize_single` and `prize_distributed`. Stringified u64. */
203
+ /** Populated for `prize_single`, `prize_distributed`, `prize_extension`. Stringified u64. */
183
204
  prizeId: string | null;
184
205
  /** Populated for `prize_distributed`. */
185
206
  payoutIndex: number | null;
@@ -187,6 +208,10 @@ interface RewardClaim {
187
208
  position: number | null;
188
209
  /** Populated for `entry_fee_refund`. felt252 hex string of the game token. */
189
210
  refundTokenId: string | null;
211
+ /** Game token id, for `prize_extension` / `entry_fee_extension` (Option → null when absent). */
212
+ extensionTokenId: string | null;
213
+ /** Opaque payout/claim params (`Span<felt252>`), for the extension claim kinds. */
214
+ extensionParams: string[] | null;
190
215
  claimed: boolean;
191
216
  }
192
217
  interface PrizeAggregation {
@@ -482,4 +507,39 @@ declare class BudokanClient {
482
507
  */
483
508
  declare function createBudokanClient(config: BudokanClientConfig): BudokanClient;
484
509
 
485
- export { 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 PlatformStats as f, type PrizeStats as g, type WSEventHandler as h, type BudokanClientConfig as i, ConnectionStatus as j, type ConnectionStatusState as k, type LeaderboardEntry as l, type Phase as m, type WSChannel as n, type WSEventMessage as o, type WSMessage as p, type WSSubscribeMessage as q, type WSUnsubscribeMessage as r, createBudokanClient as s };
510
+ /**
511
+ * One row per (player token, tournament) where the token's final rank fell
512
+ * inside a paid position. Multiple placements per tournament are possible
513
+ * when the player owns several tokens entered into the same tournament.
514
+ */
515
+ interface PlayerPlacement {
516
+ tournamentId: string;
517
+ tokenId: string;
518
+ /** 1-indexed rank in the tournament's final leaderboard. */
519
+ position: number;
520
+ /** Token's final score as a decimal string (preserves felt252 precision). */
521
+ score: string;
522
+ }
523
+ /**
524
+ * Aggregate rewards summary for a player address. Computed against current
525
+ * NFT ownership (denshokan), not historical attribution — see PR #243.
526
+ *
527
+ * `tournaments`, `prizes`, and `rewardClaims` are restricted to tournaments
528
+ * where the player has at least one placement. Consumers compute USD values
529
+ * by walking placements + prize/entry-fee data + token prices client-side.
530
+ */
531
+ interface PlayerRewards {
532
+ /** Count of placements that landed on a paid position. */
533
+ wins: number;
534
+ /** Lowest position number across all placements; null when no wins. */
535
+ bestPlacement: number | null;
536
+ placements: PlayerPlacement[];
537
+ /** Tournaments where the player placed (subset of currently-held entries). */
538
+ tournaments: Tournament[];
539
+ /** All sponsored prizes for those tournaments. */
540
+ prizes: Prize[];
541
+ /** All reward claims for those tournaments. */
542
+ rewardClaims: RewardClaim[];
543
+ }
544
+
545
+ export { 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 PlatformStats as f, type PrizeStats as g, type WSEventHandler as h, type BudokanClientConfig as i, ConnectionStatus as j, type ConnectionStatusState as k, type LeaderboardEntry as l, type Phase as m, type PlayerPlacement as n, type PlayerRewards as o, type WSChannel as p, type WSEventMessage as q, type WSMessage as r, type WSSubscribeMessage as s, type WSUnsubscribeMessage as t, createBudokanClient as u };
@@ -56,7 +56,18 @@ interface Tournament {
56
56
  hasEntryRequirement: boolean | null;
57
57
  schedule: Schedule | null;
58
58
  gameConfig: GameConfig | null;
59
+ /** Built-in entry fee (EntryFeeKind::BuiltIn). Null for free OR extension-fee tournaments. */
59
60
  entryFee: EntryFee | null;
61
+ /**
62
+ * Discriminates the on-chain `EntryFeeKind`: `"builtin"` (see `entryFee`),
63
+ * `"extension"` (see `entryFeeExtension`), or `null` when there's no fee.
64
+ */
65
+ entryFeeKind: "builtin" | "extension" | null;
66
+ /** External entry-fee extension (EntryFeeKind::Extension). Set only when entryFeeKind === "extension". */
67
+ entryFeeExtension: {
68
+ address: string;
69
+ config: string[];
70
+ } | null;
60
71
  entryRequirement: EntryRequirement | null;
61
72
  leaderboardConfig: LeaderboardConfig | null;
62
73
  entryCount: number;
@@ -156,8 +167,14 @@ interface Prize {
156
167
  prizeId: string;
157
168
  tournamentId: string;
158
169
  payoutPosition: number;
159
- tokenAddress: string;
160
- tokenType: "erc20" | "erc721";
170
+ /** Token contract for built-in prizes; `null` for `tokenType === "extension"`. */
171
+ tokenAddress: string | null;
172
+ /**
173
+ * `erc20` / `erc721` are built-in token prizes. `extension` is an external
174
+ * `IPrizeExtension` prize (the #269 path): the token fields below are null
175
+ * and `extensionAddress` / `extensionConfig` are populated instead.
176
+ */
177
+ tokenType: "erc20" | "erc721" | "extension";
161
178
  amount: string | null;
162
179
  tokenId: string | null;
163
180
  distributionType: string | null;
@@ -167,6 +184,10 @@ interface Prize {
167
184
  distributionShares: number[] | null;
168
185
  distributionCount: number | null;
169
186
  sponsorAddress: string;
187
+ /** Extension contract address; only set when `tokenType === "extension"`. */
188
+ extensionAddress: string | null;
189
+ /** Opaque `Span<felt252>` config; only set when `tokenType === "extension"`. */
190
+ extensionConfig: string[] | null;
170
191
  }
171
192
  /**
172
193
  * Discriminator for `RewardClaim.claimKind`. Picks one of the six terminal
@@ -175,11 +196,11 @@ interface Prize {
175
196
  * variant-specific fields below are populated only for the kinds that carry
176
197
  * them; the two pure-marker creator kinds leave all four nullable fields null.
177
198
  */
178
- type RewardClaimKind = "prize_single" | "prize_distributed" | "entry_fee_position" | "entry_fee_tournament_creator" | "entry_fee_game_creator" | "entry_fee_refund";
199
+ type RewardClaimKind = "prize_single" | "prize_distributed" | "entry_fee_position" | "entry_fee_tournament_creator" | "entry_fee_game_creator" | "entry_fee_refund" | "prize_extension" | "entry_fee_extension";
179
200
  interface RewardClaim {
180
201
  tournamentId: string;
181
202
  claimKind: RewardClaimKind;
182
- /** Populated for `prize_single` and `prize_distributed`. Stringified u64. */
203
+ /** Populated for `prize_single`, `prize_distributed`, `prize_extension`. Stringified u64. */
183
204
  prizeId: string | null;
184
205
  /** Populated for `prize_distributed`. */
185
206
  payoutIndex: number | null;
@@ -187,6 +208,10 @@ interface RewardClaim {
187
208
  position: number | null;
188
209
  /** Populated for `entry_fee_refund`. felt252 hex string of the game token. */
189
210
  refundTokenId: string | null;
211
+ /** Game token id, for `prize_extension` / `entry_fee_extension` (Option → null when absent). */
212
+ extensionTokenId: string | null;
213
+ /** Opaque payout/claim params (`Span<felt252>`), for the extension claim kinds. */
214
+ extensionParams: string[] | null;
190
215
  claimed: boolean;
191
216
  }
192
217
  interface PrizeAggregation {
@@ -482,4 +507,39 @@ declare class BudokanClient {
482
507
  */
483
508
  declare function createBudokanClient(config: BudokanClientConfig): BudokanClient;
484
509
 
485
- export { 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 PlatformStats as f, type PrizeStats as g, type WSEventHandler as h, type BudokanClientConfig as i, ConnectionStatus as j, type ConnectionStatusState as k, type LeaderboardEntry as l, type Phase as m, type WSChannel as n, type WSEventMessage as o, type WSMessage as p, type WSSubscribeMessage as q, type WSUnsubscribeMessage as r, createBudokanClient as s };
510
+ /**
511
+ * One row per (player token, tournament) where the token's final rank fell
512
+ * inside a paid position. Multiple placements per tournament are possible
513
+ * when the player owns several tokens entered into the same tournament.
514
+ */
515
+ interface PlayerPlacement {
516
+ tournamentId: string;
517
+ tokenId: string;
518
+ /** 1-indexed rank in the tournament's final leaderboard. */
519
+ position: number;
520
+ /** Token's final score as a decimal string (preserves felt252 precision). */
521
+ score: string;
522
+ }
523
+ /**
524
+ * Aggregate rewards summary for a player address. Computed against current
525
+ * NFT ownership (denshokan), not historical attribution — see PR #243.
526
+ *
527
+ * `tournaments`, `prizes`, and `rewardClaims` are restricted to tournaments
528
+ * where the player has at least one placement. Consumers compute USD values
529
+ * by walking placements + prize/entry-fee data + token prices client-side.
530
+ */
531
+ interface PlayerRewards {
532
+ /** Count of placements that landed on a paid position. */
533
+ wins: number;
534
+ /** Lowest position number across all placements; null when no wins. */
535
+ bestPlacement: number | null;
536
+ placements: PlayerPlacement[];
537
+ /** Tournaments where the player placed (subset of currently-held entries). */
538
+ tournaments: Tournament[];
539
+ /** All sponsored prizes for those tournaments. */
540
+ prizes: Prize[];
541
+ /** All reward claims for those tournaments. */
542
+ rewardClaims: RewardClaim[];
543
+ }
544
+
545
+ export { 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 PlatformStats as f, type PrizeStats as g, type WSEventHandler as h, type BudokanClientConfig as i, ConnectionStatus as j, type ConnectionStatusState as k, type LeaderboardEntry as l, type Phase as m, type PlayerPlacement as n, type PlayerRewards as o, type WSChannel as p, type WSEventMessage as q, type WSMessage as r, type WSSubscribeMessage as s, type WSUnsubscribeMessage as t, createBudokanClient as u };