I am trying to create my first Smart Contract but how is it possible that the error says invalid argument?, please consider that with the first method (CreateITem) everything works fine... that's for saying that it's not a problem of invalid ABI or invalid contract address ?
The error is : throw new Error('incorrect number of arguments');
pragma solidity ^0.5.0;
contract ItemsList {
uint public itemCount = 0;
mapping(uint => Item) public items;
struct Item {
string encryptedProofHash;
}
function createItem(string memory _encryptedProofHash) public {
items[itemCount] = Item(_encryptedProofHash);
itemCount++;
}
function getItemCount() public view returns (uint){
return itemCount;
}
}
...and this is the code for reading using ethers.js
var wallet = new ethers.Wallet(privateKey,provider);
var contract = new ethers.Contract(address,abi,wallet);
var sendPromise = contract.getItemCount(); ------------------->> ERRROR
sendPromise.then(function(transaction){
console.log(transaction);
}).catch((error) => {
console.error(error)
});