# Swapping Tokens (/docs/rise-wallet/swapping)

import { SwapWidget } from "@/components/rise-wallet/SwapWidget";
import { ComponentPreviewTabs } from "@/components/rise-wallet/ComponentPreviewTabs";
import { CODE_EXAMPLES } from "@/components/rise-wallet/code-examples";

# Swapping Tokens

Swapping tokens often requires two steps: **Approval** and **Execution**. RISE Wallet supports batching these operations into a single atomic transaction when using EIP-5792 `sendCalls`, providing a much smoother UX.

<ComponentPreviewTabs code={CODE_EXAMPLES.swap}>
  <SwapWidget />
</ComponentPreviewTabs>

## Atomic Batching

Instead of asking the user to sign an "Approve" transaction, wait for it to land, and then sign a "Swap" transaction, you can bundle them together.

```tsx
const approveData = encodeFunctionData({
  abi: ERC20_ABI,
  functionName: "approve",
  args: [ROUTER_ADDRESS, amount],
});

const swapData = encodeFunctionData({
  abi: ROUTER_ABI,
  functionName: "swapExactTokensForTokens",
  args: [amount, minOut, path, recipient, deadline],
});

// Send both calls in one user operation
await sendCallsAsync({
  calls: [
    { to: TOKEN_ADDRESS, data: approveData },
    { to: ROUTER_ADDRESS, data: swapData },
  ],
});
```

This reduces the time users spend waiting and clicking popups, making DeFi feel instant.
