The solidity contract has defined the following mapping
struct recordStruct {
uint256 price;
uint64 time;
}
mapping(address => recordStruct[]) public records;
Question: How can we use Web3.js to retrieve the entire mapping?
If this is not possible, how can we pass in the address
and receive the object stored in the recordStruct
array?
Attempt When using the following web3 code:
var record = await MyContractInstance.records.call('0xDbB7d1Ed07F8D1D0C5D5bB9b9e427E997f240F7d')
I get the following error
(node:2452) UnhandledPromiseRejectionWarning: Error: Invalid number of arguments to Solidity function
I am using Web3.js 1.0.0-beta.34