0

I try to call a smart contract method in my web page, this is my following code:

this.miniVaultContract.methods.addDocument("0x00aaff","0x00aaff","0x00aaff",["0x00aaff", "0x00aaff", "0x00aaff"],[1, 2, 3],4,2,3,1)
.send({
    from: this.selectedAccount //My Metamask address
}).on('error', error => {
    alert("An error has occured when adding your document (ERR: " + error + ")");
    return;
});

My smart contract looks like this:

function addDocument(
    bytes32 documentId, bytes32 title, bytes32 description, bytes32[] keywords, uint[] ratings, uint documentType, uint startDate, uint endDate, uint duration
)
    public
    returns (bool)
{
    /* my code */
}

When I try to call the method, I get the following error:

Unhandled Rejection (TypeError): value.forEach is not a function

I thought maybe it has to do with the array in the parameters, but I can't seem to find any documentation about that in web3.

Any ideas on what could go wrong here?

0

Try and do the following.

this.miniVaultContract.methods.addDocument("0x00aaff","0x00aaff","0x00aaff",[["0x00aaff", "0x00aaff", "0x00aaff"]],[[1, 2, 3]],4,2,3,1)
.send({
    from: this.selectedAccount //My Metamask address
}).on('error', error => {
    alert("An error has occured when adding your document (ERR: " + error + ")");
    return;
});

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.