<VersionWarning version="0.1" />

# uninstallModule

Uninstalls a [ERC-7579](https://eips.ethereum.org/EIPS/eip-7579) module from the smart account. Check out [this guide](/references/permissionless/how-to/accounts/use-erc7579-account) for a complete tutorial.

## Usage

:::code-group
```ts [example.ts]
import { erc7579Actions } from "permissionless/actions/erc7579"

const safeAccount = await signerToSafeSmartAccount(publicClient, {
	signer,
	safeVersion: "1.4.1",
	entryPoint: ENTRYPOINT_ADDRESS_V07,
	safe4337ModuleAddress: "0x7579EE8307284F293B1927136486880611F20002",
	erc7579LaunchpadAddress: "0x7579011aB74c46090561ea277Ba79D510c6C00ff",
	attesters: ["0x000000333034E9f539ce08819E12c1b8Cb29084d"],
	attestersThreshold: 1,
})

// Extend the client with the ERC7579 actions
const smartAccountClient = createSmartAccountClient({
	account: safeAccount,
	entryPoint: ENTRYPOINT_ADDRESS_V07,
	chain: sepolia,
	bundlerTransport: http(bundlerUrl),
	middleware: {
		gasPrice: async () => {
			return (await pimlicoBundlerClient.getUserOperationGasPrice()).fast
		},
		sponsorUserOperation: pimlicoBundlerClient.sponsorUserOperation,
	},
}).extend(erc7579Actions({ entryPoint: ENTRYPOINT_ADDRESS_V07 }))

const ownableExecutorModule = "0x4Fd8d57b94966982B62e9588C27B4171B55E8354"

const moduleData = encodePacked(["address"], ["0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"])
const userOpHash = await smartAccountClient.uninstallModule({
	type: "executor",
	address: ownableExecutorModule,
	context: moduleData,
})

const receipt = await pimlicoBundlerClient.waitForUserOperationReceipt({ hash: userOpHash })
```

```ts [publicClient.ts]
import { createPublicClient, http } from "viem"

export const publicClient = createPublicClient({
	transport: http("https://sepolia.rpc.thirdweb.com"),
})
```

```ts [signer.ts]
import { generatePrivateKey, privateKeyToAccount } from "viem/accounts"

const privateKey = generatePrivateKey()

export const signer = privateKeyToAccount(privateKey)
```
:::

## Returns

* **Type:** `hash`

The user operation hash.

:::warning
This is a user operation hash, not a transaction hash, you must use `waitForUserOperationReceipt` to wait for the user operation to be included onchain.
:::

## Parameters

### address

* **Type:** `Address`

Address of the module to uninstall.

### type

* **Type:** `ModuleType`

Type of the module to uninstall. Accepted values are `"validator" | "executor" | "fallback" | "hook"`.

### context

* **Type:** `Hex`

Context bytes that will be passed to the module as part of `deInitData`.

### maxFeePerGas (optional)

* **Type:** `bigint`

The maximum fee per gas that the user is willing to pay for this user operation. If not provided, the bundler will use its own recommendation.

### maxPriorityFeePerGas (optional)

* **Type:** `bigint`

The maximum priority fee per gas that the user is willing to pay for this user operation. If not provided, the bundler will use its own recommendation.

### nonce (optional)

* **Type:** `bigint`

The nonce of the smart account that will be used to send this user operation. If not provided, current nonce will be used.
