@provable-games/budokan-sdk 0.1.23 → 0.1.25

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.
@@ -53,10 +53,29 @@ interface Tournament {
53
53
  leaderboardGameMustBeOver: boolean | null;
54
54
  entryFeeToken: string | null;
55
55
  entryFeeAmount: string | null;
56
+ /**
57
+ * Effective protocol-fee rate (basis points) snapshotted for this tournament
58
+ * at creation — the slice of the built-in entry-fee pool routed to the DAO
59
+ * buyback/treasury. `0` when no protocol fee applies. Sourced from the
60
+ * `TournamentCreated` event via the indexer/API; `null` over the RPC/viewer
61
+ * data source (the per-tournament snapshot has no on-chain getter).
62
+ */
63
+ protocolFeeShare: number | null;
56
64
  hasEntryRequirement: boolean | null;
57
65
  schedule: Schedule | null;
58
66
  gameConfig: GameConfig | null;
67
+ /** Built-in entry fee (EntryFeeKind::BuiltIn). Null for free OR extension-fee tournaments. */
59
68
  entryFee: EntryFee | null;
69
+ /**
70
+ * Discriminates the on-chain `EntryFeeKind`: `"builtin"` (see `entryFee`),
71
+ * `"extension"` (see `entryFeeExtension`), or `null` when there's no fee.
72
+ */
73
+ entryFeeKind: "builtin" | "extension" | null;
74
+ /** External entry-fee extension (EntryFeeKind::Extension). Set only when entryFeeKind === "extension". */
75
+ entryFeeExtension: {
76
+ address: string;
77
+ config: string[];
78
+ } | null;
60
79
  entryRequirement: EntryRequirement | null;
61
80
  leaderboardConfig: LeaderboardConfig | null;
62
81
  entryCount: number;
@@ -156,8 +175,14 @@ interface Prize {
156
175
  prizeId: string;
157
176
  tournamentId: string;
158
177
  payoutPosition: number;
159
- tokenAddress: string;
160
- tokenType: "erc20" | "erc721";
178
+ /** Token contract for built-in prizes; `null` for `tokenType === "extension"`. */
179
+ tokenAddress: string | null;
180
+ /**
181
+ * `erc20` / `erc721` are built-in token prizes. `extension` is an external
182
+ * `IPrizeExtension` prize (the #269 path): the token fields below are null
183
+ * and `extensionAddress` / `extensionConfig` are populated instead.
184
+ */
185
+ tokenType: "erc20" | "erc721" | "extension";
161
186
  amount: string | null;
162
187
  tokenId: string | null;
163
188
  distributionType: string | null;
@@ -167,19 +192,49 @@ interface Prize {
167
192
  distributionShares: number[] | null;
168
193
  distributionCount: number | null;
169
194
  sponsorAddress: string;
195
+ /** Extension contract address; only set when `tokenType === "extension"`. */
196
+ extensionAddress: string | null;
197
+ /** Opaque `Span<felt252>` config; only set when `tokenType === "extension"`. */
198
+ extensionConfig: string[] | null;
170
199
  }
200
+ type Erc20Prize = Prize & {
201
+ tokenType: "erc20";
202
+ tokenAddress: string;
203
+ amount: string;
204
+ tokenId: null;
205
+ extensionAddress: null;
206
+ extensionConfig: null;
207
+ };
208
+ type Erc721Prize = Prize & {
209
+ tokenType: "erc721";
210
+ tokenAddress: string;
211
+ amount: null;
212
+ tokenId: string;
213
+ extensionAddress: null;
214
+ extensionConfig: null;
215
+ };
216
+ type TokenPrize = Erc20Prize | Erc721Prize;
217
+ type ExtensionPrize = Prize & {
218
+ tokenType: "extension";
219
+ tokenAddress: null;
220
+ amount: null;
221
+ tokenId: null;
222
+ extensionAddress: string;
223
+ extensionConfig: string[] | null;
224
+ };
171
225
  /**
172
- * Discriminator for `RewardClaim.claimKind`. Picks one of the six terminal
226
+ * Discriminator for `RewardClaim.claimKind`. Picks one of the seven terminal
173
227
  * variants of the on-chain `RewardType` enum (Prize::Single, Prize::Distributed,
174
- * EntryFee::Position / TournamentCreator / GameCreator / Refund). The
175
- * variant-specific fields below are populated only for the kinds that carry
176
- * them; the two pure-marker creator kinds leave all four nullable fields null.
228
+ * EntryFee::Position / TournamentCreator / GameCreator / Refund / ProtocolFee).
229
+ * The variant-specific fields below are populated only for the kinds that carry
230
+ * them; the three pure-marker kinds (tournament_creator, game_creator,
231
+ * protocol_fee) leave all four nullable fields null.
177
232
  */
178
- type RewardClaimKind = "prize_single" | "prize_distributed" | "entry_fee_position" | "entry_fee_tournament_creator" | "entry_fee_game_creator" | "entry_fee_refund";
233
+ type RewardClaimKind = "prize_single" | "prize_distributed" | "entry_fee_position" | "entry_fee_tournament_creator" | "entry_fee_game_creator" | "entry_fee_protocol_fee" | "entry_fee_refund" | "prize_extension" | "entry_fee_extension";
179
234
  interface RewardClaim {
180
235
  tournamentId: string;
181
236
  claimKind: RewardClaimKind;
182
- /** Populated for `prize_single` and `prize_distributed`. Stringified u64. */
237
+ /** Populated for `prize_single`, `prize_distributed`, `prize_extension`. Stringified u64. */
183
238
  prizeId: string | null;
184
239
  /** Populated for `prize_distributed`. */
185
240
  payoutIndex: number | null;
@@ -187,6 +242,10 @@ interface RewardClaim {
187
242
  position: number | null;
188
243
  /** Populated for `entry_fee_refund`. felt252 hex string of the game token. */
189
244
  refundTokenId: string | null;
245
+ /** Game token id, for `prize_extension` / `entry_fee_extension` (Option → null when absent). */
246
+ extensionTokenId: string | null;
247
+ /** Opaque payout/claim params (`Span<felt252>`), for the extension claim kinds. */
248
+ extensionParams: string[] | null;
190
249
  claimed: boolean;
191
250
  }
192
251
  interface PrizeAggregation {
@@ -517,4 +576,4 @@ interface PlayerRewards {
517
576
  rewardClaims: RewardClaim[];
518
577
  }
519
578
 
520
- 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 };
579
+ export { BudokanClient as B, type ConnectionMode as C, type DataSource as D, type ExtensionPrize as E, 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 TokenPrize as i, type BudokanClientConfig as j, ConnectionStatus as k, type ConnectionStatusState as l, type Erc20Prize as m, type Erc721Prize as n, type LeaderboardEntry as o, type Phase as p, type PlayerPlacement as q, type PlayerRewards as r, type WSChannel as s, type WSEventMessage as t, type WSMessage as u, type WSSubscribeMessage as v, type WSUnsubscribeMessage as w, createBudokanClient as x };
@@ -53,10 +53,29 @@ interface Tournament {
53
53
  leaderboardGameMustBeOver: boolean | null;
54
54
  entryFeeToken: string | null;
55
55
  entryFeeAmount: string | null;
56
+ /**
57
+ * Effective protocol-fee rate (basis points) snapshotted for this tournament
58
+ * at creation — the slice of the built-in entry-fee pool routed to the DAO
59
+ * buyback/treasury. `0` when no protocol fee applies. Sourced from the
60
+ * `TournamentCreated` event via the indexer/API; `null` over the RPC/viewer
61
+ * data source (the per-tournament snapshot has no on-chain getter).
62
+ */
63
+ protocolFeeShare: number | null;
56
64
  hasEntryRequirement: boolean | null;
57
65
  schedule: Schedule | null;
58
66
  gameConfig: GameConfig | null;
67
+ /** Built-in entry fee (EntryFeeKind::BuiltIn). Null for free OR extension-fee tournaments. */
59
68
  entryFee: EntryFee | null;
69
+ /**
70
+ * Discriminates the on-chain `EntryFeeKind`: `"builtin"` (see `entryFee`),
71
+ * `"extension"` (see `entryFeeExtension`), or `null` when there's no fee.
72
+ */
73
+ entryFeeKind: "builtin" | "extension" | null;
74
+ /** External entry-fee extension (EntryFeeKind::Extension). Set only when entryFeeKind === "extension". */
75
+ entryFeeExtension: {
76
+ address: string;
77
+ config: string[];
78
+ } | null;
60
79
  entryRequirement: EntryRequirement | null;
61
80
  leaderboardConfig: LeaderboardConfig | null;
62
81
  entryCount: number;
@@ -156,8 +175,14 @@ interface Prize {
156
175
  prizeId: string;
157
176
  tournamentId: string;
158
177
  payoutPosition: number;
159
- tokenAddress: string;
160
- tokenType: "erc20" | "erc721";
178
+ /** Token contract for built-in prizes; `null` for `tokenType === "extension"`. */
179
+ tokenAddress: string | null;
180
+ /**
181
+ * `erc20` / `erc721` are built-in token prizes. `extension` is an external
182
+ * `IPrizeExtension` prize (the #269 path): the token fields below are null
183
+ * and `extensionAddress` / `extensionConfig` are populated instead.
184
+ */
185
+ tokenType: "erc20" | "erc721" | "extension";
161
186
  amount: string | null;
162
187
  tokenId: string | null;
163
188
  distributionType: string | null;
@@ -167,19 +192,49 @@ interface Prize {
167
192
  distributionShares: number[] | null;
168
193
  distributionCount: number | null;
169
194
  sponsorAddress: string;
195
+ /** Extension contract address; only set when `tokenType === "extension"`. */
196
+ extensionAddress: string | null;
197
+ /** Opaque `Span<felt252>` config; only set when `tokenType === "extension"`. */
198
+ extensionConfig: string[] | null;
170
199
  }
200
+ type Erc20Prize = Prize & {
201
+ tokenType: "erc20";
202
+ tokenAddress: string;
203
+ amount: string;
204
+ tokenId: null;
205
+ extensionAddress: null;
206
+ extensionConfig: null;
207
+ };
208
+ type Erc721Prize = Prize & {
209
+ tokenType: "erc721";
210
+ tokenAddress: string;
211
+ amount: null;
212
+ tokenId: string;
213
+ extensionAddress: null;
214
+ extensionConfig: null;
215
+ };
216
+ type TokenPrize = Erc20Prize | Erc721Prize;
217
+ type ExtensionPrize = Prize & {
218
+ tokenType: "extension";
219
+ tokenAddress: null;
220
+ amount: null;
221
+ tokenId: null;
222
+ extensionAddress: string;
223
+ extensionConfig: string[] | null;
224
+ };
171
225
  /**
172
- * Discriminator for `RewardClaim.claimKind`. Picks one of the six terminal
226
+ * Discriminator for `RewardClaim.claimKind`. Picks one of the seven terminal
173
227
  * variants of the on-chain `RewardType` enum (Prize::Single, Prize::Distributed,
174
- * EntryFee::Position / TournamentCreator / GameCreator / Refund). The
175
- * variant-specific fields below are populated only for the kinds that carry
176
- * them; the two pure-marker creator kinds leave all four nullable fields null.
228
+ * EntryFee::Position / TournamentCreator / GameCreator / Refund / ProtocolFee).
229
+ * The variant-specific fields below are populated only for the kinds that carry
230
+ * them; the three pure-marker kinds (tournament_creator, game_creator,
231
+ * protocol_fee) leave all four nullable fields null.
177
232
  */
178
- type RewardClaimKind = "prize_single" | "prize_distributed" | "entry_fee_position" | "entry_fee_tournament_creator" | "entry_fee_game_creator" | "entry_fee_refund";
233
+ type RewardClaimKind = "prize_single" | "prize_distributed" | "entry_fee_position" | "entry_fee_tournament_creator" | "entry_fee_game_creator" | "entry_fee_protocol_fee" | "entry_fee_refund" | "prize_extension" | "entry_fee_extension";
179
234
  interface RewardClaim {
180
235
  tournamentId: string;
181
236
  claimKind: RewardClaimKind;
182
- /** Populated for `prize_single` and `prize_distributed`. Stringified u64. */
237
+ /** Populated for `prize_single`, `prize_distributed`, `prize_extension`. Stringified u64. */
183
238
  prizeId: string | null;
184
239
  /** Populated for `prize_distributed`. */
185
240
  payoutIndex: number | null;
@@ -187,6 +242,10 @@ interface RewardClaim {
187
242
  position: number | null;
188
243
  /** Populated for `entry_fee_refund`. felt252 hex string of the game token. */
189
244
  refundTokenId: string | null;
245
+ /** Game token id, for `prize_extension` / `entry_fee_extension` (Option → null when absent). */
246
+ extensionTokenId: string | null;
247
+ /** Opaque payout/claim params (`Span<felt252>`), for the extension claim kinds. */
248
+ extensionParams: string[] | null;
190
249
  claimed: boolean;
191
250
  }
192
251
  interface PrizeAggregation {
@@ -517,4 +576,4 @@ interface PlayerRewards {
517
576
  rewardClaims: RewardClaim[];
518
577
  }
519
578
 
520
- 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 };
579
+ export { BudokanClient as B, type ConnectionMode as C, type DataSource as D, type ExtensionPrize as E, 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 TokenPrize as i, type BudokanClientConfig as j, ConnectionStatus as k, type ConnectionStatusState as l, type Erc20Prize as m, type Erc721Prize as n, type LeaderboardEntry as o, type Phase as p, type PlayerPlacement as q, type PlayerRewards as r, type WSChannel as s, type WSEventMessage as t, type WSMessage as u, type WSSubscribeMessage as v, type WSUnsubscribeMessage as w, createBudokanClient as x };