-
-
Notifications
You must be signed in to change notification settings - Fork 228
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Consolidate
signTypedData
and recoverTypedSignature
functions
The `signTypedData` and `recoverTypedSignature` functions each had three different implementations (one for each version of EIP-712). They have each been consolidated into a single function each. The functions `signTypedData` and `recoverTypedSignature` used to be specifically for `eth_signTypedData_v3`. Instead they now accept an additional `version` parameter that specifies which version should be used. This replaces `signTypedDataLegacy` and `recoverTypedSignatureLegacy`, which were for `eth_signTypedData_v1`, and it replaces `signTypedData_v4` and `recoverTypedSignature_v4`. The functions `signTypedMessage` and `recoverTypedMessage` used to provide a single interface for using any of EIP-712 types. But now that the base functions serve that purpose instead, they are now obsolete and have been removed. Additionally a few `TypedDataUtils` functions were updated to accept a `version` parameter instead of a `useV4` parameter, to bring them in-line with the other functions. The functions changed are `hashStruct`, `eip712Hash`, and `encodeData`. The README and inline documentation has been updated accordingly. New doc strings were added for `signTypedData` and `recoverTypedSignature`, which didn't have any yet before now. Credit to @aakilfernandes for this idea, who first implemented this in PR #66.
- Loading branch information
Showing
3 changed files
with
183 additions
and
296 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.