Base ERC-7579 Methods
The Nexus Client provides several methods for interacting with User Operations and the blockchain:
installModule
Installs the module on the smart account.
Usage Exampleconst userOpReceipt: UserOpReceipt = await smartAccount.installModule({
moduleAddress: K1_VALIDATOR,
type: 'validator',
data: encodePacked(["address"], [await smartAccount.getAddress()])
})
- moduleAddress (
Address
, required) - type (ModuleType, required)
- data (
0x${string}
| undefined, optional)
Promise<UserOpReceipt>
: A promise of UserOpReceipt
uninstallModule
Uninstalls the module of the smart account.
Usage Exampleawait smartAccount.uninstallModule(moduleAddress, ModuleType.Validation);
- moduleAddress (
Address
, required) - type (ModuleType, required)
- moduleSelector (
0x${string}
| undefined, optional) This will only be needed when uninstallingFallback
modules - data (
0x${string}
| undefined, optional)
Promise<UserOpReceipt>
: A promise of UserOpReceipt
isModuleInstalled
Checks if a module is installed on the smart account.
Usage Exampleconst isInstalled: boolean = await smartAccount.isModuleInstalled({
type,
moduleAddress
});
- type (ModuleType, required)
- moduleAddress (
Address
, required) - data (
0x${string}
| undefined, optional)
Promise<boolean>
: A promise of a boolean
getPreviousModule
Gets the pointer to the previously installed module based on given moduleAddress
and type
const previousModule = await smartAccount.getPreviousModule({
moduleAddress,
type
});
- moduleAddress (
Address
, required) - type (ModuleType, required)
Promise<{moduleAddress: Address; type: ModuleType}>
: A promise of an object
getInstalledValidators
Gets the installed validators
Usage Exampleconst validators = await smartAccount.getInstalledValidators();
Promise<Address[]>
: A promise of validator addresses
getInstalledExecutors
Gets the installed executors
Usage Exampleconst executors = await smartAccount.getInstalledExecutors();
Promise<Address[]>
: A promise of executor addresses
getInstalledModules
Gets all the installed modules
Usage Exampleconst modules = await smartAccount.getInstalledModules();
Promise<Address[]>
: A promise of module addresses
getActiveHook
Gets the active hook module
Usage Exampleconst hook = await smartAccount.getActiveHook();
Promise<Address>
: A promise of a hook address
getFallbackBySelector
Gets the fallback module by the selector
Usage Exampleconst fallback = await smartAccount.getFallbackBySelector();
- selector (
Hex
, optional) The fallback module selector, if not passed, the GENERIC_FALLBACK_SELECTOR will be used
Promise<Address>
: A promise of a fallback module address
supportsModule
Check if the smart account supports a module
Usage Exampleconst isSupported = await smartAccount.supportsModule(ModuleType.Hook);
- type (ModuleType, required)
Promise<boolean>
: A promise of a boolean
sendTransactionWithExecutor
Sends a transaction using an active executor module.
Usage Exampleconst userOpReceipt: UserOpReceipt = await smartAccount.sendTransactionWithExecutor(
[transaction],
ownedAccountAddress
)
- manyOrOneTransactions (Transaction |
Transaction[]
, required) - ownedAccountAddress (
Address
, required)
Promise<UserOpReceipt>
: A promise of UserOpReceipt
Transaction Methods
- sendTransaction - Submit a User Operation to the pool
- sendUserOperation - Submit a customized User Operation
- sendTokenPaymasterUserOp - Send a User Operation with token paymaster
Preparation Methods
- prepareTokenPaymasterUserOp - Prepare a User Operation with token paymaster
- prepareUserOperation - Prepare a User Operation without sending
Status & Information Methods
- waitForUserOperationReceipt - Wait for a User Operation to be included in a block
- estimateUserOperationGas - Estimate gas values for a User Operation
- getUserOperation - Get information about a User Operation
- debugUserOperation - Debug a User Operation with detailed information
- getUserOperationReceipt - Get the User Operation Receipt given a User Operation hash
Network Methods
- getSupportedEntryPoints - Get supported EntryPoints
- getChainId - Get the current chain ID