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

fix(): signTypedData_v4 for metamask #1191

Merged

Conversation

midgerate
Copy link

Fixes issue where we are unable to sign transactions if its a typed array on metamask connected via walletconnect.

MetaMask/metamask-mobile#4441

@pedrouid
Copy link
Member

Why would this method be an exception?

@midgerate
Copy link
Author

@pedrouid I could not test much. Here's what I know

  1. Metamask defaults eth_signTypedData to eth_signTypedData_v3
  2. Other wallets like rainbow, trust, argent defaults to eth_signTypedData_v4
  3. When I tried to call eth_signTypedData_v4 with trust wallet, I was unable to sign the request (It seems (not confirmed) that trust does not allow eth_signTypedData_v4 being called directly)
  4. I found that in Cannot press sign button when call sign typed data v4 MetaMask/metamask-mobile#4441 using the handleOtherRequests with eth_signTypedData_v4 works for metamask and not for trust.

So I created a specific condition for metamask and we have tested that it works now for metamask and all other wallets.

It would be great if you could improve this PR since you understand the internals.

I think this might already be solved in WC2 but it would take us a long time to integrate WC2.

@itm-penny
Copy link

@midgerate Hi! I am searching for a solution to solve the same problem and I found this pull request, I wonder if I am able to test this locally in my project?
My project is built in react app in javascript and I am using npm to install the walletconnect package, but I don't know how to change the code locally and to test it. Thanks for the help in advance!

@midgerate
Copy link
Author

@itm-penny At snapshot we use patch-package to make changes to all the build files and then make it work. You could technically use this fork that I created, publish it to npm and then use it.

@itm-penny
Copy link

@midgerate Thanks! Will give it a try!

@itm-penny
Copy link

@midgerate I tried changing the exact same part of the code and used patch-package to test it, and this solved my problem! Thank you so much for the solution, I've stuck in this problem for over a week. Hopefully this pull request gets merged ASAP, thanks again man!

@Hmac512
Copy link

Hmac512 commented Jul 2, 2022

Thanks for making this PR @midgerate

This issue comes down to a simple question. Why exactly is walletconnect taking an explicitly versioned request like “eth_signTypedData_v4”, and removing the version before sending it to the wallet? “eth_signTypedData”

That seems like a bug. I can’t for the life of me figure out how one could decide to do that on purpose.

@samuveth
Copy link

@pedrouid could we get this reviewed and merged please. We need this change so that we can move to EIP712 on snapshot.org

@xanderdeseyn
Copy link

Any progress on this?

@pedrouid pedrouid merged commit dcf6c02 into WalletConnect:v1.0 Aug 2, 2022
@bkrem
Copy link
Member

bkrem commented Aug 2, 2022

Published in https://github.com/WalletConnect/walletconnect-monorepo/releases/tag/1.8.0

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.

None yet

7 participants