@dubsdotapp/expo 0.2.52 → 0.2.54
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 +14 -1
- package/dist/index.d.mts +31 -1
- package/dist/index.d.ts +31 -1
- package/dist/index.js +653 -399
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +312 -59
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -2
- package/src/client.ts +18 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/usePushNotifications.ts +173 -0
- package/src/index.ts +2 -0
- package/src/ui/AuthGate.tsx +151 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @dubsdotapp/expo
|
|
2
2
|
|
|
3
|
-
React Native SDK for the [Dubs](https://dubs.fun) betting platform.
|
|
3
|
+
React Native SDK for the [Dubs](https://dubs.fun) betting platform.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -14,6 +14,19 @@ For the built-in Mobile Wallet Adapter (optional):
|
|
|
14
14
|
npx expo install @solana-mobile/mobile-wallet-adapter-protocol-web3js
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
+
### Custom Dev Builds
|
|
18
|
+
|
|
19
|
+
The SDK includes `expo-crypto` as a dependency to provide `crypto.getRandomValues` for Solana transaction signing, wallet encryption, and other cryptographic operations. This works automatically in Expo Go and EAS builds.
|
|
20
|
+
|
|
21
|
+
If your app uses a **custom dev build** (has `ios/` or `android/` directories), you need to rebuild after installing so the native `ExpoCrypto` module is linked:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npx expo prebuild --clean
|
|
25
|
+
npx expo run:ios # or npx expo run:android
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
This is standard Expo behavior for any package with native code — you only need to do this once after installing the SDK.
|
|
29
|
+
|
|
17
30
|
## Quick Start
|
|
18
31
|
|
|
19
32
|
### 1. Set up the provider
|
package/dist/index.d.mts
CHANGED
|
@@ -464,6 +464,12 @@ declare class DubsClient {
|
|
|
464
464
|
}>;
|
|
465
465
|
checkUsername(username: string): Promise<CheckUsernameResult>;
|
|
466
466
|
logout(): Promise<void>;
|
|
467
|
+
registerPushToken(params: {
|
|
468
|
+
token: string;
|
|
469
|
+
platform: string;
|
|
470
|
+
deviceName?: string;
|
|
471
|
+
}): Promise<void>;
|
|
472
|
+
unregisterPushToken(token: string): Promise<void>;
|
|
467
473
|
parseError(error: unknown): Promise<ParsedError>;
|
|
468
474
|
getErrorCodes(): Promise<Record<number, SolanaErrorCode>>;
|
|
469
475
|
/**
|
|
@@ -883,6 +889,30 @@ declare function useUFCFightCard(): QueryResult<UFCEvent[]>;
|
|
|
883
889
|
|
|
884
890
|
declare function useUFCFighterDetail(athleteId: string | null): QueryResult<UFCFighterDetail>;
|
|
885
891
|
|
|
892
|
+
interface PushNotificationStatus {
|
|
893
|
+
/** Whether notification permission has been granted */
|
|
894
|
+
hasPermission: boolean;
|
|
895
|
+
/** The Expo push token, if registered */
|
|
896
|
+
expoPushToken: string | null;
|
|
897
|
+
/** Whether a registration operation is in progress */
|
|
898
|
+
loading: boolean;
|
|
899
|
+
/** The last error encountered */
|
|
900
|
+
error: Error | null;
|
|
901
|
+
/**
|
|
902
|
+
* Request notification permission and register the push token.
|
|
903
|
+
* Does NOT auto-prompt — must be called explicitly (e.g. from an onboarding screen).
|
|
904
|
+
*/
|
|
905
|
+
register: () => Promise<boolean>;
|
|
906
|
+
/** Unregister the current push token */
|
|
907
|
+
unregister: () => Promise<void>;
|
|
908
|
+
/**
|
|
909
|
+
* Silently re-register if permission was already granted (no prompt).
|
|
910
|
+
* Safe to call on app startup for returning users.
|
|
911
|
+
*/
|
|
912
|
+
restoreIfGranted: () => Promise<void>;
|
|
913
|
+
}
|
|
914
|
+
declare function usePushNotifications(): PushNotificationStatus;
|
|
915
|
+
|
|
886
916
|
interface UserProfileCardProps {
|
|
887
917
|
walletAddress: string;
|
|
888
918
|
username?: string;
|
|
@@ -1066,4 +1096,4 @@ declare function ClaimButton({ gameId, style, onSuccess, onError }: ClaimButtonP
|
|
|
1066
1096
|
*/
|
|
1067
1097
|
declare function signAndSendBase64Transaction(base64Tx: string, wallet: WalletAdapter, connection: Connection): Promise<string>;
|
|
1068
1098
|
|
|
1069
|
-
export { AuthGate, type AuthGateProps, type AuthStatus, type AuthenticateParams, type AuthenticateResult, type Bettor, type BuildClaimParams, type BuildClaimResult, type CheckUsernameResult, ClaimButton, type ClaimButtonProps, type ClaimMutationResult, ClaimPrizeSheet, type ClaimPrizeSheetProps, type ClaimStatus, type ConfirmClaimParams, type ConfirmClaimResult, type ConfirmGameParams, type ConfirmGameResult, ConnectWalletScreen, type ConnectWalletScreenProps, type CreateCustomGameMutationResult, type CreateCustomGameParams, type CreateCustomGameResult, CreateCustomGameSheet, type CreateCustomGameSheetProps, type CreateGameMutationResult, type CreateGameParams, type CreateGameResult, DEFAULT_BASE_URL, DEFAULT_RPC_URL, type DeviceInfo, 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, JoinGameSheet, type JoinGameSheetProps, 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, PhantomDeeplinkAdapter, type PhantomDeeplinkAdapterConfig, type PhantomSession, 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 UFCData, type UFCEvent, type UFCFight, type UFCFighter, type UFCFighterDetail, type UiConfig, type UnifiedEvent, type UseAuthResult, UserProfileCard, type UserProfileCardProps, type ValidateEventResult, type WalletAdapter, createSecureStoreStorage, getDeviceInfo, isSolanaSeeker, mergeTheme, parseSolanaError, signAndSendBase64Transaction, useAppConfig, useAuth, useClaim, useCreateCustomGame, useCreateGame, useDubs, useDubsTheme, useEvents, useGame, useGames, useHasClaimed, useJoinGame, useNetworkGames, useUFCFightCard, useUFCFighterDetail };
|
|
1099
|
+
export { AuthGate, type AuthGateProps, type AuthStatus, type AuthenticateParams, type AuthenticateResult, type Bettor, type BuildClaimParams, type BuildClaimResult, type CheckUsernameResult, ClaimButton, type ClaimButtonProps, type ClaimMutationResult, ClaimPrizeSheet, type ClaimPrizeSheetProps, type ClaimStatus, type ConfirmClaimParams, type ConfirmClaimResult, type ConfirmGameParams, type ConfirmGameResult, ConnectWalletScreen, type ConnectWalletScreenProps, type CreateCustomGameMutationResult, type CreateCustomGameParams, type CreateCustomGameResult, CreateCustomGameSheet, type CreateCustomGameSheetProps, type CreateGameMutationResult, type CreateGameParams, type CreateGameResult, DEFAULT_BASE_URL, DEFAULT_RPC_URL, type DeviceInfo, 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, JoinGameSheet, type JoinGameSheetProps, 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, 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, SettingsSheet, type SettingsSheetProps, type SolanaErrorCode, type TokenStorage, type UFCData, type UFCEvent, type UFCFight, type UFCFighter, type UFCFighterDetail, type UiConfig, type UnifiedEvent, type UseAuthResult, UserProfileCard, type UserProfileCardProps, type ValidateEventResult, type WalletAdapter, createSecureStoreStorage, getDeviceInfo, isSolanaSeeker, mergeTheme, parseSolanaError, signAndSendBase64Transaction, useAppConfig, useAuth, useClaim, useCreateCustomGame, useCreateGame, useDubs, useDubsTheme, useEvents, useGame, useGames, useHasClaimed, useJoinGame, useNetworkGames, usePushNotifications, useUFCFightCard, useUFCFighterDetail };
|
package/dist/index.d.ts
CHANGED
|
@@ -464,6 +464,12 @@ declare class DubsClient {
|
|
|
464
464
|
}>;
|
|
465
465
|
checkUsername(username: string): Promise<CheckUsernameResult>;
|
|
466
466
|
logout(): Promise<void>;
|
|
467
|
+
registerPushToken(params: {
|
|
468
|
+
token: string;
|
|
469
|
+
platform: string;
|
|
470
|
+
deviceName?: string;
|
|
471
|
+
}): Promise<void>;
|
|
472
|
+
unregisterPushToken(token: string): Promise<void>;
|
|
467
473
|
parseError(error: unknown): Promise<ParsedError>;
|
|
468
474
|
getErrorCodes(): Promise<Record<number, SolanaErrorCode>>;
|
|
469
475
|
/**
|
|
@@ -883,6 +889,30 @@ declare function useUFCFightCard(): QueryResult<UFCEvent[]>;
|
|
|
883
889
|
|
|
884
890
|
declare function useUFCFighterDetail(athleteId: string | null): QueryResult<UFCFighterDetail>;
|
|
885
891
|
|
|
892
|
+
interface PushNotificationStatus {
|
|
893
|
+
/** Whether notification permission has been granted */
|
|
894
|
+
hasPermission: boolean;
|
|
895
|
+
/** The Expo push token, if registered */
|
|
896
|
+
expoPushToken: string | null;
|
|
897
|
+
/** Whether a registration operation is in progress */
|
|
898
|
+
loading: boolean;
|
|
899
|
+
/** The last error encountered */
|
|
900
|
+
error: Error | null;
|
|
901
|
+
/**
|
|
902
|
+
* Request notification permission and register the push token.
|
|
903
|
+
* Does NOT auto-prompt — must be called explicitly (e.g. from an onboarding screen).
|
|
904
|
+
*/
|
|
905
|
+
register: () => Promise<boolean>;
|
|
906
|
+
/** Unregister the current push token */
|
|
907
|
+
unregister: () => Promise<void>;
|
|
908
|
+
/**
|
|
909
|
+
* Silently re-register if permission was already granted (no prompt).
|
|
910
|
+
* Safe to call on app startup for returning users.
|
|
911
|
+
*/
|
|
912
|
+
restoreIfGranted: () => Promise<void>;
|
|
913
|
+
}
|
|
914
|
+
declare function usePushNotifications(): PushNotificationStatus;
|
|
915
|
+
|
|
886
916
|
interface UserProfileCardProps {
|
|
887
917
|
walletAddress: string;
|
|
888
918
|
username?: string;
|
|
@@ -1066,4 +1096,4 @@ declare function ClaimButton({ gameId, style, onSuccess, onError }: ClaimButtonP
|
|
|
1066
1096
|
*/
|
|
1067
1097
|
declare function signAndSendBase64Transaction(base64Tx: string, wallet: WalletAdapter, connection: Connection): Promise<string>;
|
|
1068
1098
|
|
|
1069
|
-
export { AuthGate, type AuthGateProps, type AuthStatus, type AuthenticateParams, type AuthenticateResult, type Bettor, type BuildClaimParams, type BuildClaimResult, type CheckUsernameResult, ClaimButton, type ClaimButtonProps, type ClaimMutationResult, ClaimPrizeSheet, type ClaimPrizeSheetProps, type ClaimStatus, type ConfirmClaimParams, type ConfirmClaimResult, type ConfirmGameParams, type ConfirmGameResult, ConnectWalletScreen, type ConnectWalletScreenProps, type CreateCustomGameMutationResult, type CreateCustomGameParams, type CreateCustomGameResult, CreateCustomGameSheet, type CreateCustomGameSheetProps, type CreateGameMutationResult, type CreateGameParams, type CreateGameResult, DEFAULT_BASE_URL, DEFAULT_RPC_URL, type DeviceInfo, 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, JoinGameSheet, type JoinGameSheetProps, 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, PhantomDeeplinkAdapter, type PhantomDeeplinkAdapterConfig, type PhantomSession, 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 UFCData, type UFCEvent, type UFCFight, type UFCFighter, type UFCFighterDetail, type UiConfig, type UnifiedEvent, type UseAuthResult, UserProfileCard, type UserProfileCardProps, type ValidateEventResult, type WalletAdapter, createSecureStoreStorage, getDeviceInfo, isSolanaSeeker, mergeTheme, parseSolanaError, signAndSendBase64Transaction, useAppConfig, useAuth, useClaim, useCreateCustomGame, useCreateGame, useDubs, useDubsTheme, useEvents, useGame, useGames, useHasClaimed, useJoinGame, useNetworkGames, useUFCFightCard, useUFCFighterDetail };
|
|
1099
|
+
export { AuthGate, type AuthGateProps, type AuthStatus, type AuthenticateParams, type AuthenticateResult, type Bettor, type BuildClaimParams, type BuildClaimResult, type CheckUsernameResult, ClaimButton, type ClaimButtonProps, type ClaimMutationResult, ClaimPrizeSheet, type ClaimPrizeSheetProps, type ClaimStatus, type ConfirmClaimParams, type ConfirmClaimResult, type ConfirmGameParams, type ConfirmGameResult, ConnectWalletScreen, type ConnectWalletScreenProps, type CreateCustomGameMutationResult, type CreateCustomGameParams, type CreateCustomGameResult, CreateCustomGameSheet, type CreateCustomGameSheetProps, type CreateGameMutationResult, type CreateGameParams, type CreateGameResult, DEFAULT_BASE_URL, DEFAULT_RPC_URL, type DeviceInfo, 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, JoinGameSheet, type JoinGameSheetProps, 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, 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, SettingsSheet, type SettingsSheetProps, type SolanaErrorCode, type TokenStorage, type UFCData, type UFCEvent, type UFCFight, type UFCFighter, type UFCFighterDetail, type UiConfig, type UnifiedEvent, type UseAuthResult, UserProfileCard, type UserProfileCardProps, type ValidateEventResult, type WalletAdapter, createSecureStoreStorage, getDeviceInfo, isSolanaSeeker, mergeTheme, parseSolanaError, signAndSendBase64Transaction, useAppConfig, useAuth, useClaim, useCreateCustomGame, useCreateGame, useDubs, useDubsTheme, useEvents, useGame, useGames, useHasClaimed, useJoinGame, useNetworkGames, usePushNotifications, useUFCFightCard, useUFCFighterDetail };
|