> ## Documentation Index
> Fetch the complete documentation index at: https://docs.soroswap.finance/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Soroswap Aggregator API: base URL https://api.soroswap.finance, pick the network with ?network=mainnet or ?network=testnet (omitted means mainnet).
> Auth: Authorization: Bearer sk_... on every call. Get a key at https://console.soroswap.finance/register. A missing or invalid key returns 401 with code and registerUrl (POST /send returns 403 instead); an expired JWT or a missing role returns 403. Free plan 1 request/s; see https://docs.soroswap.finance/api/plans.md.
> Flow: POST /quote (assetIn, assetOut as C... contract addresses, amount as an integer string in the smallest unit, tradeType, protocols) -> POST /quote/build with the unchanged quote and from -> the user signs the XDR -> POST /send. Build right after quoting: a Soroban XDR is valid for 180 seconds. Submit it as is, never re-simulate it.
> Partner id: every account has one (9 hex chars, permanent). Read partnerId from GET /partner, or in the console at https://console.soroswap.finance under Fees & payouts. The partner fee itself is switched on by Soroswap; see https://docs.soroswap.finance/api/fees.md.
> AI tools: docs MCP at https://docs.soroswap.finance/mcp (claude mcp add --transport http soroswap-docs https://docs.soroswap.finance/mcp), skill with npx skills add https://docs.soroswap.finance. Other clients: https://docs.soroswap.finance/api/build-with-ai.md.
> Units and Stellar pitfalls: https://docs.soroswap.finance/api/stellar-gotchas.md. Errors and retries: https://docs.soroswap.finance/api/errors.md.

# Doing Swap

> Performing a token swap on Soroswap, covering wallet connection, trustlines, confirmation, and best practices.

Now that you have successfully added liquidity to a pool, let's move on to the next step: doing swaps. Swapping tokens on Soroswap allows you to exchange one token for another within the liquidity pool. Follow the steps below to perform a swap:

> [!NOTE]
>
> The screenshots on this page were captured in 2024. The steps still describe the flow, but the interface may look different from what you see today.

## Step 1: Access Soroswap

Open the Soroswap app at [app.soroswap.finance](https://app.soroswap.finance). This takes you straight to the swap interface.

## Step 2: Connect Your Wallet to Soroswap.Finance

1. **Choose a Stellar Wallet:** Select a wallet compatible with the Stellar network. For assistance, refer to this article: [Guide to Choosing a Stellar Wallet](https://dev.to/soroswap/guide-to-choosing-wallet-for-the-stellar-network-53k1).

![](https://mintcdn.com/soroswap/1xzCGA5zGx88_Gb9/images/captura-de-pantalla-2024-09-18-a-las-18-21-42.png?fit=max\&auto=format\&n=1xzCGA5zGx88_Gb9\&q=85\&s=8ea8e68baa759b5e8a4b57e516b6b8e0)

2. **Acquire Stellar (XLM):** Purchase XLM from a reputable exchange or transfer it from another wallet if you already possess some.
3. **Deposit XLM into Your Wallet:** Transfer the XLM to your Stellar wallet address.

> If this is your first time, ensure you acquire and transfer Stellar (XLM) to your wallet.

## Step 3: Navigate the Soroswap Finance Interface

Once your Stellar wallet is connected, familiarize yourself with the Soroswap dashboard. It displays your account details, token balances, and options for swapping tokens and managing your assets.

![](https://mintcdn.com/soroswap/1xzCGA5zGx88_Gb9/images/captura-de-pantalla-2024-09-18-a-las-18-44-15.png?fit=max\&auto=format\&n=1xzCGA5zGx88_Gb9\&q=85\&s=aee00be8d8caa7ab30f8f0df801a43c4)

## Step 4: Execute a Token Swap

1. **Select Tokens:** Choose the tokens you wish to swap from and to.

![](https://mintcdn.com/soroswap/1xzCGA5zGx88_Gb9/images/captura-de-pantalla-2024-09-18-a-las-18-28-46-1.png?fit=max\&auto=format\&n=1xzCGA5zGx88_Gb9\&q=85\&s=d69644be99633dae1a0444a053041a20)

2. **Enter Amount:** Specify the amount of tokens you want to exchange.

![](https://mintcdn.com/soroswap/1xzCGA5zGx88_Gb9/images/captura-de-pantalla-2024-09-18-a-las-18-51-21.png?fit=max\&auto=format\&n=1xzCGA5zGx88_Gb9\&q=85\&s=a244d15be824ed1207a628e077f90b23)

## Step 5: Trustlines

When swapping a new token for the first time on Soroswap.Finance, you’ll need to sign a "trustline" transaction. Trustlines authorize your account to hold and exchange the specific asset.

1. **Transaction Request:** A transaction request will be sent to authorize your wallet to hold and trade the new token.

![](https://mintcdn.com/soroswap/1xzCGA5zGx88_Gb9/images/captura-de-pantalla-2024-09-18-a-las-18-30-06.png?fit=max\&auto=format\&n=1xzCGA5zGx88_Gb9\&q=85\&s=f67edb57174bb67e7a59214331584856)

2. **Sign the Trustline Transaction:** Sign the transaction to authorize the trustline, allowing your wallet to manage the new asset.

![](https://mintcdn.com/soroswap/1xzCGA5zGx88_Gb9/images/captura-de-pantalla-2024-09-18-a-las-19-16-39.png?fit=max\&auto=format\&n=1xzCGA5zGx88_Gb9\&q=85\&s=93e7e87b85214fb416f3ac19e2896a6d)

For more information, refer to the official documentation on [trustlines](https://docs.soroswap.finance/concepts/trustlines.md).

## Step 6: Confirm the transaction

1. **Sign the Transaction:** Your wallet will display the transaction details. Review and approve it to confirm the swap.

![](https://mintcdn.com/soroswap/1xzCGA5zGx88_Gb9/images/captura-de-pantalla-2024-09-18-a-las-16-20-22.png?fit=max\&auto=format\&n=1xzCGA5zGx88_Gb9\&q=85\&s=17ed4a518db702e5c3636353d7c2cb1a)

Congratulations! You have successfully completed a swap on Soroswap.Finance Now.\\

![](https://mintcdn.com/soroswap/1xzCGA5zGx88_Gb9/images/captura-de-pantalla-2024-09-18-a-las-21-01-45.png?fit=max\&auto=format\&n=1xzCGA5zGx88_Gb9\&q=85\&s=00566c6e3525ee813c2a33465ec92ca2)

## Step 7: Check That Your Transaction Went Through

After signing the transaction, it's important to confirm that everything went smoothly. To do this, check the details in your wallet or by using one of the blockchain explorers. This step ensures that the token swap has been completed and that the new tokens are now visible in your balance.

![](https://mintcdn.com/soroswap/1xzCGA5zGx88_Gb9/images/captura-de-pantalla-2024-09-18-a-las-21-58-54.png?fit=max\&auto=format\&n=1xzCGA5zGx88_Gb9\&q=85\&s=ce56954918eb1efba320f326ef9febd3)

Once the transaction is confirmed, you’ll see a success message indicating the swap is complete. At this point, you can review the transaction details by selecting one of these options:

* [**View in Stellar.Expert**](https://stellar.expert/explorer)
* [**View in StellarChain**](https://stellarchain.io/)

### **Best Practices**

1. **Sufficient XLM for Fees:** Ensure your wallet contains enough XLM to cover transaction fees.
2. **Review Trustlines:** Confirm that all necessary trustlines are established before initiating a swap.
3. **Check Transaction History:** Verify in your wallet that the swap is complete and that the new tokens are reflected in your balance.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.