Web3.js: return value type int and uint actually returns an object

Created on 19 Dec 2015  路  3Comments  路  Source: ChainSafe/web3.js

I have a couple of test functions in solidity:

function Test1() constant returns (uint)
{
    return (1234);
}
function Test2() constant returns (int)
{
    return (2234);
}
function Test3() constant returns (string)
{
    return ("3234");
}
function Test4() constant returns (bool)
{
    return (false);
}

I am running these functions via an instance of a contract in the Chrome console and get some strange object which (amongst others) also contains my return value:
image

It would be much more convenient if the first two cases would also just return the plain int / uint value.

Most helpful comment

All 3 comments

The first two is an big number object, this is because javascript can't handle big numbers. Though we could return it as number in a string,a and then people could deal with their own big number libraries.

Thanks for the explanation, that was not quite clear when looking at an object with members called c, e and s. I think this would be very useful to document.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sundbry picture sundbry  路  3Comments

praveengupta0895 picture praveengupta0895  路  3Comments

nivida picture nivida  路  3Comments

TinyWJL picture TinyWJL  路  3Comments

xpepermint picture xpepermint  路  3Comments