Modular Account V2 • Getting started
It is easy to get started with Modular Account v2! Below, you will create a new Modular Account v2 client that will be used to send user operations. Your MAv2 smart account will be deployed on-chain when you send the first User Operation from a unique signer.
Install packages
Prerequisites
- minimum Typescript version of 5
- pin viem to 2.20.0 (
yarn add [email protected]
)
Installation
First, install the @account-kit/smart-contracts
package.
Address calculation
For Modular Account V2, the address of the smart account will be calculated as a combination of the owner and the salt. You will get the same smart account address each time you supply the same owner
, the signer(s) used to create the account for the first time. You can also optionally supply salt
if you want a different address for the same owner
param (the default salt is 0n
).
If you want to use a signer to connect to an account whose address does not map to the contract-generated address, you can supply the accountAddress
to connect with the account of interest. In that case, the signer
address is not used for address calculation, but only for signing the operation.
Creating a Modular Account V2 client
:::tip[Choosing which mode to use]
We currently offer two variants of Modular Account v2: default
and 7702
.
- (Recommended)
default
provides you with the cheapest, most flexible and advanced Smart Account 7702
if you are looking for 7702 support, learn about how to set up and take adavantage of our EIP-7702 compliant account here :::
Want to enable social login methods? Set up your Alchemy Signer.
Alternatively, you can bring a 3rd party signer as the owner of your new account.
Not sure what signer to use? Learn more.
Sending a user operation
Now that you have a client, you can send a User Operation. The first User Operation will also deploy the new Modular Account v2.