MetaMask/eth-sig-util

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'EIP712Domain')

Kattenelvis opened this issue · 5 comments

When I try to do

const recovered = recoverTypedSignature({ data:{ positive: positive_proposal_indexes_2, negative: negative_proposal_indexes_2 }, signature:signedData, version:"V4" })

I get the error "Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'EIP712Domain')
at findTypeDependencies (sign-typed-data.ts:308:1)
at encodeType (sign-typed-data.ts:276:1)
at hashType (sign-typed-data.ts:351:1)
at encodeData (sign-typed-data.ts:244:1)
at hashStruct (sign-typed-data.ts:337:1)
at Object.eip712Hash (sign-typed-data.ts:395:1)
at recoverTypedSignature (sign-typed-data.ts:568:1)
at index.js:298:1"

We would need a more complete example to be able to debug your issue. What is positive_proposal_indexes_2 and negative_proposal_indexes_2?

They're arrays of proposals and each proposal contains a hash (string), id (number) and title (string).

Gotcha.

recoverTypedSignature expects the data you pass to look a certain way. It's not enough to just pass the data you want, you need to pass other information as well. Check the documentation here and an example in the tests here.

Ohh ok, thanks for the reply

No problem!