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

# Swap tokens

> Swap tokens on supported EVM chains and Solana via Privy wallet actions

Privy enables your app to support token swaps on supported EVM chains and Solana directly from a wallet. Swaps execute as [wallet actions](/wallets/actions/overview), and Privy automates token approvals and transaction submission.

<Note>
  Swaps are executed on third-party decentralized protocols. Privy does not have discretion over how
  a swap is routed to the protocol or the price at which the swap is ultimately executed by the
  blockchain network. Swap rates may differ from quoted estimates due to market volatility,
  liquidity conditions, and slippage. These materials are for general information purposes only and
  are not investment advice or a recommendation or solicitation to engage in any specific
  transaction. Privy does not provide investment, financial, legal, or tax advice.
</Note>

## How it works

<Steps>
  <Step title="Setup">
    [Enable swaps](/wallets/actions/swap/setup) in the Privy Dashboard and configure [gas
    sponsorship](/wallets/gas-and-asset-management/gas/setup) for your app.
  </Step>

  <Step title="Get a quote">
    Call the [quote endpoint](/wallets/actions/swap/get-quote) with the token pair, chain, and
    amount. The response includes estimated output amounts and a gas estimate.
  </Step>

  <Step title="Execute the swap">
    Call the [swap endpoint](/wallets/actions/swap/execute) with the same parameters. The response
    is a wallet action that can be polled for confirmation.
  </Step>
</Steps>

## Supported chains

Swaps are available on the following chains.

<Accordion title="EVM mainnet chains">
  | Chain           | Chain ID | CAIP-2 identifier | Native token |
  | --------------- | -------- | ----------------- | ------------ |
  | Ethereum        | 1        | `eip155:1`        | ETH          |
  | Optimism        | 10       | `eip155:10`       | ETH          |
  | BNB Smart Chain | 56       | `eip155:56`       | BNB          |
  | Unichain        | 130      | `eip155:130`      | ETH          |
  | Polygon         | 137      | `eip155:137`      | POL          |
  | Monad           | 143      | `eip155:143`      | MON          |
  | World Chain     | 480      | `eip155:480`      | ETH          |
  | Tempo           | 4217     | `eip155:4217`     | None         |
  | Base            | 8453     | `eip155:8453`     | ETH          |
  | Arbitrum        | 42161    | `eip155:42161`    | ETH          |
</Accordion>

<Info>Tempo does not have a native token. Specify token contract addresses for Tempo swaps.</Info>

<Accordion title="Solana">
  | Chain          | CAIP-2 identifier                         | Native token |
  | -------------- | ----------------------------------------- | ------------ |
  | Solana mainnet | `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp` | SOL          |
</Accordion>

<Accordion title="EVM testnet chains">
  | Chain            | Chain ID | CAIP-2 identifier | Native token |
  | ---------------- | -------- | ----------------- | ------------ |
  | Unichain Sepolia | 1301     | `eip155:1301`     | ETH          |
  | Monad Testnet    | 10143    | `eip155:10143`    | MON          |
  | Sepolia          | 11155111 | `eip155:11155111` | ETH          |
  | Base Sepolia     | 84532    | `eip155:84532`    | ETH          |
</Accordion>

## Token addresses

Specify token addresses as ERC-20 contract addresses (for EVM chains), TIP-20 contract addresses
(for Tempo), or SPL token mint addresses (for Solana). Use `"native"` only on chains with native
token support (e.g., ETH on Ethereum or SOL on Solana). The `input_token` and `output_token` must be
different.

