# erc7677Middleware | @aa-sdk/core

> Overview of the erc7677Middleware function from @aa-sdk/core

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

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

```ts
function erc7677Middleware<TContext>(
  params?,
): Required<
  Pick<ClientMiddlewareConfig, "dummyPaymasterAndData" | "paymasterAndData">
>;
```

Defined in: [aa-sdk/core/src/middleware/erc7677middleware.ts:97](https://github.com/alchemyplatform/aa-sdk/blob/main/aa-sdk/core/src/middleware/erc7677middleware.ts#L97)

Middleware function for interacting with ERC-7677 enabled clients. It supports resolving paymaster and data fields for user operations.
This middleware assumes that your RPC provider supports the ERC-7677 methods (pm_getPaymasterStubData and pm_getPaymasterData).

## Example

```ts
import { createSmartAccountClient, erc7677Middleware } from "@aa-sdk/core";
import { http } from "viem";
import { sepolia } from "viem/chains";

const client = createSmartAccountClient({
  transport: http("rpc-url"),
  chain: sepolia,
  // this assumes that your RPC provider supports the ERC-7677 methods AND takes no context
  ...erc7677Middleware(),
});
```

## 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` | `Record`\<`string`, `any`>
      </td>

      <td>
        `undefined` | `Record`\<`string`, `any`>
      </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>
        `params?`
      </td>

      <td>
        [`Erc7677MiddlewareParams`](../type-aliases/Erc7677MiddlewareParams)\<`TContext`, `EntryPointVersion`>
      </td>

      <td>
        Middleware parameters including context function or object. Context can be resolved dynamically by passing in a function which takes in the context at the time of sending a user op
      </td>
    </tr>

  </tbody>
</table>

## Returns

`Required`\<`Pick`\<`ClientMiddlewareConfig`, `"dummyPaymasterAndData"` | `"paymasterAndData"`>>

An object containing middleware functions `dummyPaymasterAndData` and `paymasterAndData` for processing user operations with the paymaster data