Missing chainid in signTypedDataV4 and V3
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 642
- Forks
- 369
- PR merge metrics
- No merged PRs in 30d
Description
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 ()
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)
```
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce signTypedData v3 and v4 with injected wallets other than MetaMask, using the request data and ParserError shown in the issue. Trace where chainId becomes "NaN" and verify that the corrected signing flow produces a valid signature that can be verified in the web app.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- blockchain
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100