anza-xyz / wallet-adapter

Modular TypeScript wallet adapters and components for Solana applications.
https://anza-xyz.github.io/wallet-adapter/
Apache License 2.0
1.46k stars 911 forks source link

auto redirection after Solana Wallet Integration - to https://solanamobile.com/wallets #936

Closed LFerronato closed 3 months ago

LFerronato commented 3 months ago

Guys, needing help, this is the first time I'm using the Solana integration and some strange things are happening;

Describe the bug Some of our users have reported that when they attempt to access our dApp, they are being redirected to https://solanamobile.com/wallets. This behavior is unexpected and has not been coded into our dApp by our team. (video - https://github.com/anza-xyz/wallet-adapter/assets/43012047/54ae16cf-320a-44a7-9782-73db23e18ff2)

To Reproduce Steps to reproduce the behavior:

  1. Go to https://gray.market
  2. just wait (video)

Expected behavior I believe that is very intrusive and affect the dApp's sense of security, a redirect like this. It's not the kind of thing that a lib should generate as a side effect. So, the expected behavior It would be if this didn't exist by default

Smartphone (please complete the following information): I'm not sure which devices, there are reports from several users that this is happening.

Additional context I wrote this note: https://github.com/anza-xyz/wallet-adapter/issues/604#issuecomment-2021430962 I have openned a issue here before: https://github.com/solana-labs/solana-web3.js/issues/2378

Dependencies:

    "@solana/spl-token": "^0.4.0",
    "@solana/wallet-adapter-react": "^0.15.35",
    "@solana/wallet-adapter-react-ui": "^0.9.34",
    "@solana/wallet-adapter-wallets": "^0.19.25",
    "@solana/web3.js": "^1.89.1",
    "bs58": "^5.0.0",
    "next": "14.0.4",
steveluscher commented 3 months ago

When on mobile, your code must not attempt to autoconnect to the wallet. If you do, this is what happens:

  1. You try to autoconnect
  2. The mobile wallet adapter tries to make a connection
  3. Because the connection did not originate from a user gesture (eg. a tap on the screen) the browser's popup blocker blocks it.
  4. Mobile wallet adapter presumes that there is no installed wallet, and redirects to the wallets landing.

Again: do not autoconnect or call connect() programmatically on mobile.