[SOLVED] Calling ERC20 contract using Moralis API

Hi, everyone! I have an issue calling erc20 Polygon Dai contract functions using Moralis API. I thought the issue can be with ABI or address but I tried calling the same function in remix IDE (same address and ABI) and it worked. Here is my code

const _allowance = async(owner) => {
    let options = {
        chain: chain,
        contractAddress: payTokenAddress,
        function_name: "allowance",
        abi: ERC20ABI,
        params: {
            owner,
            spender: marketsAddress,
        },
    };
    try {
        let allowance = await Moralis.Web3API.native.runContractFunction(
            options
        );
        console.log(allowance);
        return allowance;
    } catch (error){
        console.error(error);
    }

Here ABI is imported from my config. After calling it I get the following error in console:

Returned values aren't valid, did it run Out of Gas? You might also see this error if you are not using the correct ABI for the contract you are retrieving data from, requesting data from a block number that does not exist, or querying a node which is not fully synced.

I guess it is the wrong option name. Change this to address: payTokenAddress

Thanks, it worked! It’s just my inattentivness. Literaly spent half a day figuring out this bug