Feature request: sign digest method in Signer
See original GitHub issueDescription
The request is to basically offer the functionality you described in this comment as a method in the Signer class.
Just like there is a signMessage method, it’d be nice to have a similar signDigest
, which takes the raw digest (a 32 bytes hash) and returns a signature as a JavaScript object with the v
, r
and s
properties.
Use Case
This would be particularly useful for testing contracts that implement EIP-712 and EIP-2612.
A comprehensive testing suite involves many networks: the local chain, the coverage chain, maybe a testnet or a fork of mainnet. Having a signDigest
method in the Signer
would simplify the writing of tests, insofar developers wouldn’t have to manage a mapping of private keys => accounts for each network. Furthermore, there are tools where the default behaviour is to create a new set of accounts on every run (e.g. solidity-coverage), so additional configuration is required to make them compatible with tests that involve hardcoded private keys.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top GitHub Comments
As a note to anyone following this issue, #687 has been addressed. Please try out EIP-712 support. 😃
Closing this and tracking progress in #687 .
Thanks! 😃