Error 141: " is required"

I want to use Moralis web3API to run a function of my contract and get back the data read.
I don’t understand what this error means

code: 141, error: " is required"}

I mean I understand it says it requires a parameter or something for the function but I included it in my function see below my function being called

const options = {
        chain : "rinkeby",
        address : contractID,
        function_name : "mintedByTier",
        abi : contractABI,
        params: {value:0}
      }
      try{
        let quantityMinted = await Moralis.Web3API.native.runContractFunction(options);
        console.log(quantityMinted)
      } catch(err) {
        console.log(err);
      }

Finally the ABI where the function is defined

{
      "inputs": [
        {
          "internalType": "uint256",
          "name": "",
          "type": "uint256"
        }
      ],
      "name": "mintedByTier",
      "outputs": [
        {
          "internalType": "uint256",
          "name": "",
          "type": "uint256"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },

I read that naming the parameter in the abi could fix it but it did not work for me. I am not sure whether the error comes from me or moralis?
Best

You have to give this input a name.

I already did this but I’m still having the same error

"inputs": [
        {
          "internalType": "uint256",
          "name": "test",
          "type": "uint256"
        }
code: 141, error: "test is required"}
code: 141
error: "test is required"
const options = {
        chain : "rinkeby",
        address : params.contractId,
        function_name : "mintedByTier",
        abi : ContractABI2,
        params: {test: 0}
      }

params udpated

Ok, now, use “0” instead of 0 for that value

1 Like

Oh ok it works.
So all functions that have params inside them we need to go in the ABI and give a name to the input if we want it to works?

Usually they already have a name. But when they don’t have, you can use this solution.

1 Like