Support EIP-712 structured signing
Overview
See https://github.com/shapeshift/web/issues/5138 for original issue.
We want to be able to support actual EIP-712 signing i.e eth_signTypedData_v4 scheme. We currently only support personal_sign i.e good old regular unstructured signing.
The obvious first consumer of this will be CoW swapper, for which signing requests will be able to be displayed in a structured way vs. the hashed digest currently.
References and additional details
MM signing schemes docs: https://docs.metamask.io/wallet/how-to/sign-data/
CoW reference PR with a fallback to personal_sign: https://github.com/gnosis/cowswap/pull/576
Acceptance Criteria
- CoW swapper uses
eth_signTypedData_v4if available in the current hdwallet (note, this isn't implemented yet and the guts of this will be hdwallet implementation) -
personal_signis still working as before, and this is brought as a non-breaking change, with the possibility to choose a signing scheme, but no runtime change for current consumooors, except CoW swapper - This should be implemented in hdwallet for all wallets in which
eth_signTypedData_v4works (possibly all?), and properly have feature capabilities as off for others. -
eth_signTypedData_v4is not the default option, rather consumers are able to select a signing scheme.personal_signis still the default, in case no signing scheme is selected - When trying to do an
eth_signTypedData_v4call, failures are properly handled with a fallback topersonal_sign- For MetaMask,
eth_signTypedData_v4should be intented but may fail, because Ledger and Trezor through MM do not supporteth_signTypedData_v4, see https://docs.metamask.io/wallet/how-to/sign-data/
- For MetaMask,
Need By Date
No response
Screenshots/Mockups
No response
Estimated effort
No response
Will implement when cowswap volume goes parabolic.
@gomes to take a look at this for portals.