# alchemyGasAndPaymasterAndDataMiddleware | @account-kit/infra

> Overview of the alchemyGasAndPaymasterAndDataMiddleware 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 alchemyGasAndPaymasterAndDataMiddleware(
  params,
): Pick<
  ClientMiddlewareConfig,
  "dummyPaymasterAndData" | "feeEstimator" | "gasEstimator" | "paymasterAndData"
>;
```

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

Paymaster middleware factory that uses Alchemy's Gas Manager for sponsoring
transactions. Uses Alchemy's custom `alchemy_requestGasAndPaymasterAndData`
method instead of conforming to the standard ERC-7677 interface. Note that
if you use `createAlchemySmartAccountClient`, this middleware is already
used by default and you do not need to manually include it.

## Example

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

const client = createSmartAccountClient({
  transport: alchemy({ apiKey: "your-api-key" }),
  chain: sepolia,
  ...alchemyGasAndPaymasterAndDataMiddleware({
    policyId: "policyId",
    transport: alchemy({ apiKey: "your-api-key" }),
  }),
});
```

## 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>
        `AlchemyGasAndPaymasterAndDataMiddlewareParams`
      </td>

      <td>
        configuration params
      </td>
    </tr>

  </tbody>
</table>

## Returns

`Pick`\<[`ClientMiddlewareConfig`](../../../../../aa-sdk/core/src/type-aliases/ClientMiddlewareConfig),
| `"dummyPaymasterAndData"`
| `"feeEstimator"`
| `"gasEstimator"`
| `"paymasterAndData"`>

partial client middleware configuration containing `dummyPaymasterAndData`, `feeEstimator`, `gasEstimator`, and `paymasterAndData`