any update on this ? i need to watch event from same smart contract but different address
you can not use same table as of now, you will have to use separate tables
i probably had 10-20 address , i dont want to see my moralis dashboard with 20 table with simmiliar name T_T
I donât see a problem in having 20 tables in dashboard
i want to try that but i got this " tableName should contain only letters"
i want to my table name will look like this and i can create job to loop all table
EventNameContract1
EventNameContract2
You could try:
EventNameContractA
EventNameContractB
EventNameContractC
EventNameContractD
This is actually what Iâm currently doing (the separate tables part, not the merging yet). It actually works reasonably well, but it feels like it may get out of hand once 100,200âŚ1000 tokens are added/tracked.
Do we have a better way (yet) of merging tables? Also, what is the best way to âdynamicallyâ list all existing tables so as to iterate through them in the script and merge (basically a table names query)?
NOTE: Currently in test. Having to slog through multiple (dynamically created) tables to make sure all rows are empty, just to delete them is quite taxing. Also, the âonly lettersâ limitation is a bit rough. Iâve currently chosen to base58
the original address hash, shorten it sliiiiiiiightly, then append the token chain text. No collisions so far! â:dizzy:
there is the option now to sync all the evens in the same table by adding the event sync from code, and by not providing the contract address, you have to use a syntax like this:
Moralis.Cloud.run(âcoreservices_addEventSyncâ, options, { useMasterKey: true });
Excellent. Would you mind giving a more explicit example of adding sync events without a contract address? Iâm a bit lost as to what that means.
Would it sync every event from every supported DEX or what?
Check the example from documentation where an event sync is added from code.
Alright, so it appears it could/would be filtered by chain.
Any quality way (Moralis or otherwise) to correlate the event to the specific DEX (especially when the event signature and chain is the same) and CHAIN (in the rare cases where the token address is the same across all chains)?
If the contract address is the same on multiple chains, you can not sync in the same table now as you will need to specify the contract address and the chain. In that case you will have to use multiple tables.
In few months we will work on developing an API for syncing data directly into your backend.
Fair enough. I can create a separate âsyncâ per chain (rather than my current method of separate syncs per individual contract ). Not tooooo many moving parts.
Is there a function in Moralis code (advanced or otherwise) to list existing syncs/tables, etc? For example, for the purpose of running local âinitâ functions to ensure tables are present or create them if necessary . . . or for deleting as needed.
You can make a query in the database to see what entries are already present in a table specific to event syncs. You can also try to add them and if the table is already used then it will return a specific error message.
Hrm, Iâm thinking more of:
âI have NO IDEA what tables were left from the previous dev session. Iâd like to go through and remove any with the âdevâ prefixâ
Is there no way to query exactly whatâs there rather then pinging for errors? Something like Moralis.listTables()
?
This didnât work for me, and no errors were produced. Did you literally mean coreservices_addEventSync
, or some other command? I also tried watchContractEvent
but it complained about the missing address.
Would be nice to have central list of available functions, and explicit examples for somewhat obtuse devs such as myself.
FYI, Iâm referencing Watching from Code
you have to use the command that I pasted to work without an address, watchContractEvent will not work without an address specified
there isnât now a way to list the events with a simple command/function, you can look in the database and see the events saved in a specific table, you can query that table
I did this and receive:
{ status: 200, data: { success: true, result: true } }
Documentation says I wonât see the results in the ADMIN UI, but I will see them in the DB. I donât see them in either place. Note that I do see my previous watchContractEvent
items.
you have to use a different table name, to make sure the parameters have the right values, you will see them in both places when it works
Yes, each time Iâve used COMPLETELY different names that follow all the rules, yet still nothing.
My last two table attempts (neither of which exist) were âUniswapvtwoETHâ and âUniswapvthreeETHâ . . . both returned 200
, but nothing showed up in the panel.
Again, this is a case where an explicit example would be helpful â because Iâm obviously missing something.