rainbow-me / rainbowkit

The best way to connect a wallet 🌈 🧰
https://rainbowkit.com
MIT License
2.4k stars 637 forks source link

[bug] Mobile Safari cannot open page because address is invalid #1336

Open jeanregisser opened 1 year ago

jeanregisser commented 1 year ago

Is there an existing issue for this?

RainbowKit Version

1.0.4

wagmi Version

unsure (version used by https://www.rainbowkit.com/)

Current Behavior

Tapping Argent, Trust Wallet or Omni shows "Safari cannot open the page because the address is invalid." This is on https://www.rainbowkit.com/

https://github.com/rainbow-me/rainbowkit/assets/57791/a502f4e1-7ed9-47a2-9eeb-8f666bd7e43a

Expected Behavior

Tapping these wallets should open them reliably on iOS (Safari).

Steps To Reproduce

  1. Go to https://www.rainbowkit.com/ on Safari on iOS
  2. Tap "Connect Wallet"
  3. Tap Argent / Trust Wallet / Omni
  4. Notice the error popup from Safari

Note sometimes it works the first time, but then fails quite reliably.

Link to Minimal Reproducible Example (CodeSandbox, StackBlitz, etc.)

No response

Anything else?

This is quite annoying bug on the day WC v1 shuts own. Having no other options but to use the latest RainbowKit version which has this bug.

This was tested on iOS 16.5.1

jeanregisser commented 1 year ago

From what I see, the problem may come from this line: https://github.com/rainbow-me/rainbowkit/blob/88168e1eb13fa1de7bffaea5d4839823f214a36a/packages/rainbowkit/src/utils/getWalletConnectUri.ts#L9 Where it's doing an async call to get the display_uri whereas previously with v1, the uri was directly returned. https://github.com/rainbow-me/rainbowkit/blob/88168e1eb13fa1de7bffaea5d4839823f214a36a/packages/rainbowkit/src/utils/getWalletConnectUri.ts#L10 I haven't checked the internals of this. More of a suspicion.

DanielSinclair commented 1 year ago

@jeanregisser Do you have these wallets installed? This is currently the expected UX if a user does not have the wallet installed. There is also another case where Safari will block further attempts to deep link into an app if you hit Cancel on the "Open this page in x" alert until the next refresh or the page is opened in a new tab. Mobile Safari is death by a thousand cuts.

For WalletConnect v2, we are relying on native Deep Links instead of Universal Links (which would previously deliver a user to a fallback website if the wallet is not installed). Fetching a WalletConnect v2 pairing is slower, and iOS will block Universal Link redirects in our existing architecture, so we're pushing users through the native Deep Link popup for the time being. We will soon improve this UX and execute a rearchitecture to prefer Universal Links for some wallets, but wanted to ensure a stable transition to WalletConnect v2 first.

jeanregisser commented 1 year ago

Hey, I do have these 3 wallets installed.

It's indeed what you said, I had unintentionally cancelled the first open and then all subsequent opens failed with the error.

Thanks 🙏

Looking forward to see universal links come back.

mighty-phoenix commented 5 months ago

Hey all. Facing the same issue. Any updates on this? Thanks!

magiziz commented 5 months ago

@mighty-phoenix Sorry for the delay here. We're working on a fix right now, please bear with us 🙏

mattpilleul commented 1 month ago

Hi! Any update on this issue? Still facing the problem in some of our apps

magiziz commented 1 month ago

@mattpilleul We have a PR open which should be merged soon

hzhu commented 1 month ago

Thank you @magiziz 🥰! Our users are encountering this issue frequently so we're looking forward to the fix 🤞🏽 .

addmorebass commented 1 month ago

Any ETA on this PR merge?

magiziz commented 1 month ago

@addmorebass We're aiming to get this out either next week or the week after that.

hzhu commented 3 weeks ago

Any ETA on this—given that two weeks has passed? This issue affects all RainbowKit apps—quite a few apps.

On Matcha, this means no MetaMask user can trade on iOS. Rolling back versions could be a solution for us, but that would undo previous work and peerDependencies upgrades. Some teammates have suggested dropping RainbowKit, but I'm not in favor of that either. I love 🌈 RainbowKit!

addmorebass commented 2 weeks ago

Bumping amongst the people to fix this bug please. I think it will make my ETH go up

addmorebass commented 2 days ago

Any ETA on this?