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

Deeplinks #134

Merged
merged 8 commits into from
Apr 18, 2024
Merged

Deeplinks #134

merged 8 commits into from
Apr 18, 2024

Conversation

alx-khramov
Copy link
Contributor

@alx-khramov alx-khramov commented Apr 2, 2024

This PR adds a support for deeplinks and adds deeplinks to wallets adapters for wallets, supporting deeplinks.

Resolves SI-955, SI-963, SI-986

How it works in general:

A user takes a mobile device, opens a regular mobile browser like Safari, opens dApp in it and clicks on a wallet connection button.

  1. If a wallet is detected (web3 provider like window.ethereum is found), then it will be connected and that's it.
  2. A wallet wasn't detected, but a deeplink for the wallet is defined in the Wallet Adapter. Then a new browser's tab is opened using the deeplink as an address. See the section below about "Detection of a wallet app" for some details.
  3. Otherwise, if a wallet is not detected and there is no deeplink, redirect the user to the wallet's download page.

Detection of a wallet app on a user's device

We are not able to detect if some mobile app, which wasn't developed by us, is installed on a user's device. This is right, at least for security reasons.
Some wallets provide a web page like https://metamask.app.link, which can detect if a wallet app is installed and redirect a user to a deeplink in this case. And redirect to the download page otherwise. If a wallet provides such a page, we use it.
But not all wallets do this. For example, imToken just provides a raw deeplink without ability to detect if a wallet is installed. So, if a user opens a dApp on a mobile device in a mobile browser, clicks imToken to connect, but it is not installed on the device, then the user will get an empty white page in the browser. And it seems, there is nothing can be done with it.

Wallets affected

Deeplinks were added for: MetaMask, BitKeep, Coin98, imToken, OKX, Trust wallets.

@alx-khramov alx-khramov self-assigned this Apr 2, 2024
@alx-khramov alx-khramov requested a review from a team as a code owner April 2, 2024 16:15
Copy link

changeset-bot bot commented Apr 2, 2024

⚠️ No Changeset found

Latest commit: 2e9913d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

DiRaiks
DiRaiks previously approved these changes Apr 8, 2024
Copy link
Contributor

@DiRaiks DiRaiks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@alx-khramov alx-khramov force-pushed the feature/si-955-wallet-adapters-api-deeplinks branch 2 times, most recently from 3138bdf to 037d4b0 Compare April 12, 2024 14:08
@alx-khramov alx-khramov merged commit b24698e into main Apr 18, 2024
1 check passed
@alx-khramov alx-khramov deleted the feature/si-955-wallet-adapters-api-deeplinks branch April 18, 2024 10:19
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

Successfully merging this pull request may close these issues.

3 participants