supportsExecutionMode
Checks if a ERC-7579 execution mode is supported 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 isExecutionModeSupported = await smartAccountClient.supportsExecutionMode({
type: "delegatecall",
revertOnError: true,
selector: "0x",
context: "0x",
})
Returns
- Type:
boolean
True if the execution mode is supported, false otherwise.
Parameters
type
- Type:
CallType
Type of the call. Accepted values are "call" | "delegatecall" | "staticcall"
.
revertOnError (optional)
- Type:
boolean
If true, the execution will revert if the call fails. Defaults to false.
selector (optional)
- Type:
Hex
The selector of the function to call. If not provided, 0x
will be used.
context (optional)
- Type:
Hex
Context bytes that will be passed to the module as part of modeContext
.