I'm new to Solana development and I'm working on a project called Soltrac, which is a CLI tool designed to copytrade a Solana wallet. The tool monitors transactions of a specified wallet and replicates them. You can find the repository here.
Currently, I'm able to recognize the program ID being used in the transaction to determine if it is from Raydium or Jupiter. However, I'm stuck trying to recognize and parse the instructions within these transactions to understand what they do. Specifically, I want to print details similar to what SOLSCAN shows in a swap transaction from Raydium, such as:
SWAP from X token to Y token for Z amount
Here's a snippet of my code where I recognize the program ID:
for instruction in &message.instructions { if let UiInstruction::Parsed(UiParsedInstruction::PartiallyDecoded(partially_decoded)) = instruction { if partially_decoded.program_id == raydium_program_id.to_string() { is_raydium_tx = true; } else if partially_decoded.program_id == jupiter_program_id.to_string() { is_jupiter_tx = true; } }}
I would appreciate any guidance on how to recognize and parse these instructions. If you have any links or resources that could help me understand this better, please share them. Also, if anyone is interested in contributing, the repository is open for ideas and contributions.
Thank you!