Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forcing wallet-adapter to only show Solflare option is failing #1035

Open
nikitavoloboev opened this issue Nov 14, 2024 · 2 comments
Open

Forcing wallet-adapter to only show Solflare option is failing #1035

nikitavoloboev opened this issue Nov 14, 2024 · 2 comments

Comments

@nikitavoloboev
Copy link

Describe the bug

I have this code:

  const network = WalletAdapterNetwork.Mainnet
  const endpoint = useMemo(() => clusterApiUrl(network), [network])

  const wallets = useMemo(() => [new SolflareWalletAdapter()], [])

  return (
    <>
      <ConnectionProvider endpoint={endpoint}>
        <WalletProvider wallets={wallets} autoConnect>
          <WalletModalProvider>
            <Outlet />
          </WalletModalProvider>
        </WalletProvider>
      </ConnectionProvider>
    </>
  )

Note the const wallets = useMemo(() => [new SolflareWalletAdapter()], []) line.

With above code, I still see this:

image

So it does not respect showing only Solflare. Unless there is another way to enforce a wallet?

@mcintyre94
Copy link
Collaborator

This is because wallet-adapter detects all wallet-standard wallets, without an adapter. Phantom implements wallet-standard, so all apps using wallet-adapter (with or without their adapter) will display Phantom as an option if it is installed. There is no API to restrict the wallets that are displayed AFAIK. Solflare also implements wallet-standard, so you don't need to include their adapter either.

If you really want to only support Solflare for some reason (and have your app broken in eg Phantom's mobile dapp viewer), you could use the Solflare SDK directly instead of wallet-adapter. Or you could fork wallet-adapter and modify it to only offer connection to Solflare. I wouldn't recommend that though, if a user has another wallet but not Solflare then they're unlikely to be willing to change wallets in order to use your app.

@xinKyy
Copy link

xinKyy commented Nov 22, 2024

I hope to increase restrictions on displaying APIs for specified wallets. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants