Hey there,
Iโve created a new smart contract event watcher within both programmatically and dashboard. Both of them returned success on moralis server console log but not shown on dashboard as a table class object.
Here is my programmatic script and console message;
const Moralis = require("moralis/node")
require("dotenv").config()
const contractAddresses = require("./constants/networkMapping.json")
let chainId = process.env.chainId || 31337
let moralisChainId = chainId == "31337" ? "1337" : chainId
const contractAddress = contractAddresses[chainId]["MyBoredApe"][0]
const serverUrl = process.env.NEXT_PUBLIC_MORALIS_SERVER_URL
const appId = process.env.NEXT_PUBLIC_MORALIS_DAPP_ID
const masterKey = process.env.masterKey
async function main() {
await Moralis.start({ serverUrl, appId, masterKey })
console.log(`Working with contract address ${contractAddress}`)
let MintedOptions = {
// Moralis understands a local chain is 1337
description: "MyBoredApe Event Watcher",
chainId: moralisChainId,
address: contractAddress,
topic: "Transfer(address,address,uint256)",
abi: {
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "from",
type: "address"
},
{
indexed: true,
internalType: "address",
name: "to",
type: "address"
},
{
indexed: true,
internalType: "uint256",
name: "tokenId",
type: "uint256"
}
],
name: "Transfer",
type: "event"
},
filter: { eq: ["sender", "0x0"] },
tableName: "Minted",
sync_historical: true
}
const mintedResponse = await Moralis.Cloud.run(
"watchContractEvent",
MintedOptions,
{ useMasterKey: true }
)
if (
mintedResponse.success
) {
console.log("Success! Database updated with watching events")
} else {
console.log("Something went wrong...")
}
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error)
process.exit(1)
})
As you can see, i got success response from server but i canโt see the new event sync table object on my dashboard panel.
Iโm using localDevChain.
Server url: r6eqfpa57f3r.usemoralis.com
Any help will be appreciated.
Thank you.