Repository navigation
bytes32 type is too strict #77
Replies: 8 comments 2 replies
|
Nice! I still think it should be the default. It’s odd for literal bytes to not match type for something expecting bytes |
|
Looks really easy to make it the default I can do the pr |
|
Ethers does use something similar Reference Could possibly make sense in having a similar default |
|
The default used to be When thinking about defaults, I think about ABI item inputs and outputs. Does For example, if I want to decode Think there are two approaches here:
|
|
fwiw I disagree with past me here. Consistently using hex strings is quite nice |
|
I always wonder if there are peformance reasons to use bytes array rather than hex strings though |

Uh oh!
There was an error while loading. Please reload this page.
Is there an existing issue for this?
Package Version
latest
TypeScript Version
latest
Current Behavior
The type for bytes32 only accepts hex numbers of type

0x..... Have to awkwardly convert bytes to a hex value. I think not accepting a string makes sense as it could be a mistake but literal bytes should be validExpected Behavior
Should loosen type to accept bytes arrays too
Link to Minimal Reproducible Example (TypeScript Playground)
https://github.com/ethereum-optimism/optimism/blob/ef8d1454ddd68cc6a42129549595cb0f1d84af87/packages/atst/src/index.ts
Steps To Reproduce
Pass in any bytes array to a contract method that accepts bytes32
Anything else?
No response
All reactions