@dubsdotapp/expo 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +80 -19
- package/dist/index.d.mts +191 -57
- package/dist/index.d.ts +191 -57
- package/dist/index.js +1430 -507
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1484 -556
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -2
- package/src/auth-context.ts +9 -0
- package/src/client.ts +21 -1
- package/src/constants.ts +15 -0
- package/src/hooks/useAuth.ts +16 -4
- package/src/hooks/useClaim.ts +11 -9
- package/src/hooks/useCreateGame.ts +15 -12
- package/src/hooks/useJoinGame.ts +18 -14
- package/src/index.ts +20 -2
- package/src/managed-wallet.tsx +148 -0
- package/src/provider.tsx +228 -9
- package/src/storage.ts +57 -0
- package/src/types.ts +39 -4
- package/src/ui/AuthGate.tsx +407 -308
- package/src/ui/game/GamePoster.tsx +182 -0
- package/src/ui/game/JoinGameButton.tsx +73 -0
- package/src/ui/game/LivePoolsCard.tsx +88 -0
- package/src/ui/game/PickWinnerCard.tsx +126 -0
- package/src/ui/game/PlayersCard.tsx +108 -0
- package/src/ui/game/index.ts +10 -0
- package/src/ui/index.ts +10 -0
- package/src/utils/transaction.ts +8 -49
- package/src/wallet/mwa-adapter.ts +9 -6
- package/src/wallet/types.ts +6 -0
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ React Native SDK for the [Dubs](https://dubs.fun) betting platform. Pure TypeScr
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npx expo install @dubsdotapp/expo @solana/web3.js
|
|
8
|
+
npx expo install @dubsdotapp/expo @solana/web3.js expo-secure-store
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
For the built-in Mobile Wallet Adapter (optional):
|
|
@@ -19,25 +19,38 @@ npx expo install @solana-mobile/mobile-wallet-adapter-protocol-web3js
|
|
|
19
19
|
### 1. Set up the provider
|
|
20
20
|
|
|
21
21
|
```tsx
|
|
22
|
-
import { DubsProvider
|
|
23
|
-
|
|
24
|
-
const wallet = new MwaWalletAdapter({
|
|
25
|
-
appIdentity: { name: 'My App' },
|
|
26
|
-
});
|
|
22
|
+
import { DubsProvider } from '@dubsdotapp/expo';
|
|
27
23
|
|
|
28
24
|
export default function App() {
|
|
29
25
|
return (
|
|
30
|
-
<DubsProvider
|
|
31
|
-
apiKey="your_api_key_here"
|
|
32
|
-
wallet={wallet}
|
|
33
|
-
>
|
|
26
|
+
<DubsProvider apiKey="your_api_key_here" appName="My App" network="devnet">
|
|
34
27
|
<HomeScreen />
|
|
35
28
|
</DubsProvider>
|
|
36
29
|
);
|
|
37
30
|
}
|
|
38
31
|
```
|
|
39
32
|
|
|
40
|
-
|
|
33
|
+
That's it — 5 lines. `DubsProvider` handles everything:
|
|
34
|
+
|
|
35
|
+
- **Connect screen** — shows a "Connect Wallet" button, opens Phantom/Solflare/etc.
|
|
36
|
+
- **Silent reconnect** — returning users skip straight to the app
|
|
37
|
+
- **3-step onboarding** — avatar selection (6 DiceBear styles), real-time username validation, optional referral code
|
|
38
|
+
- **Token persistence** — MWA + JWT tokens saved in `expo-secure-store`
|
|
39
|
+
- **Session management** — sign-in, registration, restore, and full disconnect/logout
|
|
40
|
+
|
|
41
|
+
### 2. Access the user
|
|
42
|
+
|
|
43
|
+
```tsx
|
|
44
|
+
import { useAuth } from '@dubsdotapp/expo';
|
|
45
|
+
|
|
46
|
+
function Profile() {
|
|
47
|
+
const { user, isAuthenticated } = useAuth();
|
|
48
|
+
if (!isAuthenticated) return null;
|
|
49
|
+
return <Text>@{user.username}</Text>;
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### 3. Browse events
|
|
41
54
|
|
|
42
55
|
```tsx
|
|
43
56
|
import { useEvents } from '@dubsdotapp/expo';
|
|
@@ -59,7 +72,7 @@ function EventsList() {
|
|
|
59
72
|
}
|
|
60
73
|
```
|
|
61
74
|
|
|
62
|
-
###
|
|
75
|
+
### 4. Create a bet
|
|
63
76
|
|
|
64
77
|
```tsx
|
|
65
78
|
import { useCreateGame } from '@dubsdotapp/expo';
|
|
@@ -88,22 +101,50 @@ function CreateBet({ eventId }: { eventId: string }) {
|
|
|
88
101
|
}
|
|
89
102
|
```
|
|
90
103
|
|
|
91
|
-
##
|
|
104
|
+
## Provider Props
|
|
105
|
+
|
|
106
|
+
| Prop | Type | Default | Description |
|
|
107
|
+
|------|------|---------|-------------|
|
|
108
|
+
| `apiKey` | `string` | *required* | Your Dubs API key |
|
|
109
|
+
| `appName` | `string` | `'Dubs'` | App name shown on connect/auth screens |
|
|
110
|
+
| `network` | `'devnet' \| 'mainnet-beta'` | `'mainnet-beta'` | Network preset (sets baseUrl, rpcUrl, cluster) |
|
|
111
|
+
| `wallet` | `WalletAdapter` | *auto (MWA)* | Bring your own wallet adapter |
|
|
112
|
+
| `tokenStorage` | `TokenStorage` | *SecureStore* | Custom token persistence |
|
|
113
|
+
| `baseUrl` | `string` | *from network* | Override API base URL |
|
|
114
|
+
| `rpcUrl` | `string` | *from network* | Override Solana RPC URL |
|
|
115
|
+
| `renderConnectScreen` | `fn \| false` | *default UI* | Custom connect screen, or `false` to hide |
|
|
116
|
+
| `renderLoading` | `fn` | *default UI* | Custom loading screen during auth |
|
|
117
|
+
| `renderError` | `fn` | *default UI* | Custom error screen |
|
|
118
|
+
| `renderRegistration` | `fn` | *default UI* | Custom registration screen |
|
|
119
|
+
| `managed` | `boolean` | `true` | Set `false` for headless mode (no connect screen or auth gate) |
|
|
120
|
+
|
|
121
|
+
### Disconnect
|
|
122
|
+
|
|
123
|
+
```tsx
|
|
124
|
+
import { useDubs } from '@dubsdotapp/expo';
|
|
125
|
+
|
|
126
|
+
function LogoutButton() {
|
|
127
|
+
const { disconnect } = useDubs();
|
|
128
|
+
return <Button title="Log Out" onPress={disconnect} />;
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
`disconnect()` clears wallet connection, MWA token, JWT, and returns to the connect screen.
|
|
92
133
|
|
|
93
|
-
|
|
134
|
+
## Custom Wallet Adapter (BYOA)
|
|
135
|
+
|
|
136
|
+
If you're using Privy, Dynamic, or another wallet provider, pass a `wallet` prop to skip managed MWA:
|
|
94
137
|
|
|
95
138
|
```tsx
|
|
96
139
|
import { DubsProvider } from '@dubsdotapp/expo';
|
|
97
140
|
import type { WalletAdapter } from '@dubsdotapp/expo';
|
|
98
|
-
import { Transaction, PublicKey } from '@solana/web3.js';
|
|
99
141
|
|
|
100
142
|
const myAdapter: WalletAdapter = {
|
|
101
143
|
publicKey: new PublicKey('...'),
|
|
102
144
|
connected: true,
|
|
103
|
-
signTransaction: async (tx
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
},
|
|
145
|
+
signTransaction: async (tx) => { /* ... */ return signedTx; },
|
|
146
|
+
connect: async () => { /* ... */ },
|
|
147
|
+
disconnect: () => { /* ... */ },
|
|
107
148
|
};
|
|
108
149
|
|
|
109
150
|
<DubsProvider apiKey="..." wallet={myAdapter}>
|
|
@@ -111,6 +152,26 @@ const myAdapter: WalletAdapter = {
|
|
|
111
152
|
</DubsProvider>
|
|
112
153
|
```
|
|
113
154
|
|
|
155
|
+
## Custom Token Storage
|
|
156
|
+
|
|
157
|
+
By default, `DubsProvider` uses `expo-secure-store` for persisting auth tokens. To use a different storage:
|
|
158
|
+
|
|
159
|
+
```tsx
|
|
160
|
+
import { DubsProvider } from '@dubsdotapp/expo';
|
|
161
|
+
import type { TokenStorage } from '@dubsdotapp/expo';
|
|
162
|
+
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
163
|
+
|
|
164
|
+
const myStorage: TokenStorage = {
|
|
165
|
+
getItem: (key) => AsyncStorage.getItem(key),
|
|
166
|
+
setItem: (key, value) => AsyncStorage.setItem(key, value),
|
|
167
|
+
deleteItem: (key) => AsyncStorage.removeItem(key),
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
<DubsProvider apiKey="..." tokenStorage={myStorage}>
|
|
171
|
+
<App />
|
|
172
|
+
</DubsProvider>
|
|
173
|
+
```
|
|
174
|
+
|
|
114
175
|
## API Reference
|
|
115
176
|
|
|
116
177
|
### Hooks
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { PublicKey, Transaction, Connection
|
|
2
|
+
import React$1 from 'react';
|
|
3
|
+
import { PublicKey, Transaction, Connection } from '@solana/web3.js';
|
|
4
4
|
|
|
5
5
|
interface Opponent {
|
|
6
6
|
name: string | null;
|
|
@@ -128,6 +128,13 @@ interface GameMedia {
|
|
|
128
128
|
poster: string | null;
|
|
129
129
|
thumbnail: string | null;
|
|
130
130
|
}
|
|
131
|
+
interface Bettor {
|
|
132
|
+
wallet: string;
|
|
133
|
+
username: string | null;
|
|
134
|
+
avatar: string | null;
|
|
135
|
+
team: 'home' | 'away' | 'draw';
|
|
136
|
+
amount: number;
|
|
137
|
+
}
|
|
131
138
|
interface GameDetail {
|
|
132
139
|
gameId: string;
|
|
133
140
|
gameAddress: string;
|
|
@@ -137,15 +144,14 @@ interface GameDetail {
|
|
|
137
144
|
isLocked: boolean;
|
|
138
145
|
isResolved: boolean;
|
|
139
146
|
status: string;
|
|
147
|
+
league: string | null;
|
|
140
148
|
lockTimestamp: number | null;
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
drawPlayers: string[];
|
|
149
|
+
opponents: GameListOpponent[];
|
|
150
|
+
bettors: Bettor[];
|
|
144
151
|
homePool: number;
|
|
145
152
|
awayPool: number;
|
|
146
153
|
drawPool: number;
|
|
147
154
|
totalPool: number;
|
|
148
|
-
sportsEvent: Record<string, unknown> | null;
|
|
149
155
|
media: GameMedia;
|
|
150
156
|
createdAt: string;
|
|
151
157
|
updatedAt: string;
|
|
@@ -177,6 +183,7 @@ interface GetGamesParams {
|
|
|
177
183
|
}
|
|
178
184
|
interface GetNetworkGamesParams {
|
|
179
185
|
league?: string;
|
|
186
|
+
exclude_wallet?: string;
|
|
180
187
|
limit?: number;
|
|
181
188
|
offset?: number;
|
|
182
189
|
}
|
|
@@ -232,6 +239,7 @@ interface RegisterParams {
|
|
|
232
239
|
nonce: string;
|
|
233
240
|
username: string;
|
|
234
241
|
referralCode?: string;
|
|
242
|
+
avatarUrl?: string;
|
|
235
243
|
}
|
|
236
244
|
interface RegisterResult {
|
|
237
245
|
user: DubsUser;
|
|
@@ -256,6 +264,28 @@ interface MutationResult<TParams, TResult> {
|
|
|
256
264
|
data: TResult | null;
|
|
257
265
|
reset: () => void;
|
|
258
266
|
}
|
|
267
|
+
interface LiveScoreCompetitor {
|
|
268
|
+
name: string;
|
|
269
|
+
homeAway: 'home' | 'away';
|
|
270
|
+
score: number;
|
|
271
|
+
logo: string | null;
|
|
272
|
+
abbreviation: string;
|
|
273
|
+
}
|
|
274
|
+
interface LiveScore {
|
|
275
|
+
status: string;
|
|
276
|
+
period: number | null;
|
|
277
|
+
displayClock: string | null;
|
|
278
|
+
detail: string | null;
|
|
279
|
+
shortDetail: string | null;
|
|
280
|
+
competitors: LiveScoreCompetitor[];
|
|
281
|
+
ufcData?: {
|
|
282
|
+
currentRound: number;
|
|
283
|
+
totalRounds: number;
|
|
284
|
+
clock: string;
|
|
285
|
+
fightState: string;
|
|
286
|
+
statusDetail: string;
|
|
287
|
+
};
|
|
288
|
+
}
|
|
259
289
|
|
|
260
290
|
interface DubsClientConfig {
|
|
261
291
|
apiKey: string;
|
|
@@ -284,6 +314,7 @@ declare class DubsClient {
|
|
|
284
314
|
confirmGame(params: ConfirmGameParams): Promise<ConfirmGameResult>;
|
|
285
315
|
buildClaimTransaction(params: BuildClaimParams): Promise<BuildClaimResult>;
|
|
286
316
|
getGame(gameId: string): Promise<GameDetail>;
|
|
317
|
+
getLiveScore(gameId: string): Promise<LiveScore | null>;
|
|
287
318
|
getGames(params?: GetGamesParams): Promise<GameListItem[]>;
|
|
288
319
|
getNetworkGames(params?: GetNetworkGamesParams): Promise<{
|
|
289
320
|
games: GameListItem[];
|
|
@@ -333,6 +364,28 @@ declare function parseSolanaError(err: unknown): ParsedError;
|
|
|
333
364
|
|
|
334
365
|
declare const DEFAULT_BASE_URL = "https://dubs-server-prod-9c91d3f01199.herokuapp.com/api/developer/v1";
|
|
335
366
|
declare const DEFAULT_RPC_URL = "https://api.mainnet-beta.solana.com";
|
|
367
|
+
type DubsNetwork = 'devnet' | 'mainnet-beta';
|
|
368
|
+
declare const NETWORK_CONFIG: Record<DubsNetwork, {
|
|
369
|
+
baseUrl: string;
|
|
370
|
+
rpcUrl: string;
|
|
371
|
+
cluster: string;
|
|
372
|
+
}>;
|
|
373
|
+
|
|
374
|
+
interface TokenStorage {
|
|
375
|
+
getItem(key: string): Promise<string | null>;
|
|
376
|
+
setItem(key: string, value: string): Promise<void>;
|
|
377
|
+
deleteItem(key: string): Promise<void>;
|
|
378
|
+
}
|
|
379
|
+
declare const STORAGE_KEYS: {
|
|
380
|
+
readonly MWA_AUTH_TOKEN: "dubs_mwa_auth_token";
|
|
381
|
+
readonly JWT_TOKEN: "dubs_jwt_token";
|
|
382
|
+
};
|
|
383
|
+
/**
|
|
384
|
+
* Creates a TokenStorage backed by expo-secure-store.
|
|
385
|
+
* Lazy-imports the module so it's only required at runtime when actually used.
|
|
386
|
+
* Throws a clear error if expo-secure-store is not installed.
|
|
387
|
+
*/
|
|
388
|
+
declare function createSecureStoreStorage(): TokenStorage;
|
|
336
389
|
|
|
337
390
|
/**
|
|
338
391
|
* Minimal wallet adapter interface.
|
|
@@ -357,21 +410,74 @@ interface WalletAdapter {
|
|
|
357
410
|
* Returns the signature as a Uint8Array.
|
|
358
411
|
*/
|
|
359
412
|
signMessage?(message: Uint8Array): Promise<Uint8Array>;
|
|
413
|
+
/** Optional: Connect the wallet */
|
|
414
|
+
connect?(): Promise<void>;
|
|
415
|
+
/** Optional: Disconnect the wallet */
|
|
416
|
+
disconnect?(): void | Promise<void>;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
interface RegistrationScreenProps {
|
|
420
|
+
onRegister: (username: string, referralCode?: string, avatarUrl?: string) => void;
|
|
421
|
+
registering: boolean;
|
|
422
|
+
error: Error | null;
|
|
423
|
+
client: DubsClient;
|
|
424
|
+
}
|
|
425
|
+
interface AuthGateProps {
|
|
426
|
+
children: React$1.ReactNode;
|
|
427
|
+
onSaveToken: (token: string | null) => void | Promise<void>;
|
|
428
|
+
onLoadToken: () => string | null | Promise<string | null>;
|
|
429
|
+
renderLoading?: (status: AuthStatus) => React$1.ReactNode;
|
|
430
|
+
renderError?: (error: Error, retry: () => void) => React$1.ReactNode;
|
|
431
|
+
renderRegistration?: (props: RegistrationScreenProps) => React$1.ReactNode;
|
|
432
|
+
appName?: string;
|
|
360
433
|
}
|
|
434
|
+
declare function AuthGate({ children, onSaveToken, onLoadToken, renderLoading, renderError, renderRegistration, appName, }: AuthGateProps): react_jsx_runtime.JSX.Element;
|
|
435
|
+
|
|
436
|
+
interface ConnectWalletScreenProps {
|
|
437
|
+
/** Called when the user taps Connect Wallet */
|
|
438
|
+
onConnect: () => void | Promise<void>;
|
|
439
|
+
/** Show a loading spinner on the button while connecting */
|
|
440
|
+
connecting?: boolean;
|
|
441
|
+
/** Error message to display (e.g. "User rejected the request") */
|
|
442
|
+
error?: string | null;
|
|
443
|
+
/** App name shown in the header. Defaults to "Dubs" */
|
|
444
|
+
appName?: string;
|
|
445
|
+
}
|
|
446
|
+
declare function ConnectWalletScreen({ onConnect, connecting, error, appName, }: ConnectWalletScreenProps): react_jsx_runtime.JSX.Element;
|
|
361
447
|
|
|
362
448
|
interface DubsContextValue {
|
|
363
449
|
client: DubsClient;
|
|
364
450
|
wallet: WalletAdapter;
|
|
365
451
|
connection: Connection;
|
|
452
|
+
appName: string;
|
|
453
|
+
network: DubsNetwork;
|
|
454
|
+
disconnect: () => Promise<void>;
|
|
366
455
|
}
|
|
367
456
|
interface DubsProviderProps {
|
|
368
457
|
apiKey: string;
|
|
458
|
+
children: React$1.ReactNode;
|
|
459
|
+
appName?: string;
|
|
460
|
+
network?: DubsNetwork;
|
|
461
|
+
/** Escape hatch: bring your own wallet adapter. Disables managed MWA. */
|
|
462
|
+
wallet?: WalletAdapter;
|
|
463
|
+
/** Escape hatch: custom token persistence. Defaults to expo-secure-store. */
|
|
464
|
+
tokenStorage?: TokenStorage;
|
|
465
|
+
/** Escape hatch: override base URL (takes precedence over network). */
|
|
369
466
|
baseUrl?: string;
|
|
467
|
+
/** Escape hatch: override RPC URL (takes precedence over network). */
|
|
370
468
|
rpcUrl?: string;
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
469
|
+
/** Custom connect screen, or false to hide it entirely (headless mode). */
|
|
470
|
+
renderConnectScreen?: ((props: ConnectWalletScreenProps) => React$1.ReactNode) | false;
|
|
471
|
+
/** Custom loading screen shown during auth. */
|
|
472
|
+
renderLoading?: (status: AuthStatus) => React$1.ReactNode;
|
|
473
|
+
/** Custom error screen shown on auth failure. */
|
|
474
|
+
renderError?: (error: Error, retry: () => void) => React$1.ReactNode;
|
|
475
|
+
/** Custom registration screen. */
|
|
476
|
+
renderRegistration?: (props: RegistrationScreenProps) => React$1.ReactNode;
|
|
477
|
+
/** Set to false to skip AuthGate and connect screen (headless/BYOA mode). Default: true. */
|
|
478
|
+
managed?: boolean;
|
|
479
|
+
}
|
|
480
|
+
declare function DubsProvider({ apiKey, children, appName, network, wallet: externalWallet, tokenStorage, baseUrl: baseUrlOverride, rpcUrl: rpcUrlOverride, renderConnectScreen, renderLoading, renderError, renderRegistration, managed, }: DubsProviderProps): react_jsx_runtime.JSX.Element;
|
|
375
481
|
declare function useDubs(): DubsContextValue;
|
|
376
482
|
|
|
377
483
|
/** The `transact` function signature from @solana-mobile/mobile-wallet-adapter-protocol-web3js */
|
|
@@ -410,6 +516,8 @@ declare class MwaWalletAdapter implements WalletAdapter {
|
|
|
410
516
|
constructor(config: MwaAdapterConfig);
|
|
411
517
|
get publicKey(): PublicKey | null;
|
|
412
518
|
get connected(): boolean;
|
|
519
|
+
get authToken(): string | null;
|
|
520
|
+
setAuthToken(token: string | null): void;
|
|
413
521
|
/**
|
|
414
522
|
* Connect to a mobile wallet. Call this before any signing.
|
|
415
523
|
*/
|
|
@@ -499,7 +607,7 @@ interface UseAuthResult {
|
|
|
499
607
|
* Register a new user after authenticate() returned needsRegistration.
|
|
500
608
|
* Reuses the nonce+signature from authenticate() — no second signing prompt.
|
|
501
609
|
*/
|
|
502
|
-
register: (username: string, referralCode?: string) => Promise<void>;
|
|
610
|
+
register: (username: string, referralCode?: string, avatarUrl?: string) => Promise<void>;
|
|
503
611
|
/** Log out and clear state */
|
|
504
612
|
logout: () => Promise<void>;
|
|
505
613
|
/**
|
|
@@ -512,45 +620,6 @@ interface UseAuthResult {
|
|
|
512
620
|
}
|
|
513
621
|
declare function useAuth(): UseAuthResult;
|
|
514
622
|
|
|
515
|
-
interface RegistrationScreenProps {
|
|
516
|
-
/** Called when the user submits registration */
|
|
517
|
-
onRegister: (username: string, referralCode?: string) => void;
|
|
518
|
-
/** Whether a registration request is in flight */
|
|
519
|
-
registering: boolean;
|
|
520
|
-
/** Error from the last registration attempt, or null */
|
|
521
|
-
error: Error | null;
|
|
522
|
-
/** DubsClient instance for checkUsername() availability checks */
|
|
523
|
-
client: DubsClient;
|
|
524
|
-
}
|
|
525
|
-
interface AuthGateProps {
|
|
526
|
-
children: React.ReactNode;
|
|
527
|
-
/** Persist or clear the JWT token (called with null on logout) */
|
|
528
|
-
onSaveToken: (token: string | null) => void | Promise<void>;
|
|
529
|
-
/** Load a previously persisted JWT token */
|
|
530
|
-
onLoadToken: () => string | null | Promise<string | null>;
|
|
531
|
-
/** Custom loading screen (receives current auth status) */
|
|
532
|
-
renderLoading?: (status: AuthStatus) => React.ReactNode;
|
|
533
|
-
/** Custom error screen (receives the error and a retry callback) */
|
|
534
|
-
renderError?: (error: Error, retry: () => void) => React.ReactNode;
|
|
535
|
-
/** Custom registration screen */
|
|
536
|
-
renderRegistration?: (props: RegistrationScreenProps) => React.ReactNode;
|
|
537
|
-
/** App name shown in default screens. Defaults to "Dubs" */
|
|
538
|
-
appName?: string;
|
|
539
|
-
}
|
|
540
|
-
declare function AuthGate({ children, onSaveToken, onLoadToken, renderLoading, renderError, renderRegistration, appName, }: AuthGateProps): react_jsx_runtime.JSX.Element;
|
|
541
|
-
|
|
542
|
-
interface ConnectWalletScreenProps {
|
|
543
|
-
/** Called when the user taps Connect Wallet */
|
|
544
|
-
onConnect: () => void | Promise<void>;
|
|
545
|
-
/** Show a loading spinner on the button while connecting */
|
|
546
|
-
connecting?: boolean;
|
|
547
|
-
/** Error message to display (e.g. "User rejected the request") */
|
|
548
|
-
error?: string | null;
|
|
549
|
-
/** App name shown in the header. Defaults to "Dubs" */
|
|
550
|
-
appName?: string;
|
|
551
|
-
}
|
|
552
|
-
declare function ConnectWalletScreen({ onConnect, connecting, error, appName, }: ConnectWalletScreenProps): react_jsx_runtime.JSX.Element;
|
|
553
|
-
|
|
554
623
|
interface UserProfileCardProps {
|
|
555
624
|
walletAddress: string;
|
|
556
625
|
username?: string;
|
|
@@ -590,15 +659,80 @@ interface DubsTheme {
|
|
|
590
659
|
}
|
|
591
660
|
declare function useDubsTheme(): DubsTheme;
|
|
592
661
|
|
|
662
|
+
interface GamePosterProps {
|
|
663
|
+
game: GameDetail;
|
|
664
|
+
/** Optional Image component — pass expo-image or RN Image. Defaults to RN Image. */
|
|
665
|
+
ImageComponent?: React.ComponentType<any>;
|
|
666
|
+
}
|
|
593
667
|
/**
|
|
594
|
-
*
|
|
595
|
-
*
|
|
668
|
+
* Matchup poster hero widget.
|
|
669
|
+
* Shows the game poster image (or team logo fallback), countdown pill, and pool total.
|
|
670
|
+
*/
|
|
671
|
+
declare function GamePoster({ game, ImageComponent }: GamePosterProps): react_jsx_runtime.JSX.Element;
|
|
672
|
+
|
|
673
|
+
interface LivePoolsCardProps {
|
|
674
|
+
game: GameDetail;
|
|
675
|
+
/** Custom short-name function for team labels. Defaults to full name. */
|
|
676
|
+
shortName?: (name: string | null) => string;
|
|
677
|
+
/** Override bar colors. Defaults to blue/red. */
|
|
678
|
+
homeColor?: string;
|
|
679
|
+
awayColor?: string;
|
|
680
|
+
}
|
|
681
|
+
/**
|
|
682
|
+
* Pool breakdown card showing each side's SOL amount, bar chart, and implied odds.
|
|
683
|
+
*/
|
|
684
|
+
declare function LivePoolsCard({ game, shortName, homeColor, awayColor, }: LivePoolsCardProps): react_jsx_runtime.JSX.Element;
|
|
685
|
+
|
|
686
|
+
interface PickWinnerCardProps {
|
|
687
|
+
game: GameDetail;
|
|
688
|
+
selectedTeam: 'home' | 'away' | null;
|
|
689
|
+
onSelect: (team: 'home' | 'away') => void;
|
|
690
|
+
/** Custom short-name function for team labels. Defaults to full name. */
|
|
691
|
+
shortName?: (name: string | null) => string;
|
|
692
|
+
/** Override colors. Defaults to blue/red. */
|
|
693
|
+
homeColor?: string;
|
|
694
|
+
awayColor?: string;
|
|
695
|
+
/** Optional Image component (expo-image, etc.). */
|
|
696
|
+
ImageComponent?: React.ComponentType<any>;
|
|
697
|
+
}
|
|
698
|
+
/**
|
|
699
|
+
* Team selection card for picking which side to bet on.
|
|
700
|
+
*/
|
|
701
|
+
declare function PickWinnerCard({ game, selectedTeam, onSelect, shortName, homeColor, awayColor, ImageComponent, }: PickWinnerCardProps): react_jsx_runtime.JSX.Element;
|
|
702
|
+
|
|
703
|
+
interface PlayersCardProps {
|
|
704
|
+
game: GameDetail;
|
|
705
|
+
/** How many chars to show on each side of a truncated wallet. Default 4. */
|
|
706
|
+
truncateChars?: number;
|
|
707
|
+
/** Override team dot colors. */
|
|
708
|
+
homeColor?: string;
|
|
709
|
+
awayColor?: string;
|
|
710
|
+
drawColor?: string;
|
|
711
|
+
/** Optional Image component (expo-image, etc.). */
|
|
712
|
+
ImageComponent?: React.ComponentType<any>;
|
|
713
|
+
}
|
|
714
|
+
/**
|
|
715
|
+
* Card showing all bettors in a game with their avatar, username, team, and wager amount.
|
|
596
716
|
*/
|
|
597
|
-
declare function
|
|
717
|
+
declare function PlayersCard({ game, truncateChars, homeColor, awayColor, drawColor, ImageComponent, }: PlayersCardProps): react_jsx_runtime.JSX.Element;
|
|
718
|
+
|
|
719
|
+
interface JoinGameButtonProps {
|
|
720
|
+
game: GameDetail;
|
|
721
|
+
walletAddress: string;
|
|
722
|
+
selectedTeam: 'home' | 'away' | null;
|
|
723
|
+
status: MutationStatus;
|
|
724
|
+
onJoin: () => void;
|
|
725
|
+
}
|
|
598
726
|
/**
|
|
599
|
-
*
|
|
600
|
-
*
|
|
727
|
+
* Fixed bottom bar with buy-in info and join button.
|
|
728
|
+
* Renders nothing if the user already joined, or the game is locked/resolved.
|
|
729
|
+
*/
|
|
730
|
+
declare function JoinGameButton({ game, walletAddress, selectedTeam, status, onJoin }: JoinGameButtonProps): react_jsx_runtime.JSX.Element | null;
|
|
731
|
+
|
|
732
|
+
/**
|
|
733
|
+
* Deserialize a base64-encoded transaction, sign via wallet adapter, send to Solana.
|
|
734
|
+
* Returns the transaction signature.
|
|
601
735
|
*/
|
|
602
|
-
declare function
|
|
736
|
+
declare function signAndSendBase64Transaction(base64Tx: string, wallet: WalletAdapter): Promise<string>;
|
|
603
737
|
|
|
604
|
-
export { AuthGate, type AuthGateProps, type AuthStatus, type AuthenticateParams, type AuthenticateResult, type BuildClaimParams, type BuildClaimResult, type CheckUsernameResult, type ClaimMutationResult, type ConfirmGameParams, type ConfirmGameResult, ConnectWalletScreen, type ConnectWalletScreenProps, type CreateGameMutationResult, type CreateGameParams, type CreateGameResult, DEFAULT_BASE_URL, DEFAULT_RPC_URL, DubsApiError, type DubsAppUser, DubsClient, type DubsClientConfig, type DubsContextValue, DubsProvider, type DubsProviderProps, type DubsPublicUser, type DubsTheme, type DubsUser, type EsportsMatchDetail, type EsportsMatchOpponent, type EsportsMatchResult, type EventMedia, type EventMeta, type EventStream, type GameDetail, type GameListItem, type GameListOpponent, type GameMedia, type GetGamesParams, type GetNetworkGamesParams, type GetUpcomingEventsParams, type JoinGameMutationResult, type JoinGameParams, type JoinGameResult, type MutationResult, type MutationStatus, type MwaAdapterConfig, type MwaTransactFn, MwaWalletAdapter, type NonceResult, type Opponent, type Pagination, type ParsedError, type QueryResult, type RegisterParams, type RegisterResult, type RegistrationScreenProps, SOLANA_PROGRAM_ERRORS, SettingsSheet, type SettingsSheetProps, type SolanaErrorCode, type UnifiedEvent, type UseAuthResult, UserProfileCard, type UserProfileCardProps, type ValidateEventResult, type WalletAdapter,
|
|
738
|
+
export { AuthGate, type AuthGateProps, type AuthStatus, type AuthenticateParams, type AuthenticateResult, type Bettor, type BuildClaimParams, type BuildClaimResult, type CheckUsernameResult, type ClaimMutationResult, type ConfirmGameParams, type ConfirmGameResult, ConnectWalletScreen, type ConnectWalletScreenProps, type CreateGameMutationResult, type CreateGameParams, type CreateGameResult, DEFAULT_BASE_URL, DEFAULT_RPC_URL, DubsApiError, type DubsAppUser, DubsClient, type DubsClientConfig, type DubsContextValue, type DubsNetwork, DubsProvider, type DubsProviderProps, type DubsPublicUser, type DubsTheme, type DubsUser, type EsportsMatchDetail, type EsportsMatchOpponent, type EsportsMatchResult, type EventMedia, type EventMeta, type EventStream, type GameDetail, type GameListItem, type GameListOpponent, type GameMedia, GamePoster, type GamePosterProps, type GetGamesParams, type GetNetworkGamesParams, type GetUpcomingEventsParams, JoinGameButton, type JoinGameButtonProps, type JoinGameMutationResult, type JoinGameParams, type JoinGameResult, LivePoolsCard, type LivePoolsCardProps, type LiveScore, type LiveScoreCompetitor, type MutationResult, type MutationStatus, type MwaAdapterConfig, type MwaTransactFn, MwaWalletAdapter, NETWORK_CONFIG, type NonceResult, type Opponent, type Pagination, type ParsedError, PickWinnerCard, type PickWinnerCardProps, PlayersCard, type PlayersCardProps, type QueryResult, type RegisterParams, type RegisterResult, type RegistrationScreenProps, SOLANA_PROGRAM_ERRORS, STORAGE_KEYS, SettingsSheet, type SettingsSheetProps, type SolanaErrorCode, type TokenStorage, type UnifiedEvent, type UseAuthResult, UserProfileCard, type UserProfileCardProps, type ValidateEventResult, type WalletAdapter, createSecureStoreStorage, parseSolanaError, signAndSendBase64Transaction, useAuth, useClaim, useCreateGame, useDubs, useDubsTheme, useEvents, useGame, useGames, useJoinGame, useNetworkGames };
|