Issue with this code of call function of Mumbai Polygon

           ERC20_ABI = [

{“name”:“customTotalStaked”,“outputs”:[{“internalType”:“uint256”,“name”:"",“type”:“uint256”}],“payable”:false,“stateMutability”:“view”,“type”:“function”},
];
async function tsupply(){
x = await Moralis.Web3API.native.runContractFunction({
chain: “mumbai”,
address: “0xf8aDc852F8CaE4395d03AaBF5534051Bf4AEFAD1”,
function_name: “customTotalStaked”,
abi: ERC20_ABI,

})
console.log(x);
}

I want to call function of my polygon mumbai smart contract but it saying uncaught promse

Hi, you can see here how to post code on forum:

1 Like

You got a wrong abi. It should be this

let ERC20_ABI = [
  {
    constant: true,
    inputs: [],
    name: "customTotalStaked",
    outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
    payable: false,
    stateMutability: "view",
    type: "function",
  },
];