@dubsdotapp/expo 0.2.18 → 0.2.20

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
@@ -625,7 +625,6 @@ declare class PhantomDeeplinkAdapter implements WalletAdapter {
625
625
  connect(): Promise<void>;
626
626
  disconnect(): void;
627
627
  signTransaction(transaction: Transaction): Promise<Transaction>;
628
- signAndSendTransaction(transaction: Transaction): Promise<string>;
629
628
  signMessage(message: Uint8Array): Promise<Uint8Array>;
630
629
  /** Remove the Linking event listener. Call when the adapter is no longer needed. */
631
630
  destroy(): void;
@@ -864,8 +863,10 @@ declare function CreateCustomGameSheet({ visible, onDismiss, title, maxPlayers,
864
863
 
865
864
  /**
866
865
  * Deserialize a base64-encoded transaction, sign via wallet adapter, send to Solana.
866
+ * Prefers signAndSendTransaction if available (MWA), otherwise falls back to
867
+ * signTransaction + sendRawTransaction via RPC (Phantom deeplinks).
867
868
  * Returns the transaction signature.
868
869
  */
869
- declare function signAndSendBase64Transaction(base64Tx: string, wallet: WalletAdapter): Promise<string>;
870
+ declare function signAndSendBase64Transaction(base64Tx: string, wallet: WalletAdapter, connection: Connection): Promise<string>;
870
871
 
871
872
  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
@@ -625,7 +625,6 @@ declare class PhantomDeeplinkAdapter implements WalletAdapter {
625
625
  connect(): Promise<void>;
626
626
  disconnect(): void;
627
627
  signTransaction(transaction: Transaction): Promise<Transaction>;
628
- signAndSendTransaction(transaction: Transaction): Promise<string>;
629
628
  signMessage(message: Uint8Array): Promise<Uint8Array>;
630
629
  /** Remove the Linking event listener. Call when the adapter is no longer needed. */
631
630
  destroy(): void;
@@ -864,8 +863,10 @@ declare function CreateCustomGameSheet({ visible, onDismiss, title, maxPlayers,
864
863
 
865
864
  /**
866
865
  * Deserialize a base64-encoded transaction, sign via wallet adapter, send to Solana.
866
+ * Prefers signAndSendTransaction if available (MWA), otherwise falls back to
867
+ * signTransaction + sendRawTransaction via RPC (Phantom deeplinks).
867
868
  * Returns the transaction signature.
868
869
  */
869
- declare function signAndSendBase64Transaction(base64Tx: string, wallet: WalletAdapter): Promise<string>;
870
+ declare function signAndSendBase64Transaction(base64Tx: string, wallet: WalletAdapter, connection: Connection): Promise<string>;
870
871
 
871
872
  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.js CHANGED
@@ -895,7 +895,8 @@ var PhantomDeeplinkAdapter = class {
895
895
  console.log(TAG2, "Using app_url:", appUrl);
896
896
  const params = new URLSearchParams({
897
897
  dapp_encryption_public_key: dappPubBase58,
898
- cluster: this.config.cluster || "mainnet-beta",
898
+ // Force mainnet-beta for deeplink session — devnet sessions cause -32603 on signMessage
899
+ cluster: "mainnet-beta",
899
900
  redirect_link: redirectLink,
900
901
  app_url: appUrl
901
902
  });
@@ -970,38 +971,6 @@ var PhantomDeeplinkAdapter = class {
970
971
  console.log(TAG2, "Decrypted signed transaction, length:", data.transaction?.length);
971
972
  return import_web32.Transaction.from(import_bs582.default.decode(data.transaction));
972
973
  }
973
- async signAndSendTransaction(transaction) {
974
- this.assertConnected();
975
- console.log(TAG2, "signAndSendTransaction() \u2014 serializing transaction");
976
- const serializedTx = import_bs582.default.encode(
977
- transaction.serialize({ requireAllSignatures: false, verifySignatures: false })
978
- );
979
- console.log(TAG2, "Transaction serialized, length:", serializedTx.length);
980
- const { nonce, ciphertext } = encryptPayload(
981
- { transaction: serializedTx, session: this._sessionToken },
982
- this._sharedSecret
983
- );
984
- const requestId = nextRequestId();
985
- const redirectLink = this.config.redirectUri;
986
- console.log(TAG2, `signAndSendTransaction() requestId=${requestId}`);
987
- const params = new URLSearchParams({
988
- dapp_encryption_public_key: import_bs582.default.encode(this._dappKeyPair.publicKey),
989
- nonce,
990
- payload: ciphertext,
991
- redirect_link: redirectLink
992
- });
993
- const url = `https://phantom.app/ul/v1/signAndSendTransaction?${params.toString()}`;
994
- console.log(TAG2, "Opening Phantom signAndSendTransaction deeplink...");
995
- const response = await this.handler.send(url, requestId, this.timeout);
996
- console.log(TAG2, "Received signAndSendTransaction response");
997
- const data = decryptPayload(
998
- response.params.data,
999
- response.params.nonce,
1000
- this._sharedSecret
1001
- );
1002
- console.log(TAG2, "Transaction sent! Signature:", data.signature);
1003
- return data.signature;
1004
- }
1005
974
  async signMessage(message) {
1006
975
  this.assertConnected();
1007
976
  console.log(TAG2, "signMessage() \u2014 message length:", message.length);
@@ -1326,12 +1295,23 @@ function ManagedWalletProvider({
1326
1295
  }
1327
1296
  return;
1328
1297
  }
1329
- console.log(TAG3, "Phantom path \u2014 clearing any saved session, will require fresh connect");
1330
- await storage.deleteItem(STORAGE_KEYS.PHANTOM_SESSION).catch(() => {
1331
- });
1332
1298
  try {
1299
+ const savedSession = await storage.getItem(STORAGE_KEYS.PHANTOM_SESSION);
1300
+ if (savedSession && !cancelled) {
1301
+ const session = JSON.parse(savedSession);
1302
+ console.log(TAG3, "Found saved Phantom session, restoring for wallet:", session.walletPublicKey);
1303
+ phantom.restoreSession(session);
1304
+ if (!cancelled) {
1305
+ console.log(TAG3, "Phantom reconnected from saved session");
1306
+ setConnected(true);
1307
+ }
1308
+ } else {
1309
+ console.log(TAG3, "No saved Phantom session");
1310
+ }
1333
1311
  } catch (err) {
1334
- console.log(TAG3, "Unexpected error during Phantom init:", err instanceof Error ? err.message : err);
1312
+ console.log(TAG3, "Phantom session restore failed:", err instanceof Error ? err.message : err);
1313
+ await storage.deleteItem(STORAGE_KEYS.PHANTOM_SESSION).catch(() => {
1314
+ });
1335
1315
  } finally {
1336
1316
  if (!cancelled) {
1337
1317
  console.log(TAG3, "Phantom init complete, marking ready");
@@ -1548,7 +1528,7 @@ var import_react6 = require("react");
1548
1528
 
1549
1529
  // src/utils/transaction.ts
1550
1530
  var import_web33 = require("@solana/web3.js");
1551
- async function signAndSendBase64Transaction(base64Tx, wallet) {
1531
+ async function signAndSendBase64Transaction(base64Tx, wallet, connection) {
1552
1532
  if (!wallet.publicKey) throw new Error("Wallet not connected");
1553
1533
  const binaryStr = atob(base64Tx);
1554
1534
  const bytes = new Uint8Array(binaryStr.length);
@@ -1559,12 +1539,14 @@ async function signAndSendBase64Transaction(base64Tx, wallet) {
1559
1539
  if (wallet.signAndSendTransaction) {
1560
1540
  return wallet.signAndSendTransaction(transaction);
1561
1541
  }
1562
- throw new Error("Wallet does not support signAndSendTransaction");
1542
+ const signed = await wallet.signTransaction(transaction);
1543
+ const signature = await connection.sendRawTransaction(signed.serialize());
1544
+ return signature;
1563
1545
  }
1564
1546
 
1565
1547
  // src/hooks/useCreateGame.ts
1566
1548
  function useCreateGame() {
1567
- const { client, wallet } = useDubs();
1549
+ const { client, wallet, connection } = useDubs();
1568
1550
  const [status, setStatus] = (0, import_react6.useState)("idle");
1569
1551
  const [error, setError] = (0, import_react6.useState)(null);
1570
1552
  const [data, setData] = (0, import_react6.useState)(null);
@@ -1585,7 +1567,8 @@ function useCreateGame() {
1585
1567
  console.log("[useCreateGame] Step 2: Signing and sending...");
1586
1568
  const signature = await signAndSendBase64Transaction(
1587
1569
  createResult.transaction,
1588
- wallet
1570
+ wallet,
1571
+ connection
1589
1572
  );
1590
1573
  console.log("[useCreateGame] Step 2 done. Signature:", signature);
1591
1574
  setStatus("confirming");
@@ -1625,7 +1608,7 @@ function useCreateGame() {
1625
1608
  // src/hooks/useJoinGame.ts
1626
1609
  var import_react7 = require("react");
1627
1610
  function useJoinGame() {
1628
- const { client, wallet } = useDubs();
1611
+ const { client, wallet, connection } = useDubs();
1629
1612
  const [status, setStatus] = (0, import_react7.useState)("idle");
1630
1613
  const [error, setError] = (0, import_react7.useState)(null);
1631
1614
  const [data, setData] = (0, import_react7.useState)(null);
@@ -1646,7 +1629,8 @@ function useJoinGame() {
1646
1629
  console.log("[useJoinGame] Step 2: Signing and sending transaction...");
1647
1630
  const signature = await signAndSendBase64Transaction(
1648
1631
  joinResult.transaction,
1649
- wallet
1632
+ wallet,
1633
+ connection
1650
1634
  );
1651
1635
  console.log("[useJoinGame] Step 2 done. Signature:", signature);
1652
1636
  setStatus("confirming");
@@ -1687,7 +1671,7 @@ function useJoinGame() {
1687
1671
  // src/hooks/useClaim.ts
1688
1672
  var import_react8 = require("react");
1689
1673
  function useClaim() {
1690
- const { client, wallet } = useDubs();
1674
+ const { client, wallet, connection } = useDubs();
1691
1675
  const [status, setStatus] = (0, import_react8.useState)("idle");
1692
1676
  const [error, setError] = (0, import_react8.useState)(null);
1693
1677
  const [data, setData] = (0, import_react8.useState)(null);
@@ -1708,7 +1692,8 @@ function useClaim() {
1708
1692
  console.log("[useClaim] Step 2: Signing and sending...");
1709
1693
  const signature = await signAndSendBase64Transaction(
1710
1694
  claimResult.transaction,
1711
- wallet
1695
+ wallet,
1696
+ connection
1712
1697
  );
1713
1698
  console.log("[useClaim] Step 2 done. Signature:", signature);
1714
1699
  const explorerUrl = `https://solscan.io/tx/${signature}`;
@@ -1735,7 +1720,7 @@ function useClaim() {
1735
1720
  // src/hooks/useCreateCustomGame.ts
1736
1721
  var import_react9 = require("react");
1737
1722
  function useCreateCustomGame() {
1738
- const { client, wallet } = useDubs();
1723
+ const { client, wallet, connection } = useDubs();
1739
1724
  const [status, setStatus] = (0, import_react9.useState)("idle");
1740
1725
  const [error, setError] = (0, import_react9.useState)(null);
1741
1726
  const [data, setData] = (0, import_react9.useState)(null);
@@ -1756,7 +1741,8 @@ function useCreateCustomGame() {
1756
1741
  console.log("[useCreateCustomGame] Step 2: Signing and sending...");
1757
1742
  const signature = await signAndSendBase64Transaction(
1758
1743
  createResult.transaction,
1759
- wallet
1744
+ wallet,
1745
+ connection
1760
1746
  );
1761
1747
  console.log("[useCreateCustomGame] Step 2 done. Signature:", signature);
1762
1748
  setStatus("confirming");