MetaMask / metamask-mobile

Mobile web browser providing access to websites that use the Ethereum blockchain
https://metamask.io
Other
2.18k stars 1.12k forks source link

Mobile Linking with Dapp using metamask as a signer #1695

Open zwang1225 opened 4 years ago

zwang1225 commented 4 years ago

Describe the usability problem We are trying to create mobile linking between our dapp and metamask mobile. To achieve that, we used linking generator and WalletConnect, and and ideal user experience will be that user triggers transactions inside our Dapp and goes to metamask completing the transaction. After that user should be come back to our Dapp with confirmation from metamask wallet.

Right now we can set up the bridge with QR code by using WalletConnect, which the user scans inside metamask, and it sets up a socket connection between Dapp and wallet(But this is from metamask wallet side). And we can also trigger transactions from the Dapp by using the linking urls you provide, but this way we cannot get any response from metamask.

My questions are:

  1. to achieve the scenario we want, what is the proper way of setting up the linking process?
  2. is that possible to avoid using WalletConnect and using APIs from metamask?
  3. how can we implement our contract into this process(Eg: using methods from our contract)
omnat commented 4 years ago

Hi @zwang1225 , I recommend checking out the docs for mobile linking on WalletConnect - https://docs.metamask.io/guide/walletconnect.html To use your dapp in MetaMask mobile, you can either open your dapp in the MetaMask browser, or enable signing with WalletConnect mobile deeplinks.

zwang1225 commented 4 years ago

Hi @omnat , thank you for getting back to me so quick. The situation we are facing now is:

  1. to use metamask deeplinking generator, we cannot get any response from metamask app after any transactions, it seems like one direction operation. So is there a way for us to get response from metamask app by using this?
  2. Metamask deeplinking doesn't provide an interface to use methods from our contract, do you have a way for us to implement our contract?
  3. To use WalletConnect, I've gone through all the docs, and the only option can work now is to use QR code. If we try to link the apps, there aren't any options. Or can you give me a direction to go through if I'm missing anything?(Plus they provide **wallet-registry which is the as linking generator)
omnat commented 4 years ago

@zwang1225 please follow these steps https://docs.walletconnect.org/mobile-linking#dapp-support, and test it with MetaMask mobile. Supporting QR code package should already support mobile linking.

MetaMask deeplink generator doesn't enable signing transactions. We are updating our docs this week to explain it better.

zwang1225 commented 4 years ago

Hi @omnat WalletConnect only works with their QR code. To make mobile linking they don't have any coding examples in their docs. Am i missing anything? Is there a good example or further docs I can take a look?

omnat commented 4 years ago

@zwang1225 Their qrcode-modal package auto supports mobile linking. Once you start supporting QR code package, try following these steps to test the flow:

  1. Open your dapp in Safari/Chrome/ mobile browser
  2. Connect with WalletConnect
  3. On iOS, you should see a list of wallet options you can select from, choose MetaMask.
zwang1225 commented 4 years ago

@omnat The problem is we are trying to link from an mobile app, like native app. And the way walletConnect is linking is still using an URL to link to metamask. I'm looking for a way to get a callback after the transaction is done, and can access it inside our app. To use their QR code modal it can work, but I'm looking for a way to directly trigger metamask instead of scanning QR code.

dancre commented 4 years ago

@zwang1225 my investigation has shown this isn't possible yet with a good UX. Ideally, Metamask mobile would support deep linking for signing transactions as well as sending ETH/ERC20, and support the x-callback-url where it would call a deep link to return to the native app once a transaction is signed. This would allow further cases like "Log in with MetaMask" where you could verify the user owns a public address and pull down all their related wallet info into a nice dashboard.

To answer your questions directly:

  1. I don't think metamask should notify you of a complete transaction, metamask should just handle the signing of the transaction and then pass control back to the native app through deeplink, with information on transactionId. The native app would then be responsible for monitoring the transaction to verify if/when it completes.
  2. Metamask needs to support signing any kind of transaction through deeplinking, doesn't seem possible right now
  3. The only benefit I see to using wallet connect over metamask right now is it allows signing all transactions, it still has a pretty average UX where you need to manually navigate back to your native app and also initiating transaction signs is a bit messy where you have to manually deep link into metamask from my understanding...

