Here is my codes:
let serverUrl = process.env.MORALIS_SERVER_URL;
let appId = process.env.MORALIS_APP_ID;
let masterKey = process.env.MORALIS_MASTER_KEY;
const moralisServer = async () => {
await Moralis.start({ serverUrl, appId, masterKey });
logger.info(âMoralis connectedâ);
};
moralisServer();
This works perfectly to call read funcitons like symbol âERC721MockContractâ. But if I use the code below:
let moralisSecret = process.env.MORALIS_SECRET;
const moralisServer = async () => {
await Moralis.start({ moralisSecret });
await Moralis.enableWeb3({
privateKey: process.env.PRIVATE_KEY2,
});
};
moralisServer();
It shows error: ABI is required!. Here is my full code:
const options = {
chain: âbsc testnetâ,
address: â0x0252906b8835fBDB4b8E579db8641F1EC38b6D23â,
function_name: âownerOfâ,
abi: ABI,
params: {
tokenId: tokenId.tokenId,
},
};
const owenrOfNft = await Moralis.Web3API.native.runContractFunction(options);