I am trying to list the history of a token in my wallet. So, I am dealing with different scenarios right now, and I am stuck with a swap transaction and I am wondering the best way to identify a transaction as a swap (right now I am trying to detect some amount out and some in into the user wallet).
I see solscan.io and wallets can decode the instructions properly, the library gives me information about it and I have everything I need, however, in one inner instruction an account is opened and closed and the authority is not the user itself and I am wondering how solscan (and others) identify that.
This is what solscan.io shows:
and the instruction is this one:
And I have this same information but I am not able to determine how that is related to the user:
In ATLAS to USDC exchange I can identify the user because the authority is the wallet user but on this one I don't know what to do, any help is appreciated.
To be clear, what I am trying to figuring out is how to identify a transaction (like the one I show on the pictures) as a type “swap”. Using TS SDK, what is the best approach to identify a transaction of swap from Prism or Jupiter as a swap transaction? Since there are a lot of inner instructions, what would be the best way to classify transactions (specifically for this case, a swap transaction)?