I'm building a web interface for my dapp, but can't seem to retrieve individual struct items from a public array.

I'm trying to retrieve a Proposal struct from the proposals() public function in my contract (I have a Proposal[] public proposals; array).

So the user enters a particular proposalID and they should be returned the Proposal struct. The method works fine on Remix.

However, I'm getting this alert:

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

I've verified the ABI is correct when I initialize my JS myContract object.

What's causing this error? Here's the code that's resulting in an error:

            myContract.proposals(propID, function(error, result) {
                if(!error) {
                    alert("Result: " + result);
                } else {
                    alert("There was a problem: " + error);

All the other functions work (ie. myContract.owner etc).


Looks like one can't return a struct for anything other than internal use...

Instead, make an accessor method that returns the relevant parts of the struct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.