Abi object required

what’s suppose to go in the abi object field? best guess what this… doesn’t work
data: {abi: {type: ‘string’, name: ‘label_’}, params: {label_: ‘testing’}}

your evm example doesn’t have params… where do I add parameters?

import Moralis from ‘moralis’;
import { EvmChain } from ‘@moralisweb3/evm-utils’;

const abi = []; // Add ABI

const functionName = ‘balanceOf’;

const address = ‘0x1234567890123456789012345678901234567890’;

const chain = EvmChain.ETHEREUM;

await Moralis.start({
apiKey: ‘<YOUR_API_KEY>’,
// …and any other configuration
});

const response = await Moralis.EvmApi.utils.runContractFunction({
abi
functionName,
address,
chain,
});
console.log(response.result);

Using this page will be easier to test with adding the ABI, otherwise just use it with the SDK.

The params object is included along with the abi, functionName, address, etc if the function you’re calling requires any.

const response = await Moralis.EvmApi.utils.runContractFunction({
  abi,
  functionName,
  address,
  chain,
  params: {
    "inputname": "inputvalue"
  }
});
1 Like