# alchemyUserOperationSimulator | @account-kit/infra

> Overview of the alchemyUserOperationSimulator function from @account-kit/infra

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

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

```ts
function alchemyUserOperationSimulator<TContext>(
  transport,
): ClientMiddlewareFn<TContext>;
```

Defined in: [account-kit/infra/src/middleware/userOperationSimulator.ts:32](https://github.com/alchemyplatform/aa-sdk/blob/main/account-kit/infra/src/middleware/userOperationSimulator.ts#L32)

A middleware function to be used during simulation of user operations which leverages Alchemy's RPC uo simulation method.

## Example

```ts
import {
  alchemyUserOperationSimulator,
  alchemy,
  sepolia,
} from "@account-kit/infra";
import { createSmartAccountClient } from "@aa-sdk/core";

const alchemyTransport = alchemy({
  chain: sepolia,
  apiKey: "your-api-key",
});

const client = createSmartAccountClient({
  chain: sepolia,
  userOperationSimulator: alchemyUserOperationSimulator(alchemyTransport),
  ...otherParams,
});
```

## Type Parameters

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

  <tbody>
    <tr>
      <td>
        `TContext` *extends* `undefined` | `UserOperationContext`
      </td>

      <td>
        `undefined` | `UserOperationContext`
      </td>
    </tr>

  </tbody>
</table>

## Parameters

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

  <tbody>
    <tr>
      <td>
        `transport`
      </td>

      <td>
        `AlchemyTransport`
      </td>

      <td>
        An Alchemy Transport that can be used for making RPC calls to alchemy
      </td>
    </tr>

  </tbody>
</table>

## Returns

`ClientMiddlewareFn`\<`TContext`>

A middleware function to simulate and process user operations