Description

Added an EIP-191 library to the sway std library in order to support EIP-191 compliant message hashes as well as an EIP-712 library that returns the EIP-712 domain separator and a function to return an EIP-712 compliant hash given an already hashed struct. Additionally, I worked on a predicate that would unlock coins if it was given a valid signature (that of the owner of the predicate)

Fuel EVM Signing libraries showcase

How it's made

By adding sha256_with_offset and keccak256_with_offset to the sway-std-lib, which are then used for the eip191 library, which returns an eip191 compliant message given some message of type T. As well as for the eip712 library, which returns an eip712 compliant domain separator given a name, version, chainId, and verifying contract. Additionally, the eip712 library can compute a valid message hash given an already hashed struct. Finally, a minor addition to tx.sw that allows one to get a transaction's id can be used in combination to the libraries above to construct a predicate that allows an evm public:private key pair to spend coins on fuel.