I need to create a Program with a function swap_on_dex(...)
which will accept an input token with an amount, a target wallet address and execute a swap for SOL (optionally, for other token) on any popular DEX: Orca, Raydium, Serum, Jupiter.
I haven't found any info about the topic. I've looked into Raydium which is the most popular DEX, yet to no avail.
There're, however, examples of how to execute this on the client side, that is, off-chain. But I need it within a Program - on-chain, in Rust.
How to do it? Any simple example?