Minimal support for ERC2771 (GSNv2) (#2508)
Co-authored-by: Francisco Giordano <frangio.1@gmail.com>
This commit is contained in:
@ -72,9 +72,9 @@ library ECDSA {
|
||||
|
||||
/**
|
||||
* @dev Returns an Ethereum Signed Message, created from a `hash`. This
|
||||
* replicates the behavior of the
|
||||
* https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign[`eth_sign`]
|
||||
* JSON-RPC method.
|
||||
* produces hash corresponding to the one signed with the
|
||||
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
|
||||
* JSON-RPC method as part of EIP-191.
|
||||
*
|
||||
* See {recover}.
|
||||
*/
|
||||
@ -83,4 +83,17 @@ library ECDSA {
|
||||
// enforced by the type signature above
|
||||
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Returns an Ethereum Signed Typed Data, created from a
|
||||
* `domainSeparator` and a `structHash`. This produces hash corresponding
|
||||
* to the one signed with the
|
||||
* https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
|
||||
* JSON-RPC method as part of EIP-712.
|
||||
*
|
||||
* See {recover}.
|
||||
*/
|
||||
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
|
||||
return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user