it looks like this code finds the function name in the api:
const options = {
contractAddress: "0xA794C9ee519FD31BbCE643e8D8138f735E97D1DB",
functionName: "approve",
abi: [{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}],
params: {spender: "0x923761B99e4b7d54E5fC33E4B6F7512f6D8a71e3", amount: 10},
};
function executeFunction2({ contractAddress, abi, functionName, params = {} } = {}) {
const contractOptions = {};
const functionData = abi.find(x => x.name === functionName);
if (!functionData) throw new Error('Function does not exist in abi');
console.log(functionName)
}
executeFunction2(options);
I copied the start of the executeFunction form Moralis SDK, with the part where it checks the api.
And in your case you said that it generated that error with Function does not exist in abi'