Open
Description
Ethers Version
5.7.2
Search Terms
hashDomain
Describe the Problem
hashDomain
throws an error when the argument is a domain object with name: undefined
. Note that it correctly processes a domain object with no name
at all, because it's an optional field. A name
field with an undefined
value should be treated the same way, if only because TypeScript can't distinguish a missing field from an undefined-valued field.
This probably applies to all the other optional domain fields as well, though I haven't tested.
Code Snippet
utils._TypedDataEncoder.hashDomain({ name: undefined })
Contract ABI
No response
Errors
Uncaught TypeError: Cannot read properties of undefined (reading 'length')
at toUtf8Bytes (node_modules/@ethersproject/strings/lib/utf8.js:179:29)
at id (node_modules/@ethersproject/hash/lib/id.js:7:65)
at node_modules/@ethersproject/hash/lib/typed-data.js:161:32
at node_modules/@ethersproject/hash/lib/typed-data.js:293:56
Environment
No response
Environment (Other)
No response
Activity