@dubsdotapp/expo 0.1.3 → 0.2.1
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 +207 -46
- package/dist/index.d.ts +207 -46
- package/dist/index.js +1266 -411
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1299 -444
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -2
- package/src/auth-context.ts +9 -0
- package/src/client.ts +30 -1
- package/src/constants.ts +15 -0
- package/src/hooks/useAuth.ts +13 -2
- 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 +22 -3
- package/src/managed-wallet.tsx +158 -0
- package/src/provider.tsx +245 -9
- package/src/storage.ts +57 -0
- package/src/types.ts +47 -4
- package/src/ui/AuthGate.tsx +20 -11
- package/src/ui/ConnectWalletScreen.tsx +31 -5
- 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 +11 -1
- package/src/ui/theme.ts +5 -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
|
}
|
|
@@ -257,6 +264,34 @@ interface MutationResult<TParams, TResult> {
|
|
|
257
264
|
data: TResult | null;
|
|
258
265
|
reset: () => void;
|
|
259
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
|
+
}
|
|
289
|
+
interface UiConfig {
|
|
290
|
+
accentColor?: string;
|
|
291
|
+
appIcon?: string;
|
|
292
|
+
appName?: string;
|
|
293
|
+
tagline?: string;
|
|
294
|
+
}
|
|
260
295
|
|
|
261
296
|
interface DubsClientConfig {
|
|
262
297
|
apiKey: string;
|
|
@@ -285,6 +320,7 @@ declare class DubsClient {
|
|
|
285
320
|
confirmGame(params: ConfirmGameParams): Promise<ConfirmGameResult>;
|
|
286
321
|
buildClaimTransaction(params: BuildClaimParams): Promise<BuildClaimResult>;
|
|
287
322
|
getGame(gameId: string): Promise<GameDetail>;
|
|
323
|
+
getLiveScore(gameId: string): Promise<LiveScore | null>;
|
|
288
324
|
getGames(params?: GetGamesParams): Promise<GameListItem[]>;
|
|
289
325
|
getNetworkGames(params?: GetNetworkGamesParams): Promise<{
|
|
290
326
|
games: GameListItem[];
|
|
@@ -317,6 +353,8 @@ declare class DubsClient {
|
|
|
317
353
|
parseErrorLocal(error: unknown): ParsedError;
|
|
318
354
|
/** Get the full local error code map */
|
|
319
355
|
getErrorCodesLocal(): Record<number, SolanaErrorCode>;
|
|
356
|
+
/** Fetch the app's UI customization config (accent color, icon, tagline) */
|
|
357
|
+
getAppConfig(): Promise<UiConfig>;
|
|
320
358
|
}
|
|
321
359
|
|
|
322
360
|
declare class DubsApiError extends Error {
|
|
@@ -334,6 +372,28 @@ declare function parseSolanaError(err: unknown): ParsedError;
|
|
|
334
372
|
|
|
335
373
|
declare const DEFAULT_BASE_URL = "https://dubs-server-prod-9c91d3f01199.herokuapp.com/api/developer/v1";
|
|
336
374
|
declare const DEFAULT_RPC_URL = "https://api.mainnet-beta.solana.com";
|
|
375
|
+
type DubsNetwork = 'devnet' | 'mainnet-beta';
|
|
376
|
+
declare const NETWORK_CONFIG: Record<DubsNetwork, {
|
|
377
|
+
baseUrl: string;
|
|
378
|
+
rpcUrl: string;
|
|
379
|
+
cluster: string;
|
|
380
|
+
}>;
|
|
381
|
+
|
|
382
|
+
interface TokenStorage {
|
|
383
|
+
getItem(key: string): Promise<string | null>;
|
|
384
|
+
setItem(key: string, value: string): Promise<void>;
|
|
385
|
+
deleteItem(key: string): Promise<void>;
|
|
386
|
+
}
|
|
387
|
+
declare const STORAGE_KEYS: {
|
|
388
|
+
readonly MWA_AUTH_TOKEN: "dubs_mwa_auth_token";
|
|
389
|
+
readonly JWT_TOKEN: "dubs_jwt_token";
|
|
390
|
+
};
|
|
391
|
+
/**
|
|
392
|
+
* Creates a TokenStorage backed by expo-secure-store.
|
|
393
|
+
* Lazy-imports the module so it's only required at runtime when actually used.
|
|
394
|
+
* Throws a clear error if expo-secure-store is not installed.
|
|
395
|
+
*/
|
|
396
|
+
declare function createSecureStoreStorage(): TokenStorage;
|
|
337
397
|
|
|
338
398
|
/**
|
|
339
399
|
* Minimal wallet adapter interface.
|
|
@@ -358,21 +418,82 @@ interface WalletAdapter {
|
|
|
358
418
|
* Returns the signature as a Uint8Array.
|
|
359
419
|
*/
|
|
360
420
|
signMessage?(message: Uint8Array): Promise<Uint8Array>;
|
|
421
|
+
/** Optional: Connect the wallet */
|
|
422
|
+
connect?(): Promise<void>;
|
|
423
|
+
/** Optional: Disconnect the wallet */
|
|
424
|
+
disconnect?(): void | Promise<void>;
|
|
361
425
|
}
|
|
362
426
|
|
|
427
|
+
interface RegistrationScreenProps {
|
|
428
|
+
onRegister: (username: string, referralCode?: string, avatarUrl?: string) => void;
|
|
429
|
+
registering: boolean;
|
|
430
|
+
error: Error | null;
|
|
431
|
+
client: DubsClient;
|
|
432
|
+
}
|
|
433
|
+
interface AuthGateProps {
|
|
434
|
+
children: React$1.ReactNode;
|
|
435
|
+
onSaveToken: (token: string | null) => void | Promise<void>;
|
|
436
|
+
onLoadToken: () => string | null | Promise<string | null>;
|
|
437
|
+
renderLoading?: (status: AuthStatus) => React$1.ReactNode;
|
|
438
|
+
renderError?: (error: Error, retry: () => void) => React$1.ReactNode;
|
|
439
|
+
renderRegistration?: (props: RegistrationScreenProps) => React$1.ReactNode;
|
|
440
|
+
appName?: string;
|
|
441
|
+
/** Override accent color for registration screens (from developer UI config) */
|
|
442
|
+
accentColor?: string;
|
|
443
|
+
}
|
|
444
|
+
declare function AuthGate({ children, onSaveToken, onLoadToken, renderLoading, renderError, renderRegistration, appName, accentColor, }: AuthGateProps): react_jsx_runtime.JSX.Element;
|
|
445
|
+
|
|
446
|
+
interface ConnectWalletScreenProps {
|
|
447
|
+
/** Called when the user taps Connect Wallet */
|
|
448
|
+
onConnect: () => void | Promise<void>;
|
|
449
|
+
/** Show a loading spinner on the button while connecting */
|
|
450
|
+
connecting?: boolean;
|
|
451
|
+
/** Error message to display (e.g. "User rejected the request") */
|
|
452
|
+
error?: string | null;
|
|
453
|
+
/** App name shown in the header. Defaults to "Dubs" */
|
|
454
|
+
appName?: string;
|
|
455
|
+
/** Override accent color (e.g. from developer UI config) */
|
|
456
|
+
accentColor?: string;
|
|
457
|
+
/** URL to app icon — renders as Image instead of the default letter circle */
|
|
458
|
+
appIcon?: string;
|
|
459
|
+
/** Override subtitle text below app name */
|
|
460
|
+
tagline?: string;
|
|
461
|
+
}
|
|
462
|
+
declare function ConnectWalletScreen({ onConnect, connecting, error, appName, accentColor, appIcon, tagline, }: ConnectWalletScreenProps): react_jsx_runtime.JSX.Element;
|
|
463
|
+
|
|
363
464
|
interface DubsContextValue {
|
|
364
465
|
client: DubsClient;
|
|
365
466
|
wallet: WalletAdapter;
|
|
366
467
|
connection: Connection;
|
|
468
|
+
appName: string;
|
|
469
|
+
network: DubsNetwork;
|
|
470
|
+
disconnect: () => Promise<void>;
|
|
367
471
|
}
|
|
368
472
|
interface DubsProviderProps {
|
|
369
473
|
apiKey: string;
|
|
474
|
+
children: React$1.ReactNode;
|
|
475
|
+
appName?: string;
|
|
476
|
+
network?: DubsNetwork;
|
|
477
|
+
/** Escape hatch: bring your own wallet adapter. Disables managed MWA. */
|
|
478
|
+
wallet?: WalletAdapter;
|
|
479
|
+
/** Escape hatch: custom token persistence. Defaults to expo-secure-store. */
|
|
480
|
+
tokenStorage?: TokenStorage;
|
|
481
|
+
/** Escape hatch: override base URL (takes precedence over network). */
|
|
370
482
|
baseUrl?: string;
|
|
483
|
+
/** Escape hatch: override RPC URL (takes precedence over network). */
|
|
371
484
|
rpcUrl?: string;
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
485
|
+
/** Custom connect screen, or false to hide it entirely (headless mode). */
|
|
486
|
+
renderConnectScreen?: ((props: ConnectWalletScreenProps) => React$1.ReactNode) | false;
|
|
487
|
+
/** Custom loading screen shown during auth. */
|
|
488
|
+
renderLoading?: (status: AuthStatus) => React$1.ReactNode;
|
|
489
|
+
/** Custom error screen shown on auth failure. */
|
|
490
|
+
renderError?: (error: Error, retry: () => void) => React$1.ReactNode;
|
|
491
|
+
/** Custom registration screen. */
|
|
492
|
+
renderRegistration?: (props: RegistrationScreenProps) => React$1.ReactNode;
|
|
493
|
+
/** Set to false to skip AuthGate and connect screen (headless/BYOA mode). Default: true. */
|
|
494
|
+
managed?: boolean;
|
|
495
|
+
}
|
|
496
|
+
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;
|
|
376
497
|
declare function useDubs(): DubsContextValue;
|
|
377
498
|
|
|
378
499
|
/** The `transact` function signature from @solana-mobile/mobile-wallet-adapter-protocol-web3js */
|
|
@@ -411,6 +532,8 @@ declare class MwaWalletAdapter implements WalletAdapter {
|
|
|
411
532
|
constructor(config: MwaAdapterConfig);
|
|
412
533
|
get publicKey(): PublicKey | null;
|
|
413
534
|
get connected(): boolean;
|
|
535
|
+
get authToken(): string | null;
|
|
536
|
+
setAuthToken(token: string | null): void;
|
|
414
537
|
/**
|
|
415
538
|
* Connect to a mobile wallet. Call this before any signing.
|
|
416
539
|
*/
|
|
@@ -513,35 +636,6 @@ interface UseAuthResult {
|
|
|
513
636
|
}
|
|
514
637
|
declare function useAuth(): UseAuthResult;
|
|
515
638
|
|
|
516
|
-
interface RegistrationScreenProps {
|
|
517
|
-
onRegister: (username: string, referralCode?: string, avatarUrl?: string) => void;
|
|
518
|
-
registering: boolean;
|
|
519
|
-
error: Error | null;
|
|
520
|
-
client: DubsClient;
|
|
521
|
-
}
|
|
522
|
-
interface AuthGateProps {
|
|
523
|
-
children: React.ReactNode;
|
|
524
|
-
onSaveToken: (token: string | null) => void | Promise<void>;
|
|
525
|
-
onLoadToken: () => string | null | Promise<string | null>;
|
|
526
|
-
renderLoading?: (status: AuthStatus) => React.ReactNode;
|
|
527
|
-
renderError?: (error: Error, retry: () => void) => React.ReactNode;
|
|
528
|
-
renderRegistration?: (props: RegistrationScreenProps) => React.ReactNode;
|
|
529
|
-
appName?: string;
|
|
530
|
-
}
|
|
531
|
-
declare function AuthGate({ children, onSaveToken, onLoadToken, renderLoading, renderError, renderRegistration, appName, }: AuthGateProps): react_jsx_runtime.JSX.Element;
|
|
532
|
-
|
|
533
|
-
interface ConnectWalletScreenProps {
|
|
534
|
-
/** Called when the user taps Connect Wallet */
|
|
535
|
-
onConnect: () => void | Promise<void>;
|
|
536
|
-
/** Show a loading spinner on the button while connecting */
|
|
537
|
-
connecting?: boolean;
|
|
538
|
-
/** Error message to display (e.g. "User rejected the request") */
|
|
539
|
-
error?: string | null;
|
|
540
|
-
/** App name shown in the header. Defaults to "Dubs" */
|
|
541
|
-
appName?: string;
|
|
542
|
-
}
|
|
543
|
-
declare function ConnectWalletScreen({ onConnect, connecting, error, appName, }: ConnectWalletScreenProps): react_jsx_runtime.JSX.Element;
|
|
544
|
-
|
|
545
639
|
interface UserProfileCardProps {
|
|
546
640
|
walletAddress: string;
|
|
547
641
|
username?: string;
|
|
@@ -580,16 +674,83 @@ interface DubsTheme {
|
|
|
580
674
|
errorBorder: string;
|
|
581
675
|
}
|
|
582
676
|
declare function useDubsTheme(): DubsTheme;
|
|
677
|
+
/** Merge overrides into a base theme (e.g. custom accent color from developer config) */
|
|
678
|
+
declare function mergeTheme(base: DubsTheme, overrides: Partial<DubsTheme>): DubsTheme;
|
|
583
679
|
|
|
680
|
+
interface GamePosterProps {
|
|
681
|
+
game: GameDetail;
|
|
682
|
+
/** Optional Image component — pass expo-image or RN Image. Defaults to RN Image. */
|
|
683
|
+
ImageComponent?: React.ComponentType<any>;
|
|
684
|
+
}
|
|
584
685
|
/**
|
|
585
|
-
*
|
|
586
|
-
*
|
|
686
|
+
* Matchup poster hero widget.
|
|
687
|
+
* Shows the game poster image (or team logo fallback), countdown pill, and pool total.
|
|
688
|
+
*/
|
|
689
|
+
declare function GamePoster({ game, ImageComponent }: GamePosterProps): react_jsx_runtime.JSX.Element;
|
|
690
|
+
|
|
691
|
+
interface LivePoolsCardProps {
|
|
692
|
+
game: GameDetail;
|
|
693
|
+
/** Custom short-name function for team labels. Defaults to full name. */
|
|
694
|
+
shortName?: (name: string | null) => string;
|
|
695
|
+
/** Override bar colors. Defaults to blue/red. */
|
|
696
|
+
homeColor?: string;
|
|
697
|
+
awayColor?: string;
|
|
698
|
+
}
|
|
699
|
+
/**
|
|
700
|
+
* Pool breakdown card showing each side's SOL amount, bar chart, and implied odds.
|
|
701
|
+
*/
|
|
702
|
+
declare function LivePoolsCard({ game, shortName, homeColor, awayColor, }: LivePoolsCardProps): react_jsx_runtime.JSX.Element;
|
|
703
|
+
|
|
704
|
+
interface PickWinnerCardProps {
|
|
705
|
+
game: GameDetail;
|
|
706
|
+
selectedTeam: 'home' | 'away' | null;
|
|
707
|
+
onSelect: (team: 'home' | 'away') => void;
|
|
708
|
+
/** Custom short-name function for team labels. Defaults to full name. */
|
|
709
|
+
shortName?: (name: string | null) => string;
|
|
710
|
+
/** Override colors. Defaults to blue/red. */
|
|
711
|
+
homeColor?: string;
|
|
712
|
+
awayColor?: string;
|
|
713
|
+
/** Optional Image component (expo-image, etc.). */
|
|
714
|
+
ImageComponent?: React.ComponentType<any>;
|
|
715
|
+
}
|
|
716
|
+
/**
|
|
717
|
+
* Team selection card for picking which side to bet on.
|
|
718
|
+
*/
|
|
719
|
+
declare function PickWinnerCard({ game, selectedTeam, onSelect, shortName, homeColor, awayColor, ImageComponent, }: PickWinnerCardProps): react_jsx_runtime.JSX.Element;
|
|
720
|
+
|
|
721
|
+
interface PlayersCardProps {
|
|
722
|
+
game: GameDetail;
|
|
723
|
+
/** How many chars to show on each side of a truncated wallet. Default 4. */
|
|
724
|
+
truncateChars?: number;
|
|
725
|
+
/** Override team dot colors. */
|
|
726
|
+
homeColor?: string;
|
|
727
|
+
awayColor?: string;
|
|
728
|
+
drawColor?: string;
|
|
729
|
+
/** Optional Image component (expo-image, etc.). */
|
|
730
|
+
ImageComponent?: React.ComponentType<any>;
|
|
731
|
+
}
|
|
732
|
+
/**
|
|
733
|
+
* Card showing all bettors in a game with their avatar, username, team, and wager amount.
|
|
587
734
|
*/
|
|
588
|
-
declare function
|
|
735
|
+
declare function PlayersCard({ game, truncateChars, homeColor, awayColor, drawColor, ImageComponent, }: PlayersCardProps): react_jsx_runtime.JSX.Element;
|
|
736
|
+
|
|
737
|
+
interface JoinGameButtonProps {
|
|
738
|
+
game: GameDetail;
|
|
739
|
+
walletAddress: string;
|
|
740
|
+
selectedTeam: 'home' | 'away' | null;
|
|
741
|
+
status: MutationStatus;
|
|
742
|
+
onJoin: () => void;
|
|
743
|
+
}
|
|
589
744
|
/**
|
|
590
|
-
*
|
|
591
|
-
*
|
|
745
|
+
* Fixed bottom bar with buy-in info and join button.
|
|
746
|
+
* Renders nothing if the user already joined, or the game is locked/resolved.
|
|
747
|
+
*/
|
|
748
|
+
declare function JoinGameButton({ game, walletAddress, selectedTeam, status, onJoin }: JoinGameButtonProps): react_jsx_runtime.JSX.Element | null;
|
|
749
|
+
|
|
750
|
+
/**
|
|
751
|
+
* Deserialize a base64-encoded transaction, sign via wallet adapter, send to Solana.
|
|
752
|
+
* Returns the transaction signature.
|
|
592
753
|
*/
|
|
593
|
-
declare function
|
|
754
|
+
declare function signAndSendBase64Transaction(base64Tx: string, wallet: WalletAdapter): Promise<string>;
|
|
594
755
|
|
|
595
|
-
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,
|
|
756
|
+
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 UiConfig, type UnifiedEvent, type UseAuthResult, UserProfileCard, type UserProfileCardProps, type ValidateEventResult, type WalletAdapter, createSecureStoreStorage, mergeTheme, parseSolanaError, signAndSendBase64Transaction, useAuth, useClaim, useCreateGame, useDubs, useDubsTheme, useEvents, useGame, useGames, useJoinGame, useNetworkGames };
|