react-celo
react-celo copied to clipboard
SignTypedData with Metamask
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*
)?
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
similar issues https://github.com/snapshot-labs/snapshot/issues/950
https://github.com/MetaMask/metamask-mobile/issues/3008
Yeah, i think you should use v3 and prepare to migrate to v4.
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
https://github.com/celo-org/celo-monorepo/blob/master/packages/sdk/connect/src/connection.ts#L277