1

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:

  1. 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...
  2. 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.

4
  • I found a solution on how to subscribe to token transactions, or rather to a block, I used the method from the documentation solana.com/docs/rpc/websocket/blocksubscribe, it is not in the library solana/web3 because it is not stable, I had to open the websocket connection separately through the WS library. The data is coming in well, but there is still one problem, the object innerInstructions->instructions[] contains a data field in an encrypted format, although I specify the format encoding:jsonParsed in the request. Does anyone know how to solve it? Commented Apr 2 at 13:34
  • I figured out how to receive information, you don’t need to decode the date field, to get the transfer value you need to use the postTokenBalance and preTokenBalance fields to calculate the amount of reserves, the transfer amount, and the price, and the accounts (array [0,1,2]) field allows you to calculate who transferred funds to where and from where we can find it in message.accountKeys. Commented Apr 3 at 16:15
  • I'm facing the same problem. Could you please share your code?
    – luaksksk
    Commented Apr 7 at 6:36
  • I found a better solution, you just need to use helius.xyz service, they provide better rpc than other services and they have a special subscription transaction method, but you need to buy a paid subscription for $49. I checked, it works without data delays in the web socket, here is the documentation docs.helius.dev/webhooks-and-websockets/websockets. Commented Apr 8 at 10:43

1 Answer 1

0

Use Bitquery Solana DEXTrades API to track SPL token swap transactions to calculate the token price and get information about wallets. Register as a developer to get free points on Bitquery IDE. And run this saved query. Bitquery has many powerful APIs to get on chain data for different chains like ethereum, bsc, arbitrum, solana, matic, etc.

If you have any questions, reach out to support through telegram channel.

Full Disclosure: I work at Bitquery in Developer Relations Team.Query screenshot

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.