When using web3, calling a function that returns an enum type converts it to a uint. Initially I assumed that enums are converted incrementally: 0,1,2,3.... However what I received was a hexadecimal. How is it converted, and how do you parse it?
For example:
contract Foo {
enum Letter {A, B, C}
function say(uint index) returns (Letter) {
if(index == 0) return Letter.A;
if(index == 1) return Letter.B;
if(index == 2) return Letter.C;
throw;
}
}
If you call Foo.say.call(1) you get a hex number (0x3ad324...). How would I check if it was Letter.A or 'Letter.B` that was returned?
web3were hashes, not incremental numbers. – latrasis May 20 '16 at 15:11