I created smart contract and I deployed it on Ropsten network using Truffle. I tested it from Remix and it works. I have there 2 view with a same name checkInputData but different number of parameters.

When I call the first checkInputData from my front-end app (using Metamask and Web3) it works, but when I call the second one, it writes

Error: Invalid number of arguments to Solidity function

This is my first (correctly working) view:

function checkInputData(string memory _deviceId, int32 _latitude, int32 _longitude, uint _time, uint _speedType) public view returns(bool)

this is the view with the error:

function checkInputData(uint _speedType, int32 _latitude1, int32 _longitude1, uint _time1, int32 _latitude2, int32 _longitude2, uint _time2) public view returns(bool)

and this is how I call it:

contract.checkInputData.call(2,0,0,0,0,10000,0, (error, result)=>{
            if (error) {
            } else{

I tried to call it in Remix with the same parameters and it works there. enter image description here

Any ideas what can be wrong and how to solve it?

UPDATE: I fixed the problem by changing view name. But it still did not give me an answer what was the problem.

  • It's just what the error says. You're passing 8 arguments, but the function only takes 7. In Remix you're passing 7 (the right number), so it works. – user19510 Apr 6 at 18:48
  • @smarx sorry my bad, I wrote one more zero here, but in my code is only 7 parameters. I uploaded the post. – Banana Cake Apr 6 at 18:50

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.