Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing chainid in signTypedDataV4 and V3 #371

Open
EmmanuelAdeiza opened this issue Oct 30, 2024 · 0 comments
Open

Missing chainid in signTypedDataV4 and V3 #371

EmmanuelAdeiza opened this issue Oct 30, 2024 · 0 comments

Comments

@EmmanuelAdeiza
Copy link

EmmanuelAdeiza commented Oct 30, 2024

For signTypedDatav4 and v3, it doesn't work when I try other injected wallets. Only worked with Metamask wallet.
This is the data received for V4.

{"domain":{"chainId":"NaN","name":"Ether Mail","verifyingContract":"0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC","version":"1"},"message":{"contents":"Hello, Bob!","from":{"name":"Cow","wallets":["0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826","0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF"]},"to":[{"name":"Bob","wallets":["0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB","0xB0BdaBea57B0BDABeA57b0bdABEA57b0BDabEa57","0xB0B0b0b0b0b0B000000000000000000000000000"]}],"attachment":"0x"},"primaryType":"Mail","types":{"EIP712Domain":[{"name":"name","type":"string"},{"name":"version","type":"string"},{"name":"chainId","type":"uint256"},{"name":"verifyingContract","type":"address"}],"Group":[{"name":"name","type":"string"},{"name":"members","type":"Person[]"}],"Mail":[{"name":"from","type":"Person"},{"name":"to","type":"Person[]"},{"name":"contents","type":"string"},{"name":"attachment","type":"bytes"}],"Person":[{"name":"name","type":"string"},{"name":"wallets","type":"address[]"}]}}

And when I try to add the chainId the verify doesn't work and breaks on the web with this message.

index.js:2691 ParserError: Unable to encode value: Invalid number. Expected a valid number value, but received "NaN".
    at getBigInt (number.js:75:1)
    at Object.encode (number.js:110:1)
    at types.reduce.staticBuffer (packer.js:86:1)
    at Array.reduce (<anonymous>)
    at pack (packer.js:77:53)
    at encode (abi.js:79:1)
    at encodeData (sign-typed-data.js:242:1)
    at hashStruct (sign-typed-data.js:301:1)
    at eip712DomainHash (sign-typed-data.js:349:1)
    at Object.eip712Hash (sign-typed-data.js:367:1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant