0

I am trying to use Web3.js to push values from my frontend to a dynamic struct array in my backend.

However, I am receiving an error that I need to provide a parameter to my frontend: "Unhandled Rejection (Error): Invalid number of parameters for "challenges". Got 0 expected 1!"

I have no idea what this parameter is. Would anyone happen to know what this parameter could be? My code is provided below. Help would be insanely appreciated!

1

Given the following data-structure:

struct Type {
    string  field1;
    address field2;
    uint256 field3;
}

And the following state-variable:

Type[] public array;

The compiler generates the following getter-function:

function array(uint256 index) public view returns (string, address, uint256) {
    return (array[index].field1, array[index].field2, array[index].field3);
}

So you should call challenges(index) with some integer value of index.

| improve this answer | |

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.