Version
ethers-core v2.0.14 (https://github.com/gakonst/ethers-rs#51fe937f)
Platform
GNU/Linux x86_64
Description
TypedData::encode_eip712 doesn't work correctly when an int256 is used. This is easier explained with some tests, so I opened a WIP PR with a couple of tests: #2784
Both tests use almost the same EIP712 data, except one uses uint256 and the other one uses int256.
I'm pretty sure the int256 hash used in the test is correct because I verified it both with viem and ethers.js:
const viem = require("viem")
const ethers = require("ethers")
const typedData = {
"domain": {
"name": "TestName",
"version": "1",
"chainId": 31337,
"verifyingContract": "0x1111111111111111111111111111111111111111",
},
"types": {
"Test": [{ "name": "amount", "type": "int256" }],
},
"message": {
"amount": "1234",
},
"primaryType": "Test",
};
console.log("viem", viem.hashTypedData(typedData))
console.log("ethers", ethers.TypedDataEncoder.hash(typedData.domain, typedData.types, typedData.message))