Does Sway support ERC-712 typed hash signatures?
This allows a user to know what they are signing, instead signing a byte string.
When you use 1inch or UniswapX you are signing typed signatures.
Does a basic implementation of ERC-712 exist for Sway, or do I need to implement this?
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/EIP712.sol)
pragma solidity ^0.8.20;
import {MessageHashUtils} from "./MessageHashUtils.sol";
import {ShortStrings, ShortString} from "../ShortStrings.sol";
import {IERC5267} from "../../interfaces/IERC5267.sol";
/**
* @dev https://eips.ethereum.org/EIPS/eip-712[EIP-712] is a standard for hashing and signing of typed structured data.
*
* The encoding scheme specified in the EIP requires a domain separator and a hash of the typed structured data, whose
* encoding is very generic and therefore its implementation in Solidity is not feasible, thus this contract
* does not implement the encoding itself. Protocols need to implement the type-specific encoding they need in order to
* produce the hash of their typed data using a combination of `abi.encode` and `keccak256`.
*
* This contract implements the EIP-712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
* scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
* ({_hashTypedDataV4}).
This file has been truncated. show original
Also will the fuel wallet need to support this? Metamask has for quite some time with eth_signtypeddata_v4
Hey @partylikeits1983 , we don’t have an implementation for typed signatures yet though it is in discussions, I will get back to you with more details on the same at the earliest.
Hey @partylikeits1983 , we dont have it officially as of now, but if you want you can always create a custon sway implementation of eip 712