# Safe Account

The `SafeAccount` uses the original Safe Singleton and adds ERC-4337 functionality using a module/fallback handler.

* The V2 contracts, or `SafeAccountV0_2_0` in AbstractionKit, support EntryPoint v0.6.
* The V3 contracts, or `SafeAccountV0_3_0` in AbstractionKit, support EntryPoint v0.7.

The contracts were developed by the Safe Team and audited by OpenZeppelin & Ackee Blockchain.

## Audits[​](#audits "Direct link to Audits")

* [Version 0.2.0 by Ackee and OpenZeppelin](https://github.com/safe-global/safe-modules/blob/main/modules/4337/docs/v0.2.0/audit.md)
* [Version 0.3.0 by Ackee](https://github.com/safe-global/safe-modules/blob/main/modules/4337/docs/v0.3.0/audit.md)

To learn more about the contracts, visit the [repository of Safe ERC-4337 Module](https://github.com/safe-global/safe-modules/tree/main/modules/4337).

## Import[​](#import "Direct link to Import")

### V3 for EntryPoint v0.7[​](#v3-for-entrypoint-v07 "Direct link to V3 for EntryPoint v0.7")

```
import { SafeAccountV0_3_0 as SafeAccount } from "abstractionkit"; 
```

### V2 for EntryPoint v0.6[​](#v2-for-entrypoint-v06 "Direct link to V2 for EntryPoint v0.6")

```
import { SafeAccountV0_2_0 as SafeAccount } from "abstractionkit"; 
```

## How to Use[​](#how-to-use "Direct link to How to Use")

AbstractionKit classes are designed to support the same methods across both versions, ensuring compatibility within the essential classes. This allows developers to upgrade from Safe V2 to Safe V3 seamlessly without breaking functionality or requiring significant code changes.

To initialize a new Safe Account and calculate its address:

```
const ownerPublicAddress = "0xBdbc5FBC9cA8C3F514D073eC3de840Ac84FC6D31"; // Safe owner pub address
const smartAccount = SafeAccount.initializeNewAccount([ownerPublicAddress]);

const accountAddress = smartAccount.accountAddress;
```

###

<!-- -->

[Safe Account V3](https://docs.candide.dev/wallet/abstractionkit/safe-account-v3.md)

[Reference functions for Safe Account V3 with EntryPoint V7](https://docs.candide.dev/wallet/abstractionkit/safe-account-v3.md)

[Safe Account V2](https://docs.candide.dev/wallet/abstractionkit/safe-account-v2.md)

[Reference functions for Safe Account V2 with EntryPoint V6](https://docs.candide.dev/wallet/abstractionkit/safe-account-v2.md)
