react-celo icon indicating copy to clipboard operation
react-celo copied to clipboard

SignTypedData with Metamask

Open aaronmgdr opened this issue 2 years ago • 5 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Description

The signTypedData does not work when doing with metamask (but does on other wallets)

Steps to reproduce

call connection.signTypedData

Get an error

Expected behavior

get a signature

Screenshot

No response

Where is the problem happening?

Both

Environment

n/a

What version of react-celo were you using? (This can be found in the list of wallets in the "Connect" modal)

4.1.0

What wallet were you using?

metamask

What is the dApp URL? (if applicable)

No response

Additional context

I wonder if this is due to the lack of versioning (metamsk uses signTypedData_v*)?

aaronmgdr avatar Aug 26 '22 10:08 aaronmgdr

confirmed that metamask extension will sign if _v3 or _v4 is appending to the method name. AND the typed data is stringified.

However once the version is appending wallet connect wallets (omni valora) no longer can sign. 🤔

further more contractkit's CeloProvider (not the react CeloProvider, the ether one) treats the eth_signTypedData differently if this is a local account or not whereas with the versioning it will just always forwardSend to the rpcCaller.

still in investigation

aaronmgdr avatar Sep 09 '22 14:09 aaronmgdr

similar issues https://github.com/snapshot-labs/snapshot/issues/950

https://github.com/MetaMask/metamask-mobile/issues/3008

aaronmgdr avatar Sep 09 '22 14:09 aaronmgdr

Yeah, i think you should use v3 and prepare to migrate to v4.

kamikazebr avatar Sep 09 '22 21:09 kamikazebr

Valora treats eth_signTypedData and eth_signTypedData_v4 the same: https://github.com/valora-inc/wallet/blob/de7286f2bb557d21560dfd10e13e33a41a4cc04b/src/walletConnect/request.ts#L128-L130

Here's the discussion we had around it: https://github.com/valora-inc/wallet/pull/1474

jeanregisser avatar Sep 12 '22 08:09 jeanregisser

https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L277

aaronmgdr avatar Sep 30 '22 14:09 aaronmgdr