How to use ModuleKit with different accounts
The ModuleKit is integrated with a range of modular smart accounts. When you write your integration tests and use makeAccountInstance
, you can easily switch between different accounts. Alternatively, you can also use the setAccountEnv
function to use a specific account type for a specific test.
Write your tests
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:
// Create an account instance
AccountInstance memory instance = makeAccountInstance("account1");
// Execute a UserOperation on the account
instance.exec({ target: address(1), value: 1 wei, callData: "" });
Run your tests against different accounts
To do this, run:
ACCOUNT_TYPE=... forge test
where the options are:
DEFAULT
: The ERC-7579 Reference Implementation (note: this is equivalent to emitting theACCOUNT_TYPE
environment variable)SAFE
: The Safe accountKERNEL
: The Kernel accountNEXUS
: The Nexus accountCUSTOM
: A custom account