> For the complete documentation index, see [llms.txt](https://saseul-gold.gitbook.io/saseul-gold-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://saseul-gold.gitbook.io/saseul-gold-docs/dex-api/swap.md).

# Swap

Inter-token exchange must have a liquidity pool for that token pair, and the reserve value for token token\_address\_in must be at least amount.&#x20;

If all conditions are met and the contract is performed, the number of tokens in token\_in\_address from the user's wallet will be transferred to the liquidity pool by amount\_in, and tokens for token\_address\_out will be paid.&#x20;

Setting minimum\_amount\_out prevents swaps when set below the corresponding quantity.

```
{
    "transaction": {
        "type": "Swap",
        "token_address_in": "dc2d6ab6d6a6000fb82931cc6ea3989629d051612701158df1214",
        "token_address_out": "450a8c9a1a72c285d919ef86c673542b5396ee79dffb6b58fc8",
        "amount_in": "100000000000000000000",
        "minimum_amount_out": "50000000000000000000",
        "timestamp": 1735694190022786,
        "from": "f43808a3998233c4336d873880fe4a22fdd7eafdd90e"
    },
    "public_key": "391e87c9ceedb34ecd7f74d4536a33851ce54dbb0c2dfbf1a529816f8ed7",
    "signature": "de081b535e1ef03432dcef296639b44238adf56d41c2cbfd699c5e1478b25"
}
```
