MetaMask / eth-method-registry

A JS library for getting Solidity method data from a four-byte method signature
ISC License
21 stars 13 forks source link

Update parse() to handle args that are tuples #6

Closed danjm closed 5 years ago

danjm commented 5 years ago

fixes https://github.com/MetaMask/metamask-extension/issues/5983

This PR address an issue with parsing methods with signatures like fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)

Encodings of contract arguments can include tuples (and tuples within tuples, etc.) This will cause parenthesis to appear in the arg list of the signature. This could lead to the representation of method names and arguments with parameters included.

This PR ensures that the presence of tuples in method signatures does not cause parenthesis to appear in the string representation of the method name and its arguments.

Test cases are added.

Note that this will cause tuples to be represented flatly. I've created an issue for us to improve that in the future https://github.com/danfinlay/eth-method-registry/issues/7

danjm commented 5 years ago

Associated version bump PR in MetaMask https://github.com/MetaMask/metamask-extension/pull/6403