Detecting Other Wallets
Use these recipes for detecting other wallets (like browser extension wallets) installed in your users' browsers, and adjust the "Connect Wallet" button logic accordingly.
Ethereum
Via window.ethereum
function hasBrowserExtensionWallet() {
const provider = window.ethereum;
return provider && !provider.isPasskeys;
}
Via Multi Injected Provider Discovery (EIP-6963)
Using mipd (opens in a new tab) utilities:
import { createStore } from 'mipd';
import { useSyncExternalStore } from 'react';
const store = createStore();
function useProviders() {
return useSyncExternalStore(store.subscribe, store.getProviders);
}
function useHasBrowserExtensionWallet() {
const providers = useProviders();
return providers.some(
(provider) => provider.info.rdns !== 'network.passkeys',
);
}
Via Wagmi
import { useConnect } from 'wagmi';
function useHasBrowserExtensionWallet() {
const { connectors } = useConnect();
return connectors.some((connector) => connector.id !== 'network.passkeys');
}
Solana
Via window.solana
function hasBrowserExtensionWallet() {
const provider = window.solana;
return provider && !provider.isPasskeys;
}
Bitcoin
Via window.BitcoinProvider
function hasBrowserExtensionWallet() {
const provider = window.BitcoinProvider;
return provider && !provider.isPasskeys;
}