1

I have installed both of Phantom and Solflare. If I use @solana/wallet-adapter-react to select/connect wallet, adapter automatically detects Phantom and Solflare both. But I want to hide Solflare, and show only Phantom wallet in the screen.

Is it possible?

Please tell me how to show certain wallets only in the screen even though it is installed on the browser.

1 Answer 1

1

Sure, But you will need to add custom logic to your wallet list component/function.

function WalletList() {
    const { wallets, select } = useWallet();

    const installedWallets = wallets.filter(
        (wallet) => wallet.readyState === "Installed"
    );

    return (
        <section>
            {installedWallets.length === 0 && (
                <section>
                    Please Install a Compatible Solana wallet to continue
                </section>
            )}

            {installedWallets
                .filter((wallet) => wallet.adapter.name === "Phantom")
                .map((wallet) => (
                <WalletItem
                    key={wallet.adapter.name}
                    name={wallet.adapter.name}
                    iconSrc={wallet.adapter.icon}
                    connect={() => select(wallet.adapter.name)}
                />
            ))}
            </section>
    );
}

reference -> https://github.com/jim4067/yet-another-solana-ui-template/blob/3236833a7e01407c8057fde46aea14f295122a97/app/ui/components/nav/ConnectBtn.tsx#L84-L118

4
  • Should customize existing npm module?
    – toygr
    Commented Oct 10 at 6:19
  • not sure I understand? customize in what way?
    – Jimii
    Commented Oct 10 at 6:29
  • where can I edit WalletList function?
    – toygr
    Commented Oct 10 at 9:19
  • check the link I shared
    – Jimii
    Commented Oct 10 at 11:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.