NexusSmartAccount
The NexusSmartAccount
class is a comprehensive implementation of a smart contract account that is compliant with ERC-7579 and ERC-4337 standards. It is part of the Biconomy suite of contracts for Modular Smart Accounts.
Overview
NexusSmartAccount
extends BaseSmartContractAccount
and provides a wide range of functionality for managing and interacting with smart contract accounts. It includes features such as:
- Account creation and deployment
- Transaction execution
- User operation building and sending
- Module management (installation, uninstallation, and querying)
- Balance checking
- Gas estimation
- Signature validation
Key Components
Modules
The account supports various types of modules:
- Validation modules
- Execution modules
- Fallback modules
- Hook modules
These modules can be installed, uninstalled, and queried, allowing for a flexible and extensible account structure.
Bundler and Paymaster
The class integrates with a bundler for submitting user operations and a paymaster for gas abstraction, enhancing the user experience by potentially allowing gasless transactions.
User Operations
The class provides methods for building, signing, and sending user operations, which are the core concept of ERC-4337 for account abstraction.
Main Methods
Some of the key methods include:
create
: Static method to create a new NexusSmartAccount instancegetAddress
: Retrieves the account's addresssendTransaction
: Sends a transaction (or batch of transactions)buildUserOp
: Builds a user operationsendUserOp
: Sends a user operationinstallModule
: Installs a module on the accountuninstallModule
: Uninstalls a module from the accountgetBalances
: Retrieves token balances for the accountsignMessage
: Signs a message using the account
Usage
The NexusSmartAccount
is designed to be used as part of a larger system for managing smart contract accounts. It provides a high level of flexibility and functionality, allowing developers to create sophisticated account-based applications.
To use this class, you would typically:
- Create an instance using the static
create
method - Use the instance to perform actions like sending transactions, managing modules, or interacting with the blockchain
Advanced Features
The class also includes advanced features such as:
- Counterfactual address calculation
- ERC-6492 compliant signature generation
- Gas estimation for user operations
- Token fee estimation and management
- Support for various execution modes