@dubsdotapp/expo 0.2.7 → 0.2.9

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
@@ -438,6 +438,12 @@ interface WalletAdapter {
438
438
  connect?(): Promise<void>;
439
439
  /** Optional: Disconnect the wallet */
440
440
  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>;
441
447
  }
442
448
 
443
449
  interface RegistrationScreenProps {
@@ -562,6 +568,12 @@ declare class MwaWalletAdapter implements WalletAdapter {
562
568
  disconnect(): void;
563
569
  signTransaction(transaction: Transaction): Promise<Transaction>;
564
570
  signMessage(message: Uint8Array): Promise<Uint8Array>;
571
+ /**
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.
575
+ */
576
+ connectAndSignMessage(message: Uint8Array): Promise<Uint8Array>;
565
577
  signAndSendTransaction(transaction: Transaction): Promise<string>;
566
578
  }
567
579
 
@@ -625,6 +637,7 @@ interface CreateCustomGameMutationResult {
625
637
  gameAddress: string;
626
638
  signature: string;
627
639
  explorerUrl: string;
640
+ buyIn: number;
628
641
  }
629
642
  declare function useCreateCustomGame(): {
630
643
  execute: (params: CreateCustomGameParams) => Promise<CreateCustomGameMutationResult>;
@@ -788,10 +801,11 @@ interface CreateCustomGameSheetProps {
788
801
  presetAmounts?: number[];
789
802
  defaultAmount?: number;
790
803
  metadata?: Record<string, unknown>;
804
+ onAmountChange?: (amount: number | null) => void;
791
805
  onSuccess?: (result: CreateCustomGameMutationResult) => void;
792
806
  onError?: (error: Error) => void;
793
807
  }
794
- declare function CreateCustomGameSheet({ visible, onDismiss, title, maxPlayers, fee, presetAmounts, defaultAmount, metadata, onSuccess, onError, }: CreateCustomGameSheetProps): react_jsx_runtime.JSX.Element;
808
+ declare function CreateCustomGameSheet({ visible, onDismiss, title, maxPlayers, fee, presetAmounts, defaultAmount, metadata, onAmountChange, onSuccess, onError, }: CreateCustomGameSheetProps): react_jsx_runtime.JSX.Element;
795
809
 
796
810
  /**
797
811
  * Deserialize a base64-encoded transaction, sign via wallet adapter, send to Solana.
package/dist/index.d.ts CHANGED
@@ -438,6 +438,12 @@ interface WalletAdapter {
438
438
  connect?(): Promise<void>;
439
439
  /** Optional: Disconnect the wallet */
440
440
  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>;
441
447
  }
442
448
 
443
449
  interface RegistrationScreenProps {
@@ -562,6 +568,12 @@ declare class MwaWalletAdapter implements WalletAdapter {
562
568
  disconnect(): void;
563
569
  signTransaction(transaction: Transaction): Promise<Transaction>;
564
570
  signMessage(message: Uint8Array): Promise<Uint8Array>;
571
+ /**
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.
575
+ */
576
+ connectAndSignMessage(message: Uint8Array): Promise<Uint8Array>;
565
577
  signAndSendTransaction(transaction: Transaction): Promise<string>;
566
578
  }
567
579
 
@@ -625,6 +637,7 @@ interface CreateCustomGameMutationResult {
625
637
  gameAddress: string;
626
638
  signature: string;
627
639
  explorerUrl: string;
640
+ buyIn: number;
628
641
  }
629
642
  declare function useCreateCustomGame(): {
630
643
  execute: (params: CreateCustomGameParams) => Promise<CreateCustomGameMutationResult>;
@@ -788,10 +801,11 @@ interface CreateCustomGameSheetProps {
788
801
  presetAmounts?: number[];
789
802
  defaultAmount?: number;
790
803
  metadata?: Record<string, unknown>;
804
+ onAmountChange?: (amount: number | null) => void;
791
805
  onSuccess?: (result: CreateCustomGameMutationResult) => void;
792
806
  onError?: (error: Error) => void;
793
807
  }
794
- declare function CreateCustomGameSheet({ visible, onDismiss, title, maxPlayers, fee, presetAmounts, defaultAmount, metadata, onSuccess, onError, }: CreateCustomGameSheetProps): react_jsx_runtime.JSX.Element;
808
+ declare function CreateCustomGameSheet({ visible, onDismiss, title, maxPlayers, fee, presetAmounts, defaultAmount, metadata, onAmountChange, onSuccess, onError, }: CreateCustomGameSheetProps): react_jsx_runtime.JSX.Element;
795
809
 
796
810
  /**
797
811
  * Deserialize a base64-encoded transaction, sign via wallet adapter, send to Solana.
package/dist/index.js CHANGED
@@ -637,6 +637,29 @@ var MwaWalletAdapter = class {
637
637
  });
638
638
  return sig instanceof Uint8Array ? sig : new Uint8Array(sig);
639
639
  }
640
+ /**
641
+ * Connect (authorize) and sign a message in a single MWA transact() session.
642
+ * This avoids the double-open problem with Phantom on regular Android where
643
+ * two rapid transact() calls cause the second one to be auto-declined.
644
+ */
645
+ async connectAndSignMessage(message) {
646
+ const sig = await this.transact(async (wallet) => {
647
+ const authResult = this._authToken ? await wallet.reauthorize({ auth_token: this._authToken }) : await wallet.authorize({
648
+ identity: this.config.appIdentity,
649
+ cluster: this.config.cluster || "mainnet-beta"
650
+ });
651
+ this._publicKey = toPublicKey(authResult.accounts[0].address);
652
+ this._authToken = authResult.auth_token;
653
+ this._connected = true;
654
+ this.config.onAuthTokenChange?.(this._authToken);
655
+ const result = await wallet.signMessages({
656
+ addresses: [this._publicKey.toBytes()],
657
+ payloads: [message]
658
+ });
659
+ return result[0];
660
+ });
661
+ return sig instanceof Uint8Array ? sig : new Uint8Array(sig);
662
+ }
640
663
  async signAndSendTransaction(transaction) {
641
664
  if (!this._connected) throw new Error("Wallet not connected");
642
665
  const signature = await this.transact(async (wallet) => {
@@ -1279,7 +1302,8 @@ function useCreateCustomGame() {
1279
1302
  gameId: createResult.gameId,
1280
1303
  gameAddress: createResult.gameAddress,
1281
1304
  signature,
1282
- explorerUrl
1305
+ explorerUrl,
1306
+ buyIn: params.wagerAmount
1283
1307
  };
1284
1308
  setData(result);
1285
1309
  setStatus("success");
@@ -1326,16 +1350,23 @@ function useAuth() {
1326
1350
  if (!wallet.publicKey) {
1327
1351
  throw new Error("Wallet not connected");
1328
1352
  }
1329
- if (!wallet.signMessage) {
1353
+ if (!wallet.signMessage && !wallet.connectAndSignMessage) {
1330
1354
  throw new Error("Wallet does not support signMessage");
1331
1355
  }
1332
- const walletAddress = wallet.publicKey.toBase58();
1333
1356
  setStatus("authenticating");
1334
1357
  setError(null);
1358
+ const walletAddress = wallet.publicKey.toBase58();
1335
1359
  const { nonce, message } = await client.getNonce(walletAddress);
1336
1360
  setStatus("signing");
1337
1361
  const messageBytes = new TextEncoder().encode(message);
1338
- const signatureBytes = await wallet.signMessage(messageBytes);
1362
+ let signatureBytes;
1363
+ if (wallet.connectAndSignMessage) {
1364
+ signatureBytes = await wallet.connectAndSignMessage(messageBytes);
1365
+ } else if (wallet.signMessage) {
1366
+ signatureBytes = await wallet.signMessage(messageBytes);
1367
+ } else {
1368
+ throw new Error("Wallet does not support signMessage");
1369
+ }
1339
1370
  const signature = import_bs58.default.encode(signatureBytes);
1340
1371
  setStatus("verifying");
1341
1372
  const result = await client.authenticate({ walletAddress, signature, nonce });
@@ -2807,6 +2838,7 @@ function CreateCustomGameSheet({
2807
2838
  presetAmounts = [0.01, 0.1, 0.5, 1],
2808
2839
  defaultAmount = 0.01,
2809
2840
  metadata,
2841
+ onAmountChange,
2810
2842
  onSuccess,
2811
2843
  onError
2812
2844
  }) {
@@ -2850,17 +2882,21 @@ function CreateCustomGameSheet({
2850
2882
  setSelectedAmount(amount);
2851
2883
  setIsCustom(false);
2852
2884
  setCustomAmount("");
2853
- }, []);
2885
+ onAmountChange?.(amount);
2886
+ }, [onAmountChange]);
2854
2887
  const handleCustomSelect = (0, import_react20.useCallback)(() => {
2855
2888
  setIsCustom(true);
2856
2889
  setSelectedAmount(null);
2857
- }, []);
2890
+ onAmountChange?.(null);
2891
+ }, [onAmountChange]);
2858
2892
  const handleCustomAmountChange = (0, import_react20.useCallback)((text) => {
2859
2893
  const cleaned = text.replace(/[^0-9.]/g, "").replace(/(\..*?)\..*/g, "$1");
2860
2894
  setCustomAmount(cleaned);
2861
2895
  const parsed = parseFloat(cleaned);
2862
- setSelectedAmount(parsed > 0 ? parsed : null);
2863
- }, []);
2896
+ const amount = parsed > 0 ? parsed : null;
2897
+ setSelectedAmount(amount);
2898
+ onAmountChange?.(amount);
2899
+ }, [onAmountChange]);
2864
2900
  const effectiveAmount = selectedAmount;
2865
2901
  const playerCount = maxPlayers || 2;
2866
2902
  const pot = effectiveAmount ? effectiveAmount * playerCount : 0;