@dubsdotapp/expo 0.2.9 → 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 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.
@@ -438,12 +439,6 @@ interface WalletAdapter {
438
439
  connect?(): Promise<void>;
439
440
  /** Optional: Disconnect the wallet */
440
441
  disconnect?(): void | Promise<void>;
441
- /**
442
- * Optional: Connect and sign a message in one step.
443
- * For MWA wallets, this runs authorize + signMessage in a single transact() session
444
- * (avoids the double-open problem with Phantom on regular Android).
445
- */
446
- connectAndSignMessage?(message: Uint8Array): Promise<Uint8Array>;
447
442
  }
448
443
 
449
444
  interface RegistrationScreenProps {
@@ -515,8 +510,12 @@ interface DubsProviderProps {
515
510
  renderRegistration?: (props: RegistrationScreenProps) => React$1.ReactNode;
516
511
  /** Set to false to skip AuthGate and connect screen (headless/BYOA mode). Default: true. */
517
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;
518
517
  }
519
- 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;
520
519
  declare function useDubs(): DubsContextValue;
521
520
  declare function useAppConfig(): UiConfig;
522
521
 
@@ -568,13 +567,68 @@ declare class MwaWalletAdapter implements WalletAdapter {
568
567
  disconnect(): void;
569
568
  signTransaction(transaction: Transaction): Promise<Transaction>;
570
569
  signMessage(message: Uint8Array): Promise<Uint8Array>;
570
+ signAndSendTransaction(transaction: Transaction): Promise<string>;
571
+ }
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;
571
617
  /**
572
- * Connect (authorize) and sign a message in a single MWA transact() session.
573
- * This avoids the double-open problem with Phantom on regular Android where
574
- * two rapid transact() calls cause the second one to be auto-declined.
618
+ * Restore a previously saved session without opening Phantom.
619
+ * Call this before connect() if you have persisted session state.
575
620
  */
576
- connectAndSignMessage(message: Uint8Array): Promise<Uint8Array>;
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>;
577
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;
578
632
  }
579
633
 
580
634
  declare function useEvents(params?: GetUpcomingEventsParams): QueryResult<{
@@ -813,4 +867,4 @@ declare function CreateCustomGameSheet({ visible, onDismiss, title, maxPlayers,
813
867
  */
814
868
  declare function signAndSendBase64Transaction(base64Tx: string, wallet: WalletAdapter): Promise<string>;
815
869
 
816
- 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.
@@ -438,12 +439,6 @@ interface WalletAdapter {
438
439
  connect?(): Promise<void>;
439
440
  /** Optional: Disconnect the wallet */
440
441
  disconnect?(): void | Promise<void>;
441
- /**
442
- * Optional: Connect and sign a message in one step.
443
- * For MWA wallets, this runs authorize + signMessage in a single transact() session
444
- * (avoids the double-open problem with Phantom on regular Android).
445
- */
446
- connectAndSignMessage?(message: Uint8Array): Promise<Uint8Array>;
447
442
  }
448
443
 
449
444
  interface RegistrationScreenProps {
@@ -515,8 +510,12 @@ interface DubsProviderProps {
515
510
  renderRegistration?: (props: RegistrationScreenProps) => React$1.ReactNode;
516
511
  /** Set to false to skip AuthGate and connect screen (headless/BYOA mode). Default: true. */
517
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;
518
517
  }
519
- 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;
520
519
  declare function useDubs(): DubsContextValue;
521
520
  declare function useAppConfig(): UiConfig;
522
521
 
@@ -568,13 +567,68 @@ declare class MwaWalletAdapter implements WalletAdapter {
568
567
  disconnect(): void;
569
568
  signTransaction(transaction: Transaction): Promise<Transaction>;
570
569
  signMessage(message: Uint8Array): Promise<Uint8Array>;
570
+ signAndSendTransaction(transaction: Transaction): Promise<string>;
571
+ }
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;
571
617
  /**
572
- * Connect (authorize) and sign a message in a single MWA transact() session.
573
- * This avoids the double-open problem with Phantom on regular Android where
574
- * two rapid transact() calls cause the second one to be auto-declined.
618
+ * Restore a previously saved session without opening Phantom.
619
+ * Call this before connect() if you have persisted session state.
575
620
  */
576
- connectAndSignMessage(message: Uint8Array): Promise<Uint8Array>;
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>;
577
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;
578
632
  }
579
633
 
580
634
  declare function useEvents(params?: GetUpcomingEventsParams): QueryResult<{
@@ -813,4 +867,4 @@ declare function CreateCustomGameSheet({ visible, onDismiss, title, maxPlayers,
813
867
  */
814
868
  declare function signAndSendBase64Transaction(base64Tx: string, wallet: WalletAdapter): Promise<string>;
815
869
 
816
- 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 };