<Warning>
  Token addresses are chain-specific. Ensure that the addresses provided for `input_token` and
  `output_token` correspond to token contracts deployed on the chain specified in the `caip2` field.
  The same token (e.g., USDC) may have different contract addresses on different chains. Use a
  resource like [Token Lists](https://tokenlists.org/) to source correct addresses for your target
  chain.
</Warning>

## Fees

The following fees may apply when executing a swap. Fees are subject to change.

| Fee                   | Description                                                                                                                                                                                                                                                                                                                                                                            |
| --------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Privy swap fee**    | Privy charges up to 0.25% on each swap, calculated from the input token amount. This fee is included in the swap rate.                                                                                                                                                                                                                                                                 |
| **Protocol fee**      | Underlying DEX protocols charge a fee on each swap. For EVM chains, Uniswap liquidity pools typically charge 0.3% for V2 pools and 0.01%–1% for V3/V4 pools depending on the pool's fee tier. This fee is included in the swap rate.                                                                                                                                                   |
| **Network fee (gas)** | Blockchain transaction processing fees paid to the network. Gas sponsorship is required for swaps, meaning Privy sponsors these fees from your app's gas credits. This includes any token approval transactions required for the swap (e.g., the first time a wallet swaps a given ERC-20 or TIP-20 token). Gas fees fluctuate based on network congestion and transaction complexity. |
| **Relayer fee**       | (Cross-chain only) Paid to the bridge provider for routing the swap across chains. Varies with network conditions and liquidity. Included in `estimated_fees` on the quote response.                                                                                                                                                                                                   |
| **Developer fee**     | (Cross-chain only) A configurable fee allocated to your app. Requires a [custom fees configuration](/wallets/actions/swap/custom-fees). Set via the `fee_configuration` parameter on the quote and swap endpoints. Included in `estimated_fees` on the quote response.                                                                                                                 |

<Info>
  The estimated output amounts returned by the [quote endpoint](/wallets/actions/swap/get-quote)
  reflect the swap rate after Privy and protocol fees. The `gas_estimate` field provides a separate
  estimate of the network fee.
</Info>

## Slippage

Slippage is the difference between the quoted price of a swap and the price at which it executes. Because token prices can change quickly, especially during periods of high volatility or low liquidity, the final execution price may differ from the quoted price.

The `slippage_bps` parameter sets the maximum slippage tolerance in basis points (e.g., `50` for 0.5%). This controls the maximum percentage difference your app is willing to accept between the quoted price and the execution price.

* If the maximum slippage is set too low, the swap may fail if the price moves beyond the specified tolerance.
* If the maximum slippage is set higher, the swap is more likely to succeed, but the wallet may receive a less favorable price if the market moves significantly.
* If a swap fails due to slippage, the wallet is still responsible for any network fees incurred.

Privy enables the use of auto-slippage by omitting the `slippage_bps` parameter. When omitted, an appropriate slippage tolerance is automatically determined based on the tokens being swapped and current market conditions. Your app can also set a specific `slippage_bps` value and use the `minimum_output_amount` from the [quote response](/wallets/actions/swap/get-quote) to verify the minimum tokens received before executing.

## Cross-chain swaps

Privy's swap API supports swapping tokens across different chains. A cross-chain swap routes output tokens to a destination chain — for example, swapping ETH on Base and receiving ETH on Arbitrum, or swapping USDC on Ethereum and receiving SOL on Solana.

Cross-chain swaps use a `source` and `destination` object format with separate `caip2` identifiers for each side. See the [get a quote](/wallets/actions/swap/get-quote#cross-chain-swaps) and [execute a swap](/wallets/actions/swap/execute#cross-chain-swaps) pages for usage.

Supported cross-chain routes mirror those for [transfers](/wallets/actions/transfer/overview#native-bridging):

| Source chain | Supported destination chains               |
| ------------ | ------------------------------------------ |
| Ethereum     | Base, Tempo, Arbitrum, Polygon, Solana     |
| Base         | Ethereum, Tempo, Arbitrum, Polygon, Solana |
| Tempo        | Ethereum, Base, Arbitrum, Polygon, Solana  |
| Arbitrum     | Ethereum, Base, Tempo, Polygon, Solana     |
| Polygon      | Ethereum, Base, Tempo, Arbitrum, Solana    |
| Solana       | Ethereum, Base, Tempo, Arbitrum, Polygon   |

Cross-chain swaps are subject to relayer fees, slippage, and current liquidity conditions. Quotes expire — use the `expires_at` field to detect stale quotes and fetch a fresh one before executing.

## Next steps

<CardGroup cols={2}>
  <Card title="Setup" icon="gear" href="/wallets/actions/swap/setup" arrow>
    Enable swaps and configure routing in the Privy Dashboard.
  </Card>

  <Card title="Get a quote" icon="magnifying-glass-dollar" href="/wallets/actions/swap/get-quote" arrow>
    Fetch a price quote before executing a swap.
  </Card>

  <Card title="Execute a swap" icon="arrow-right-arrow-left" href="/wallets/actions/swap/execute" arrow>
    Execute a token swap from a wallet.
  </Card>

  <Card title="Errors" icon="circle-exclamation" href="/wallets/actions/swap/errors" arrow>
    Error reference for swap APIs.
  </Card>
</CardGroup>
