Using web3 executeFunction to run a smart contact function

I am trying to run a function from smart contract using executeFunction, but I am receiving an error while. The smart contract function do not requires any inputs, but on executing its should give me price.

I am not sure where i am making mistake.


you can try to use runContractFunction:

it could be easier to use

I am still receiving the same error after using runContractFunction


I tried executing using api call from and it gave me below error.

did you provide the abi?


can you also paste the data instead of only using pictures?

let ABI = [
    inputs: [],
    name: "getLatestPrice",
    outputs: [
        internalType: "int256",
        name: "",
        type: "int256",
    stateMutability: "view",
    type: "function",

async function getPrice() {
  await Moralis.Web3();
  let options = {
    chain: "avalanche testnet",
    address: "0x2c6a6c6763434b33c75b668907f620177477f3db",
    function_name: "getLatestPrice",
    abi: ABI,
  const price = await Moralis.Web3API.native.runContractFunction(options);

I see a different format here:

also, you don’t need to use Moralis.enableWeb3() for runContractFunction