<VersionWarning version="0.1" />

# signerToSafeSmartAccount

Creates a Safe smart account instance controlled by a `SmartAccountSigner`.

## Usage

:::code-group
```ts [example.ts]
import { ENTRYPOINT_ADDRESS_V07 } from "permissionless"
import { signerToSafeSmartAccount } from "permissionless/accounts"
import { publicClient } from "./publicClient"
import { signer } from "./signer"

const safeAccount = await signerToSafeSmartAccount(publicClient, {
    signer,
    safeVersion: "1.4.1",
    entryPoint: ENTRYPOINT_ADDRESS_V07,
})
```

```ts [publicClient.ts]
import { createPublicClient, http } from "viem"

export const publicClient = createPublicClient({
	transport: http("https://sepolia.rpc.thirdweb.com"),
})
```

```ts [signer.ts]
import { generatePrivateKey, privateKeyToAccount } from "viem/accounts"

const privateKey = generatePrivateKey()

export const signer = privateKeyToAccount(privateKey)
```
:::

## Returns

* **Type:** `SafeSmartAccount`

The smart account instance.

## Parameters

### signer

* **Type:** `SmartAccountSigner`

The signer that will be used to sign messages and user operations.

### safeVersion

* **Type:** `1.4.1`

The version of the Safe contract that will be used.

### entryPoint

* **Type:** `Address`

The address of the EntryPoint contract.

### saltNonce (optional)

* **Type:** `bigint`

The salt nonce that will be used to deploy the smart account. If not provided, `0` will be used.

### addModuleLibAddress (optional)

* **Type:** `Address`

The address of the `AddModuleLib` contract. If not provided, the default address for the Safe version will be used.

### safe4337ModuleAddress (optional)

* **Type:** `Address`

The address of the `Safe4337Module` contract. If not provided, the default address for the Safe version will be used.

### safeProxyFactoryAddress (optional)

* **Type:** `Address`

The address of the `SafeProxyFactory` contract. If not provided, the default address for the Safe version will be used.

### safeSingletonAddress (optional)

* **Type:** `Address`

The address of the `SafeSingleton` contract. If not provided, the default address for the Safe version will be used.

### multiSendAddress (optional)

* **Type:** `Address`

The address of the `MultiSend` contract. If not provided, the default address for the Safe version will be used.

### multiSendCallOnlyAddress (optional)

* **Type:** `Address`

The address of the `MultiSendCallOnly` contract. If not provided, the default address for the Safe version will be used.

### safeModules (optional)

* **Type:** `Address[]`

:::info
The ERC-4337 module will always be added and does not need to be provided.
:::

The addresses of the Safe modules that will be added during deployment.

### setupTransactions (optional)

* **Type:** `Call[]`

:::info
This can be useful, for example, to approve tokens to an ERC-20 paymaster contract so it can pay for the gas of the first user operation.
:::

An array of calls that will be executed during the deployment of the smart account (when the `initCode` is executed).

### address (optional)

* **Type:** `Address`

:::warning
If you provide an address, the smart account can not be deployed. This should be used if you want to interact with an existing smart account.
:::

The address of the smart account. If not provided, the determinstic smart account address will be used.
