-
Notifications
You must be signed in to change notification settings - Fork 231
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
Fix signTypedData #220
Fix signTypedData #220
Conversation
CLA Assistant Lite All Contributors have signed the CLA. |
@@ -68,5 +67,8 @@ export function generateTypedData({ | |||
nonce: BigNumber.from(safeTransactionData.nonce) | |||
} | |||
} | |||
if (eip712WithChainId) { | |||
typedData.domain.chainId = chainId |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the error was caused because ethers would try to encode undefined
instead of ignoring it if the key is present?
Would it be possible to unit-test this? I feel like this is missed / refactored wrong easily.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that was exactly the issue ;)
I'll add some tests to cover that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
What it solves
Fixes the error
[Error: invalid BigNumber value (argument="value", value=undefined, code=INVALID_ARGUMENT, version=bignumber/5.6.2)](https://ethereum.stackexchange.com/questions/130776/error-invalid-bignumber-value-argument-value-value-undefined-code-invalid)
for Safes with version<v1.3.0
.This issue was caused because
chainId
had a wrong type makingsigner._signTypedData()
complain about it.