I think the best option from UX is to write your own wallet in your native app still, unfortunately, however there is obviously security issues with this. Thoughts?

lingxiao commented 3 years ago

Any updates on this? The callback URL to the home app with success or failure log of the transaction would be essential.

s-udhaya commented 3 years ago

@omnat Any update on this issue?

xzilja commented 3 years ago

It looks like Opensea has done it somehow with metamask, trust and rainbow wallets

moonaigithub commented 3 years ago

Hi any updates ? 🙂🙏

stevenkampen commented 3 years ago

Also trying to work this out. No clear examples online but as I understand it, it should possible with "universal" links...

stevenkampen commented 3 years ago

Still plugging away on this and it's getting to the hair pulling point. There are no functional examples of mobile linking in the walletconnect docs or the monorepo, as far as I can see.

@omnat Can we get some clarification here? This morning I actually tried calling the WalletConnect office because that seems like the only way forward (no answer).

Is it possible this is the wallet being selective about pairing requests that it responds to?

ajansari95 commented 3 years ago

Any updates?

Nick-R commented 3 years ago

+1

marcnpopa commented 2 years ago

+1

aasswd commented 2 years ago

Still plugging away on this and it's getting to the hair pulling point. There are no functional examples of mobile linking in the walletconnect docs or the monorepo, as far as I can see.

@omnat Can we get some clarification here? This morning I actually tried calling the WalletConnect office because that seems like the only way forward (no answer).

Is it possible this is the wallet being selective about pairing requests that it responds to?

Hi buddy I'm not sure if you are still working on this. I am trying to figure out the same thing and I found https://github.com/WalletConnect/walletconnect-example-dapp. They host a website as well and you can try out on ios safari, it seems to work. I am still wondering how opensea ios does it.

RoyalSix commented 2 years ago

I have also been grinding on this issue for a few weeks now. Tried taking the approach of branch.io because thats what metamask uses to deeplink. You can tell by the url it provides.

I think metamask as a recognition for OpenSea that allows them to provide a favorable UX. If this is not true I would love to see an example providing the same UX in a codesandbox. Because I really think its not possible.

It clearly states in docs that UX is something that is important to the team yet I've seen no progress and very little engagement by anyone on supporting this issue.

39otrebla commented 2 years ago

We too are having issues with this. We've been able to delegate login and signing of a personal message to Metamask Mobile, though Metamask does not deep link back to our app.

Actually, I see two different issues here:

  1. using a custom URI scheme as the WalletConnect's redirectUrl doesn't work although it is documented: Metamask doesn't back-link to the mobile dApp after connecting the wallet
  2. we didn't find any documentation on how to send Metamask the callback/redirect URL when performing other operations, like personal_sign

We would be happy to contribute, if needed.

didopimentel commented 2 years ago

Are there any news on this?

omnat commented 2 years ago

This issue certainly has been a priority, apologies for not communicating that here sooner.

We are actively working on a solution for this, and about to roll out a beta testing program for it in a couple weeks. If you are interested in testing it out and see if it resolves your issue and any other feedback, we'd love your input! Here's a form you can fill, and as soon as our team is ready, we'll send it over https://forms.gle/2s5cDoEHLmRidMnV7

billyjacoby commented 2 years ago

Is there any update on this? Facing the same issue as described here.

robbiedood commented 1 year ago

Got the same issue here +1 Look forward an update from experts..

markoorn commented 1 year ago

Somehow daylight.xyz have managed to get this working as well - any update from the MetaMask team on how this is possible? The issue has been open for two and a half years now without any real helpful response from the team.

siosio34 commented 1 year ago

+1

amanPradhan05 commented 1 year ago

i am getting the same issue,any update guyz on this?

lorenzolanciok commented 1 year ago

I got the same issue, any update?

CristianMR commented 11 months ago

Any updates on this?

oneforalone commented 11 months ago

Any updates? And when do you plan to release this feature?

softstackio commented 7 months ago

Somehow daylight.xyz have managed to get this working as well - any update from the MetaMask team on how this is possible? The issue has been open for two and a half years now without any real helpful response from the team.

working on the same problem and about to fix it.

bcneves13 commented 2 weeks ago

Is there any solution by now?