Closed BellringerQuinn closed 1 day ago
https://github.com/0xsequence/ethkit/blob/master/ethcoder/events_parser.go
Bonus points: translate the above ABI parser (it is poorly titled events_parser, it should be useable for any ABI) into C++ and use it to attempt to recover from an ABI provided in the wrong format; if unable to parse, we should still throw an ArgumentException
Some Regex you can use to validate the expected format
FunctionNameRegex = @"^[A-Z|a-z|,-|0-9]+$" FunctionABIRegex = @"^[A-Z|a-z|,-|0-9]+(([A-Z|a-z|0-9]+(, [A-Z|a-z|0-9]+))?)$"
Already merged into master
There are multiple places in the SDK where we may pass a portion of an ABI e.g. burn(uint256,uint256)
This is done when using a Contract that wasn't created with a full abi as an argument (client-side encoding) or when making a DelayedEncode transaction (server-side encoding)
A common user error is to paste the contract function definition e.g. burn(uint256 tokenId, uint256 amount)
This can easily go unnoticed and can be a pain to debug.
Before attempting to encode or hit the WaaS API, we should validate that the ABI is in the correct format and throw an ArgumentException (or similar)