ethereumjs-abi icon indicating copy to clipboard operation
ethereumjs-abi copied to clipboard

Handle type aliases

Open niran opened this issue 9 years ago • 7 comments

I copied types over from my contract and ran into an error when it tried to parse lengths that were missing. The workaround is easy, but it'd be nice if it were safe to copy the types from the contract.

niran avatar Jan 19 '16 00:01 niran

Sorry @niran I am not sure exactly which types this is an issue with? Would you mind posting some examples?

axic avatar Jan 19 '16 18:01 axic

uint and int are aliases for uint256 and int256. byte is an alias for bytes1.

https://solidity.readthedocs.org/en/latest/types.html

niran avatar Jan 21 '16 17:01 niran

@niran those aliases are implemented. Where are you getting an error?

axic avatar Jan 21 '16 18:01 axic

@niran apparently byte is a new addition as hence it is not included. It needs to go into the ABI first, but happy to support it after.

axic avatar Jan 21 '16 19:01 axic

uint failed for me here if I recall correctly: https://github.com/axic/ethereumjs-abi/blob/master/lib/index.js#L78

It tries to parse the size, but there isn't one.

niran avatar Jan 21 '16 23:01 niran

@niran the translation is done earlier: https://github.com/axic/ethereumjs-abi/blob/master/lib/index.js#L178 and https://github.com/axic/ethereumjs-abi/blob/master/lib/index.js#L217

It should be (u)int256 by the time it gets into the single item encoding

axic avatar Jan 22 '16 00:01 axic

What's the status of this, is this a bug or was this wrong use of the API?

holgerd77 avatar Sep 21 '18 12:09 holgerd77