@dubsdotapp/expo 0.2.27 → 0.2.28

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
@@ -562,16 +562,6 @@ interface MwaAdapterConfig {
562
562
  /**
563
563
  * Mobile Wallet Adapter implementation.
564
564
  * Wraps @solana-mobile/mobile-wallet-adapter-protocol-web3js.
565
- *
566
- * Usage:
567
- * ```ts
568
- * import { transact } from '@solana-mobile/mobile-wallet-adapter-protocol-web3js';
569
- *
570
- * const adapter = new MwaWalletAdapter({
571
- * transact,
572
- * appIdentity: { name: 'My App' },
573
- * });
574
- * ```
575
565
  */
576
566
  declare class MwaWalletAdapter implements WalletAdapter {
577
567
  private _publicKey;
@@ -588,6 +578,8 @@ declare class MwaWalletAdapter implements WalletAdapter {
588
578
  setAuthToken(token: string | null): void;
589
579
  /**
590
580
  * Connect to a mobile wallet. Call this before any signing.
581
+ * Tries reauthorize first (if we have a saved token), then falls back to
582
+ * a fresh authorize in a SEPARATE transact session.
591
583
  */
592
584
  connect(): Promise<void>;
593
585
  /**
@@ -597,6 +589,7 @@ declare class MwaWalletAdapter implements WalletAdapter {
597
589
  signTransaction(transaction: Transaction): Promise<Transaction>;
598
590
  signMessage(message: Uint8Array): Promise<Uint8Array>;
599
591
  signAndSendTransaction(transaction: Transaction): Promise<string>;
592
+ private applyAuthResult;
600
593
  }
601
594
 
602
595
  /** Serializable session state — save this to restore without a deeplink round-trip. */
package/dist/index.d.ts CHANGED
@@ -562,16 +562,6 @@ interface MwaAdapterConfig {
562
562
  /**
563
563
  * Mobile Wallet Adapter implementation.
564
564
  * Wraps @solana-mobile/mobile-wallet-adapter-protocol-web3js.
565
- *
566
- * Usage:
567
- * ```ts
568
- * import { transact } from '@solana-mobile/mobile-wallet-adapter-protocol-web3js';
569
- *
570
- * const adapter = new MwaWalletAdapter({
571
- * transact,
572
- * appIdentity: { name: 'My App' },
573
- * });
574
- * ```
575
565
  */
576
566
  declare class MwaWalletAdapter implements WalletAdapter {
577
567
  private _publicKey;
@@ -588,6 +578,8 @@ declare class MwaWalletAdapter implements WalletAdapter {
588
578
  setAuthToken(token: string | null): void;
589
579
  /**
590
580
  * Connect to a mobile wallet. Call this before any signing.
581
+ * Tries reauthorize first (if we have a saved token), then falls back to
582
+ * a fresh authorize in a SEPARATE transact session.
591
583
  */
592
584
  connect(): Promise<void>;
593
585
  /**
@@ -597,6 +589,7 @@ declare class MwaWalletAdapter implements WalletAdapter {
597
589
  signTransaction(transaction: Transaction): Promise<Transaction>;
598
590
  signMessage(message: Uint8Array): Promise<Uint8Array>;
599
591
  signAndSendTransaction(transaction: Transaction): Promise<string>;
592
+ private applyAuthResult;
600
593
  }
601
594
 
602
595
  /** Serializable session state — save this to restore without a deeplink round-trip. */
package/dist/index.js CHANGED
@@ -596,32 +596,29 @@ var MwaWalletAdapter = class {
596
596
  }
597
597
  /**
598
598
  * Connect to a mobile wallet. Call this before any signing.
599
+ * Tries reauthorize first (if we have a saved token), then falls back to
600
+ * a fresh authorize in a SEPARATE transact session.
599
601
  */
600
602
  async connect() {
601
- await this.transact(async (wallet) => {
602
- let authResult;
603
- if (this._authToken) {
604
- try {
605
- authResult = await wallet.reauthorize({ auth_token: this._authToken });
606
- } catch {
607
- console.log("[Dubs:MWA] reauthorize failed, falling back to authorize");
608
- this._authToken = null;
609
- authResult = await wallet.authorize({
610
- identity: this.config.appIdentity,
611
- cluster: this.config.cluster || "mainnet-beta"
612
- });
613
- }
614
- } else {
615
- authResult = await wallet.authorize({
616
- identity: this.config.appIdentity,
617
- cluster: this.config.cluster || "mainnet-beta"
603
+ if (this._authToken) {
604
+ try {
605
+ await this.transact(async (wallet) => {
606
+ const authResult = await wallet.reauthorize({ auth_token: this._authToken });
607
+ this.applyAuthResult(authResult);
618
608
  });
609
+ return;
610
+ } catch {
611
+ console.log("[Dubs:MWA] reauthorize failed, clearing token and doing fresh authorize");
612
+ this._authToken = null;
613
+ this.config.onAuthTokenChange?.(null);
619
614
  }
620
- this._mwaAddress = authResult.accounts[0].address;
621
- this._publicKey = toPublicKey(this._mwaAddress);
622
- this._authToken = authResult.auth_token;
623
- this._connected = true;
624
- this.config.onAuthTokenChange?.(this._authToken);
615
+ }
616
+ await this.transact(async (wallet) => {
617
+ const authResult = await wallet.authorize({
618
+ identity: this.config.appIdentity,
619
+ cluster: this.config.cluster || "mainnet-beta"
620
+ });
621
+ this.applyAuthResult(authResult);
625
622
  });
626
623
  }
627
624
  /**
@@ -638,8 +635,7 @@ var MwaWalletAdapter = class {
638
635
  if (!this._connected) throw new Error("Wallet not connected");
639
636
  const signed = await this.transact(async (wallet) => {
640
637
  const reauth = await wallet.reauthorize({ auth_token: this._authToken });
641
- this._authToken = reauth.auth_token;
642
- this.config.onAuthTokenChange?.(this._authToken);
638
+ this.applyAuthResult(reauth);
643
639
  const result = await wallet.signTransactions({
644
640
  transactions: [transaction]
645
641
  });
@@ -651,9 +647,7 @@ var MwaWalletAdapter = class {
651
647
  if (!this._connected || !this._publicKey) throw new Error("Wallet not connected");
652
648
  const sig = await this.transact(async (wallet) => {
653
649
  const reauth = await wallet.reauthorize({ auth_token: this._authToken });
654
- this._authToken = reauth.auth_token;
655
- this._mwaAddress = reauth.accounts[0].address;
656
- this.config.onAuthTokenChange?.(this._authToken);
650
+ this.applyAuthResult(reauth);
657
651
  const result = await wallet.signMessages({
658
652
  addresses: [reauth.accounts[0].address],
659
653
  payloads: [message]
@@ -666,8 +660,7 @@ var MwaWalletAdapter = class {
666
660
  if (!this._connected) throw new Error("Wallet not connected");
667
661
  const signature = await this.transact(async (wallet) => {
668
662
  const reauth = await wallet.reauthorize({ auth_token: this._authToken });
669
- this._authToken = reauth.auth_token;
670
- this.config.onAuthTokenChange?.(this._authToken);
663
+ this.applyAuthResult(reauth);
671
664
  const result = await wallet.signAndSendTransactions({
672
665
  transactions: [transaction]
673
666
  });
@@ -678,6 +671,13 @@ var MwaWalletAdapter = class {
678
671
  }
679
672
  return String(signature);
680
673
  }
674
+ applyAuthResult(authResult) {
675
+ this._mwaAddress = authResult.accounts[0].address;
676
+ this._publicKey = toPublicKey(this._mwaAddress);
677
+ this._authToken = authResult.auth_token;
678
+ this._connected = true;
679
+ this.config.onAuthTokenChange?.(this._authToken);
680
+ }
681
681
  };
682
682
 
683
683
  // src/wallet/phantom-deeplink/phantom-deeplink-adapter.ts
@@ -1379,7 +1379,7 @@ function ManagedWalletProvider({
1379
1379
  }
1380
1380
  return transactRef.current(...args);
1381
1381
  },
1382
- appIdentity: { name: appName },
1382
+ appIdentity: { name: appName, uri: appUrl },
1383
1383
  cluster,
1384
1384
  onAuthTokenChange: (token) => {
1385
1385
  if (token) {