I’m following the docs here: https://docs.moralis.io/moralis-server/web3/web3#executefunction
I’ve successfully connected to the wallet, and initialized Web3 (and validated using the example here:https://docs.moralis.io/moralis-server/web3/web3#ensureweb3isinstalled).
However, whenever I try to execute any function, I get the below error:
custom.js:46 Activated
moralis.js:7270 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘match’)
at Function. (moralis.js:7270:51)
at tryCatch (moralis.js:73891:40)
at Generator.invoke [as _invoke] (moralis.js:74122:22)
at Generator.next (moralis.js:73947:21)
at asyncGeneratorStep (moralis.js:30483:24)
at _next (moralis.js:30505:9)
at moralis.js:30512:7
at new Promise ()
at new Wrapper (moralis.js:57078:24)
at Function. (moralis.js:30501:12)
(anonymous) @ moralis.js:7270
tryCatch @ moralis.js:73891
invoke @ moralis.js:74122
(anonymous) @ moralis.js:73947
asyncGeneratorStep @ moralis.js:30483
_next @ moralis.js:30505
(anonymous) @ moralis.js:30512
Wrapper @ moralis.js:57078
(anonymous) @ moralis.js:30501
(anonymous) @ moralis.js:7438
mintToken @ custom.js:66
Here’s the code:
const options = {
address: '0x3d2B7cA35F9d442d491a0649a71d6A822462C84C',
function_name: 'totalSupply',
abi: ABI
};
const transaction = await Moralis.executeFunction(options);
const receipt = await transaction.wait();
console.log(receipt);