I'm trying to make a simple function call to a view function that takes a single uint256
as input, however when I try to pass the variable, next type check gives me this error: Expected 0 arguments, but got 1
.
Here is my code:
const txData = claimContract.methods["viewEvent(uint256)"](eventId)
const transactionObject = {
to: claimContract.options.address!,
data: txData.encodeABI(),
};
const eventData = await web3.eth.call(transactionObject as any);
I've console logged the method to ensure it takes an input parameter:
viewEvent: [Function (anonymous)],
'viewEvent(uint256)': [Function (anonymous)],
'0x24923f5f': [Function (anonymous)],
And also tried the three different web3js syntax from the docs:
//const txData = claimContract.methods.viewEvent(eventId);
//const txData = claimContract.methods["viewEvent(uint256)"](eventId);
// const txData = claimContract.methods["0x24923f5f"](eventId);