4

Is there a way to call a contract with no arguments using async? Contract code:

contract A {
     function test() constant returns(string s, address addr) {
        s = "Success!";
        addr = msg.sender;
    }
}

Here is the js code:

async.waterfall([
        function getResult(cb) {
      contractObject = web3.eth.contract(abi);
            contractInstance = contractObject.at(address);

      contractInstance.test.call(
  function(err,getOutput) {
       if(err) {console.log(err);}
       var gotOutput = getOutput;
       console.log('Test result received: ' + getOutput);
    return cb(null,gotOutput);
     });
        }
    ], function asyncComplete(err, getResult) {
        if (err) {console.log(err);}
        var result = [];
        result.push({ result: getResult[0], address: getResult[1]});
        console.log(result);
    })

The error I am currently seeing when I execute the above code against testrpc, is

BigNumber Error: new BigNumber() not a base 16 number:

Any suggestions on how to get around this error?

q9f
  • 32,913
  • 47
  • 156
  • 395
skarred14
  • 945
  • 1
  • 9
  • 18
  • Related and might have a helpful hint: http://ethereum.stackexchange.com/questions/1741/what-does-the-web3-bignumber-not-a-base-16-number-error-mean – eth Dec 05 '16 at 00:10
  • hanks for the comment - blockchain syncing i am not sure is an issue - since i am using the testrpc and i wonder, if there could be issues around that. however, on the other hand, would you think that the issue is with type of variable being passed in - should be string instead or a bytestream of the string? – skarred14 Dec 05 '16 at 01:07

1 Answers1

4

This is a decoding bug in web3.js. I assume it has to do with the string decoding.

Please submit an issue in the web3 repo. I will look at this in the 1.0 branch

Fabian Vogelsteller
  • 1,520
  • 11
  • 12