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

# Swap Tokens

A swap exchanges one token for another **on the same chain**. Archer fetches a live quote from the best aggregator (Bungee for EVM, Jupiter for Solana), checks your balance and gas, and presents a Confirm/Cancel modal before anything is signed.

## Basic Swaps

* *"Swap 100 USDC for ETH on Arbitrum"*
* *"Swap 0.5 ETH to USDC on Base"*
* *"Buy SOL with 50 USDC on Solana"*

## USD-Denominated Amounts

Don't know the exact token amount? Phrase it in dollars:

* *"Swap $10 worth of ETH to USDC on Base"*
* *"Buy $50 of SOL on Solana"*

Archer fetches the live price, calculates the token amount, and shows you both the USD and token values before confirming.

<figure><img src="/files/O33krHbGlvP9YKWJxr4N" alt="" width="563"><figcaption></figcaption></figure>

## Max / All-In Swaps

* *"Swap all my USDC for ETH on Arbitrum"*
* *"Swap my entire SOL balance to USDC"*

For ERC-20 and SPL tokens, Archer uses your full balance. For native tokens (ETH, SOL, POL, etc.), it automatically reserves a small amount for gas so your transaction can actually execute.

## Relative Amounts

You can also use fractions:

* *"Swap half my ETH for USDC on Base"*
* *"Swap a third of my BONK to SOL"*

Archer reads your current balance and calculates the amount.

## Specifying Slippage

* *"Swap 100 USDC to ETH on Arbitrum with 1% slippage"*

Default slippage is 0.5%. You can override it per-transaction. Minimum is 0.1%, maximum is 50%.

## What Happens When You Confirm

1. Archer fetches a fresh quote (quotes typically expire in 60–90 seconds)
2. The aggregator (Bungee or Jupiter) returns the best route across DEXs
3. Archer prepares the unsigned transaction
4. You see a Confirm/Cancel modal showing: input amount, expected output, route, slippage, gas estimate, TVR fee
5. On confirm, you sign with your embedded wallet (or the server signs in a Privy TEE if you've enabled it)
6. Archer submits the transaction and reports the result back in the thread

## Sample Output Structure (MCP / API)

When called via MCP, `prepare_swap_tx` returns a structured payload:

```json
{
  "status": "OK",
  "transactionRequest": {
    "to": "0x...",
    "data": "0x...",
    "value": "0",
    "chainId": 42161,
    "signingTarget": "primary"
  },
  "humanSummary": "Swap 100 USDC to ETH on Arbitrum",
  "expectedOutput": {
    "token": "ETH",
    "amount": "0.0298",
    "amountUsd": "100.00"
  },
  "route": "Bungee → Uniswap V3",
  "slippageBps": 50,
  "gasEstimateUsd": "0.04",
  "tvrFeeUsd": "0.10",
  "expiresAt": "2026-04-28T14:32:18Z"
}
```

## Supported Chains

Swaps are supported on every chain Archer covers — see [Supported Tokens & Networks](/archer.bot/reference/supported-tokens-and-networks.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://archer-bot.gitbook.io/archer.bot/intents/swap-tokens.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
