Sync and Watch Address in Dapp (Possible?)

I am building a Dapp that allows users to enter an address to watch and set alerts to when tx takes place, however the only way I can find to sync and watch is via the plugin in the Moralis dashboard.

Is it possible to sync and watch address on-the-fly; within the ReactJS code?

Thanks in Advance,


1 Like

Hey @ashbeech

“Sync and Watch Plugin” under the hood is a cloud function. So you can start it via:

const address = "0x4670565222894929fba3b6C91e92B4FFeB3F52FF""watchEthAddress", {address}); 

Function will return you null, but address will be in a list of “Sync and Watch Plugin”

Happy BUIDLing :man_mechanic:

Thanks @Yomoo, so just to be clear this is without having to initially installed the “Sync and Watch Plugin”?

When I run the code in the API JS console in the control panel:"watchEthAddress", {address});

I get “Moralis not defined”, but using Parse, I get no error:"watchEthAddress", {address});


I’ve added an address, with historical transactions, into the Sync and Watch Plugin, but no txs have been inserted into the server database.

I’ve also run this in JS API console:

const address = "0x4670565222894929fba3b6C91e92B4FFeB3F52FF""watchEthAddress", {address});

It does insert the address into a single row under watchEthAddress, no txs get synced in relation to it either.

What am I doing wrong/missing?

For syncing historical data you need to add:"watchEthAddress", {address, "sync_historical":true});

1 Like

In SDK or cloud functions you need to use
in JS console

1 Like

Is there a way to programatically or in control panel to stop historical and realtime syncs in process on addresses @Yomoo?

I have addresses I’ve used to test builds with that are still syncing data I don’t need, but would like to stop them somehow.

Can’t see anything in docs, so in meantime, should deleting tables and reinstalling Sync and Watch plugin work?

UPDATE: I found only method to stop historical sync was to delete the server instance, currently.

Hey @ashbeech

For stopping plugin “Sync and Watch” for an address you can delete a plugin with needed address manualy from Moralis Admin UI:

Or you can create a cloud function which will delete wallet from WatchedEthAddress :

Moralis.Cloud.define("destroy", async (request) => {
  const logger = Moralis.Cloud.getLogger()
  const query = new Moralis.Query("WatchedEthAddress");
  query.equalTo("address", "0x497173ba067d71c1ee1d4661fe4c1369e4210fc7");
  const object = await query.first()
   if (object) {
    object.destroy().then(() => {"success");
    }, (error) => {;

Nice, this is great.

1 Like

Happy BUIDLing :man_mechanic: