Conversation
encodeData
| if (type === 'address') { | ||
| if (typeof value === 'number') { | ||
| return ['address', padStart(numberToBytes(value), 20)]; | ||
| // Unnecessary casting - Request value could have been a hex string |
There was a problem hiding this comment.
Please note that these comments are temporary, will be deleted later on.
There was a problem hiding this comment.
In regards to this comment and in the Notion ## Address Type - Number to Address
I think this is confusing to me.
Request value could have been a hex string.
It seems that here, because it checks typeof value === 'number', it could not be a hex string
| if (type === 'address') { | ||
| if (typeof value === 'number') { | ||
| return ['address', padStart(numberToBytes(value), 20)]; | ||
| // Unnecessary casting - Request value could have been a hex string |
There was a problem hiding this comment.
In regards to this comment and in the Notion ## Address Type - Number to Address
I think this is confusing to me.
Request value could have been a hex string.
It seems that here, because it checks typeof value === 'number', it could not be a hex string
|
|
||
| if (type === 'bool') { | ||
| return ['bool', Boolean(value)]; | ||
| // Unnecessary casting - Request value could have been a boolean |
There was a problem hiding this comment.
Unnecessary casting - Request value could have been a boolean
maybe I am not understanding the comment fully. It seems we expect it to be boolean but it could be another type. maybe we can mention is it unnecessary because we should expect explicit boolean types: true and false only. other types, even "true" or "false" should be rejected.
I guess if we did make this stricter, we could consider adding support by explicitly casting "true"/"false" or 1/0.
|
Closing this as stale |
No description provided.