@dubsdotapp/expo 0.5.17 → 0.5.19
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.mts +2090 -0
- package/dist/index.d.ts +2090 -0
- package/dist/index.js +1916 -147
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1868 -102
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -4
- package/src/chat/hooks.ts +320 -0
- package/src/chat/index.ts +40 -0
- package/src/chat/provider.tsx +213 -0
- package/src/chat/socket.ts +175 -0
- package/src/chat/types.ts +146 -0
- package/src/client.ts +182 -0
- package/src/hooks/index.ts +6 -0
- package/src/hooks/useEnterJackpot.ts +80 -0
- package/src/hooks/useJackpot.ts +37 -0
- package/src/hooks/useJackpotHistory.ts +34 -0
- package/src/index.ts +55 -0
- package/src/types.ts +69 -0
- package/src/ui/game/JoinGameSheet.tsx +1 -1
- package/src/ui/index.ts +4 -0
- package/src/ui/jackpot/JackpotCard.tsx +417 -0
- package/src/ui/jackpot/JackpotSheet.tsx +683 -0
- package/src/ui/jackpot/JackpotWidget.tsx +74 -0
- package/src/ui/jackpot/index.ts +6 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,2090 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React$1 from 'react';
|
|
3
|
+
import { PublicKey, Transaction, Connection } from '@solana/web3.js';
|
|
4
|
+
import { ViewStyle } from 'react-native';
|
|
5
|
+
|
|
6
|
+
interface DeviceInfo {
|
|
7
|
+
platform: string;
|
|
8
|
+
modelName: string | null;
|
|
9
|
+
brand: string | null;
|
|
10
|
+
manufacturer: string | null;
|
|
11
|
+
osName: string | null;
|
|
12
|
+
osVersion: string | null;
|
|
13
|
+
deviceType: number | null;
|
|
14
|
+
deviceName: string | null;
|
|
15
|
+
totalMemory: number | null;
|
|
16
|
+
modelId: string | null;
|
|
17
|
+
designName: string | null;
|
|
18
|
+
productName: string | null;
|
|
19
|
+
isDevice: boolean | null;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Detect Solana Seeker device (synchronous — safe to call during render).
|
|
23
|
+
* Checks brand from expo-device; returns false if expo-device isn't installed.
|
|
24
|
+
*/
|
|
25
|
+
declare function isSolanaSeeker(): boolean;
|
|
26
|
+
declare function getDeviceInfo(): Promise<DeviceInfo>;
|
|
27
|
+
|
|
28
|
+
interface Opponent {
|
|
29
|
+
name: string | null;
|
|
30
|
+
imageUrl: string | null;
|
|
31
|
+
score: number | null;
|
|
32
|
+
}
|
|
33
|
+
interface EventMedia {
|
|
34
|
+
poster: string | null;
|
|
35
|
+
thumbnail: string | null;
|
|
36
|
+
streams: EventStream[];
|
|
37
|
+
}
|
|
38
|
+
interface EventStream {
|
|
39
|
+
url: string | null;
|
|
40
|
+
language: string | null;
|
|
41
|
+
}
|
|
42
|
+
interface EventMeta {
|
|
43
|
+
matchType: string | null;
|
|
44
|
+
numberOfGames: number | null;
|
|
45
|
+
tournament: string | null;
|
|
46
|
+
country: string | null;
|
|
47
|
+
}
|
|
48
|
+
interface UnifiedEvent {
|
|
49
|
+
id: string;
|
|
50
|
+
type: 'sports' | 'esports';
|
|
51
|
+
title: string;
|
|
52
|
+
league: string | null;
|
|
53
|
+
game: string | null;
|
|
54
|
+
startTime: string | null;
|
|
55
|
+
status: 'upcoming' | 'live' | 'finished' | 'canceled';
|
|
56
|
+
tier: string | null;
|
|
57
|
+
venue: string | null;
|
|
58
|
+
opponents: Opponent[];
|
|
59
|
+
media: EventMedia;
|
|
60
|
+
meta: EventMeta;
|
|
61
|
+
}
|
|
62
|
+
interface Pagination {
|
|
63
|
+
page: number;
|
|
64
|
+
perPage: number;
|
|
65
|
+
total: number;
|
|
66
|
+
totalPages: number;
|
|
67
|
+
}
|
|
68
|
+
interface EsportsMatchOpponent {
|
|
69
|
+
id: number;
|
|
70
|
+
name: string;
|
|
71
|
+
acronym: string | null;
|
|
72
|
+
imageUrl: string | null;
|
|
73
|
+
}
|
|
74
|
+
interface EsportsMatchResult {
|
|
75
|
+
teamId: number;
|
|
76
|
+
score: number;
|
|
77
|
+
}
|
|
78
|
+
interface EsportsMatchDetail {
|
|
79
|
+
matchId: number;
|
|
80
|
+
title: string;
|
|
81
|
+
status: string;
|
|
82
|
+
videogame: string | null;
|
|
83
|
+
league: string | null;
|
|
84
|
+
serie: string | null;
|
|
85
|
+
tournament: string | null;
|
|
86
|
+
tier: string | null;
|
|
87
|
+
startTime: string | null;
|
|
88
|
+
endTime: string | null;
|
|
89
|
+
matchType: string | null;
|
|
90
|
+
numberOfGames: number | null;
|
|
91
|
+
opponents: EsportsMatchOpponent[];
|
|
92
|
+
results: EsportsMatchResult[];
|
|
93
|
+
winnerId: number | null;
|
|
94
|
+
}
|
|
95
|
+
interface ValidateEventResult {
|
|
96
|
+
bettable: boolean;
|
|
97
|
+
gameMode: number;
|
|
98
|
+
lockTimestamp: number;
|
|
99
|
+
startTime: string | null;
|
|
100
|
+
status: string;
|
|
101
|
+
}
|
|
102
|
+
interface CreateGameParams {
|
|
103
|
+
id: string;
|
|
104
|
+
playerWallet: string;
|
|
105
|
+
teamChoice: 'home' | 'away' | 'draw';
|
|
106
|
+
wagerAmount: number;
|
|
107
|
+
}
|
|
108
|
+
interface CreateGameResult {
|
|
109
|
+
gameId: string;
|
|
110
|
+
gameAddress: string;
|
|
111
|
+
transaction: string;
|
|
112
|
+
lockTimestamp: number;
|
|
113
|
+
event: UnifiedEvent;
|
|
114
|
+
}
|
|
115
|
+
interface CreateCustomGameParams {
|
|
116
|
+
playerWallet: string;
|
|
117
|
+
teamChoice: 'home' | 'away';
|
|
118
|
+
wagerAmount: number;
|
|
119
|
+
title?: string;
|
|
120
|
+
maxPlayers?: number;
|
|
121
|
+
metadata?: Record<string, unknown>;
|
|
122
|
+
}
|
|
123
|
+
interface CreateCustomGameResult {
|
|
124
|
+
gameId: string;
|
|
125
|
+
gameAddress: string;
|
|
126
|
+
transaction: string;
|
|
127
|
+
lockTimestamp: number;
|
|
128
|
+
}
|
|
129
|
+
interface JoinGameParams {
|
|
130
|
+
playerWallet: string;
|
|
131
|
+
gameId: string;
|
|
132
|
+
teamChoice: 'home' | 'away' | 'draw';
|
|
133
|
+
amount: number;
|
|
134
|
+
}
|
|
135
|
+
interface JoinGameResult {
|
|
136
|
+
gameId: string;
|
|
137
|
+
transaction: string;
|
|
138
|
+
gameAddress: string;
|
|
139
|
+
}
|
|
140
|
+
interface ConfirmGameParams {
|
|
141
|
+
gameId: string;
|
|
142
|
+
playerWallet: string;
|
|
143
|
+
signature: string;
|
|
144
|
+
teamChoice?: 'home' | 'away' | 'draw';
|
|
145
|
+
wagerAmount?: number;
|
|
146
|
+
role?: 'creator' | 'joiner';
|
|
147
|
+
gameAddress?: string;
|
|
148
|
+
}
|
|
149
|
+
interface ConfirmGameResult {
|
|
150
|
+
gameId: string;
|
|
151
|
+
signature: string;
|
|
152
|
+
explorerUrl: string;
|
|
153
|
+
message: string;
|
|
154
|
+
}
|
|
155
|
+
interface BuildClaimParams {
|
|
156
|
+
playerWallet: string;
|
|
157
|
+
gameId: string;
|
|
158
|
+
}
|
|
159
|
+
interface BuildClaimResult {
|
|
160
|
+
transaction: string;
|
|
161
|
+
gameAddress: string;
|
|
162
|
+
message: string;
|
|
163
|
+
}
|
|
164
|
+
interface ConfirmClaimParams {
|
|
165
|
+
playerWallet: string;
|
|
166
|
+
signature: string;
|
|
167
|
+
amountClaimed?: number;
|
|
168
|
+
}
|
|
169
|
+
interface ConfirmClaimResult {
|
|
170
|
+
gameId: string;
|
|
171
|
+
signature: string;
|
|
172
|
+
explorerUrl: string;
|
|
173
|
+
message: string;
|
|
174
|
+
}
|
|
175
|
+
interface GameMedia {
|
|
176
|
+
poster: string | null;
|
|
177
|
+
thumbnail: string | null;
|
|
178
|
+
}
|
|
179
|
+
interface Bettor {
|
|
180
|
+
wallet: string;
|
|
181
|
+
username: string | null;
|
|
182
|
+
avatar: string | null;
|
|
183
|
+
team: 'home' | 'away' | 'draw';
|
|
184
|
+
amount: number;
|
|
185
|
+
amountClaimed: number | null;
|
|
186
|
+
claimSignature: string | null;
|
|
187
|
+
}
|
|
188
|
+
interface GameDetail {
|
|
189
|
+
gameId: string;
|
|
190
|
+
gameAddress: string;
|
|
191
|
+
title: string;
|
|
192
|
+
buyIn: number;
|
|
193
|
+
gameMode: number;
|
|
194
|
+
isLocked: boolean;
|
|
195
|
+
isResolved: boolean;
|
|
196
|
+
status: string;
|
|
197
|
+
league: string | null;
|
|
198
|
+
lockTimestamp: number | null;
|
|
199
|
+
/** Winning side: 'home' | 'away' | 'draw' | null (null = refund) */
|
|
200
|
+
winnerSide: string | null;
|
|
201
|
+
opponents: GameListOpponent[];
|
|
202
|
+
bettors: Bettor[];
|
|
203
|
+
homePool: number;
|
|
204
|
+
awayPool: number;
|
|
205
|
+
drawPool: number;
|
|
206
|
+
totalPool: number;
|
|
207
|
+
media: GameMedia;
|
|
208
|
+
createdAt: string;
|
|
209
|
+
updatedAt: string;
|
|
210
|
+
}
|
|
211
|
+
interface GameListOpponent {
|
|
212
|
+
name: string | null;
|
|
213
|
+
imageUrl: string | null;
|
|
214
|
+
}
|
|
215
|
+
interface GameListItem {
|
|
216
|
+
gameId: string;
|
|
217
|
+
title: string;
|
|
218
|
+
buyIn: number;
|
|
219
|
+
gameMode: number;
|
|
220
|
+
isLocked: boolean;
|
|
221
|
+
isResolved: boolean;
|
|
222
|
+
status: string;
|
|
223
|
+
totalPool: number;
|
|
224
|
+
league: string | null;
|
|
225
|
+
lockTimestamp: number | null;
|
|
226
|
+
createdAt: string;
|
|
227
|
+
opponents: GameListOpponent[];
|
|
228
|
+
media: GameMedia;
|
|
229
|
+
}
|
|
230
|
+
interface GetGamesParams {
|
|
231
|
+
wallet?: string;
|
|
232
|
+
status?: 'open' | 'locked' | 'resolved';
|
|
233
|
+
limit?: number;
|
|
234
|
+
offset?: number;
|
|
235
|
+
}
|
|
236
|
+
interface GetNetworkGamesParams {
|
|
237
|
+
league?: string;
|
|
238
|
+
exclude_wallet?: string;
|
|
239
|
+
limit?: number;
|
|
240
|
+
offset?: number;
|
|
241
|
+
}
|
|
242
|
+
interface GetUpcomingEventsParams {
|
|
243
|
+
type?: 'sports' | 'esports';
|
|
244
|
+
game?: string;
|
|
245
|
+
page?: number;
|
|
246
|
+
per_page?: number;
|
|
247
|
+
}
|
|
248
|
+
interface ParsedError {
|
|
249
|
+
code: string;
|
|
250
|
+
message: string;
|
|
251
|
+
}
|
|
252
|
+
interface SolanaErrorCode {
|
|
253
|
+
code: string;
|
|
254
|
+
message: string;
|
|
255
|
+
}
|
|
256
|
+
interface DubsUser {
|
|
257
|
+
walletAddress: string;
|
|
258
|
+
username: string;
|
|
259
|
+
avatar: string | null;
|
|
260
|
+
myReferralCode: string | null;
|
|
261
|
+
onboardingComplete: boolean;
|
|
262
|
+
createdAt: string;
|
|
263
|
+
}
|
|
264
|
+
interface DubsPublicUser {
|
|
265
|
+
walletAddress: string;
|
|
266
|
+
username: string;
|
|
267
|
+
avatar: string | null;
|
|
268
|
+
createdAt: string;
|
|
269
|
+
}
|
|
270
|
+
interface DubsAppUser extends DubsPublicUser {
|
|
271
|
+
firstSeenAt: string;
|
|
272
|
+
lastSeenAt: string;
|
|
273
|
+
}
|
|
274
|
+
interface NonceResult {
|
|
275
|
+
nonce: string;
|
|
276
|
+
message: string;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
interface AuthenticateParams {
|
|
280
|
+
walletAddress: string;
|
|
281
|
+
signature: string;
|
|
282
|
+
nonce: string;
|
|
283
|
+
deviceInfo?: DeviceInfo;
|
|
284
|
+
}
|
|
285
|
+
interface AuthenticateResult {
|
|
286
|
+
needsRegistration: boolean;
|
|
287
|
+
user?: DubsUser;
|
|
288
|
+
token?: string;
|
|
289
|
+
}
|
|
290
|
+
interface RegisterParams {
|
|
291
|
+
walletAddress: string;
|
|
292
|
+
signature: string;
|
|
293
|
+
nonce: string;
|
|
294
|
+
username: string;
|
|
295
|
+
referralCode?: string;
|
|
296
|
+
avatarUrl?: string;
|
|
297
|
+
deviceInfo?: DeviceInfo;
|
|
298
|
+
}
|
|
299
|
+
interface RegisterResult {
|
|
300
|
+
user: DubsUser;
|
|
301
|
+
token: string;
|
|
302
|
+
}
|
|
303
|
+
interface CheckUsernameResult {
|
|
304
|
+
available: boolean;
|
|
305
|
+
reason?: string;
|
|
306
|
+
}
|
|
307
|
+
type AuthStatus = 'idle' | 'authenticating' | 'signing' | 'verifying' | 'needsRegistration' | 'registering' | 'authenticated' | 'error';
|
|
308
|
+
type MutationStatus = 'idle' | 'building' | 'signing' | 'confirming' | 'saving' | 'success' | 'error';
|
|
309
|
+
interface QueryResult<T> {
|
|
310
|
+
data: T | null;
|
|
311
|
+
loading: boolean;
|
|
312
|
+
error: Error | null;
|
|
313
|
+
refetch: () => void;
|
|
314
|
+
}
|
|
315
|
+
interface MutationResult<TParams, TResult> {
|
|
316
|
+
execute: (params: TParams) => Promise<TResult>;
|
|
317
|
+
status: MutationStatus;
|
|
318
|
+
error: Error | null;
|
|
319
|
+
data: TResult | null;
|
|
320
|
+
reset: () => void;
|
|
321
|
+
}
|
|
322
|
+
interface LiveScoreCompetitor {
|
|
323
|
+
name: string;
|
|
324
|
+
homeAway: 'home' | 'away';
|
|
325
|
+
score: number;
|
|
326
|
+
logo: string | null;
|
|
327
|
+
abbreviation: string;
|
|
328
|
+
}
|
|
329
|
+
interface LiveScore {
|
|
330
|
+
status: string;
|
|
331
|
+
period: number | null;
|
|
332
|
+
displayClock: string | null;
|
|
333
|
+
detail: string | null;
|
|
334
|
+
shortDetail: string | null;
|
|
335
|
+
competitors: LiveScoreCompetitor[];
|
|
336
|
+
ufcData?: {
|
|
337
|
+
currentRound: number;
|
|
338
|
+
totalRounds: number;
|
|
339
|
+
clock: string;
|
|
340
|
+
fightState: string;
|
|
341
|
+
statusDetail: string;
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
interface UFCFighter {
|
|
345
|
+
name: string;
|
|
346
|
+
athleteId: string | null;
|
|
347
|
+
headshotUrl: string | null;
|
|
348
|
+
flagUrl: string | null;
|
|
349
|
+
country: string | null;
|
|
350
|
+
abbreviation: string;
|
|
351
|
+
record: string | null;
|
|
352
|
+
winner: boolean;
|
|
353
|
+
}
|
|
354
|
+
interface UFCFighterDetail {
|
|
355
|
+
athleteId: string;
|
|
356
|
+
firstName: string | null;
|
|
357
|
+
lastName: string | null;
|
|
358
|
+
fullName: string | null;
|
|
359
|
+
nickname: string | null;
|
|
360
|
+
shortName: string | null;
|
|
361
|
+
height: string | null;
|
|
362
|
+
heightInches: number | null;
|
|
363
|
+
weight: string | null;
|
|
364
|
+
weightLbs: number | null;
|
|
365
|
+
reach: string | null;
|
|
366
|
+
reachInches: number | null;
|
|
367
|
+
age: number | null;
|
|
368
|
+
dateOfBirth: string | null;
|
|
369
|
+
stance: string | null;
|
|
370
|
+
weightClass: string | null;
|
|
371
|
+
citizenship: string | null;
|
|
372
|
+
citizenshipAbbreviation: string | null;
|
|
373
|
+
gym: string | null;
|
|
374
|
+
gymCountry: string | null;
|
|
375
|
+
active: boolean;
|
|
376
|
+
headshotUrl: string | null;
|
|
377
|
+
flagUrl: string | null;
|
|
378
|
+
stanceImageUrl: string | null;
|
|
379
|
+
espnUrl: string | null;
|
|
380
|
+
slug: string | null;
|
|
381
|
+
}
|
|
382
|
+
interface UFCData {
|
|
383
|
+
currentRound: number;
|
|
384
|
+
totalRounds: number;
|
|
385
|
+
clock: string;
|
|
386
|
+
fightState: 'pre' | 'in' | 'post';
|
|
387
|
+
statusDetail: string;
|
|
388
|
+
statusShortDetail?: string;
|
|
389
|
+
}
|
|
390
|
+
interface UFCFight {
|
|
391
|
+
id: string | null;
|
|
392
|
+
home: UFCFighter;
|
|
393
|
+
away: UFCFighter;
|
|
394
|
+
weightClass: string | null;
|
|
395
|
+
status: string;
|
|
396
|
+
ufcData: UFCData | null;
|
|
397
|
+
}
|
|
398
|
+
interface UFCEvent {
|
|
399
|
+
eventName: string;
|
|
400
|
+
date: string | null;
|
|
401
|
+
fights: UFCFight[];
|
|
402
|
+
}
|
|
403
|
+
interface BuildArcadeEntryResult {
|
|
404
|
+
transaction: string;
|
|
405
|
+
poolId: string;
|
|
406
|
+
amount: string;
|
|
407
|
+
destination?: string;
|
|
408
|
+
gameId?: string;
|
|
409
|
+
gameAddress?: string;
|
|
410
|
+
}
|
|
411
|
+
interface EnterArcadePoolResult {
|
|
412
|
+
poolId: string;
|
|
413
|
+
signature: string;
|
|
414
|
+
entry: ArcadeEntry;
|
|
415
|
+
}
|
|
416
|
+
interface ArcadePool {
|
|
417
|
+
id: number;
|
|
418
|
+
app_id: number;
|
|
419
|
+
game_slug: string;
|
|
420
|
+
name: string;
|
|
421
|
+
buy_in_lamports: number;
|
|
422
|
+
max_lives: number;
|
|
423
|
+
period_start: string;
|
|
424
|
+
period_end: string;
|
|
425
|
+
schedule: 'weekly' | 'daily' | 'monthly';
|
|
426
|
+
status: 'open' | 'active' | 'resolving' | 'complete' | 'cancelled';
|
|
427
|
+
solana_game_id: string | null;
|
|
428
|
+
solana_game_address: string | null;
|
|
429
|
+
total_entries: number;
|
|
430
|
+
created_at: string;
|
|
431
|
+
next_resolution: string | null;
|
|
432
|
+
}
|
|
433
|
+
interface ArcadeEntry {
|
|
434
|
+
id: number;
|
|
435
|
+
pool_id: number;
|
|
436
|
+
wallet_address: string;
|
|
437
|
+
best_score: number;
|
|
438
|
+
lives_used: number;
|
|
439
|
+
rank: number | null;
|
|
440
|
+
created_at: string;
|
|
441
|
+
attempts: ArcadeAttempt[] | null;
|
|
442
|
+
}
|
|
443
|
+
interface ArcadeAttempt {
|
|
444
|
+
id: number;
|
|
445
|
+
attempt_number: number;
|
|
446
|
+
score: number | null;
|
|
447
|
+
status: 'active' | 'submitted' | 'expired';
|
|
448
|
+
started_at: string;
|
|
449
|
+
submitted_at: string | null;
|
|
450
|
+
duration_ms: number | null;
|
|
451
|
+
}
|
|
452
|
+
interface ArcadeLeaderboardEntry {
|
|
453
|
+
id: number;
|
|
454
|
+
wallet_address: string;
|
|
455
|
+
best_score: number;
|
|
456
|
+
lives_used: number;
|
|
457
|
+
username: string;
|
|
458
|
+
avatar: string | null;
|
|
459
|
+
rank: number;
|
|
460
|
+
}
|
|
461
|
+
interface ArcadePoolStats {
|
|
462
|
+
total_entries: number;
|
|
463
|
+
top_score: number;
|
|
464
|
+
avg_score: number;
|
|
465
|
+
active_players: number;
|
|
466
|
+
}
|
|
467
|
+
interface StartAttemptResult {
|
|
468
|
+
sessionToken: string;
|
|
469
|
+
attemptNumber: number;
|
|
470
|
+
livesRemaining: number;
|
|
471
|
+
}
|
|
472
|
+
interface SubmitScoreResult {
|
|
473
|
+
score: number;
|
|
474
|
+
bestScore: number;
|
|
475
|
+
livesUsed: number;
|
|
476
|
+
isNewBest: boolean;
|
|
477
|
+
}
|
|
478
|
+
interface ArcadePoolResult {
|
|
479
|
+
id: number;
|
|
480
|
+
pool_id: number;
|
|
481
|
+
entry_id: number;
|
|
482
|
+
wallet_address: string;
|
|
483
|
+
amount_lamports: string;
|
|
484
|
+
status: string;
|
|
485
|
+
username: string;
|
|
486
|
+
avatar: string | null;
|
|
487
|
+
best_score: number;
|
|
488
|
+
}
|
|
489
|
+
interface JackpotRound {
|
|
490
|
+
roundId: string;
|
|
491
|
+
status: 'Open' | 'Locked' | 'Resolved';
|
|
492
|
+
totalPotLamports: string;
|
|
493
|
+
totalPotSol: number;
|
|
494
|
+
entryCount: number;
|
|
495
|
+
totalWeight: string;
|
|
496
|
+
timeRemainingSlots: number;
|
|
497
|
+
}
|
|
498
|
+
interface JackpotLastWinner {
|
|
499
|
+
roundId: string;
|
|
500
|
+
winner: string;
|
|
501
|
+
winAmount: string;
|
|
502
|
+
winAmountSol: number;
|
|
503
|
+
totalPot: string;
|
|
504
|
+
entryCount: number;
|
|
505
|
+
timestamp: string | null;
|
|
506
|
+
}
|
|
507
|
+
interface JackpotEntry {
|
|
508
|
+
player: string;
|
|
509
|
+
weight: string;
|
|
510
|
+
weightSol: number;
|
|
511
|
+
oddsPercent: string;
|
|
512
|
+
}
|
|
513
|
+
interface JackpotRoundResult {
|
|
514
|
+
roundId: string;
|
|
515
|
+
winner: string;
|
|
516
|
+
winAmount: string;
|
|
517
|
+
winAmountSol: number;
|
|
518
|
+
totalPot: string;
|
|
519
|
+
totalPotSol: number;
|
|
520
|
+
entryCount: number;
|
|
521
|
+
timestamp: string;
|
|
522
|
+
}
|
|
523
|
+
interface JackpotConfig {
|
|
524
|
+
feeBasisPoints: number;
|
|
525
|
+
roundDurationSlots: string;
|
|
526
|
+
minEntryLamports: number;
|
|
527
|
+
minEntrySol: number;
|
|
528
|
+
}
|
|
529
|
+
interface BuildJackpotEnterResult {
|
|
530
|
+
transaction: string;
|
|
531
|
+
roundId: string;
|
|
532
|
+
amount: string;
|
|
533
|
+
amountSol: number;
|
|
534
|
+
}
|
|
535
|
+
interface ConfirmJackpotEnterResult {
|
|
536
|
+
attributed: boolean;
|
|
537
|
+
appId: number;
|
|
538
|
+
signature: string;
|
|
539
|
+
}
|
|
540
|
+
interface UiConfig {
|
|
541
|
+
accentColor?: string;
|
|
542
|
+
appIcon?: string;
|
|
543
|
+
appName?: string;
|
|
544
|
+
appUrl?: string;
|
|
545
|
+
tagline?: string;
|
|
546
|
+
environment?: 'sandbox' | 'production';
|
|
547
|
+
/**
|
|
548
|
+
* Whether the developer has uploaded push credentials in the dev portal.
|
|
549
|
+
* Consumers should gate their push opt-in UI on the relevant platform flag —
|
|
550
|
+
* e.g. only show the "Enable Notifications" screen if pushConfigured.android is true.
|
|
551
|
+
*/
|
|
552
|
+
pushConfigured?: {
|
|
553
|
+
android: boolean;
|
|
554
|
+
ios: boolean;
|
|
555
|
+
};
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
interface DubsClientConfig {
|
|
559
|
+
apiKey: string;
|
|
560
|
+
baseUrl?: string;
|
|
561
|
+
}
|
|
562
|
+
declare class DubsClient {
|
|
563
|
+
private readonly apiKey;
|
|
564
|
+
private readonly baseUrl;
|
|
565
|
+
private _token;
|
|
566
|
+
constructor(config: DubsClientConfig);
|
|
567
|
+
/** Set the user JWT token for authenticated requests */
|
|
568
|
+
setToken(token: string | null): void;
|
|
569
|
+
/** Get the current user JWT token */
|
|
570
|
+
getToken(): string | null;
|
|
571
|
+
private request;
|
|
572
|
+
getUpcomingEvents(params?: GetUpcomingEventsParams): Promise<{
|
|
573
|
+
events: UnifiedEvent[];
|
|
574
|
+
pagination: Pagination;
|
|
575
|
+
}>;
|
|
576
|
+
getSportsEvents(league: string): Promise<UnifiedEvent[]>;
|
|
577
|
+
getEsportsMatches(videogame?: string): Promise<UnifiedEvent[]>;
|
|
578
|
+
getEsportsMatchDetail(matchId: string | number): Promise<EsportsMatchDetail>;
|
|
579
|
+
getUFCFightCard(): Promise<UFCEvent[]>;
|
|
580
|
+
getUFCFighterDetail(athleteId: string): Promise<UFCFighterDetail>;
|
|
581
|
+
validateEvent(id: string): Promise<ValidateEventResult>;
|
|
582
|
+
createGame(params: CreateGameParams): Promise<CreateGameResult>;
|
|
583
|
+
joinGame(params: JoinGameParams): Promise<JoinGameResult>;
|
|
584
|
+
confirmGame(params: ConfirmGameParams): Promise<ConfirmGameResult>;
|
|
585
|
+
createCustomGame(params: CreateCustomGameParams): Promise<CreateCustomGameResult>;
|
|
586
|
+
confirmCustomGame(params: ConfirmGameParams): Promise<ConfirmGameResult>;
|
|
587
|
+
buildClaimTransaction(params: BuildClaimParams): Promise<BuildClaimResult>;
|
|
588
|
+
confirmClaim(gameId: string, params: ConfirmClaimParams): Promise<ConfirmClaimResult>;
|
|
589
|
+
getGame(gameId: string): Promise<GameDetail>;
|
|
590
|
+
getLiveScore(gameId: string): Promise<LiveScore | null>;
|
|
591
|
+
getGames(params?: GetGamesParams): Promise<GameListItem[]>;
|
|
592
|
+
getNetworkGames(params?: GetNetworkGamesParams): Promise<{
|
|
593
|
+
games: GameListItem[];
|
|
594
|
+
pagination: Pagination;
|
|
595
|
+
}>;
|
|
596
|
+
getNonce(walletAddress: string): Promise<NonceResult>;
|
|
597
|
+
authenticate(params: AuthenticateParams): Promise<AuthenticateResult>;
|
|
598
|
+
register(params: RegisterParams): Promise<RegisterResult>;
|
|
599
|
+
getMe(): Promise<DubsUser>;
|
|
600
|
+
getUser(walletAddress: string): Promise<DubsPublicUser | null>;
|
|
601
|
+
getAppUsers(params?: {
|
|
602
|
+
limit?: number;
|
|
603
|
+
offset?: number;
|
|
604
|
+
}): Promise<{
|
|
605
|
+
users: DubsAppUser[];
|
|
606
|
+
pagination: {
|
|
607
|
+
total: number;
|
|
608
|
+
limit: number;
|
|
609
|
+
offset: number;
|
|
610
|
+
};
|
|
611
|
+
}>;
|
|
612
|
+
checkUsername(username: string): Promise<CheckUsernameResult>;
|
|
613
|
+
logout(): Promise<void>;
|
|
614
|
+
registerPushToken(params: {
|
|
615
|
+
token: string;
|
|
616
|
+
platform: string;
|
|
617
|
+
deviceName?: string;
|
|
618
|
+
}): Promise<void>;
|
|
619
|
+
unregisterPushToken(token: string): Promise<void>;
|
|
620
|
+
updateProfile(params: {
|
|
621
|
+
avatar?: string;
|
|
622
|
+
}): Promise<DubsUser>;
|
|
623
|
+
parseError(error: unknown): Promise<ParsedError>;
|
|
624
|
+
getErrorCodes(): Promise<Record<number, SolanaErrorCode>>;
|
|
625
|
+
/**
|
|
626
|
+
* Parse a Solana error locally without an API call.
|
|
627
|
+
* Useful for instant feedback in the UI.
|
|
628
|
+
*/
|
|
629
|
+
parseErrorLocal(error: unknown): ParsedError;
|
|
630
|
+
/** Get the full local error code map */
|
|
631
|
+
getErrorCodesLocal(): Record<number, SolanaErrorCode>;
|
|
632
|
+
getArcadePools(params?: {
|
|
633
|
+
gameSlug?: string;
|
|
634
|
+
status?: string;
|
|
635
|
+
}): Promise<ArcadePool[]>;
|
|
636
|
+
getArcadePool(poolId: number): Promise<{
|
|
637
|
+
pool: ArcadePool;
|
|
638
|
+
stats: ArcadePoolStats;
|
|
639
|
+
}>;
|
|
640
|
+
/** Build unsigned entry transaction for an arcade pool */
|
|
641
|
+
buildArcadeEntry(poolId: number, walletAddress: string): Promise<BuildArcadeEntryResult>;
|
|
642
|
+
enterArcadePool(poolId: number, params: {
|
|
643
|
+
walletAddress: string;
|
|
644
|
+
txSignature: string;
|
|
645
|
+
gameId?: string;
|
|
646
|
+
gameAddress?: string;
|
|
647
|
+
}): Promise<ArcadeEntry>;
|
|
648
|
+
startArcadeAttempt(poolId: number, walletAddress: string): Promise<StartAttemptResult>;
|
|
649
|
+
submitArcadeScore(poolId: number, params: {
|
|
650
|
+
walletAddress: string;
|
|
651
|
+
sessionToken: string;
|
|
652
|
+
score: number;
|
|
653
|
+
durationMs?: number;
|
|
654
|
+
}): Promise<SubmitScoreResult>;
|
|
655
|
+
getArcadeLeaderboard(poolId: number, params?: {
|
|
656
|
+
limit?: number;
|
|
657
|
+
offset?: number;
|
|
658
|
+
}): Promise<ArcadeLeaderboardEntry[]>;
|
|
659
|
+
getArcadeResults(poolId: number): Promise<ArcadePoolResult[]>;
|
|
660
|
+
getArcadeEntry(poolId: number, walletAddress: string): Promise<ArcadeEntry>;
|
|
661
|
+
/** Get current jackpot round + last winner */
|
|
662
|
+
getJackpotCurrent(): Promise<{
|
|
663
|
+
round: JackpotRound | null;
|
|
664
|
+
lastWinner: JackpotLastWinner | null;
|
|
665
|
+
}>;
|
|
666
|
+
/** Get current round entries with odds */
|
|
667
|
+
getJackpotEntries(): Promise<{
|
|
668
|
+
roundId: string;
|
|
669
|
+
entries: JackpotEntry[];
|
|
670
|
+
totalEntries: number;
|
|
671
|
+
}>;
|
|
672
|
+
/** Get recent jackpot round results */
|
|
673
|
+
getJackpotHistory(limit?: number): Promise<JackpotRoundResult[]>;
|
|
674
|
+
/** Get jackpot protocol config */
|
|
675
|
+
getJackpotConfig(): Promise<JackpotConfig>;
|
|
676
|
+
/** Build unsigned jackpot enter transaction */
|
|
677
|
+
buildJackpotEnter(playerAddress: string, amount: number): Promise<BuildJackpotEnterResult>;
|
|
678
|
+
/** Confirm jackpot entry after wallet signs (creates developer attribution) */
|
|
679
|
+
confirmJackpotEnter(params: {
|
|
680
|
+
playerAddress: string;
|
|
681
|
+
roundId?: string;
|
|
682
|
+
amount?: number;
|
|
683
|
+
signature: string;
|
|
684
|
+
}): Promise<ConfirmJackpotEnterResult>;
|
|
685
|
+
/** Get recent global chat messages */
|
|
686
|
+
getChatMessages(params?: {
|
|
687
|
+
limit?: number;
|
|
688
|
+
before?: number;
|
|
689
|
+
}): Promise<{
|
|
690
|
+
messages: any[];
|
|
691
|
+
hasMore: boolean;
|
|
692
|
+
}>;
|
|
693
|
+
/** Send a message to global chat */
|
|
694
|
+
sendChatMessage(params: {
|
|
695
|
+
message: string;
|
|
696
|
+
replyToId?: number;
|
|
697
|
+
}): Promise<{
|
|
698
|
+
message: any;
|
|
699
|
+
}>;
|
|
700
|
+
/** Edit your own message */
|
|
701
|
+
editChatMessage(id: number, message: string): Promise<{
|
|
702
|
+
message: any;
|
|
703
|
+
}>;
|
|
704
|
+
/** Delete your own message */
|
|
705
|
+
deleteChatMessage(id: number): Promise<{
|
|
706
|
+
messageId: number;
|
|
707
|
+
}>;
|
|
708
|
+
/** Block a user */
|
|
709
|
+
blockUser(targetUserId: number): Promise<void>;
|
|
710
|
+
/** Unblock a user */
|
|
711
|
+
unblockUser(targetUserId: number): Promise<void>;
|
|
712
|
+
/** Get DM conversations inbox */
|
|
713
|
+
getConversations(limit?: number): Promise<{
|
|
714
|
+
conversations: any[];
|
|
715
|
+
}>;
|
|
716
|
+
/** Get conversation history with a specific user */
|
|
717
|
+
getConversation(walletAddress: string, params?: {
|
|
718
|
+
limit?: number;
|
|
719
|
+
beforeId?: number;
|
|
720
|
+
}): Promise<{
|
|
721
|
+
messages: any[];
|
|
722
|
+
otherUser: any;
|
|
723
|
+
}>;
|
|
724
|
+
/** Send a direct message */
|
|
725
|
+
sendDirectMessage(params: {
|
|
726
|
+
recipientWallet: string;
|
|
727
|
+
message: string;
|
|
728
|
+
}): Promise<{
|
|
729
|
+
message: any;
|
|
730
|
+
}>;
|
|
731
|
+
/** Mark all DMs from a user as read */
|
|
732
|
+
markDMRead(walletAddress: string): Promise<{
|
|
733
|
+
markedRead: number;
|
|
734
|
+
}>;
|
|
735
|
+
/** Get unread DM count */
|
|
736
|
+
getDMUnreadCount(): Promise<{
|
|
737
|
+
unreadCount: number;
|
|
738
|
+
}>;
|
|
739
|
+
/** Delete a DM conversation (soft delete) */
|
|
740
|
+
deleteConversation(walletAddress: string): Promise<void>;
|
|
741
|
+
/** Search users by username */
|
|
742
|
+
searchUsers(query: string): Promise<{
|
|
743
|
+
results: any[];
|
|
744
|
+
}>;
|
|
745
|
+
/** Send a friend request */
|
|
746
|
+
sendFriendRequest(targetUserId: number): Promise<{
|
|
747
|
+
requestId: number;
|
|
748
|
+
}>;
|
|
749
|
+
/** Get pending friend requests (received) */
|
|
750
|
+
getPendingFriendRequests(): Promise<{
|
|
751
|
+
requests: any[];
|
|
752
|
+
}>;
|
|
753
|
+
/** Accept a friend request */
|
|
754
|
+
acceptFriendRequest(requestId: number): Promise<void>;
|
|
755
|
+
/** Reject a friend request */
|
|
756
|
+
rejectFriendRequest(requestId: number): Promise<void>;
|
|
757
|
+
/** Get friends list */
|
|
758
|
+
getFriends(): Promise<{
|
|
759
|
+
friends: any[];
|
|
760
|
+
}>;
|
|
761
|
+
/** Remove a friend */
|
|
762
|
+
removeFriend(targetUserId: number): Promise<void>;
|
|
763
|
+
/** Get blocked users list */
|
|
764
|
+
getBlockedUsers(): Promise<{
|
|
765
|
+
blocked: any[];
|
|
766
|
+
}>;
|
|
767
|
+
/** Fetch the app's UI customization config (accent color, icon, tagline, environment) */
|
|
768
|
+
getAppConfig(): Promise<UiConfig>;
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
declare class DubsApiError extends Error {
|
|
772
|
+
readonly code: string;
|
|
773
|
+
readonly httpStatus: number;
|
|
774
|
+
constructor(code: string, message: string, httpStatus: number);
|
|
775
|
+
}
|
|
776
|
+
/** Custom error codes from dubs_solana_program (6000-6049) */
|
|
777
|
+
declare const SOLANA_PROGRAM_ERRORS: Record<number, SolanaErrorCode>;
|
|
778
|
+
/**
|
|
779
|
+
* Parse a raw Solana transaction error into a human-readable { code, message }.
|
|
780
|
+
* Handles: { InstructionError: [idx, { Custom: N }] }, string errors, etc.
|
|
781
|
+
*/
|
|
782
|
+
declare function parseSolanaError(err: unknown): ParsedError;
|
|
783
|
+
|
|
784
|
+
declare const DEFAULT_BASE_URL = "https://dubs-server-prod-9c91d3f01199.herokuapp.com/api/developer/v1";
|
|
785
|
+
declare const DEFAULT_RPC_URL = "https://api.mainnet-beta.solana.com";
|
|
786
|
+
type DubsNetwork = 'devnet' | 'mainnet-beta';
|
|
787
|
+
declare const NETWORK_CONFIG: Record<DubsNetwork, {
|
|
788
|
+
baseUrl: string;
|
|
789
|
+
rpcUrl: string;
|
|
790
|
+
cluster: string;
|
|
791
|
+
}>;
|
|
792
|
+
|
|
793
|
+
interface TokenStorage {
|
|
794
|
+
getItem(key: string): Promise<string | null>;
|
|
795
|
+
setItem(key: string, value: string): Promise<void>;
|
|
796
|
+
deleteItem(key: string): Promise<void>;
|
|
797
|
+
}
|
|
798
|
+
declare const STORAGE_KEYS: {
|
|
799
|
+
readonly MWA_AUTH_TOKEN: "dubs_mwa_auth_token";
|
|
800
|
+
readonly MWA_WALLET_ADDRESS: "dubs_mwa_wallet_address";
|
|
801
|
+
readonly JWT_TOKEN: "dubs_jwt_token";
|
|
802
|
+
readonly PHANTOM_SESSION: "dubs_phantom_session";
|
|
803
|
+
readonly PHANTOM_CONNECT_IN_FLIGHT: "dubs_phantom_connect_in_flight";
|
|
804
|
+
};
|
|
805
|
+
/**
|
|
806
|
+
* Creates a TokenStorage backed by expo-secure-store.
|
|
807
|
+
* Lazy-imports the module so it's only required at runtime when actually used.
|
|
808
|
+
* Throws a clear error if expo-secure-store is not installed.
|
|
809
|
+
*/
|
|
810
|
+
declare function createSecureStoreStorage(): TokenStorage;
|
|
811
|
+
|
|
812
|
+
/**
|
|
813
|
+
* Minimal wallet adapter interface.
|
|
814
|
+
* Two required methods: publicKey + signTransaction.
|
|
815
|
+
* signAndSendTransaction is optional — if not provided, the SDK signs then sends via RPC.
|
|
816
|
+
*/
|
|
817
|
+
interface WalletAdapter {
|
|
818
|
+
/** The connected wallet's public key, or null if not connected */
|
|
819
|
+
publicKey: PublicKey | null;
|
|
820
|
+
/** Whether the wallet is currently connected */
|
|
821
|
+
connected: boolean;
|
|
822
|
+
/** Sign a transaction without sending it */
|
|
823
|
+
signTransaction(transaction: Transaction): Promise<Transaction>;
|
|
824
|
+
/**
|
|
825
|
+
* Optional: Sign and send in one step.
|
|
826
|
+
* If provided, the SDK will prefer this over signTransaction + sendRawTransaction.
|
|
827
|
+
* Returns the transaction signature.
|
|
828
|
+
*/
|
|
829
|
+
signAndSendTransaction?(transaction: Transaction): Promise<string>;
|
|
830
|
+
/**
|
|
831
|
+
* Optional: Sign an arbitrary message (for authentication).
|
|
832
|
+
* Returns the signature as a Uint8Array.
|
|
833
|
+
*/
|
|
834
|
+
signMessage?(message: Uint8Array): Promise<Uint8Array>;
|
|
835
|
+
/** Optional: Connect the wallet */
|
|
836
|
+
connect?(): Promise<void>;
|
|
837
|
+
/** Optional: Disconnect the wallet */
|
|
838
|
+
disconnect?(): void | Promise<void>;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
interface RegistrationScreenProps {
|
|
842
|
+
onRegister: (username: string, referralCode?: string, avatarUrl?: string) => void;
|
|
843
|
+
registering: boolean;
|
|
844
|
+
error: Error | null;
|
|
845
|
+
client: DubsClient;
|
|
846
|
+
}
|
|
847
|
+
interface ConnectWalletScreenProps$1 {
|
|
848
|
+
/** Call this to trigger the wallet connection flow */
|
|
849
|
+
onConnect: () => void;
|
|
850
|
+
/** True while the wallet is connecting/signing */
|
|
851
|
+
connecting: boolean;
|
|
852
|
+
/** Error from a failed connection attempt */
|
|
853
|
+
error: Error | null;
|
|
854
|
+
}
|
|
855
|
+
interface AuthGateProps {
|
|
856
|
+
children: React$1.ReactNode;
|
|
857
|
+
onSaveToken: (token: string | null) => void | Promise<void>;
|
|
858
|
+
onLoadToken: () => string | null | Promise<string | null>;
|
|
859
|
+
renderLoading?: (status: AuthStatus) => React$1.ReactNode;
|
|
860
|
+
renderError?: (error: Error, retry: () => void) => React$1.ReactNode;
|
|
861
|
+
renderRegistration?: (props: RegistrationScreenProps) => React$1.ReactNode;
|
|
862
|
+
/**
|
|
863
|
+
* Render your own connect-wallet screen.
|
|
864
|
+
* Receives { onConnect, connecting, error }.
|
|
865
|
+
* If omitted, the default ConnectWalletScreen is shown.
|
|
866
|
+
*/
|
|
867
|
+
renderConnectWallet?: (props: ConnectWalletScreenProps$1) => React$1.ReactNode;
|
|
868
|
+
appName?: string;
|
|
869
|
+
/** Override accent color for registration screens (from developer UI config) */
|
|
870
|
+
accentColor?: string;
|
|
871
|
+
}
|
|
872
|
+
declare function AuthGate({ children, onSaveToken, onLoadToken, renderLoading, renderError, renderRegistration, renderConnectWallet, appName, accentColor, }: AuthGateProps): react_jsx_runtime.JSX.Element;
|
|
873
|
+
|
|
874
|
+
interface ConnectWalletScreenProps {
|
|
875
|
+
/** Called when the user taps Connect Wallet */
|
|
876
|
+
onConnect: () => void | Promise<void>;
|
|
877
|
+
/** Show a loading spinner on the button while connecting */
|
|
878
|
+
connecting?: boolean;
|
|
879
|
+
/** Error message to display (e.g. "User rejected the request") */
|
|
880
|
+
error?: string | null;
|
|
881
|
+
/** App name shown in the header. Defaults to "Dubs" */
|
|
882
|
+
appName?: string;
|
|
883
|
+
/** Override accent color (e.g. from developer UI config) */
|
|
884
|
+
accentColor?: string;
|
|
885
|
+
/** URL to app icon — renders as Image instead of the default letter circle */
|
|
886
|
+
appIcon?: string;
|
|
887
|
+
/** Override subtitle text below app name */
|
|
888
|
+
tagline?: string;
|
|
889
|
+
}
|
|
890
|
+
declare function ConnectWalletScreen({ onConnect, connecting, error, appName, accentColor, appIcon, tagline, }: ConnectWalletScreenProps): react_jsx_runtime.JSX.Element;
|
|
891
|
+
|
|
892
|
+
interface DubsContextValue {
|
|
893
|
+
client: DubsClient;
|
|
894
|
+
wallet: WalletAdapter;
|
|
895
|
+
connection: Connection;
|
|
896
|
+
appName: string;
|
|
897
|
+
network: DubsNetwork;
|
|
898
|
+
disconnect: () => Promise<void>;
|
|
899
|
+
uiConfig: UiConfig;
|
|
900
|
+
pushEnabled: boolean;
|
|
901
|
+
}
|
|
902
|
+
interface DubsProviderProps {
|
|
903
|
+
apiKey: string;
|
|
904
|
+
children: React$1.ReactNode;
|
|
905
|
+
appName?: string;
|
|
906
|
+
network?: DubsNetwork;
|
|
907
|
+
/** Escape hatch: bring your own wallet adapter. Disables managed MWA. */
|
|
908
|
+
wallet?: WalletAdapter;
|
|
909
|
+
/** Escape hatch: custom token persistence. Defaults to expo-secure-store. */
|
|
910
|
+
tokenStorage?: TokenStorage;
|
|
911
|
+
/** Escape hatch: override base URL (takes precedence over network). */
|
|
912
|
+
baseUrl?: string;
|
|
913
|
+
/** Escape hatch: override RPC URL (takes precedence over network). */
|
|
914
|
+
rpcUrl?: string;
|
|
915
|
+
/** Custom connect screen, or false to hide it entirely (headless mode). */
|
|
916
|
+
renderConnectScreen?: ((props: ConnectWalletScreenProps) => React$1.ReactNode) | false;
|
|
917
|
+
/** Custom loading screen shown during auth. */
|
|
918
|
+
renderLoading?: (status: AuthStatus) => React$1.ReactNode;
|
|
919
|
+
/** Custom error screen shown on auth failure. */
|
|
920
|
+
renderError?: (error: Error, retry: () => void) => React$1.ReactNode;
|
|
921
|
+
/** Custom registration screen. */
|
|
922
|
+
renderRegistration?: (props: RegistrationScreenProps) => React$1.ReactNode;
|
|
923
|
+
/** Set to false to skip AuthGate and connect screen (headless/BYOA mode). Default: true. */
|
|
924
|
+
managed?: boolean;
|
|
925
|
+
/** Deeplink redirect URI for Phantom wallet (required for iOS support). */
|
|
926
|
+
redirectUri?: string;
|
|
927
|
+
/** App URL shown in Phantom's connect screen. */
|
|
928
|
+
appUrl?: string;
|
|
929
|
+
/** Enable Dubs push notifications. Default: true. Set false if your app manages its own Firebase/push. */
|
|
930
|
+
pushEnabled?: boolean;
|
|
931
|
+
}
|
|
932
|
+
declare function DubsProvider({ apiKey, children, appName, network, wallet: externalWallet, tokenStorage, baseUrl: baseUrlOverride, rpcUrl: rpcUrlOverride, renderConnectScreen, renderLoading, renderError, renderRegistration, managed, redirectUri, appUrl, pushEnabled, }: DubsProviderProps): react_jsx_runtime.JSX.Element | null;
|
|
933
|
+
declare function useDubs(): DubsContextValue;
|
|
934
|
+
declare function useAppConfig(): UiConfig;
|
|
935
|
+
|
|
936
|
+
/** The `transact` function signature from @solana-mobile/mobile-wallet-adapter-protocol-web3js */
|
|
937
|
+
type MwaTransactFn = (callback: (wallet: any) => Promise<any>) => Promise<any>;
|
|
938
|
+
interface MwaAdapterConfig {
|
|
939
|
+
/** The MWA `transact` function — import it from @solana-mobile/mobile-wallet-adapter-protocol-web3js */
|
|
940
|
+
transact: MwaTransactFn;
|
|
941
|
+
appIdentity: {
|
|
942
|
+
name: string;
|
|
943
|
+
uri?: string;
|
|
944
|
+
icon?: string;
|
|
945
|
+
};
|
|
946
|
+
cluster?: string;
|
|
947
|
+
onAuthTokenChange?: (token: string | null) => void;
|
|
948
|
+
}
|
|
949
|
+
/**
|
|
950
|
+
* Mobile Wallet Adapter implementation.
|
|
951
|
+
* Wraps @solana-mobile/mobile-wallet-adapter-protocol-web3js.
|
|
952
|
+
*/
|
|
953
|
+
declare class MwaWalletAdapter implements WalletAdapter {
|
|
954
|
+
private _publicKey;
|
|
955
|
+
private _connected;
|
|
956
|
+
private _authToken;
|
|
957
|
+
/** The raw base64-encoded address from MWA authorize — needed for signMessages */
|
|
958
|
+
private _mwaAddress;
|
|
959
|
+
private readonly config;
|
|
960
|
+
private readonly transact;
|
|
961
|
+
constructor(config: MwaAdapterConfig);
|
|
962
|
+
get publicKey(): PublicKey | null;
|
|
963
|
+
get connected(): boolean;
|
|
964
|
+
get authToken(): string | null;
|
|
965
|
+
setAuthToken(token: string | null): void;
|
|
966
|
+
/**
|
|
967
|
+
* Restore a previous session silently (no wallet interaction).
|
|
968
|
+
* Sets the public key and auth token so the adapter appears connected.
|
|
969
|
+
* The next signing operation will reauthorize with Phantom.
|
|
970
|
+
*/
|
|
971
|
+
restoreSession(token: string, walletAddressBase58: string): void;
|
|
972
|
+
/**
|
|
973
|
+
* Connect to a mobile wallet. Call this before any signing.
|
|
974
|
+
* Tries reauthorize first (if we have a saved token), then falls back to
|
|
975
|
+
* a fresh authorize in a SEPARATE transact session.
|
|
976
|
+
*/
|
|
977
|
+
connect(): Promise<void>;
|
|
978
|
+
/**
|
|
979
|
+
* Disconnect and clear auth token.
|
|
980
|
+
*/
|
|
981
|
+
disconnect(): void;
|
|
982
|
+
signTransaction(transaction: Transaction): Promise<Transaction>;
|
|
983
|
+
signMessage(message: Uint8Array): Promise<Uint8Array>;
|
|
984
|
+
signAndSendTransaction(transaction: Transaction): Promise<string>;
|
|
985
|
+
private applyAuthResult;
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
/** Serializable session state — save this to restore without a deeplink round-trip. */
|
|
989
|
+
interface PhantomSession {
|
|
990
|
+
/** Our x25519 public key (base58) */
|
|
991
|
+
dappPublicKey: string;
|
|
992
|
+
/** Our x25519 secret key (base58) */
|
|
993
|
+
dappSecretKey: string;
|
|
994
|
+
/** Phantom's x25519 public key (base58) */
|
|
995
|
+
phantomPublicKey: string;
|
|
996
|
+
/** Shared secret (base58) */
|
|
997
|
+
sharedSecret: string;
|
|
998
|
+
/** Phantom session token (opaque string) */
|
|
999
|
+
sessionToken: string;
|
|
1000
|
+
/** User's wallet public key (base58) */
|
|
1001
|
+
walletPublicKey: string;
|
|
1002
|
+
}
|
|
1003
|
+
interface PhantomDeeplinkAdapterConfig {
|
|
1004
|
+
/** The deeplink redirect URI, e.g. "myapp://phantom-callback" */
|
|
1005
|
+
redirectUri: string;
|
|
1006
|
+
/** Shown in Phantom's connect screen */
|
|
1007
|
+
appUrl?: string;
|
|
1008
|
+
/** Solana cluster: 'devnet' | 'mainnet-beta' */
|
|
1009
|
+
cluster?: string;
|
|
1010
|
+
/** Deeplink round-trip timeout in ms (default 120000) */
|
|
1011
|
+
timeout?: number;
|
|
1012
|
+
/** Called when the Phantom session changes (save/clear for persistence) */
|
|
1013
|
+
onSessionChange?: (session: PhantomSession | null) => void;
|
|
1014
|
+
/** Storage for persisting in-flight connect state (cold-start recovery on Android) */
|
|
1015
|
+
storage?: TokenStorage;
|
|
1016
|
+
}
|
|
1017
|
+
/**
|
|
1018
|
+
* Phantom wallet adapter using deeplinks (works on iOS and Android).
|
|
1019
|
+
* Uses x25519 encrypted communication per Phantom's deeplink protocol.
|
|
1020
|
+
*/
|
|
1021
|
+
declare class PhantomDeeplinkAdapter implements WalletAdapter {
|
|
1022
|
+
private _publicKey;
|
|
1023
|
+
private _connected;
|
|
1024
|
+
private _dappKeyPair;
|
|
1025
|
+
private _sharedSecret;
|
|
1026
|
+
private _sessionToken;
|
|
1027
|
+
private _phantomPublicKey;
|
|
1028
|
+
private readonly config;
|
|
1029
|
+
private readonly handler;
|
|
1030
|
+
private readonly timeout;
|
|
1031
|
+
constructor(config: PhantomDeeplinkAdapterConfig);
|
|
1032
|
+
get publicKey(): PublicKey | null;
|
|
1033
|
+
get connected(): boolean;
|
|
1034
|
+
/**
|
|
1035
|
+
* Restore a previously saved session without opening Phantom.
|
|
1036
|
+
* Call this before connect() if you have persisted session state.
|
|
1037
|
+
*/
|
|
1038
|
+
restoreSession(saved: PhantomSession): void;
|
|
1039
|
+
/** Serialize the current session for persistence. Returns null if not connected. */
|
|
1040
|
+
getSession(): PhantomSession | null;
|
|
1041
|
+
connect(): Promise<void>;
|
|
1042
|
+
disconnect(): void;
|
|
1043
|
+
/**
|
|
1044
|
+
* Return and clear the stashed cold-start URL from the deeplink handler.
|
|
1045
|
+
* Used by ManagedWalletProvider to detect an in-flight connect on cold start.
|
|
1046
|
+
*/
|
|
1047
|
+
consumeColdStartUrl(): string | null;
|
|
1048
|
+
/**
|
|
1049
|
+
* Complete a connect flow that was interrupted by the OS killing the app (Android).
|
|
1050
|
+
* Loads the saved in-flight keypair from storage, decrypts the Phantom response
|
|
1051
|
+
* from the cold-start URL, and restores the session.
|
|
1052
|
+
*/
|
|
1053
|
+
completeConnectFromColdStart(url: string): Promise<void>;
|
|
1054
|
+
signTransaction(transaction: Transaction): Promise<Transaction>;
|
|
1055
|
+
signMessage(message: Uint8Array): Promise<Uint8Array>;
|
|
1056
|
+
/** Remove the Linking event listener. Call when the adapter is no longer needed. */
|
|
1057
|
+
destroy(): void;
|
|
1058
|
+
private assertConnected;
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
declare function useEvents(params?: GetUpcomingEventsParams): QueryResult<{
|
|
1062
|
+
events: UnifiedEvent[];
|
|
1063
|
+
pagination: Pagination;
|
|
1064
|
+
}>;
|
|
1065
|
+
|
|
1066
|
+
declare function useGame(gameId: string | null): QueryResult<GameDetail>;
|
|
1067
|
+
|
|
1068
|
+
declare function useGames(params?: GetGamesParams): QueryResult<GameListItem[]>;
|
|
1069
|
+
|
|
1070
|
+
declare function useNetworkGames(params?: GetNetworkGamesParams): QueryResult<{
|
|
1071
|
+
games: GameListItem[];
|
|
1072
|
+
pagination: Pagination;
|
|
1073
|
+
}>;
|
|
1074
|
+
|
|
1075
|
+
interface CreateGameMutationResult {
|
|
1076
|
+
gameId: string;
|
|
1077
|
+
gameAddress: string;
|
|
1078
|
+
signature: string;
|
|
1079
|
+
explorerUrl: string;
|
|
1080
|
+
}
|
|
1081
|
+
declare function useCreateGame(): {
|
|
1082
|
+
execute: (params: CreateGameParams) => Promise<CreateGameMutationResult>;
|
|
1083
|
+
status: MutationStatus;
|
|
1084
|
+
error: Error | null;
|
|
1085
|
+
data: CreateGameMutationResult | null;
|
|
1086
|
+
reset: () => void;
|
|
1087
|
+
};
|
|
1088
|
+
|
|
1089
|
+
interface JoinGameMutationResult {
|
|
1090
|
+
gameId: string;
|
|
1091
|
+
gameAddress: string;
|
|
1092
|
+
signature: string;
|
|
1093
|
+
explorerUrl: string;
|
|
1094
|
+
}
|
|
1095
|
+
declare function useJoinGame(): {
|
|
1096
|
+
execute: (params: JoinGameParams) => Promise<JoinGameMutationResult>;
|
|
1097
|
+
status: MutationStatus;
|
|
1098
|
+
error: Error | null;
|
|
1099
|
+
data: JoinGameMutationResult | null;
|
|
1100
|
+
reset: () => void;
|
|
1101
|
+
};
|
|
1102
|
+
|
|
1103
|
+
interface ClaimMutationResult {
|
|
1104
|
+
gameId: string;
|
|
1105
|
+
signature: string;
|
|
1106
|
+
explorerUrl: string;
|
|
1107
|
+
}
|
|
1108
|
+
declare function useClaim(): {
|
|
1109
|
+
execute: (params: BuildClaimParams & {
|
|
1110
|
+
amountClaimed?: number;
|
|
1111
|
+
}) => Promise<ClaimMutationResult>;
|
|
1112
|
+
status: MutationStatus;
|
|
1113
|
+
error: Error | null;
|
|
1114
|
+
data: ClaimMutationResult | null;
|
|
1115
|
+
reset: () => void;
|
|
1116
|
+
};
|
|
1117
|
+
|
|
1118
|
+
interface CreateCustomGameMutationResult {
|
|
1119
|
+
gameId: string;
|
|
1120
|
+
gameAddress: string;
|
|
1121
|
+
signature: string;
|
|
1122
|
+
explorerUrl: string;
|
|
1123
|
+
buyIn: number;
|
|
1124
|
+
}
|
|
1125
|
+
declare function useCreateCustomGame(): {
|
|
1126
|
+
execute: (params: CreateCustomGameParams) => Promise<CreateCustomGameMutationResult>;
|
|
1127
|
+
status: MutationStatus;
|
|
1128
|
+
error: Error | null;
|
|
1129
|
+
data: CreateCustomGameMutationResult | null;
|
|
1130
|
+
reset: () => void;
|
|
1131
|
+
};
|
|
1132
|
+
|
|
1133
|
+
interface ClaimStatus {
|
|
1134
|
+
/** Whether the current wallet has claimed this game's prize */
|
|
1135
|
+
hasClaimed: boolean;
|
|
1136
|
+
/** Amount claimed (null if not claimed) */
|
|
1137
|
+
amountClaimed: number | null;
|
|
1138
|
+
/** Claim transaction signature (null if not claimed) */
|
|
1139
|
+
claimSignature: string | null;
|
|
1140
|
+
/** Whether the game has been resolved */
|
|
1141
|
+
isResolved: boolean;
|
|
1142
|
+
/** Loading state */
|
|
1143
|
+
loading: boolean;
|
|
1144
|
+
/** Error if fetch failed */
|
|
1145
|
+
error: Error | null;
|
|
1146
|
+
/** Re-fetch claim status */
|
|
1147
|
+
refetch: () => void;
|
|
1148
|
+
}
|
|
1149
|
+
/**
|
|
1150
|
+
* Check whether the current wallet has already claimed a prize for a game.
|
|
1151
|
+
*
|
|
1152
|
+
* Uses the game detail endpoint which includes per-bettor claim data.
|
|
1153
|
+
*/
|
|
1154
|
+
declare function useHasClaimed(gameId: string | null): ClaimStatus;
|
|
1155
|
+
|
|
1156
|
+
interface UseAuthResult {
|
|
1157
|
+
/** Current auth status */
|
|
1158
|
+
status: AuthStatus;
|
|
1159
|
+
/** Authenticated user profile, or null */
|
|
1160
|
+
user: DubsUser | null;
|
|
1161
|
+
/** JWT token, or null */
|
|
1162
|
+
token: string | null;
|
|
1163
|
+
/** Convenience boolean */
|
|
1164
|
+
isAuthenticated: boolean;
|
|
1165
|
+
/** Error from the last operation, or null */
|
|
1166
|
+
error: Error | null;
|
|
1167
|
+
/**
|
|
1168
|
+
* Full nonce → sign → verify flow.
|
|
1169
|
+
* If the wallet is already registered, resolves to authenticated state.
|
|
1170
|
+
* If new wallet, resolves to needsRegistration state — call register() next.
|
|
1171
|
+
*/
|
|
1172
|
+
authenticate: () => Promise<void>;
|
|
1173
|
+
/**
|
|
1174
|
+
* Register a new user after authenticate() returned needsRegistration.
|
|
1175
|
+
* Reuses the nonce+signature from authenticate() — no second signing prompt.
|
|
1176
|
+
*/
|
|
1177
|
+
register: (username: string, referralCode?: string, avatarUrl?: string) => Promise<void>;
|
|
1178
|
+
/** Log out and clear state */
|
|
1179
|
+
logout: () => Promise<void>;
|
|
1180
|
+
/**
|
|
1181
|
+
* Restore a session from a saved token (e.g. AsyncStorage on app restart).
|
|
1182
|
+
* Calls GET /auth/me to validate. Returns true if valid, false otherwise.
|
|
1183
|
+
*/
|
|
1184
|
+
restoreSession: (token: string) => Promise<boolean>;
|
|
1185
|
+
/** Re-fetch user profile from the server (e.g. after avatar change) */
|
|
1186
|
+
refreshUser: () => Promise<void>;
|
|
1187
|
+
/** Reset to idle state, clearing errors and user */
|
|
1188
|
+
reset: () => void;
|
|
1189
|
+
}
|
|
1190
|
+
declare function useAuth(): UseAuthResult;
|
|
1191
|
+
|
|
1192
|
+
declare function useUFCFightCard(): QueryResult<UFCEvent[]>;
|
|
1193
|
+
|
|
1194
|
+
declare function useUFCFighterDetail(athleteId: string | null): QueryResult<UFCFighterDetail>;
|
|
1195
|
+
|
|
1196
|
+
interface HighlightVideo {
|
|
1197
|
+
videoId: string;
|
|
1198
|
+
title: string;
|
|
1199
|
+
channelTitle: string;
|
|
1200
|
+
thumbnail: string;
|
|
1201
|
+
publishedAt: string;
|
|
1202
|
+
}
|
|
1203
|
+
declare function useHighlights(league?: string, limit?: number): QueryResult<HighlightVideo[]>;
|
|
1204
|
+
|
|
1205
|
+
interface ShortVideo {
|
|
1206
|
+
videoId: string;
|
|
1207
|
+
title: string;
|
|
1208
|
+
channelTitle: string;
|
|
1209
|
+
thumbnail: string;
|
|
1210
|
+
publishedAt: string;
|
|
1211
|
+
}
|
|
1212
|
+
declare function useShorts(league?: string, limit?: number): QueryResult<ShortVideo[]>;
|
|
1213
|
+
|
|
1214
|
+
interface PushNotificationStatus {
|
|
1215
|
+
/** Whether push notifications are enabled in the SDK configuration */
|
|
1216
|
+
enabled: boolean;
|
|
1217
|
+
/** Whether notification permission has been granted */
|
|
1218
|
+
hasPermission: boolean;
|
|
1219
|
+
/** The push token (native FCM/APNs), if registered */
|
|
1220
|
+
pushToken: string | null;
|
|
1221
|
+
/**
|
|
1222
|
+
* @deprecated Use pushToken instead. Kept for backwards compatibility.
|
|
1223
|
+
*/
|
|
1224
|
+
expoPushToken: string | null;
|
|
1225
|
+
/** Whether a registration operation is in progress */
|
|
1226
|
+
loading: boolean;
|
|
1227
|
+
/** The last error encountered */
|
|
1228
|
+
error: Error | null;
|
|
1229
|
+
/**
|
|
1230
|
+
* Request notification permission and register the push token.
|
|
1231
|
+
* Does NOT auto-prompt — must be called explicitly (e.g. from an onboarding screen).
|
|
1232
|
+
*/
|
|
1233
|
+
register: () => Promise<boolean>;
|
|
1234
|
+
/** Unregister the current push token */
|
|
1235
|
+
unregister: () => Promise<void>;
|
|
1236
|
+
/**
|
|
1237
|
+
* Silently re-register if permission was already granted (no prompt).
|
|
1238
|
+
* Safe to call on app startup for returning users.
|
|
1239
|
+
*/
|
|
1240
|
+
restoreIfGranted: () => Promise<void>;
|
|
1241
|
+
}
|
|
1242
|
+
declare function usePushNotifications(): PushNotificationStatus;
|
|
1243
|
+
|
|
1244
|
+
interface UseArcadePoolsResult {
|
|
1245
|
+
pools: ArcadePool[];
|
|
1246
|
+
loading: boolean;
|
|
1247
|
+
error: Error | null;
|
|
1248
|
+
refetch: () => void;
|
|
1249
|
+
}
|
|
1250
|
+
declare function useArcadePools(gameSlug?: string): UseArcadePoolsResult;
|
|
1251
|
+
|
|
1252
|
+
interface UseArcadePoolResult {
|
|
1253
|
+
pool: ArcadePool | null;
|
|
1254
|
+
stats: ArcadePoolStats | null;
|
|
1255
|
+
leaderboard: ArcadeLeaderboardEntry[];
|
|
1256
|
+
loading: boolean;
|
|
1257
|
+
error: Error | null;
|
|
1258
|
+
refetch: () => void;
|
|
1259
|
+
}
|
|
1260
|
+
declare function useArcadePool(poolId: number | null): UseArcadePoolResult;
|
|
1261
|
+
|
|
1262
|
+
interface UseArcadeGameResult {
|
|
1263
|
+
entry: ArcadeEntry | null;
|
|
1264
|
+
livesRemaining: number;
|
|
1265
|
+
bestScore: number;
|
|
1266
|
+
loading: boolean;
|
|
1267
|
+
error: Error | null;
|
|
1268
|
+
/** Fetch/refresh the user's entry for this pool */
|
|
1269
|
+
refreshEntry: () => Promise<void>;
|
|
1270
|
+
/** Start a new life — returns session token to pass to the game */
|
|
1271
|
+
startAttempt: () => Promise<StartAttemptResult>;
|
|
1272
|
+
/** Submit score after game over */
|
|
1273
|
+
submitScore: (sessionToken: string, score: number, durationMs?: number) => Promise<SubmitScoreResult>;
|
|
1274
|
+
}
|
|
1275
|
+
declare function useArcadeGame(poolId: number | null, maxLives?: number): UseArcadeGameResult;
|
|
1276
|
+
|
|
1277
|
+
interface EnterArcadePoolMutationResult {
|
|
1278
|
+
poolId: number;
|
|
1279
|
+
signature: string;
|
|
1280
|
+
entry: ArcadeEntry;
|
|
1281
|
+
}
|
|
1282
|
+
declare function useEnterArcadePool(): {
|
|
1283
|
+
execute: (poolId: number) => Promise<EnterArcadePoolMutationResult>;
|
|
1284
|
+
status: MutationStatus;
|
|
1285
|
+
error: Error | null;
|
|
1286
|
+
data: EnterArcadePoolMutationResult | null;
|
|
1287
|
+
reset: () => void;
|
|
1288
|
+
};
|
|
1289
|
+
|
|
1290
|
+
interface ArcadeCountdown {
|
|
1291
|
+
/** Total milliseconds remaining */
|
|
1292
|
+
totalMs: number;
|
|
1293
|
+
/** Days remaining */
|
|
1294
|
+
days: number;
|
|
1295
|
+
/** Hours remaining (0-23) */
|
|
1296
|
+
hours: number;
|
|
1297
|
+
/** Minutes remaining (0-59) */
|
|
1298
|
+
minutes: number;
|
|
1299
|
+
/** Seconds remaining (0-59) */
|
|
1300
|
+
seconds: number;
|
|
1301
|
+
/** Formatted string e.g. "2d 5h 30m" or "5m 12s" */
|
|
1302
|
+
formatted: string;
|
|
1303
|
+
/** True when countdown has reached zero */
|
|
1304
|
+
isExpired: boolean;
|
|
1305
|
+
}
|
|
1306
|
+
/**
|
|
1307
|
+
* Countdown hook for arcade pool resolution time.
|
|
1308
|
+
* Pass the `next_resolution` ISO string from the pool object.
|
|
1309
|
+
* Ticks every second automatically.
|
|
1310
|
+
*/
|
|
1311
|
+
declare function useArcadeCountdown(nextResolution: string | null | undefined): ArcadeCountdown;
|
|
1312
|
+
|
|
1313
|
+
/**
|
|
1314
|
+
* useArcadeBridge
|
|
1315
|
+
*
|
|
1316
|
+
* Owns the full RN ↔ WebView bridge for Dubs Arcade pool integration.
|
|
1317
|
+
* Replaces the manual sessionToken / gameStartTime / handleMessage / injectJavaScript
|
|
1318
|
+
* wiring that previously lived inline in each game's index.tsx.
|
|
1319
|
+
*
|
|
1320
|
+
* PROTOCOL VERSION: dubsArcade 1.0
|
|
1321
|
+
*
|
|
1322
|
+
* Usage:
|
|
1323
|
+
*
|
|
1324
|
+
* const { webviewRef, handleMessage, triggerPlay, lastResult } = useArcadeBridge({
|
|
1325
|
+
* poolId,
|
|
1326
|
+
* startAttempt,
|
|
1327
|
+
* submitScore,
|
|
1328
|
+
* canPlay,
|
|
1329
|
+
* onScoreSubmitted: (result) => { refetchPool(); },
|
|
1330
|
+
* onError: (err) => { console.warn(err); },
|
|
1331
|
+
* });
|
|
1332
|
+
*
|
|
1333
|
+
* <WebView ref={webviewRef} onMessage={handleMessage} ... />
|
|
1334
|
+
* <TouchableOpacity onPress={triggerPlay}>Play</TouchableOpacity>
|
|
1335
|
+
*/
|
|
1336
|
+
|
|
1337
|
+
type WebView = any;
|
|
1338
|
+
interface UseArcadeBridgeOptions {
|
|
1339
|
+
/** Whether the player currently has an entry with lives remaining */
|
|
1340
|
+
canPlay: boolean;
|
|
1341
|
+
/** From useArcadeGame — starts a new life on the server */
|
|
1342
|
+
startAttempt: () => Promise<StartAttemptResult>;
|
|
1343
|
+
/** From useArcadeGame — submits a score for a completed life */
|
|
1344
|
+
submitScore: (sessionToken: string, score: number, durationMs?: number) => Promise<SubmitScoreResult>;
|
|
1345
|
+
/** Called when a new life starts (after startAttempt succeeds and session is injected) */
|
|
1346
|
+
onPlayStarted?: () => void;
|
|
1347
|
+
/** Called after a score is successfully submitted */
|
|
1348
|
+
onScoreSubmitted?: (result: SubmitScoreResult) => void;
|
|
1349
|
+
/** Called on any bridge error (network, invalid message, etc.) */
|
|
1350
|
+
onError?: (err: Error) => void;
|
|
1351
|
+
}
|
|
1352
|
+
interface UseArcadeBridgeResult {
|
|
1353
|
+
/** Attach to <WebView ref={webviewRef}> */
|
|
1354
|
+
webviewRef: React.RefObject<WebView>;
|
|
1355
|
+
/** Pass to <WebView onMessage={handleMessage}> */
|
|
1356
|
+
handleMessage: (event: any) => void;
|
|
1357
|
+
/**
|
|
1358
|
+
* Call when the player taps PLAY in your UI.
|
|
1359
|
+
* Calls startAttempt() then injects the session token + ARCADE_START into the WebView.
|
|
1360
|
+
*/
|
|
1361
|
+
triggerPlay: () => Promise<void>;
|
|
1362
|
+
/** The result of the most recent submitted score, or null */
|
|
1363
|
+
lastResult: SubmitScoreResult | null;
|
|
1364
|
+
/** True while a startAttempt or submitScore request is in flight */
|
|
1365
|
+
bridgeLoading: boolean;
|
|
1366
|
+
}
|
|
1367
|
+
declare function useArcadeBridge({ canPlay, startAttempt, submitScore, onPlayStarted, onScoreSubmitted, onError, }: UseArcadeBridgeOptions): UseArcadeBridgeResult;
|
|
1368
|
+
|
|
1369
|
+
interface UseJackpotResult {
|
|
1370
|
+
round: JackpotRound | null;
|
|
1371
|
+
lastWinner: JackpotLastWinner | null;
|
|
1372
|
+
loading: boolean;
|
|
1373
|
+
error: Error | null;
|
|
1374
|
+
refetch: () => void;
|
|
1375
|
+
}
|
|
1376
|
+
declare function useJackpot(): UseJackpotResult;
|
|
1377
|
+
|
|
1378
|
+
interface UseJackpotHistoryResult {
|
|
1379
|
+
rounds: JackpotRoundResult[];
|
|
1380
|
+
loading: boolean;
|
|
1381
|
+
error: Error | null;
|
|
1382
|
+
refetch: () => void;
|
|
1383
|
+
}
|
|
1384
|
+
declare function useJackpotHistory(limit?: number): UseJackpotHistoryResult;
|
|
1385
|
+
|
|
1386
|
+
interface EnterJackpotMutationResult {
|
|
1387
|
+
roundId: string;
|
|
1388
|
+
amount: string;
|
|
1389
|
+
amountSol: number;
|
|
1390
|
+
signature: string;
|
|
1391
|
+
}
|
|
1392
|
+
declare function useEnterJackpot(): {
|
|
1393
|
+
execute: (amountLamports: number) => Promise<EnterJackpotMutationResult>;
|
|
1394
|
+
status: MutationStatus;
|
|
1395
|
+
error: Error | null;
|
|
1396
|
+
data: EnterJackpotMutationResult | null;
|
|
1397
|
+
reset: () => void;
|
|
1398
|
+
};
|
|
1399
|
+
|
|
1400
|
+
interface ConnectWalletButtonProps {
|
|
1401
|
+
/** Button label. Defaults to "Connect Wallet" */
|
|
1402
|
+
label?: string;
|
|
1403
|
+
/** Override accent/background color */
|
|
1404
|
+
accentColor?: string;
|
|
1405
|
+
/** Override text color. Defaults to #000 */
|
|
1406
|
+
textColor?: string;
|
|
1407
|
+
/** Override border radius */
|
|
1408
|
+
borderRadius?: number;
|
|
1409
|
+
/** Override padding vertical */
|
|
1410
|
+
paddingVertical?: number;
|
|
1411
|
+
/** Override font size */
|
|
1412
|
+
fontSize?: number;
|
|
1413
|
+
/** Full width. Defaults to true */
|
|
1414
|
+
fullWidth?: boolean;
|
|
1415
|
+
/** Called after authenticate() is triggered (not after it completes) */
|
|
1416
|
+
onPress?: () => void;
|
|
1417
|
+
}
|
|
1418
|
+
/**
|
|
1419
|
+
* ConnectWalletButton
|
|
1420
|
+
*
|
|
1421
|
+
* A minimal, customisable button that fires useAuth().authenticate().
|
|
1422
|
+
* Use this when you want to own the connect-wallet screen UI (e.g. inside
|
|
1423
|
+
* your own onboarding) but still hand off the wallet picker, signing, and
|
|
1424
|
+
* registration flow to the SDK.
|
|
1425
|
+
*
|
|
1426
|
+
* The SDK will handle everything after this tap:
|
|
1427
|
+
* wallet picker → sign message → (registration/avatar if new user) → authenticated
|
|
1428
|
+
*
|
|
1429
|
+
* Example:
|
|
1430
|
+
* <ConnectWalletButton
|
|
1431
|
+
* label="Let's go"
|
|
1432
|
+
* accentColor="#22C55E"
|
|
1433
|
+
* textColor="#000"
|
|
1434
|
+
* />
|
|
1435
|
+
*/
|
|
1436
|
+
declare function ConnectWalletButton({ label, accentColor, textColor, borderRadius, paddingVertical, fontSize, fullWidth, onPress, }: ConnectWalletButtonProps): react_jsx_runtime.JSX.Element;
|
|
1437
|
+
|
|
1438
|
+
interface UserProfileCardProps {
|
|
1439
|
+
walletAddress: string;
|
|
1440
|
+
username?: string;
|
|
1441
|
+
avatarUrl?: string | null;
|
|
1442
|
+
memberSince?: string | null;
|
|
1443
|
+
}
|
|
1444
|
+
declare function UserProfileCard({ walletAddress, username, avatarUrl, memberSince, }: UserProfileCardProps): react_jsx_runtime.JSX.Element;
|
|
1445
|
+
|
|
1446
|
+
interface SettingsSheetProps {
|
|
1447
|
+
walletAddress: string;
|
|
1448
|
+
username?: string;
|
|
1449
|
+
avatarUrl?: string | null;
|
|
1450
|
+
memberSince?: string | null;
|
|
1451
|
+
appVersion?: string;
|
|
1452
|
+
onCopyAddress?: () => void;
|
|
1453
|
+
onSupport?: () => void;
|
|
1454
|
+
onLogout: () => void | Promise<void>;
|
|
1455
|
+
loggingOut?: boolean;
|
|
1456
|
+
}
|
|
1457
|
+
declare function SettingsSheet({ walletAddress, username, avatarUrl, memberSince, appVersion, onCopyAddress, onSupport, onLogout, loggingOut, }: SettingsSheetProps): react_jsx_runtime.JSX.Element;
|
|
1458
|
+
|
|
1459
|
+
interface UserProfileSheetProps {
|
|
1460
|
+
visible: boolean;
|
|
1461
|
+
onDismiss: () => void;
|
|
1462
|
+
user: {
|
|
1463
|
+
walletAddress: string;
|
|
1464
|
+
username?: string;
|
|
1465
|
+
avatar?: string | null;
|
|
1466
|
+
createdAt?: string;
|
|
1467
|
+
};
|
|
1468
|
+
onAvatarUpdated?: (newAvatarUrl: string) => void;
|
|
1469
|
+
onDisconnect?: () => void;
|
|
1470
|
+
}
|
|
1471
|
+
declare function UserProfileSheet({ visible, onDismiss, user, onAvatarUpdated, onDisconnect, }: UserProfileSheetProps): react_jsx_runtime.JSX.Element;
|
|
1472
|
+
|
|
1473
|
+
interface DubsTheme {
|
|
1474
|
+
background: string;
|
|
1475
|
+
surface: string;
|
|
1476
|
+
surfaceActive: string;
|
|
1477
|
+
border: string;
|
|
1478
|
+
text: string;
|
|
1479
|
+
textSecondary: string;
|
|
1480
|
+
textMuted: string;
|
|
1481
|
+
textDim: string;
|
|
1482
|
+
accent: string;
|
|
1483
|
+
success: string;
|
|
1484
|
+
live: string;
|
|
1485
|
+
errorText: string;
|
|
1486
|
+
errorBg: string;
|
|
1487
|
+
errorBorder: string;
|
|
1488
|
+
}
|
|
1489
|
+
declare function useDubsTheme(): DubsTheme;
|
|
1490
|
+
/** Merge overrides into a base theme (e.g. custom accent color from developer config) */
|
|
1491
|
+
declare function mergeTheme(base: DubsTheme, overrides: Partial<DubsTheme>): DubsTheme;
|
|
1492
|
+
|
|
1493
|
+
interface GamePosterProps {
|
|
1494
|
+
game: GameDetail;
|
|
1495
|
+
/** Optional Image component — pass expo-image or RN Image. Defaults to RN Image. */
|
|
1496
|
+
ImageComponent?: React.ComponentType<any>;
|
|
1497
|
+
}
|
|
1498
|
+
/**
|
|
1499
|
+
* Matchup poster hero widget.
|
|
1500
|
+
* Shows the game poster image (or team logo fallback), countdown pill, and pool total.
|
|
1501
|
+
*/
|
|
1502
|
+
declare function GamePoster({ game, ImageComponent }: GamePosterProps): react_jsx_runtime.JSX.Element;
|
|
1503
|
+
|
|
1504
|
+
interface LivePoolsCardProps {
|
|
1505
|
+
game: GameDetail;
|
|
1506
|
+
/** Custom short-name function for team labels. Defaults to full name. */
|
|
1507
|
+
shortName?: (name: string | null) => string;
|
|
1508
|
+
/** Override bar colors. Defaults to blue/red. */
|
|
1509
|
+
homeColor?: string;
|
|
1510
|
+
awayColor?: string;
|
|
1511
|
+
}
|
|
1512
|
+
/**
|
|
1513
|
+
* Pool breakdown card showing each side's SOL amount, bar chart, and implied odds.
|
|
1514
|
+
*/
|
|
1515
|
+
declare function LivePoolsCard({ game, shortName, homeColor, awayColor, }: LivePoolsCardProps): react_jsx_runtime.JSX.Element;
|
|
1516
|
+
|
|
1517
|
+
interface PickWinnerCardProps {
|
|
1518
|
+
game: GameDetail;
|
|
1519
|
+
selectedTeam: 'home' | 'away' | null;
|
|
1520
|
+
onSelect: (team: 'home' | 'away') => void;
|
|
1521
|
+
/** Custom short-name function for team labels. Defaults to full name. */
|
|
1522
|
+
shortName?: (name: string | null) => string;
|
|
1523
|
+
/** Override colors. Defaults to blue/red. */
|
|
1524
|
+
homeColor?: string;
|
|
1525
|
+
awayColor?: string;
|
|
1526
|
+
/** Optional Image component (expo-image, etc.). */
|
|
1527
|
+
ImageComponent?: React.ComponentType<any>;
|
|
1528
|
+
}
|
|
1529
|
+
/**
|
|
1530
|
+
* Team selection card for picking which side to bet on.
|
|
1531
|
+
*/
|
|
1532
|
+
declare function PickWinnerCard({ game, selectedTeam, onSelect, shortName, homeColor, awayColor, ImageComponent, }: PickWinnerCardProps): react_jsx_runtime.JSX.Element;
|
|
1533
|
+
|
|
1534
|
+
interface PlayersCardProps {
|
|
1535
|
+
game: GameDetail;
|
|
1536
|
+
/** How many chars to show on each side of a truncated wallet. Default 4. */
|
|
1537
|
+
truncateChars?: number;
|
|
1538
|
+
/** Override team dot colors. */
|
|
1539
|
+
homeColor?: string;
|
|
1540
|
+
awayColor?: string;
|
|
1541
|
+
drawColor?: string;
|
|
1542
|
+
/** Optional Image component (expo-image, etc.). */
|
|
1543
|
+
ImageComponent?: React.ComponentType<any>;
|
|
1544
|
+
}
|
|
1545
|
+
/**
|
|
1546
|
+
* Card showing all bettors in a game with their avatar, username, team, and wager amount.
|
|
1547
|
+
*/
|
|
1548
|
+
declare function PlayersCard({ game, truncateChars, homeColor, awayColor, drawColor, ImageComponent, }: PlayersCardProps): react_jsx_runtime.JSX.Element;
|
|
1549
|
+
|
|
1550
|
+
interface JoinGameButtonProps {
|
|
1551
|
+
game: GameDetail;
|
|
1552
|
+
walletAddress: string;
|
|
1553
|
+
selectedTeam: 'home' | 'away' | null;
|
|
1554
|
+
status: MutationStatus;
|
|
1555
|
+
onJoin: () => void;
|
|
1556
|
+
}
|
|
1557
|
+
/**
|
|
1558
|
+
* Fixed bottom bar with buy-in info and join button.
|
|
1559
|
+
* Renders nothing if the user already joined, or the game is locked/resolved.
|
|
1560
|
+
*/
|
|
1561
|
+
declare function JoinGameButton({ game, walletAddress, selectedTeam, status, onJoin }: JoinGameButtonProps): react_jsx_runtime.JSX.Element | null;
|
|
1562
|
+
|
|
1563
|
+
interface CreateCustomGameSheetProps {
|
|
1564
|
+
visible: boolean;
|
|
1565
|
+
onDismiss: () => void;
|
|
1566
|
+
title?: string;
|
|
1567
|
+
maxPlayers?: number;
|
|
1568
|
+
fee?: number;
|
|
1569
|
+
presetAmounts?: number[];
|
|
1570
|
+
defaultAmount?: number;
|
|
1571
|
+
metadata?: Record<string, unknown>;
|
|
1572
|
+
onAmountChange?: (amount: number | null) => void;
|
|
1573
|
+
onSuccess?: (result: CreateCustomGameMutationResult) => void;
|
|
1574
|
+
onError?: (error: Error) => void;
|
|
1575
|
+
/** Pool mode: hides buy-in selection, uses defaultAmount, auto-assigns team, shows "Create Pool" labels */
|
|
1576
|
+
isPoolModeEnabled?: boolean;
|
|
1577
|
+
}
|
|
1578
|
+
declare function CreateCustomGameSheet({ visible, onDismiss, title, maxPlayers, fee, presetAmounts, defaultAmount, metadata, onAmountChange, onSuccess, onError, isPoolModeEnabled, }: CreateCustomGameSheetProps): react_jsx_runtime.JSX.Element;
|
|
1579
|
+
|
|
1580
|
+
interface JoinGameSheetProps {
|
|
1581
|
+
visible: boolean;
|
|
1582
|
+
onDismiss: () => void;
|
|
1583
|
+
game: GameDetail;
|
|
1584
|
+
/** Optional Image component (expo-image, etc.) for team logos */
|
|
1585
|
+
ImageComponent?: React$1.ComponentType<any>;
|
|
1586
|
+
/** Custom short-name function for team labels */
|
|
1587
|
+
shortName?: (name: string | null) => string;
|
|
1588
|
+
/** Override team colors (default blue/red/green) */
|
|
1589
|
+
homeColor?: string;
|
|
1590
|
+
awayColor?: string;
|
|
1591
|
+
drawColor?: string;
|
|
1592
|
+
/** Callbacks */
|
|
1593
|
+
onSuccess?: (result: JoinGameMutationResult) => void;
|
|
1594
|
+
onError?: (error: Error) => void;
|
|
1595
|
+
/** Called when the user taps a team card (useful for sound/haptics) */
|
|
1596
|
+
onTeamSelect?: (team: 'home' | 'away') => void;
|
|
1597
|
+
/** Called when the join succeeds (useful for success sound/animation) */
|
|
1598
|
+
onJoinSuccess?: (result: JoinGameMutationResult) => void;
|
|
1599
|
+
/** Called on each slider tick (useful for haptics/sound) */
|
|
1600
|
+
onSliderTick?: (value: number) => void;
|
|
1601
|
+
/** Max wager in SOL (default 5) */
|
|
1602
|
+
maxWager?: number;
|
|
1603
|
+
/** Pool mode: hides team selection, auto-assigns team, shows "Join Pool" labels */
|
|
1604
|
+
isPoolModeEnabled?: boolean;
|
|
1605
|
+
}
|
|
1606
|
+
declare function JoinGameSheet({ visible, onDismiss, game, ImageComponent, shortName, homeColor, awayColor, drawColor, onSuccess, onError, onTeamSelect, onJoinSuccess, onSliderTick, maxWager, isPoolModeEnabled, }: JoinGameSheetProps): react_jsx_runtime.JSX.Element;
|
|
1607
|
+
|
|
1608
|
+
interface ClaimPrizeSheetProps {
|
|
1609
|
+
visible: boolean;
|
|
1610
|
+
onDismiss: () => void;
|
|
1611
|
+
gameId: string;
|
|
1612
|
+
/** Prize amount in SOL */
|
|
1613
|
+
prizeAmount: number;
|
|
1614
|
+
/** When true, shows refund language instead of prize language */
|
|
1615
|
+
isRefund?: boolean;
|
|
1616
|
+
/** Callbacks */
|
|
1617
|
+
onSuccess?: (result: ClaimMutationResult) => void;
|
|
1618
|
+
onError?: (error: Error) => void;
|
|
1619
|
+
}
|
|
1620
|
+
declare function ClaimPrizeSheet({ visible, onDismiss, gameId, prizeAmount, isRefund, onSuccess, onError, }: ClaimPrizeSheetProps): react_jsx_runtime.JSX.Element;
|
|
1621
|
+
|
|
1622
|
+
interface ClaimButtonProps {
|
|
1623
|
+
gameId: string;
|
|
1624
|
+
style?: ViewStyle;
|
|
1625
|
+
onSuccess?: (result: ClaimMutationResult) => void;
|
|
1626
|
+
onError?: (error: Error) => void;
|
|
1627
|
+
}
|
|
1628
|
+
/**
|
|
1629
|
+
* Drop-in claim button that handles eligibility checks, prize/refund display,
|
|
1630
|
+
* and the claim sheet lifecycle internally.
|
|
1631
|
+
*
|
|
1632
|
+
* Renders nothing when the user is ineligible (lost, not resolved, not a bettor, etc.).
|
|
1633
|
+
*/
|
|
1634
|
+
declare function ClaimButton({ gameId, style, onSuccess, onError }: ClaimButtonProps): react_jsx_runtime.JSX.Element | null;
|
|
1635
|
+
|
|
1636
|
+
interface EnterArcadePoolSheetProps {
|
|
1637
|
+
visible: boolean;
|
|
1638
|
+
onDismiss: () => void;
|
|
1639
|
+
pool: ArcadePool;
|
|
1640
|
+
stats?: ArcadePoolStats | null;
|
|
1641
|
+
mode?: 'join' | 'rejoin';
|
|
1642
|
+
onSuccess?: (result: EnterArcadePoolMutationResult) => void;
|
|
1643
|
+
onError?: (error: Error) => void;
|
|
1644
|
+
}
|
|
1645
|
+
declare function EnterArcadePoolSheet({ visible, onDismiss, pool, stats, mode, onSuccess, onError, }: EnterArcadePoolSheetProps): react_jsx_runtime.JSX.Element;
|
|
1646
|
+
|
|
1647
|
+
interface ArcadeLeaderboardSheetProps {
|
|
1648
|
+
visible: boolean;
|
|
1649
|
+
onDismiss: () => void;
|
|
1650
|
+
poolId: number;
|
|
1651
|
+
/** Highlighted wallet address (e.g. current user) */
|
|
1652
|
+
highlightWallet?: string;
|
|
1653
|
+
}
|
|
1654
|
+
declare function ArcadeLeaderboardSheet({ visible, onDismiss, poolId, highlightWallet, }: ArcadeLeaderboardSheetProps): react_jsx_runtime.JSX.Element;
|
|
1655
|
+
|
|
1656
|
+
interface SolSliderProps {
|
|
1657
|
+
/** Current value in SOL */
|
|
1658
|
+
value: number;
|
|
1659
|
+
/** Min SOL (default 0.01) */
|
|
1660
|
+
min?: number;
|
|
1661
|
+
/** Max SOL (default 5) */
|
|
1662
|
+
max?: number;
|
|
1663
|
+
/** Step size in SOL (default 0.01) */
|
|
1664
|
+
step?: number;
|
|
1665
|
+
/** Accent color for filled track + thumb glow */
|
|
1666
|
+
accentColor?: string;
|
|
1667
|
+
/** Called on every drag frame */
|
|
1668
|
+
onValueChange: (value: number) => void;
|
|
1669
|
+
/** Called when user lifts finger */
|
|
1670
|
+
onSlidingComplete?: (value: number) => void;
|
|
1671
|
+
/** Called on each tick for haptics/sound */
|
|
1672
|
+
onTick?: (value: number) => void;
|
|
1673
|
+
/** Disabled state */
|
|
1674
|
+
disabled?: boolean;
|
|
1675
|
+
}
|
|
1676
|
+
declare function SolSlider({ value, min, max, step, accentColor, onValueChange, onSlidingComplete, onTick, disabled, }: SolSliderProps): react_jsx_runtime.JSX.Element;
|
|
1677
|
+
|
|
1678
|
+
interface CreateGameSheetProps {
|
|
1679
|
+
visible: boolean;
|
|
1680
|
+
onDismiss: () => void;
|
|
1681
|
+
event: UnifiedEvent;
|
|
1682
|
+
/** Override team colors */
|
|
1683
|
+
homeColor?: string;
|
|
1684
|
+
awayColor?: string;
|
|
1685
|
+
/** Callbacks */
|
|
1686
|
+
onSuccess?: (result: CreateGameMutationResult) => void;
|
|
1687
|
+
onError?: (error: Error) => void;
|
|
1688
|
+
/** Called when the user taps a team card */
|
|
1689
|
+
onTeamSelect?: (team: 'home' | 'away') => void;
|
|
1690
|
+
/** Called on success (for sound/animation) */
|
|
1691
|
+
onCreateSuccess?: (result: CreateGameMutationResult) => void;
|
|
1692
|
+
/** Called on each slider tick */
|
|
1693
|
+
onSliderTick?: (value: number) => void;
|
|
1694
|
+
/** Max wager in SOL */
|
|
1695
|
+
maxWager?: number;
|
|
1696
|
+
/** Custom short-name function for team labels */
|
|
1697
|
+
shortName?: (name: string | null) => string;
|
|
1698
|
+
}
|
|
1699
|
+
declare function CreateGameSheet({ visible, onDismiss, event, homeColor, awayColor, onSuccess, onError, onTeamSelect, onCreateSuccess, onSliderTick, maxWager, shortName, }: CreateGameSheetProps): react_jsx_runtime.JSX.Element;
|
|
1700
|
+
|
|
1701
|
+
interface JackpotCardProps {
|
|
1702
|
+
round: JackpotRound | null;
|
|
1703
|
+
lastWinner?: JackpotLastWinner | null;
|
|
1704
|
+
entries?: JackpotEntry[];
|
|
1705
|
+
onPress?: () => void;
|
|
1706
|
+
style?: ViewStyle;
|
|
1707
|
+
}
|
|
1708
|
+
declare function JackpotCard({ round, lastWinner, entries, onPress, style }: JackpotCardProps): react_jsx_runtime.JSX.Element;
|
|
1709
|
+
|
|
1710
|
+
interface JackpotSheetProps {
|
|
1711
|
+
visible: boolean;
|
|
1712
|
+
onDismiss: () => void;
|
|
1713
|
+
onSuccess?: (result: EnterJackpotMutationResult) => void;
|
|
1714
|
+
onError?: (error: Error) => void;
|
|
1715
|
+
minEntry?: number;
|
|
1716
|
+
maxEntry?: number;
|
|
1717
|
+
}
|
|
1718
|
+
declare function JackpotSheet({ visible, onDismiss, onSuccess, onError, minEntry, maxEntry, }: JackpotSheetProps): react_jsx_runtime.JSX.Element;
|
|
1719
|
+
|
|
1720
|
+
interface JackpotWidgetProps {
|
|
1721
|
+
/** Style applied to the card */
|
|
1722
|
+
style?: ViewStyle;
|
|
1723
|
+
/** Minimum entry in SOL (default: 0.01) */
|
|
1724
|
+
minEntry?: number;
|
|
1725
|
+
/** Maximum entry in SOL (default: 10) */
|
|
1726
|
+
maxEntry?: number;
|
|
1727
|
+
/** Callback when a jackpot entry succeeds */
|
|
1728
|
+
onEntry?: (result: EnterJackpotMutationResult) => void;
|
|
1729
|
+
/** Callback on entry error */
|
|
1730
|
+
onError?: (error: Error) => void;
|
|
1731
|
+
}
|
|
1732
|
+
/**
|
|
1733
|
+
* Self-contained Jackpot widget — the first "crypto ad".
|
|
1734
|
+
*
|
|
1735
|
+
* Drop `<JackpotWidget />` anywhere in your app. Shows a live jackpot card
|
|
1736
|
+
* matching the web lobby design with pot amount, player carousel, and
|
|
1737
|
+
* Place Bet button. Tapping opens a scrollable sheet with full entry flow.
|
|
1738
|
+
*/
|
|
1739
|
+
declare function JackpotWidget({ style, minEntry, maxEntry, onEntry, onError, }: JackpotWidgetProps): react_jsx_runtime.JSX.Element;
|
|
1740
|
+
|
|
1741
|
+
interface ChatMessage {
|
|
1742
|
+
id: number;
|
|
1743
|
+
userId: number;
|
|
1744
|
+
walletAddress: string;
|
|
1745
|
+
username: string;
|
|
1746
|
+
avatar: string | null;
|
|
1747
|
+
message: string;
|
|
1748
|
+
replyTo: {
|
|
1749
|
+
id: number;
|
|
1750
|
+
message: string;
|
|
1751
|
+
username: string;
|
|
1752
|
+
walletAddress: string;
|
|
1753
|
+
} | null;
|
|
1754
|
+
timestamp: string;
|
|
1755
|
+
edited: boolean;
|
|
1756
|
+
editedAt: string | null;
|
|
1757
|
+
isWinnerAnnouncement: boolean;
|
|
1758
|
+
winAmount?: number;
|
|
1759
|
+
roundId?: number;
|
|
1760
|
+
gameInvite: Record<string, unknown> | null;
|
|
1761
|
+
pnlShare: Record<string, unknown> | null;
|
|
1762
|
+
gifUrl: string | null;
|
|
1763
|
+
reactions: Record<string, {
|
|
1764
|
+
count: number;
|
|
1765
|
+
reactors: string[];
|
|
1766
|
+
}>;
|
|
1767
|
+
mentions: ChatMention[];
|
|
1768
|
+
payment: ChatPayment | null;
|
|
1769
|
+
}
|
|
1770
|
+
interface ChatMention {
|
|
1771
|
+
userId: number;
|
|
1772
|
+
username: string;
|
|
1773
|
+
walletAddress: string;
|
|
1774
|
+
}
|
|
1775
|
+
interface ChatPayment {
|
|
1776
|
+
id: number;
|
|
1777
|
+
senderUsername: string;
|
|
1778
|
+
recipientUsername: string;
|
|
1779
|
+
amount: number;
|
|
1780
|
+
signature: string;
|
|
1781
|
+
status: string;
|
|
1782
|
+
errorMessage: string | null;
|
|
1783
|
+
createdAt: string;
|
|
1784
|
+
confirmedAt: string | null;
|
|
1785
|
+
}
|
|
1786
|
+
interface DirectMessage {
|
|
1787
|
+
id: number;
|
|
1788
|
+
senderId: number;
|
|
1789
|
+
recipientId?: number;
|
|
1790
|
+
senderUsername: string;
|
|
1791
|
+
senderAvatar: string | null;
|
|
1792
|
+
senderWallet: string;
|
|
1793
|
+
message: string;
|
|
1794
|
+
read: boolean;
|
|
1795
|
+
createdAt: string;
|
|
1796
|
+
isOwn: boolean;
|
|
1797
|
+
gameInvite: Record<string, unknown> | null;
|
|
1798
|
+
}
|
|
1799
|
+
interface Conversation {
|
|
1800
|
+
otherUserId: number;
|
|
1801
|
+
otherUsername: string;
|
|
1802
|
+
otherAvatar: string | null;
|
|
1803
|
+
otherWallet: string;
|
|
1804
|
+
lastMessage: string;
|
|
1805
|
+
lastMessageAt: string;
|
|
1806
|
+
unreadCount: number;
|
|
1807
|
+
}
|
|
1808
|
+
interface FriendUser {
|
|
1809
|
+
userId: number;
|
|
1810
|
+
username: string;
|
|
1811
|
+
avatar: string | null;
|
|
1812
|
+
walletAddress: string;
|
|
1813
|
+
friendsSince?: string;
|
|
1814
|
+
isFriend?: boolean;
|
|
1815
|
+
isBlocked?: boolean;
|
|
1816
|
+
friendRequestSent?: boolean;
|
|
1817
|
+
friendRequestReceived?: boolean;
|
|
1818
|
+
friendRequestId?: number;
|
|
1819
|
+
}
|
|
1820
|
+
interface FriendRequest {
|
|
1821
|
+
id: number;
|
|
1822
|
+
fromUserId: number;
|
|
1823
|
+
fromUsername: string;
|
|
1824
|
+
fromAvatar: string | null;
|
|
1825
|
+
fromWallet: string;
|
|
1826
|
+
createdAt: string;
|
|
1827
|
+
}
|
|
1828
|
+
interface OnlineUser {
|
|
1829
|
+
walletAddress: string;
|
|
1830
|
+
username: string;
|
|
1831
|
+
avatar: string | null;
|
|
1832
|
+
}
|
|
1833
|
+
interface TypingEvent {
|
|
1834
|
+
userId: number;
|
|
1835
|
+
username: string;
|
|
1836
|
+
walletAddress: string;
|
|
1837
|
+
isTyping: boolean;
|
|
1838
|
+
}
|
|
1839
|
+
interface ChatNotification {
|
|
1840
|
+
id: number;
|
|
1841
|
+
type: string;
|
|
1842
|
+
read: boolean;
|
|
1843
|
+
message: string;
|
|
1844
|
+
messageId?: number;
|
|
1845
|
+
senderUsername: string;
|
|
1846
|
+
senderWallet: string;
|
|
1847
|
+
senderAvatar: string | null;
|
|
1848
|
+
createdAt: string;
|
|
1849
|
+
[key: string]: unknown;
|
|
1850
|
+
}
|
|
1851
|
+
type ChatConnectionStatus = 'disconnected' | 'connecting' | 'connected' | 'error';
|
|
1852
|
+
interface SendMessageParams {
|
|
1853
|
+
message: string;
|
|
1854
|
+
replyToId?: number;
|
|
1855
|
+
mentions?: number[];
|
|
1856
|
+
gifUrl?: string;
|
|
1857
|
+
gameInvite?: Record<string, unknown>;
|
|
1858
|
+
pnlShare?: Record<string, unknown>;
|
|
1859
|
+
}
|
|
1860
|
+
interface SendDMParams {
|
|
1861
|
+
recipientWallet: string;
|
|
1862
|
+
message: string;
|
|
1863
|
+
gameInvite?: Record<string, unknown>;
|
|
1864
|
+
animation?: string;
|
|
1865
|
+
}
|
|
1866
|
+
|
|
1867
|
+
interface ChatSocketConfig {
|
|
1868
|
+
/** Server origin, e.g. "https://dubs-server-prod-xxx.herokuapp.com" */
|
|
1869
|
+
host: string;
|
|
1870
|
+
/** JWT token for authentication */
|
|
1871
|
+
token: string;
|
|
1872
|
+
}
|
|
1873
|
+
interface ChatSocketListeners {
|
|
1874
|
+
onConnectionChange?: (status: ChatConnectionStatus) => void;
|
|
1875
|
+
onNewMessage?: (message: ChatMessage) => void;
|
|
1876
|
+
onOnlineUsers?: (users: OnlineUser[]) => void;
|
|
1877
|
+
onOnlineCount?: (count: number) => void;
|
|
1878
|
+
onTyping?: (data: {
|
|
1879
|
+
userId: number;
|
|
1880
|
+
username: string;
|
|
1881
|
+
walletAddress: string;
|
|
1882
|
+
isTyping: boolean;
|
|
1883
|
+
}) => void;
|
|
1884
|
+
onReactionAdded?: (data: {
|
|
1885
|
+
messageId: number;
|
|
1886
|
+
userId: number;
|
|
1887
|
+
reaction: string;
|
|
1888
|
+
walletAddress: string;
|
|
1889
|
+
}) => void;
|
|
1890
|
+
onReactionRemoved?: (data: {
|
|
1891
|
+
messageId: number;
|
|
1892
|
+
userId: number;
|
|
1893
|
+
reaction: string;
|
|
1894
|
+
}) => void;
|
|
1895
|
+
onNotification?: (notification: ChatNotification) => void;
|
|
1896
|
+
onUnreadCount?: (count: number) => void;
|
|
1897
|
+
onDMNewMessage?: (message: DirectMessage) => void;
|
|
1898
|
+
onDMMessageSent?: (message: DirectMessage) => void;
|
|
1899
|
+
onDMNotification?: (data: {
|
|
1900
|
+
senderId: number;
|
|
1901
|
+
senderUsername: string;
|
|
1902
|
+
senderAvatar: string | null;
|
|
1903
|
+
senderWallet: string;
|
|
1904
|
+
preview: string;
|
|
1905
|
+
createdAt: string;
|
|
1906
|
+
}) => void;
|
|
1907
|
+
onDMMessagesRead?: (data: {
|
|
1908
|
+
readBy: number;
|
|
1909
|
+
readByWallet: string;
|
|
1910
|
+
}) => void;
|
|
1911
|
+
onFriendRequestAccepted?: (data: {
|
|
1912
|
+
requestId: number;
|
|
1913
|
+
acceptedBy: number;
|
|
1914
|
+
acceptedByUsername: string;
|
|
1915
|
+
}) => void;
|
|
1916
|
+
onFriendRequestDeclined?: (data: {
|
|
1917
|
+
requestId: number;
|
|
1918
|
+
declinedBy: number;
|
|
1919
|
+
}) => void;
|
|
1920
|
+
onFriendRemoved?: (data: {
|
|
1921
|
+
removedBy: number;
|
|
1922
|
+
}) => void;
|
|
1923
|
+
onError?: (error: {
|
|
1924
|
+
message: string;
|
|
1925
|
+
}) => void;
|
|
1926
|
+
}
|
|
1927
|
+
/**
|
|
1928
|
+
* Manages the Socket.IO connection to the Dubs chat namespace.
|
|
1929
|
+
*/
|
|
1930
|
+
declare class ChatSocket {
|
|
1931
|
+
private socket;
|
|
1932
|
+
private listeners;
|
|
1933
|
+
/** Set event listeners. Call before or after connect. */
|
|
1934
|
+
setListeners(listeners: ChatSocketListeners): void;
|
|
1935
|
+
/** Connect to the /chat namespace */
|
|
1936
|
+
connect(config: ChatSocketConfig): void;
|
|
1937
|
+
/** Disconnect from the chat namespace */
|
|
1938
|
+
disconnect(): void;
|
|
1939
|
+
/** Whether the socket is currently connected */
|
|
1940
|
+
isConnected(): boolean;
|
|
1941
|
+
/** Send a message to global chat */
|
|
1942
|
+
sendMessage(params: SendMessageParams): void;
|
|
1943
|
+
/** Emit typing indicator */
|
|
1944
|
+
sendTyping(isTyping: boolean): void;
|
|
1945
|
+
/** Add an emoji reaction to a message */
|
|
1946
|
+
addReaction(messageId: number, reaction: string): void;
|
|
1947
|
+
/** Remove an emoji reaction from a message */
|
|
1948
|
+
removeReaction(messageId: number, reaction: string): void;
|
|
1949
|
+
/** Join a DM room to receive messages in real-time */
|
|
1950
|
+
joinDM(recipientWallet: string): void;
|
|
1951
|
+
/** Leave a DM room */
|
|
1952
|
+
leaveDM(recipientWallet: string): void;
|
|
1953
|
+
/** Send a direct message via socket */
|
|
1954
|
+
sendDM(params: SendDMParams): void;
|
|
1955
|
+
/** Mark DMs from a sender as read */
|
|
1956
|
+
markDMRead(senderWallet: string): void;
|
|
1957
|
+
}
|
|
1958
|
+
|
|
1959
|
+
interface ChatContextValue {
|
|
1960
|
+
/** The underlying socket manager */
|
|
1961
|
+
socket: ChatSocket;
|
|
1962
|
+
/** Connection status */
|
|
1963
|
+
status: ChatConnectionStatus;
|
|
1964
|
+
/** Global chat messages (newest last) */
|
|
1965
|
+
messages: ChatMessage[];
|
|
1966
|
+
/** Currently online users */
|
|
1967
|
+
onlineUsers: OnlineUser[];
|
|
1968
|
+
/** Online user count */
|
|
1969
|
+
onlineCount: number;
|
|
1970
|
+
/** Unread notification count */
|
|
1971
|
+
unreadCount: number;
|
|
1972
|
+
/** DM conversations */
|
|
1973
|
+
conversations: Conversation[];
|
|
1974
|
+
/** Friends list */
|
|
1975
|
+
friends: FriendUser[];
|
|
1976
|
+
/** Pending friend requests */
|
|
1977
|
+
pendingRequests: FriendRequest[];
|
|
1978
|
+
/** Reload messages from REST */
|
|
1979
|
+
refreshMessages: () => Promise<void>;
|
|
1980
|
+
/** Reload conversations from REST */
|
|
1981
|
+
refreshConversations: () => Promise<void>;
|
|
1982
|
+
/** Reload friends from REST */
|
|
1983
|
+
refreshFriends: () => Promise<void>;
|
|
1984
|
+
/** Reload pending friend requests from REST */
|
|
1985
|
+
refreshPendingRequests: () => Promise<void>;
|
|
1986
|
+
}
|
|
1987
|
+
interface ChatProviderProps {
|
|
1988
|
+
children: React$1.ReactNode;
|
|
1989
|
+
/** Set to false to disable auto-connect on mount. Default: true */
|
|
1990
|
+
autoConnect?: boolean;
|
|
1991
|
+
}
|
|
1992
|
+
/**
|
|
1993
|
+
* Provides chat, DM, and social context to child components.
|
|
1994
|
+
* Must be rendered inside a <DubsProvider>.
|
|
1995
|
+
*/
|
|
1996
|
+
declare function ChatProvider({ children, autoConnect }: ChatProviderProps): react_jsx_runtime.JSX.Element;
|
|
1997
|
+
/** Access the chat context. Must be used inside <ChatProvider>. */
|
|
1998
|
+
declare function useChatContext(): ChatContextValue;
|
|
1999
|
+
|
|
2000
|
+
/** Get the current chat connection status */
|
|
2001
|
+
declare function useChatStatus(): ChatConnectionStatus;
|
|
2002
|
+
/** Get global chat messages with refetch */
|
|
2003
|
+
declare function useChatMessages(): {
|
|
2004
|
+
messages: ChatMessage[];
|
|
2005
|
+
loading: boolean;
|
|
2006
|
+
refetch: () => Promise<void>;
|
|
2007
|
+
};
|
|
2008
|
+
/** Send a message to global chat (via socket for real-time, falls back to REST) */
|
|
2009
|
+
declare function useSendMessage(): {
|
|
2010
|
+
send: (params: SendMessageParams) => void;
|
|
2011
|
+
sendViaREST: (params: {
|
|
2012
|
+
message: string;
|
|
2013
|
+
replyToId?: number;
|
|
2014
|
+
}) => Promise<void>;
|
|
2015
|
+
};
|
|
2016
|
+
/** Get online users and count */
|
|
2017
|
+
declare function useOnlineUsers(): {
|
|
2018
|
+
users: OnlineUser[];
|
|
2019
|
+
count: number;
|
|
2020
|
+
};
|
|
2021
|
+
/** Get unread notification count */
|
|
2022
|
+
declare function useUnreadCount(): number;
|
|
2023
|
+
/** Get DM conversations inbox */
|
|
2024
|
+
declare function useConversations(): {
|
|
2025
|
+
conversations: Conversation[];
|
|
2026
|
+
loading: boolean;
|
|
2027
|
+
refetch: () => Promise<void>;
|
|
2028
|
+
};
|
|
2029
|
+
/** Get DM thread with a specific user by wallet address */
|
|
2030
|
+
declare function useDirectMessages(recipientWallet: string): {
|
|
2031
|
+
messages: DirectMessage[];
|
|
2032
|
+
loading: boolean;
|
|
2033
|
+
otherUser: {
|
|
2034
|
+
id: number;
|
|
2035
|
+
username: string;
|
|
2036
|
+
avatar: string | null;
|
|
2037
|
+
walletAddress: string;
|
|
2038
|
+
} | null;
|
|
2039
|
+
send: (message: string) => void;
|
|
2040
|
+
sendViaREST: (message: string) => Promise<void>;
|
|
2041
|
+
markRead: () => void;
|
|
2042
|
+
refetch: () => Promise<void>;
|
|
2043
|
+
};
|
|
2044
|
+
/** Get friends list */
|
|
2045
|
+
declare function useFriends(): {
|
|
2046
|
+
friends: FriendUser[];
|
|
2047
|
+
loading: boolean;
|
|
2048
|
+
refetch: () => Promise<void>;
|
|
2049
|
+
};
|
|
2050
|
+
/** Get pending friend requests */
|
|
2051
|
+
declare function useFriendRequests(): {
|
|
2052
|
+
requests: FriendRequest[];
|
|
2053
|
+
loading: boolean;
|
|
2054
|
+
refetch: () => Promise<void>;
|
|
2055
|
+
};
|
|
2056
|
+
/** Search for users by username */
|
|
2057
|
+
declare function useSearchUsers(): {
|
|
2058
|
+
results: FriendUser[];
|
|
2059
|
+
loading: boolean;
|
|
2060
|
+
search: (query: string) => Promise<void>;
|
|
2061
|
+
clear: () => void;
|
|
2062
|
+
};
|
|
2063
|
+
/** Send a friend request */
|
|
2064
|
+
declare function useSendFriendRequest(): {
|
|
2065
|
+
send: (targetUserId: number) => Promise<void>;
|
|
2066
|
+
loading: boolean;
|
|
2067
|
+
};
|
|
2068
|
+
/** Accept or reject a friend request */
|
|
2069
|
+
declare function useRespondToFriendRequest(): {
|
|
2070
|
+
accept: (requestId: number) => Promise<void>;
|
|
2071
|
+
reject: (requestId: number) => Promise<void>;
|
|
2072
|
+
loading: boolean;
|
|
2073
|
+
};
|
|
2074
|
+
|
|
2075
|
+
/**
|
|
2076
|
+
* Deserialize a base64-encoded transaction, sign via wallet adapter, send to Solana.
|
|
2077
|
+
* Prefers signAndSendTransaction if available (MWA), otherwise falls back to
|
|
2078
|
+
* signTransaction + sendRawTransaction via RPC (Phantom deeplinks).
|
|
2079
|
+
* Returns the transaction signature.
|
|
2080
|
+
*/
|
|
2081
|
+
declare function signAndSendBase64Transaction(base64Tx: string, wallet: WalletAdapter, connection: Connection): Promise<string>;
|
|
2082
|
+
|
|
2083
|
+
/**
|
|
2084
|
+
* Ensure a DiceBear avatar URL uses PNG format for React Native compatibility.
|
|
2085
|
+
* React Native's Image component cannot render SVGs.
|
|
2086
|
+
* This converts at render time only — the stored URL in the DB is never modified.
|
|
2087
|
+
*/
|
|
2088
|
+
declare function ensurePngAvatar(url: string | null | undefined): string | undefined;
|
|
2089
|
+
|
|
2090
|
+
export { type ArcadeAttempt, type ArcadeCountdown, type ArcadeEntry, type ArcadeLeaderboardEntry, ArcadeLeaderboardSheet, type ArcadeLeaderboardSheetProps, type ArcadePool, type ArcadePoolResult, type ArcadePoolStats, AuthGate, type ConnectWalletScreenProps$1 as AuthGateConnectWalletProps, type AuthGateProps, type AuthStatus, type AuthenticateParams, type AuthenticateResult, type Bettor, type BuildArcadeEntryResult, type BuildClaimParams, type BuildClaimResult, type BuildJackpotEnterResult, type ChatConnectionStatus, type ChatContextValue, type ChatMention, type ChatMessage, type ChatNotification, type ChatPayment, ChatProvider, type ChatProviderProps, ChatSocket, type ChatSocketConfig, type ChatSocketListeners, type CheckUsernameResult, ClaimButton, type ClaimButtonProps, type ClaimMutationResult, ClaimPrizeSheet, type ClaimPrizeSheetProps, type ClaimStatus, type ConfirmClaimParams, type ConfirmClaimResult, type ConfirmGameParams, type ConfirmGameResult, type ConfirmJackpotEnterResult, ConnectWalletButton, type ConnectWalletButtonProps, ConnectWalletScreen, type ConnectWalletScreenProps, type Conversation, type CreateCustomGameMutationResult, type CreateCustomGameParams, type CreateCustomGameResult, CreateCustomGameSheet, type CreateCustomGameSheetProps, type CreateGameMutationResult, type CreateGameParams, type CreateGameResult, CreateGameSheet, type CreateGameSheetProps, DEFAULT_BASE_URL, DEFAULT_RPC_URL, type DeviceInfo, type DirectMessage, DubsApiError, type DubsAppUser, DubsClient, type DubsClientConfig, type DubsContextValue, type DubsNetwork, DubsProvider, type DubsProviderProps, type DubsPublicUser, type DubsTheme, type DubsUser, type EnterArcadePoolMutationResult, type EnterArcadePoolResult, EnterArcadePoolSheet, type EnterArcadePoolSheetProps, type EnterJackpotMutationResult, type EsportsMatchDetail, type EsportsMatchOpponent, type EsportsMatchResult, type EventMedia, type EventMeta, type EventStream, type FriendRequest, type FriendUser, type GameDetail, type GameListItem, type GameListOpponent, type GameMedia, GamePoster, type GamePosterProps, type GetGamesParams, type GetNetworkGamesParams, type GetUpcomingEventsParams, type HighlightVideo, JackpotCard, type JackpotCardProps, type JackpotConfig, type JackpotEntry, type JackpotLastWinner, type JackpotRound, type JackpotRoundResult, JackpotSheet, type JackpotSheetProps, JackpotWidget, type JackpotWidgetProps, JoinGameButton, type JoinGameButtonProps, type JoinGameMutationResult, type JoinGameParams, type JoinGameResult, JoinGameSheet, type JoinGameSheetProps, LivePoolsCard, type LivePoolsCardProps, type LiveScore, type LiveScoreCompetitor, type MutationResult, type MutationStatus, type MwaAdapterConfig, type MwaTransactFn, MwaWalletAdapter, NETWORK_CONFIG, type NonceResult, type OnlineUser, type Opponent, type Pagination, type ParsedError, PhantomDeeplinkAdapter, type PhantomDeeplinkAdapterConfig, type PhantomSession, PickWinnerCard, type PickWinnerCardProps, PlayersCard, type PlayersCardProps, type PushNotificationStatus, type QueryResult, type RegisterParams, type RegisterResult, type RegistrationScreenProps, SOLANA_PROGRAM_ERRORS, STORAGE_KEYS, type SendDMParams, type SendMessageParams, SettingsSheet, type SettingsSheetProps, type ShortVideo, SolSlider, type SolSliderProps, type SolanaErrorCode, type StartAttemptResult, type SubmitScoreResult, type TokenStorage, type TypingEvent, type UFCData, type UFCEvent, type UFCFight, type UFCFighter, type UFCFighterDetail, type UiConfig, type UnifiedEvent, type UseArcadeBridgeOptions, type UseArcadeBridgeResult, type UseArcadeGameResult, type UseArcadePoolResult, type UseArcadePoolsResult, type UseAuthResult, type UseJackpotHistoryResult, type UseJackpotResult, UserProfileCard, type UserProfileCardProps, UserProfileSheet, type UserProfileSheetProps, type ValidateEventResult, type WalletAdapter, createSecureStoreStorage, ensurePngAvatar, getDeviceInfo, isSolanaSeeker, mergeTheme, parseSolanaError, signAndSendBase64Transaction, useAppConfig, useArcadeBridge, useArcadeCountdown, useArcadeGame, useArcadePool, useArcadePools, useAuth, useChatContext, useChatMessages, useChatStatus, useClaim, useConversations, useCreateCustomGame, useCreateGame, useDirectMessages, useDubs, useDubsTheme, useEnterArcadePool, useEnterJackpot, useEvents, useFriendRequests, useFriends, useGame, useGames, useHasClaimed, useHighlights, useJackpot, useJackpotHistory, useJoinGame, useNetworkGames, useOnlineUsers, usePushNotifications, useRespondToFriendRequest, useSearchUsers, useSendFriendRequest, useSendMessage, useShorts, useUFCFightCard, useUFCFighterDetail, useUnreadCount };
|