# usePrepareSwap | @account-kit/react

> Overview of the usePrepareSwap hook from @account-kit/react

> For the complete documentation index, see [llms.txt](/docs/llms.txt).

{/* This file is auto-generated by TypeDoc. Do not edit manually. */}

```ts
function usePrepareSwap(params): UsePrepareSwapResult;
```

Defined in: [account-kit/react/src/hooks/usePrepareSwap.ts:85](https://github.com/alchemyplatform/aa-sdk/blob/main/account-kit/react/src/hooks/usePrepareSwap.ts#L85)

Hook for requesting swap quotes from a smart account.

This hook provides functionality to request swap quotes for token swaps.

## Example

```ts twoslash
import { usePrepareSwap } from "@account-kit/react";

const { prepareSwapAsync, isPreparingSwap, error } = usePrepareSwap();

// Request a swap quote
const quote = await prepareSwapAsync({
  fromToken: "0x...",
  toToken: "0x...",
  minimumToAmount: "0x...",
});
```

## Remarks

- This hook only works with smart accounts and does not support EOA wallets
- The hook handles the quote request step of the swap flow
- The returned quote can be used with `useSignAndSendPreparedCalls` to complete the swap.

## Parameters

<table>
  <thead>
    <tr>
      <th align="left">Parameter</th>
      <th align="left">Type</th>
      <th align="left">Description</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `params`
      </td>

      <td>
        [`UsePrepareSwapParams`](../type-aliases/UsePrepareSwapParams)
      </td>

      <td>
        Configuration parameters for the hook
      </td>
    </tr>

  </tbody>
</table>

## Returns

[`UsePrepareSwapResult`](../type-aliases/UsePrepareSwapResult)

An object containing:

- `prepareSwap`: Function to request quote and prepare the swap synchronously
- `prepareSwapAsync`: Async function to request quote and prepare the swap (returns Promise)
- `quote`: The result of the last successful quote request
- `isPreparingSwap`: Boolean indicating if a quote is currently being requested
- `error`: Error from the last failed quote request, if any