Here are a few relevant code snippets from my smart contract
struct Constituency{
uint16 id;
string name;
uint64[] cans;
}
mapping(uint => Constituency) public constituencies;
function newConstituency(string memory _name) private{
uint64[] memory tmp;
constituencies[concount] = Constituency(concount, _name, tmp);
concount++;
}
constructor() public{
newConstituency("Bikini Bottom");
constituencies[0].cans = [1,2,3];
}
And here's the web3 snippet I'm using to access elements from the constituencies mapping:
election.methods.constituencies(0).call({from : defaultAccount},function(e,r){ console.log(r) })
Here is the response it gives out:
Result { '0': '0', '1': 'Bikini Bottom', id: '0', name: 'Bikini Bottom' }
As you can see, it simply does not mention the array. What can I do to fix this?
constituencies[0].cans = [1,2,3];
toconstituencies[0].cans.push(1); constituencies[0].cans.push(2); constituencies[0].cans.push(3);