-
Notifications
You must be signed in to change notification settings - Fork 736
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
Sending transactions on iOS shows a deep link prompt after first attempt #1165
Comments
Surprisingly I'm not seeing this issue on https://example.walletconnect.org, but looking at the code I can't see why it wouldn't run into this too: https://github.com/WalletConnect/walletconnect-example-dapp/blob/8a3216597474b09a7dcadc84efaf7e393c8eb05d/src/App.tsx#L284-L357 In my repro app, I've tried making the same API calls as the WC example by hard coding multiple |
@markdalgleish i think it all comes down to how long does it take before setting RPReplay_Final1656010925.MP4 |
i think there might not be a solution to this (wishing i am wrong!). I think acceptable UX would be if you're doing "some stuff" before signing/sending transaction, show a |
I was also able to introduce this issue to the WalletConnect example by adding the following line after the 2nd network request when sending a transaction, forcing it to wait until the next tick before continuing: If I add this line any earlier it doesn't work. It seems like it's not simply a timing issue and that the browser is using some more advanced heuristics to decide whether a navigation is triggered by a user action or not. |
wow. had some more observations. This works as expectedThis doesn't
Extreme, but even this worksI think it might be allowing multiple fetch (under certain timeout) under user action. Here's the server if you want to try |
if this is true, WalletConnect might have to move window.location.href assignment to fetch API success instead of Correction: looking into source code |
okay, i have one more theory. |
I've been digging into Calling
Knowing this, I've been able to work around the timing issues by doing the following:
I've expanded my repro to include a demo of this. There's now an additional row of actions where you can populate a transaction, then—when it's ready—pass it to either I've found that tapping "Send transaction" still works most of the time, but occasionally prompts me to open in the app instead of navigating immediately. If I tap "Send unchecked transaction", it takes me directly to the app every time without a prompt. |
Thanks for digging in, really makes sense. I have some questions. Why does it wait for Also, I don't get the reason why should we "estimate" gas on dapp side (unless we specify it explicitly), shouldn't it be handled at the wallet level as it'll eventually calculate it if I am not wrong. |
Some additional findings in terms of a workaround:
EDIT: As per my first point, I've updated my repro to avoid |
Update: we are starting to work on "eager" hooks in wagmi (using @markdalgleish's eager populating of txn request) to help with deeplinking issues on iOS. |
Maybe #444 (comment) is related to this? I experience this alert previously but since making the mentioned change in approach, this alert does not show up anymore. |
I opened a PR adding documentation to the WalletConnect site explaining the cause of these iOS app link issues and how to avoid them which recently got merged. The documentation is now live: https://walletconnect-docs-git-fork-markdalgleish-b4d402-walletconnect1.vercel.app/mobile-linking#ios-app-link-constraints I'm closing this issue since there's not much else that can be done from a WalletConnect perspective. I've started a GitHub discussion against Ethers to see if anything can be done there to help WalletConnect consumers avoid these issues: ethers-io/ethers.js#3178 |
Describe the bug
Attempting to send a transaction on iOS via
@walletconnect/ethereum-provider
+ ethers shows a prompt to the user to open in the app rather than opening the app automatically after the first attempt.It seems to be caused by the fact that the deep link navigation is triggered some time after the user interaction has occurred. The browser then intercepts the navigation, giving users a chance to back out of it.
I pushed a minimal repro here: https://github.com/markdalgleish/walletconnnect-deeplink-prompt-issue
It's deployed here: https://walletconnnect-deeplink-prompt-issue.vercel.app
I was also able to reproduce this same issue by simply navigating to the deep link URL after a 1s timeout. To help with debugging, I also included a button for doing this in my minimal repro. Note this doesn't happen if you navigate immediately, so there's also a button for this too for comparison.
I'm not sure if this is something that can be fixed or not, short of pre-emptively navigating to the deep link URL, but I realise that might also cause issues with requests that are still in flight. Either way, I figured it was worth raising since it's not a great user experience.
SDK Version
@walletconnect/[email protected]
To Reproduce
Steps to reproduce the behavior:
Open this page in "App name"?
Expected behavior
Immediately navigates to the app, the same way it did on the first attempt.
Screenshots
Smartphone:
The text was updated successfully, but these errors were encountered: