@dubsdotapp/expo 0.2.10 → 0.2.11
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 +68 -2
- package/dist/index.d.ts +68 -2
- package/dist/index.js +759 -284
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +521 -47
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
- package/src/index.ts +2 -0
- package/src/managed-wallet.tsx +150 -46
- package/src/provider.tsx +8 -0
- package/src/storage.ts +1 -0
- package/src/wallet/index.ts +2 -0
- package/src/wallet/phantom-deeplink/crypto.ts +49 -0
- package/src/wallet/phantom-deeplink/deeplink-handler.ts +177 -0
- package/src/wallet/phantom-deeplink/index.ts +2 -0
- package/src/wallet/phantom-deeplink/phantom-deeplink-adapter.ts +323 -0
package/dist/index.d.mts
CHANGED
|
@@ -403,6 +403,7 @@ interface TokenStorage {
|
|
|
403
403
|
declare const STORAGE_KEYS: {
|
|
404
404
|
readonly MWA_AUTH_TOKEN: "dubs_mwa_auth_token";
|
|
405
405
|
readonly JWT_TOKEN: "dubs_jwt_token";
|
|
406
|
+
readonly PHANTOM_SESSION: "dubs_phantom_session";
|
|
406
407
|
};
|
|
407
408
|
/**
|
|
408
409
|
* Creates a TokenStorage backed by expo-secure-store.
|
|
@@ -509,8 +510,12 @@ interface DubsProviderProps {
|
|
|
509
510
|
renderRegistration?: (props: RegistrationScreenProps) => React$1.ReactNode;
|
|
510
511
|
/** Set to false to skip AuthGate and connect screen (headless/BYOA mode). Default: true. */
|
|
511
512
|
managed?: boolean;
|
|
513
|
+
/** Deeplink redirect URI for Phantom wallet (required for iOS support). */
|
|
514
|
+
redirectUri?: string;
|
|
515
|
+
/** App URL shown in Phantom's connect screen. */
|
|
516
|
+
appUrl?: string;
|
|
512
517
|
}
|
|
513
|
-
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 | null;
|
|
518
|
+
declare function DubsProvider({ apiKey, children, appName, network, wallet: externalWallet, tokenStorage, baseUrl: baseUrlOverride, rpcUrl: rpcUrlOverride, renderConnectScreen, renderLoading, renderError, renderRegistration, managed, redirectUri, appUrl, }: DubsProviderProps): react_jsx_runtime.JSX.Element | null;
|
|
514
519
|
declare function useDubs(): DubsContextValue;
|
|
515
520
|
declare function useAppConfig(): UiConfig;
|
|
516
521
|
|
|
@@ -565,6 +570,67 @@ declare class MwaWalletAdapter implements WalletAdapter {
|
|
|
565
570
|
signAndSendTransaction(transaction: Transaction): Promise<string>;
|
|
566
571
|
}
|
|
567
572
|
|
|
573
|
+
/** Serializable session state — save this to restore without a deeplink round-trip. */
|
|
574
|
+
interface PhantomSession {
|
|
575
|
+
/** Our x25519 public key (base58) */
|
|
576
|
+
dappPublicKey: string;
|
|
577
|
+
/** Our x25519 secret key (base58) */
|
|
578
|
+
dappSecretKey: string;
|
|
579
|
+
/** Phantom's x25519 public key (base58) */
|
|
580
|
+
phantomPublicKey: string;
|
|
581
|
+
/** Shared secret (base58) */
|
|
582
|
+
sharedSecret: string;
|
|
583
|
+
/** Phantom session token (opaque string) */
|
|
584
|
+
sessionToken: string;
|
|
585
|
+
/** User's wallet public key (base58) */
|
|
586
|
+
walletPublicKey: string;
|
|
587
|
+
}
|
|
588
|
+
interface PhantomDeeplinkAdapterConfig {
|
|
589
|
+
/** The deeplink redirect URI, e.g. "myapp://phantom-callback" */
|
|
590
|
+
redirectUri: string;
|
|
591
|
+
/** Shown in Phantom's connect screen */
|
|
592
|
+
appUrl?: string;
|
|
593
|
+
/** Solana cluster: 'devnet' | 'mainnet-beta' */
|
|
594
|
+
cluster?: string;
|
|
595
|
+
/** Deeplink round-trip timeout in ms (default 120000) */
|
|
596
|
+
timeout?: number;
|
|
597
|
+
/** Called when the Phantom session changes (save/clear for persistence) */
|
|
598
|
+
onSessionChange?: (session: PhantomSession | null) => void;
|
|
599
|
+
}
|
|
600
|
+
/**
|
|
601
|
+
* Phantom wallet adapter using deeplinks (works on iOS and Android).
|
|
602
|
+
* Uses x25519 encrypted communication per Phantom's deeplink protocol.
|
|
603
|
+
*/
|
|
604
|
+
declare class PhantomDeeplinkAdapter implements WalletAdapter {
|
|
605
|
+
private _publicKey;
|
|
606
|
+
private _connected;
|
|
607
|
+
private _dappKeyPair;
|
|
608
|
+
private _sharedSecret;
|
|
609
|
+
private _sessionToken;
|
|
610
|
+
private _phantomPublicKey;
|
|
611
|
+
private readonly config;
|
|
612
|
+
private readonly handler;
|
|
613
|
+
private readonly timeout;
|
|
614
|
+
constructor(config: PhantomDeeplinkAdapterConfig);
|
|
615
|
+
get publicKey(): PublicKey | null;
|
|
616
|
+
get connected(): boolean;
|
|
617
|
+
/**
|
|
618
|
+
* Restore a previously saved session without opening Phantom.
|
|
619
|
+
* Call this before connect() if you have persisted session state.
|
|
620
|
+
*/
|
|
621
|
+
restoreSession(saved: PhantomSession): void;
|
|
622
|
+
/** Serialize the current session for persistence. Returns null if not connected. */
|
|
623
|
+
getSession(): PhantomSession | null;
|
|
624
|
+
connect(): Promise<void>;
|
|
625
|
+
disconnect(): void;
|
|
626
|
+
signTransaction(transaction: Transaction): Promise<Transaction>;
|
|
627
|
+
signAndSendTransaction(transaction: Transaction): Promise<string>;
|
|
628
|
+
signMessage(message: Uint8Array): Promise<Uint8Array>;
|
|
629
|
+
/** Remove the Linking event listener. Call when the adapter is no longer needed. */
|
|
630
|
+
destroy(): void;
|
|
631
|
+
private assertConnected;
|
|
632
|
+
}
|
|
633
|
+
|
|
568
634
|
declare function useEvents(params?: GetUpcomingEventsParams): QueryResult<{
|
|
569
635
|
events: UnifiedEvent[];
|
|
570
636
|
pagination: Pagination;
|
|
@@ -801,4 +867,4 @@ declare function CreateCustomGameSheet({ visible, onDismiss, title, maxPlayers,
|
|
|
801
867
|
*/
|
|
802
868
|
declare function signAndSendBase64Transaction(base64Tx: string, wallet: WalletAdapter): Promise<string>;
|
|
803
869
|
|
|
804
|
-
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 CreateCustomGameMutationResult, type CreateCustomGameParams, type CreateCustomGameResult, CreateCustomGameSheet, type CreateCustomGameSheetProps, 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, useAppConfig, useAuth, useClaim, useCreateCustomGame, useCreateGame, useDubs, useDubsTheme, useEvents, useGame, useGames, useJoinGame, useNetworkGames };
|
|
870
|
+
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 CreateCustomGameMutationResult, type CreateCustomGameParams, type CreateCustomGameResult, CreateCustomGameSheet, type CreateCustomGameSheetProps, 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, 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 UiConfig, type UnifiedEvent, type UseAuthResult, UserProfileCard, type UserProfileCardProps, type ValidateEventResult, type WalletAdapter, createSecureStoreStorage, mergeTheme, parseSolanaError, signAndSendBase64Transaction, useAppConfig, useAuth, useClaim, useCreateCustomGame, useCreateGame, useDubs, useDubsTheme, useEvents, useGame, useGames, useJoinGame, useNetworkGames };
|
package/dist/index.d.ts
CHANGED
|
@@ -403,6 +403,7 @@ interface TokenStorage {
|
|
|
403
403
|
declare const STORAGE_KEYS: {
|
|
404
404
|
readonly MWA_AUTH_TOKEN: "dubs_mwa_auth_token";
|
|
405
405
|
readonly JWT_TOKEN: "dubs_jwt_token";
|
|
406
|
+
readonly PHANTOM_SESSION: "dubs_phantom_session";
|
|
406
407
|
};
|
|
407
408
|
/**
|
|
408
409
|
* Creates a TokenStorage backed by expo-secure-store.
|
|
@@ -509,8 +510,12 @@ interface DubsProviderProps {
|
|
|
509
510
|
renderRegistration?: (props: RegistrationScreenProps) => React$1.ReactNode;
|
|
510
511
|
/** Set to false to skip AuthGate and connect screen (headless/BYOA mode). Default: true. */
|
|
511
512
|
managed?: boolean;
|
|
513
|
+
/** Deeplink redirect URI for Phantom wallet (required for iOS support). */
|
|
514
|
+
redirectUri?: string;
|
|
515
|
+
/** App URL shown in Phantom's connect screen. */
|
|
516
|
+
appUrl?: string;
|
|
512
517
|
}
|
|
513
|
-
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 | null;
|
|
518
|
+
declare function DubsProvider({ apiKey, children, appName, network, wallet: externalWallet, tokenStorage, baseUrl: baseUrlOverride, rpcUrl: rpcUrlOverride, renderConnectScreen, renderLoading, renderError, renderRegistration, managed, redirectUri, appUrl, }: DubsProviderProps): react_jsx_runtime.JSX.Element | null;
|
|
514
519
|
declare function useDubs(): DubsContextValue;
|
|
515
520
|
declare function useAppConfig(): UiConfig;
|
|
516
521
|
|
|
@@ -565,6 +570,67 @@ declare class MwaWalletAdapter implements WalletAdapter {
|
|
|
565
570
|
signAndSendTransaction(transaction: Transaction): Promise<string>;
|
|
566
571
|
}
|
|
567
572
|
|
|
573
|
+
/** Serializable session state — save this to restore without a deeplink round-trip. */
|
|
574
|
+
interface PhantomSession {
|
|
575
|
+
/** Our x25519 public key (base58) */
|
|
576
|
+
dappPublicKey: string;
|
|
577
|
+
/** Our x25519 secret key (base58) */
|
|
578
|
+
dappSecretKey: string;
|
|
579
|
+
/** Phantom's x25519 public key (base58) */
|
|
580
|
+
phantomPublicKey: string;
|
|
581
|
+
/** Shared secret (base58) */
|
|
582
|
+
sharedSecret: string;
|
|
583
|
+
/** Phantom session token (opaque string) */
|
|
584
|
+
sessionToken: string;
|
|
585
|
+
/** User's wallet public key (base58) */
|
|
586
|
+
walletPublicKey: string;
|
|
587
|
+
}
|
|
588
|
+
interface PhantomDeeplinkAdapterConfig {
|
|
589
|
+
/** The deeplink redirect URI, e.g. "myapp://phantom-callback" */
|
|
590
|
+
redirectUri: string;
|
|
591
|
+
/** Shown in Phantom's connect screen */
|
|
592
|
+
appUrl?: string;
|
|
593
|
+
/** Solana cluster: 'devnet' | 'mainnet-beta' */
|
|
594
|
+
cluster?: string;
|
|
595
|
+
/** Deeplink round-trip timeout in ms (default 120000) */
|
|
596
|
+
timeout?: number;
|
|
597
|
+
/** Called when the Phantom session changes (save/clear for persistence) */
|
|
598
|
+
onSessionChange?: (session: PhantomSession | null) => void;
|
|
599
|
+
}
|
|
600
|
+
/**
|
|
601
|
+
* Phantom wallet adapter using deeplinks (works on iOS and Android).
|
|
602
|
+
* Uses x25519 encrypted communication per Phantom's deeplink protocol.
|
|
603
|
+
*/
|
|
604
|
+
declare class PhantomDeeplinkAdapter implements WalletAdapter {
|
|
605
|
+
private _publicKey;
|
|
606
|
+
private _connected;
|
|
607
|
+
private _dappKeyPair;
|
|
608
|
+
private _sharedSecret;
|
|
609
|
+
private _sessionToken;
|
|
610
|
+
private _phantomPublicKey;
|
|
611
|
+
private readonly config;
|
|
612
|
+
private readonly handler;
|
|
613
|
+
private readonly timeout;
|
|
614
|
+
constructor(config: PhantomDeeplinkAdapterConfig);
|
|
615
|
+
get publicKey(): PublicKey | null;
|
|
616
|
+
get connected(): boolean;
|
|
617
|
+
/**
|
|
618
|
+
* Restore a previously saved session without opening Phantom.
|
|
619
|
+
* Call this before connect() if you have persisted session state.
|
|
620
|
+
*/
|
|
621
|
+
restoreSession(saved: PhantomSession): void;
|
|
622
|
+
/** Serialize the current session for persistence. Returns null if not connected. */
|
|
623
|
+
getSession(): PhantomSession | null;
|
|
624
|
+
connect(): Promise<void>;
|
|
625
|
+
disconnect(): void;
|
|
626
|
+
signTransaction(transaction: Transaction): Promise<Transaction>;
|
|
627
|
+
signAndSendTransaction(transaction: Transaction): Promise<string>;
|
|
628
|
+
signMessage(message: Uint8Array): Promise<Uint8Array>;
|
|
629
|
+
/** Remove the Linking event listener. Call when the adapter is no longer needed. */
|
|
630
|
+
destroy(): void;
|
|
631
|
+
private assertConnected;
|
|
632
|
+
}
|
|
633
|
+
|
|
568
634
|
declare function useEvents(params?: GetUpcomingEventsParams): QueryResult<{
|
|
569
635
|
events: UnifiedEvent[];
|
|
570
636
|
pagination: Pagination;
|
|
@@ -801,4 +867,4 @@ declare function CreateCustomGameSheet({ visible, onDismiss, title, maxPlayers,
|
|
|
801
867
|
*/
|
|
802
868
|
declare function signAndSendBase64Transaction(base64Tx: string, wallet: WalletAdapter): Promise<string>;
|
|
803
869
|
|
|
804
|
-
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 CreateCustomGameMutationResult, type CreateCustomGameParams, type CreateCustomGameResult, CreateCustomGameSheet, type CreateCustomGameSheetProps, 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, useAppConfig, useAuth, useClaim, useCreateCustomGame, useCreateGame, useDubs, useDubsTheme, useEvents, useGame, useGames, useJoinGame, useNetworkGames };
|
|
870
|
+
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 CreateCustomGameMutationResult, type CreateCustomGameParams, type CreateCustomGameResult, CreateCustomGameSheet, type CreateCustomGameSheetProps, 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, 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 UiConfig, type UnifiedEvent, type UseAuthResult, UserProfileCard, type UserProfileCardProps, type ValidateEventResult, type WalletAdapter, createSecureStoreStorage, mergeTheme, parseSolanaError, signAndSendBase64Transaction, useAppConfig, useAuth, useClaim, useCreateCustomGame, useCreateGame, useDubs, useDubsTheme, useEvents, useGame, useGames, useJoinGame, useNetworkGames };
|