Guide: Swap Transaction #61
-
Hello, Could you please provide an example of how someone would swap tokens? Now you would use a swap aggregator like Jupiter or Raydium. What I am struggling with is pairing their API with From your example:
I assume I would replace Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Thank you for opening this discussion. I am sorry you were confused with the APIs.
However, quickly looking at the API that you shared, I see that they create a transaction for you which you later need to sign. Keep in mind, transactions and instructions are two completely different entities. Every transaction includes one or more instructions. Unfortunately, deserialising transactions is not currently implemented in sol4k. You wouldn't be able to complete the first part for the step 6 with sol4k. I am planing to add this functionality in future. You can check this repository with examples to see the main flows that are currently supported. |
Beta Was this translation helpful? Give feedback.
-
Hello @Shpota thank you for the quick reply! I'll take a look at the |
Beta Was this translation helpful? Give feedback.
Hi @itsmelodewyk
Thank you for opening this discussion. I am sorry you were confused with the APIs.
TransferInstruction
is meant to transfer SOL from one account to another, generally you cannot use it for other purposes. If you want to include an arbitrary bytes to a transaction you can useBaseInstruction
. This means you would need to prepare the binary data needed for the instruction yourself.However, quickly looking at the API that you shared, I see that they create a transaction for you which you later need to sign. Keep in mind, transactions and instructions are two completely different entities. Every transaction includes one or more instructions.
Unfortunately, deserialising tran…