[SOLVED] Sync Smart Contract Events - blank screen error

you can add an event sync from code:
https://v1docs.moralis.io/moralis-dapp/automatic-transaction-sync/smart-contract-events#watching-from-code

this is the recommended way to do it now for a moralis server in the general case, you can also add topics in the sha form this way

you also have to add an abi with an event and not with a function

@cryptokid So now Sync Smart Contract Events is not working from admin dashboard ?

I don’t know what abi you used there, from that you pasted that abi doesn’t contain any event

it should still work in admin interface

hi @cryptokid , same ABI worked in morning and now its not working.

what exactly happens? I don’t understand from that image

did you try to logout and login again?

I want to sync custom events from admin interface.

so after adding address , select Network and ABI click on ‘Select Topic’ drop-down then page suddenly display blank.

https://admin.moralis.io/dapps/syncs/events/221323/new/custom

Server URL : https://ou1latf2lhci.grandmoralis.com:2053/server

do you see any error in the console when the page goes black?
usually you see a blank page when it is an error somewhere

server url doesn’t help me now

Error : vendor.16eab55b.js:32 TypeError: Cannot read property ‘toString’ of undefined
at main.659c9faa.js:2383

can you try to add in that abi only the part with the event that you want?

if still doesn’t work, can you paste the abi that you are using?

someone else reported a similar issue:

it looks like there is a general issue on our side

hi @cryptokid,

ohk please inform me once issue was fixed , Thanks for your support

hi @cryptokid,

I have try to sync event using above URL and run cloud function with given example in docs(Watch new smart contract event) , i have got API response as below but event doesn’t sync.

result: {success: true}

What is the server url and the table name for that event sync?

server URL : https://ou1latf2lhci.grandmoralis.com:2053/server

table name : UniPairCreated

the issue on that server is this event sync:

{
    "chainId": "0xa869",
    "address": "",
    "topic": "createNewNftAuction(address,uint256,uint128,uint128,uint32,uint32,address[],uint32[])",
    "abi": {
        "anonymous": false,
        "inputs": [
            [
                {
                    "internalType": "address",
                    "name": "_nftContractAddress",
                    "type": "address"
                },
                {
                    "internalType": "uint256",
                    "name": "_tokenId",
                    "type": "uint256"
                },
                {
                    "internalType": "uint128",
                    "name": "_minPrice",
                    "type": "uint128"
                },
                {
                    "internalType": "uint128",
                    "name": "_buyNowPrice",
                    "type": "uint128"
                },
                {
                    "internalType": "uint32",
                    "name": "_auctionBidPeriod",
                    "type": "uint32"
                },
                {
                    "internalType": "uint32",
                    "name": "_bidIncreasePercentage",
                    "type": "uint32"
                },
                {
                    "internalType": "address[]",
                    "name": "_feeRecipients",
                    "type": "address[]"
                },
                {
                    "internalType": "uint32[]",
                    "name": "_feePercentages",
                    "type": "uint32[]"
                }
            ]
        ],
        "name": "createNewNftAuction",
        "type": "function"
    },
    "limit": 500000,
    "tableName": "AVAXcreateNewNftAuction",
    "sync_historical": false
}

because it has an abi that it is of tope function an not event

when an invalid event is added to sync like this one, all the other event syncs will stop working

Thank you for detail information,

I am try to sync using below cloud code but same problem happening,

.

// code example of creating a sync event from cloud code
let options = {
  chainId: "0x1",
  address: "0x5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f",
  topic: "PairCreated(address, address, address, uint256)",
  abi: {
    anonymous: false,
    inputs: [
      {
        indexed: true,
        internalType: "address",
        name: "token0",
        type: "address",
      },
      {
        indexed: true,
        internalType: "address",
        name: "token1",
        type: "address",
      },
      {
        indexed: false,
        internalType: "address",
        name: "pair",
        type: "address",
      },
      {
        indexed: false,
        internalType: "uint256",
        name: "test",
        type: "uint256",
      },
    ],
    name: "PairCreated",
    type: "event",
  },
  limit: 500000,
  tableName: "UniPairCreated",
  sync_historical: false,
};

Moralis.Cloud.run("watchContractEvent", options, { useMasterKey: true });

so now how to add new event table using ‘watchContractEvent’

first you have to fix the previous issue, so that event syncs work, after you fixe that previous issue with that abi, you may have to restart coreservices and after that you can try to add a new event sync

now it works again to select the topic in the admin interface

@cryptokid thank you

Now its working fine.