raydium-io / raydium-amm

Constant product AMM integrated with the OpenBook CLOB
Apache License 2.0
73 stars 61 forks source link

How to swap assets on-chain? #3

Closed GildedHonour closed 1 month ago

GildedHonour commented 5 months ago

SOL <-> token or vise versa, or token <-> token

How does one swap assets on-chain? Within a smart contract or program. Is there an example?

RainRaydium commented 1 month ago

Please refer to https://github.com/raydium-io/raydium-sdk-V2-demo/blob/master/src/amm/swap.ts