1

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).

will_durant
  • 1,154
  • 1
  • 9
  • 21

1 Answers1

1

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.

will_durant
  • 1,154
  • 1
  • 9
  • 21