Skip to content

supportsModule

Checks if a ERC-7579 module type is supported by 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 isModuleSupported = await smartAccountClient.supportsModule({
	type: "fallback",
})
 

Returns

  • Type: boolean

True if the module type is supported, false otherwise.

Parameters

type

  • Type: ModuleType

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