I've searched a lot and can't find a solution. I want to track SPL token swap transactions to calculate the token price and get information about wallets. I found several solutions, but still have problems:
- I can subscribe to two token accounts that are connected to a raydium pair using onAccountChange, get the amount of each account (WSOL, SPL token) and calculate the price, but it doesn't give me information about wallets, fees...
- I can subscribe to the onLogs method, listen to all the logs of the pair, check if the transfer exists in the logs, using the signature and the Connection.getParsedTransaction method I can get all the information I need and it works.
But the second method is using a fetch request to get the transaction data and this is not good because the request takes time and one spl token can do many such requests per second, more than 100, and of course if I listen to logs of 10-100 different spl tokens at the same time I get error 429 Too Many Requests. A good solution is to use a WSS connection to get transaction data and it works well without fetching the data using the getParsedTransaction method. I checked the documentation and can't find a way to subscribe to transactions with data, maybe I'm missing something? Can anyone help me or maybe I have the wrong direction of research. There must be a solution because services like dexscreener.com and dextools.io can track new pairs, their price and other information in real time.