Closed ninabreznik closed 5 years ago
bytes1 0x00 ~ 0xff bytes2 0x0000 ~ 0xffff
I actually don't know exactly, but if both are valid bytes, we can except any and then before I send them to the contract with ethers.js, I encode them into the right format that ethers.js excepts. But user should be able to write any valid format of bytes. Also a string...
Does that make sense?
@alincode Just implemented formating and parsing bytes when sending a transaction.
This is the format of the hex byte ethers.js wants 0x736f6d657468696e670000000000000000000000000000000000000000000000
So, user can either write a string, that will be formatted to a bytecode or they can paste in the bytecode itself in this format 0x736f6d657468696e670000000000000000000000000000000000000000000000
Please let me know once validators are ready so I can update it in the smartcontract-app.
I am using ethers.js (ethers.utils.formatBytes32String and ethers.utils.parseBytes32String)
@ninabreznik I know how to valid bytes, so I just noted it for myself. when I finish, I will leave the release message to you.
@alincode Perfect. Let me know once you're done so I can update the validate module and test it in smartcontract-app :)
@ninabreznik
release at https://www.npmjs.com/package/solidity-validator 0.2.1
@ninabreznik fixed and update at 0.3.0
We need to validate bytes field too. So far we were validating it as a string, but when we send the EVM doesn't accept it as a string, but we need to convert it into a byte, so it makes sense to also validate it as a byte.
So, we should validate both:
There are many types of bytes, so we also need to check if it's bytes, byte32 etc.