Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs-site
Submodule docs-site updated 37 files
+30 −0 fern/api-reference/op-mainnet/flashblocks-api-quickstart.mdx
+0 −3 fern/apis/arbitrum-nova/generators.yaml
+3 −0 fern/apis/arbnova/generators.yaml
+0 −3 fern/apis/token-api/generators.yaml
+3 −0 fern/apis/token/generators.yaml
+29 −0 fern/assets/styles.css
+29 −1 fern/changelog/2025-08-21.md
+4 −2 fern/docs.yml
+0 −65 src/openapi/eth-beacon/eth-beacon.yaml
+24 −20 src/openapi/portfolio/portfolio.yaml
+0 −0 src/openrpc/alchemy/token/token.yaml
+41 −794 src/openrpc/chains/abstract/abstract.yaml
+41 −802 src/openrpc/chains/apechain/apechain.yaml
+62 −1,681 src/openrpc/chains/arb/arb.yaml
+0 −0 src/openrpc/chains/arbnova/arbnova.yaml
+45 −1,427 src/openrpc/chains/astar/astar.yaml
+61 −740 src/openrpc/chains/avax/avax.yaml
+42 −804 src/openrpc/chains/berachain/berachain.yaml
+58 −802 src/openrpc/chains/blast/blast.yaml
+67 −1,041 src/openrpc/chains/bnb/bnb.yaml
+41 −802 src/openrpc/chains/crossfi/crossfi.yaml
+72 −1,687 src/openrpc/chains/eth/eth.yaml
+45 −806 src/openrpc/chains/flow/flow.yaml
+56 −802 src/openrpc/chains/gnosis/gnosis.yaml
+42 −804 src/openrpc/chains/ink/ink.yaml
+41 −802 src/openrpc/chains/lens/lens.yaml
+60 −906 src/openrpc/chains/linea/linea.yaml
+54 −802 src/openrpc/chains/mantle/mantle.yaml
+63 −1,593 src/openrpc/chains/opt/opt.yaml
+41 −802 src/openrpc/chains/rootstock/rootstock.yaml
+58 −802 src/openrpc/chains/scroll/scroll.yaml
+41 −1,427 src/openrpc/chains/sei/sei.yaml
+61 −804 src/openrpc/chains/shape/shape.yaml
+43 −1,508 src/openrpc/chains/superseed/superseed.yaml
+66 −808 src/openrpc/chains/worldchain/worldchain.yaml
+61 −806 src/openrpc/chains/zetachain/zetachain.yaml
+94 −1,970 src/openrpc/chains/zksync/zksync.yaml
18 changes: 9 additions & 9 deletions docs/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,25 +190,25 @@ navigation:
contents:
- page: Overview
path: wallets/pages/transactions/overview.mdx
- page: Send Transactions
- page: Send transactions
path: wallets/pages/transactions/send-transactions.mdx
- page: Sign Requests
- page: Sign requests
path: wallets/pages/transactions/sign-requests.mdx
- page: Using EIP-7702
path: wallets/pages/transactions/using-eip-7702.mdx
- page: Send Batched Transactions
- page: Send batched transactions
path: wallets/pages/transactions/send-batched-transactions.mdx
- page: Sponsor Gas
- page: Sponsor gas
path: wallets/pages/transactions/sponsor-gas.mdx
- page: Pay Gas With Any Token
- page: Pay gas with any token
path: wallets/pages/transactions/pay-gas-with-any-token.mdx
- page: Swap Tokens
- page: "[NEW] Swap tokens"
path: wallets/pages/transactions/swap-tokens.mdx
- page: Send Parallel Transactions
- page: Send parallel transactions
path: wallets/pages/transactions/send-parallel-transactions.mdx
- page: Retry Transactions
- page: Retry transactions
path: wallets/pages/transactions/retry-transactions.mdx
- page: Track Transaction Status
- page: Track transaction status
path: wallets/pages/transactions/track-transaction-status.mdx
- section: Solana
contents:
Expand Down
80 changes: 80 additions & 0 deletions docs/pages/transactions/swap-tokens.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
title: Swaps (Alpha)
slug: wallets/transactions/swap-tokens
---

The Swap API is the easiest way to integrate single-chain token swaps in your app. Cross-chain swaps are coming soon!

Key benefits:

- **Single-step flows:** Batch approve + swap + post-swap action (ex: deposits, transfers, contract calls) into a single transaction - made possible by smart wallets
- **Low latency:**
- Built natively into Smart Wallets. Enables preparing gasless swaps with a single API call
- No need to make calls to two providers to perform a swap
- **Simplified stack:** No need for third-party swap integrations

Key use cases:

- Native token swaps: Enable users to do gasless swaps without ever leaving your app
- Transact with any token: Let users transact with any token they have in their wallet (ex: ETH, WLD), while your contracts still receive your preferred token(ex: USDC).

<Tip>
The Swaps API is in early access. The service is production ready, however there may be changes in the future to simplify the endpoint. We will let you know if/when that happens.

[Request early access!](https://alchemyapi.typeform.com/to/pkjSr57v)

</Tip>

# The Swap flow

## **Flow**

1. Request a swap quote
2. Sign the prepared calls (swap + post swap action)
3. Send prepared calls (swap + post swap action)
4. Poll for confirmation

## **Swap options**

```tsx
// Mode 1: Swap exact input amount
{
fromAmount: "0x2710";
} // Swap exactly 0.01 USDC (10000 in hex, 6 decimals)

// Mode 2: Get minimum output amount
{
minimumToAmount: "0x5AF3107A4000";
} // Get at least 0.0001 ETH (18 decimals). We calculate how much USDC you need to spend to get at least your desired ETH amount!
```

<Tabs>
<Tab title="React"></Tab>
<Tab title="Other JS"></Tab>
<Tab title="APIs"></Tab>
</Tabs>

# FAQs

## What chains are supported?

Chains supported (for now) are: Ethereum, Arbitrum, Base, Berachain, BSC/BNB, Ink, Monad, Optimism, Polygon, Unichain and World Chain mainnets.

## Does the Swap API support cross-chain swaps?

Currently, the Swap API supports only single-chain swaps. Cross-chain swaps are coming soon!

## How do you encode values?

Values are simply passed as hexadecimal strings. The Swap API doesn't add complexity to consider decimals, so 0x01 is always the smallest amount of a given asset.
1 ETH, or DAI (18 decimals) is `0xDE0B6B3A7640000`
1 USDC (6 decimals) is `0xF4240`
This removes any ambiguity— if it’s numerical, it’s a hex.

## What is the expiry?

The expiry is an informational indicator of when you can expect to be able to process the swap request. If you’re at/near the expiry, it might be a good time to request a new quote.

## What if I’m using React?

Use the `@account-kit/react` package to access a `smartWalletClient`. This package automatically uses the Signer for user authentication & signing. [Check out the docs for getting started with React to learn more](/wallets/react/quickstart).
Loading