Skip to main content
Privy enables your app to support token swaps on supported EVM chains directly from a wallet. Swaps route through Uniswap and execute as wallet actions. Privy automates token approvals and transaction submission.
Swaps are executed on third-party decentralized protocols such as Uniswap. 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.

How it works

1

Setup

Enable swaps in the Privy Dashboard and configure gas sponsorship for your app.
2

Get a quote

Call the quote endpoint with the token pair, chain, and amount. The response includes estimated output amounts and a gas estimate.
3

Execute the swap

Call the swap endpoint with the same parameters. The response is a wallet action that can be polled for confirmation.

Supported chains

Swaps are available on the following EVM chains. Solana and Bitcoin support are coming soon.
| 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 | | Base | 8453 | eip155:8453 | ETH | | Arbitrum | 42161 | eip155:42161 | ETH |
| 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 |

Token addresses

Specify token addresses as ERC-20 contract addresses, or use "native" for the chain’s native token (e.g., ETH on Ethereum, POL on Polygon). The input_token and output_token must be different.
Token contract 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 to source correct addresses for your target chain.

Fees

The following fees may apply when executing a swap. Fees are subject to change.
FeeDescription
Privy swap feePrivy charges up to 0.25% on each swap, calculated from the input token amount. This fee is included in the swap rate.
Uniswap protocol feeUniswap liquidity pools charge a protocol fee on each swap (typically 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 token). Gas fees fluctuate based on network congestion and transaction complexity.
The estimated output amounts returned by the quote endpoint reflect the swap rate after Privy and Uniswap protocol fees. The gas_estimate field provides a separate estimate of the network fee.

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 to verify the minimum tokens received before executing.

Next steps

Setup

Enable swaps and configure routing in the Privy Dashboard.

Get a quote

Fetch a price quote before executing a swap.

Execute a swap

Execute a token swap from a wallet.

Errors

Error reference for swap APIs.