Hi,
I am attempting to setup an event sync via a node script but getting { success: false }
as response.
Here is the script that I’m using:
require('dotenv').config()
const Moralis = require("moralis-v1/node");
const serverUrl = process.env.MORALIS_SERVER_URL;
const appId = process.env.MORALIS_APP_ID;
const masterKey = process.env.MORALIS_MASTER_KEY;
const cmdArgs = process.argv.slice(2);
if(!cmdArgs[0]) {
throw Error("Contract address not provided");
}
const watchContractEvents = async () => {
await Moralis.start({ serverUrl, appId, masterKey });
let options = {
chainId: "0x89",
address: cmdArgs[0],
topic: "TokenMinted(uint256, address)",
abi: {
anonymous: false,
inputs: [
{
indexed: false,
internalType: "uint256",
name: "tokenId",
type: "uint256"
},
{
indexed: false,
internalType: "address",
name: "minter",
type: "address"
}
],
name: "TokenMinted",
type: "event"
},
limit: 500000,
tableName: "TokenMintedEvents",
sync_historical: false,
};
let moralisRun = await Moralis.Cloud.run("watchContractEvent", options, { useMasterKey: true })
console.log('moralisRun:', moralisRun);
};
watchContractEvents();
I’ve tried specifying the topic in hex format, but it result in the same failure. Hopeful that there’s something glaringly obvious that I’m missing.
Thanks in advance,
Yuri