I have this dummy contract. How can I get the value of the whole Positions array and mapping positionIdsOf in plain javascript?

contract DummyContract{
    mapping(address => uint256[]) public positionIdsOf;
    Position[] public positions;

When I try to do this

const contract = new Contract(addressOfDummyContract)
const positions = contract.positions()

It always requires passing the index into the function to get the value at the specific index but I would like to get the whole array, same with the mapping.

Your Answer

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

Browse other questions tagged or ask your own question.