1

I am learning how to decode solana transactions, how do i decode it like sol scan to get the instructions/swaps for tokens such as raydium?

I see a programIdIndex and data, the data is base58 decoded into hex then what do i do with it to see the actual data for a swap

tldr: how does solscan decode a raydium swap transaction and spit out all that data and the inner instructions, it doesnt seem like raydium exposes their program IDL

2

1 Answer 1

1

For such cases, where the program IDL is not available, you can deduce the operations made through the inner instructions performed in the method invocation.

Create your own interface for identifying a transaction that performs the swap instruction and get your data from the the operations made in the inner instructions (eg. identify the base and quote through transactions you have made recently or from others, you can get the final amount – not the amount passed in the data for swap – from the balance changes).

For Raydium, and if I recall correctly, their programs are open sourced which should answer your question about platforms, like Solscan, being able to decode the data.

1
  • in solana is there only one function per contract to execute the calldata on or how does that work? is there sample code on how to decode this in python and javascript?
    – wonton
    Commented Dec 19, 2023 at 16:44

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.