I am wondering on how to achieve an implementation similar to what dexscreener does for example, where I can monitor all the new tokens created on SUI mainnet and maybe also all new pairs, knowing that the subscribeEvent is not really useful currently, how could I do this?
1 Like
To monitor new tokens and pairs created on SUI, here are some alternative approaches, given the current limitations with subscribeEvent:
- Query Events: You can use the query_events method to retrieve events related to token creation. Filter the events by the relevant Move module or package that handles token creation. This method allows you to gather data on token creation and pairing events directly from on-chain data.
- Polling: Setting up a polling system is a common alternative when real-time subscriptions are not feasible. It allows you to periodically check for new events, although it might not be as immediate as a subscription-based solution.
- Custom Indexer: To achieve near real-time monitoring, you could build a custom indexer. This involves continuously processing emitted events from the network. You can listen for specific event types and store them for your use case. You might need to build infrastructure to capture, store, and process these events efficiently.
- Checkpoint Monitoring: Use checkpoints to track the state of the network at specific intervals. By comparing checkpoints and events emitted in each, you can detect new tokens and pairs created since the last checkpoint. You can store this information in a database to avoid reprocessing events.
For more guidance, you can also refer to the SUI Event API documentation and Using Events in SUI docs.
1 Like