Repository navigation
Replies: 1 comment
|
Hi @qingywen, to exclude a specific wallet like Phantom, you need to use a Custom Wallet List instead of relying on default configurations or auto-discovery. Here are the two ways to handle this depending on how your dApp is set up: Solution 1: Define an Explicit Custom Wallet List (Recommended) import { connectorsForWallets } from '@rainbow-me/rainbowkit';
import {
metaMaskWallet,
rainbowWallet,
coinbaseWallet,
walletConnectWallet,
} from '@rainbow-me/rainbowkit/wallets';
import { createConfig, http } from 'wagmi';
import { mainnet, sepolia } from 'wagmi/chains';
// Define only the wallets you want to include (exclude phantomWallet)
const connectors = connectorsForWallets(
[
{
groupName: 'Recommended',
wallets: [
metaMaskWallet,
rainbowWallet,
coinbaseWallet,
walletConnectWallet, // Keeps WalletConnect fallback intact
],
},
],
{
appName: 'My dApp',
projectId: 'YOUR_PROJECT_ID',
}
);
export const config = createConfig({
connectors,
chains: [mainnet, sepolia],
transports: {
[mainnet.id]: http(),
[sepolia.id]: http(),
},
});Solution 2: Turn off EIP-6963 Auto-Discovery To stop injected wallets from auto-appearing, disable multiInjectedProviderDiscovery in your Wagmi configuration: export const config = createConfig({
connectors,
chains: [mainnet, sepolia],
multiInjectedProviderDiscovery: false, // Prevents Phantom/Injected wallets from auto-mounting
transports: {
[mainnet.id]: http(),
[sepolia.id]: http(),
},
});Awesome! If this solution solves the issue for you, feel free to hit "Mark as answer" on the thread so others facing the same issue can find it easily! 🚀 |
Uh oh!
There was an error while loading. Please reload this page.
I want to exclude the Phantom wallet so that it does not appear in the list of installed wallets. how to do that?
All reactions