How to unwatch/remove an event sync from code

I created a ‘watchContractEvent’ using the following code.

const options = {
    tableName : "sampleTable",
}"watchContractEvent", options, { useMasterKey: true });

Then, I tried to unwatch/delete the same using the following code

const options = {
    tableName : "sampleTable",
}"unwatchContractEvent", options, { useMasterKey: true });

But I can’t unwatch/delete it. It is throwing the following error.

  success: false,
  error: 'No event found with tableName "sampleTable" that is created via cloud-code'

I am kinda stuck here :roll_eyes:. Any help …?

Note : I am using nodejs and moralis package

I think the way it is implemented is not right. Options require contract event parameter details.

Refer below docs for more info.


Did you solve it by now?
Did the watch part work? You can remove easily an event watch from the admin interface.

Yup, I have supplied all the required parameters and it also started watching the events. But, the issue is with unwatching. I can’t unwatch it.

Certainly, but I need a way to do it via sdk… :sweat_smile:

This syntax worked for me:'coreservices_removeEventSync'