Skip to content

isModuleInstalled

Checks if an ERC-7579 module is installed on the smart account. Check out this guide for a complete tutorial.

Usage

example.ts
import { erc7579Actions } from "permissionless/actions/erc7579"
import { owner } from "../owner"
import { toSafeSmartAccount } from "permissionless/accounts"
 
const safeAccount = await toSafeSmartAccount({
	client: publicClient,
	owners: [owner],
	entryPoint: {
		address: entryPoint07Address,
		version: "0.7",
	}, // global entrypoint
	version: "1.4.1",
})
 
// Extend the client with the ERC7579 actions
const smartAccountClient = createSmartAccountClient({
	account: safeAccount,
	chain: sepolia,
	bundlerTransport: http(pimlicoUrl),
	paymaster: pimlicoClient,
	userOperation: {
		estimateFeesPerGas: async () => {
			return (await pimlicoClient.getUserOperationGasPrice()).fast
		},
	},
}).extend(erc7579Actions())
 
const ownableExecutorModule = "0xc98B026383885F41d9a995f85FC480E9bb8bB891"
 
const moduleData = encodePacked(["address"], ["0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"])
const isInstalled = await smartAccountClient.isModuleInstalled({
	type: "executor",
	address: ownableExecutorModule,
	context: moduleData,
})
 

Returns

  • Type: boolean

True if the module is installed, false otherwise.

Parameters

address

  • Type: Address

Address of the module to install.

type

  • Type: ModuleType

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

context

  • Type: Hex

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