# dropAndReplaceUserOperation | @aa-sdk/core

> Overview of the dropAndReplaceUserOperation 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 dropAndReplaceUserOperation<
  TTransport,
  TChain,
  TAccount,
  TContext,
  TEntryPointVersion,
>(client_, args): Promise<SendUserOperationResult<TEntryPointVersion>>;
```

Defined in: [aa-sdk/core/src/actions/smartAccount/dropAndReplaceUserOperation.ts:50](https://github.com/alchemyplatform/aa-sdk/blob/main/aa-sdk/core/src/actions/smartAccount/dropAndReplaceUserOperation.ts#L50)

Drops an existing user operation and replaces it with a new one while ensuring the appropriate fees and overrides are applied.

## Example

```ts
import {
 createSmartAccountClient,
} from "@aa-sdk/core";

// smart account client is already extended with dropAndReplaceUserOperation
const client = createSmartAccountClient(...);
const { request } = await client.sendUserOperation(...);
const result = await client.dropAndReplaceUserOperation({
 uoToDrop: request,
 account, // only required if the client above is not connected to an account
});
```

## Type Parameters

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

  <tbody>
    <tr>
      <td>
        `TTransport` *extends* [`Transport`](https://viem.sh)
      </td>

      <td>
        [`Transport`](https://viem.sh)
      </td>
    </tr>

    <tr>
      <td>
        `TChain` *extends* `undefined` | [`Chain`](https://viem.sh)
      </td>

      <td>
        `undefined` | [`Chain`](https://viem.sh)
      </td>
    </tr>

    <tr>
      <td>
        `TAccount` *extends* `any`
      </td>

      <td>
        `any`
      </td>
    </tr>

    <tr>
      <td>
        `TContext` *extends* `any`
      </td>

      <td>
        `any`
      </td>
    </tr>

    <tr>
      <td>
        `TEntryPointVersion` *extends* `GetEntryPointFromAccount`\<`TAccount`>
      </td>

      <td>
        `GetEntryPointFromAccount`\<`TAccount`>
      </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>
        `client_`
      </td>

      <td>
        [`Client`](https://viem.sh)\<`TTransport`, `TChain`, `TAccount`>
      </td>

      <td>
        The client instance with the transport, chain, and account information
      </td>
    </tr>

    <tr>
      <td>
        `args`
      </td>

      <td>
        `DropAndReplaceUserOperationParameters`\<`TAccount`, `TContext`>
      </td>

      <td>
        The parameters required for dropping and replacing the user operation including the account, operation to drop, overrides, and context
      </td>
    </tr>

  </tbody>
</table>

## Returns

`Promise`\<`SendUserOperationResult`\<`TEntryPointVersion`>>

A promise that resolves to the result of sending the new user operation