The ModuleKit is integrated with the ERC-4337 Validation library in order to make it effortless to ensure modules comply with the restrictions required by the ERC-4337 mempool. You can find the restrictions in the ERC-7562 specifications. Note: alternatively to the below, you can also use the simulateUserOp
function to simulate only specific UserOperations.
To use simulation, you will need to update your foundry.toml
file as follows:
When you write your tests, you can use the makeAccountInstance
function to create an account instance. Then, you can use this instance
to execute transactions, for example:
To do this, run:
If your tests are successful, you are compliant with the ERC-4337 restrictions. Otherwise, you will receive an error message.