@satoshai/kit 1.0.2 → 1.0.3

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.cts CHANGED
@@ -656,6 +656,11 @@ declare const useBnsName: (address?: string) => {
656
656
  * (install link), and whether it's `available` (extension detected or
657
657
  * WalletConnect configured).
658
658
  *
659
+ * Performs a fresh check of `window` globals on every render so that
660
+ * browser extensions injected after React hydration are detected by the
661
+ * time the consumer reads the wallet list (e.g. when a connect-wallet
662
+ * drawer opens).
663
+ *
659
664
  * @example
660
665
  * ```ts
661
666
  * const { wallets } = useWallets();
@@ -668,7 +673,13 @@ declare const useBnsName: (address?: string) => {
668
673
  * ```
669
674
  */
670
675
  declare const useWallets: () => {
671
- wallets: WalletInfo[];
676
+ wallets: {
677
+ available: boolean;
678
+ id: SupportedStacksWallet;
679
+ name: string;
680
+ icon: string;
681
+ webUrl: string;
682
+ }[];
672
683
  };
673
684
 
674
685
  /**
package/dist/index.d.ts CHANGED
@@ -656,6 +656,11 @@ declare const useBnsName: (address?: string) => {
656
656
  * (install link), and whether it's `available` (extension detected or
657
657
  * WalletConnect configured).
658
658
  *
659
+ * Performs a fresh check of `window` globals on every render so that
660
+ * browser extensions injected after React hydration are detected by the
661
+ * time the consumer reads the wallet list (e.g. when a connect-wallet
662
+ * drawer opens).
663
+ *
659
664
  * @example
660
665
  * ```ts
661
666
  * const { wallets } = useWallets();
@@ -668,7 +673,13 @@ declare const useBnsName: (address?: string) => {
668
673
  * ```
669
674
  */
670
675
  declare const useWallets: () => {
671
- wallets: WalletInfo[];
676
+ wallets: {
677
+ available: boolean;
678
+ id: SupportedStacksWallet;
679
+ name: string;
680
+ icon: string;
681
+ webUrl: string;
682
+ }[];
672
683
  };
673
684
 
674
685
  /**
package/dist/index.js CHANGED
@@ -708,15 +708,7 @@ var StacksWalletProvider = ({
708
708
  onAddressChange: handleAddressChange,
709
709
  onDisconnect: handleWcDisconnect
710
710
  });
711
- const [installed, setInstalled] = useState(
712
- () => getStacksWallets().installed
713
- );
714
- useEffect(() => {
715
- const fresh = getStacksWallets().installed;
716
- setInstalled(
717
- (prev) => fresh.join(",") === prev.join(",") ? prev : fresh
718
- );
719
- }, []);
711
+ const { installed } = getStacksWallets();
720
712
  const configured = wallets ?? [...SUPPORTED_STACKS_WALLETS];
721
713
  const walletInfos = configured.map((w) => ({
722
714
  id: w,
@@ -1481,7 +1473,20 @@ var useBnsName = (address) => {
1481
1473
  };
1482
1474
  var useWallets = () => {
1483
1475
  const { wallets } = useStacksWalletContext();
1484
- return useMemo(() => ({ wallets }), [wallets]);
1476
+ const { installed } = getStacksWallets();
1477
+ const installedKey = installed.join(",");
1478
+ return useMemo(
1479
+ () => ({
1480
+ wallets: wallets.map((w) => ({
1481
+ ...w,
1482
+ // wallet-connect availability is controlled by projectId in
1483
+ // the provider — don't override with getStacksWallets() which
1484
+ // unconditionally returns true for it.
1485
+ available: w.id === "wallet-connect" ? w.available : w.available || installed.includes(w.id)
1486
+ }))
1487
+ }),
1488
+ [wallets, installedKey]
1489
+ );
1485
1490
  };
1486
1491
 
1487
1492
  // src/utils/create-contract-config.ts