@devrongx/games 0.3.5 → 0.4.0

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.
@@ -0,0 +1,194 @@
1
+ // @devrongx/games — pools/types.ts
2
+ // Types matching TD backend pool API responses (pool.repo.ts).
3
+
4
+ // ─── Currency ───────────────────────────────────────────────────────────────
5
+
6
+ export interface ITDCurrency {
7
+ id: number;
8
+ name: string; // "Game Coins" | "Match Credits"
9
+ symbol: string; // "GC" | "MC"
10
+ partner_payout: boolean; // true = IAG handles USDC payout
11
+ }
12
+
13
+ // ─── Pool list item (GET /api/pools/match/:matchId) ─────────────────────────
14
+
15
+ export interface ITDPool {
16
+ id: number;
17
+ match_id: number;
18
+ game_type: string; // "pre_match_bets" | "fantasy_11" | "ball_sequence"
19
+ name: string;
20
+ machine_name: string | null;
21
+ display_price: string; // "Free" | "$1" | "$5"
22
+ entry_fee: number;
23
+ starting_coins: number;
24
+ status: string; // "draft"|"open"|"closed"|"resolving"|"complete"|"cancelled"
25
+ entry_count: number;
26
+ challenge_count: number;
27
+ currency: ITDCurrency;
28
+ }
29
+
30
+ // ─── Challenge option (nested in pool detail) ────────────────────────────────
31
+
32
+ export interface ITDChallengeOption {
33
+ key: string;
34
+ label: string;
35
+ odds: number;
36
+ entry: number;
37
+ risk: number;
38
+ }
39
+
40
+ // ─── Challenge (nested in pool detail) ───────────────────────────────────────
41
+
42
+ export interface ITDChallenge {
43
+ id: number;
44
+ question: string;
45
+ category: string;
46
+ icon: string;
47
+ accent_color: string;
48
+ sort_order: number;
49
+ options: ITDChallengeOption[];
50
+ status: string; // "draft"|"open"|"closed"|"resolved"
51
+ correct_option: string | null;
52
+ resolved_at: string | null;
53
+ }
54
+
55
+ // ─── Payout tier ─────────────────────────────────────────────────────────────
56
+
57
+ export interface ITDPayoutTier {
58
+ rank_from: number;
59
+ rank_to: number;
60
+ payout_type: "percentage" | "fixed" | "multiplier";
61
+ value: number;
62
+ }
63
+
64
+ // ─── PMB pool config (config JSON for pre_match_bets pools) ──────────────────
65
+
66
+ export interface ITDPMBConfig {
67
+ payout_tiers: ITDPayoutTier[];
68
+ compound_multipliers: number[];
69
+ parlay: {
70
+ max_slots: number;
71
+ min_legs: number;
72
+ max_legs: number;
73
+ default_stake: number;
74
+ stake_increments: number;
75
+ };
76
+ category_labels: Record<string, string>;
77
+ max_entries?: number;
78
+ }
79
+
80
+ // ─── Content/display config ──────────────────────────────────────────────────
81
+
82
+ export interface ITDPoolContentConfig {
83
+ banner_image?: string;
84
+ player_images?: [string, string];
85
+ sections?: { type: string; title: string; content: string }[];
86
+ colors?: {
87
+ parlay_slot_colors?: string[];
88
+ accent_color?: string;
89
+ };
90
+ }
91
+
92
+ // ─── Pool detail (GET /api/pools/:id) ────────────────────────────────────────
93
+
94
+ export interface ITDPoolDetail extends ITDPool {
95
+ description: string | null;
96
+ rake_percentage: number;
97
+ config: ITDPMBConfig | Record<string, unknown>;
98
+ content_config: ITDPoolContentConfig | null;
99
+ opens_at: string | null;
100
+ closes_at: string | null;
101
+ challenges: ITDChallenge[];
102
+ }
103
+
104
+ // ─── Leaderboard entry ───────────────────────────────────────────────────────
105
+
106
+ export interface ITDLeaderboardEntry {
107
+ rank: number;
108
+ user_id: number;
109
+ partner_ext_id: string | null;
110
+ entry_id: number;
111
+ current_coins: number;
112
+ final_coins: number | null;
113
+ total_risked: number;
114
+ max_possible: number;
115
+ bets_placed: number;
116
+ bets_won: number;
117
+ bets_lost: number;
118
+ questions_left: number;
119
+ active_parlays: number;
120
+ }
121
+
122
+ export interface ITDLeaderboardResponse {
123
+ pool_id: number;
124
+ total_entries: number;
125
+ leaderboard: ITDLeaderboardEntry[];
126
+ }
127
+
128
+ // ─── Pool entry (GET /api/pools/:id/my-entry) ─────────────────────────────────
129
+
130
+ export interface ITDPoolEntryRecord {
131
+ id: number;
132
+ pool_id: number;
133
+ user_id: number;
134
+ entry_fee_paid: number;
135
+ current_coins: number;
136
+ final_coins: number | null;
137
+ total_risked: number;
138
+ max_possible: number;
139
+ bets_placed: number;
140
+ bets_won: number;
141
+ bets_lost: number;
142
+ questions_left: number;
143
+ questions_total: number;
144
+ active_parlays: number;
145
+ created_at: string;
146
+ }
147
+
148
+ export interface ITDPoolBet {
149
+ id: number;
150
+ entry_id: number;
151
+ pool_challenge_id: number;
152
+ challenge_id: number;
153
+ selected_option: string;
154
+ coin_amount: number;
155
+ odds_at_bet: number;
156
+ potential_return: number;
157
+ actual_return: number | null;
158
+ status: string; // "pending"|"won"|"lost"|"push"
159
+ parlay_id: number | null;
160
+ created_at: string;
161
+ }
162
+
163
+ export interface ITDPoolParlay {
164
+ id: number;
165
+ entry_id: number;
166
+ total_coin_amount: number;
167
+ combined_multiplier: number;
168
+ potential_return: number;
169
+ actual_return: number | null;
170
+ status: string;
171
+ bets: {
172
+ id: number;
173
+ challenge_id: number;
174
+ selected_option: string;
175
+ coin_amount: number;
176
+ odds_at_bet: number;
177
+ status: string;
178
+ }[];
179
+ created_at: string;
180
+ }
181
+
182
+ export interface ITDMyEntryResponse {
183
+ entry: ITDPoolEntryRecord;
184
+ bets: ITDPoolBet[];
185
+ parlays: ITDPoolParlay[];
186
+ }
187
+
188
+ // ─── Bet input ────────────────────────────────────────────────────────────────
189
+
190
+ export interface ITDBetInput {
191
+ challenge_id: number;
192
+ selected_option: string;
193
+ coin_amount: number;
194
+ }