<VersionWarning version="0.1" />

# signerToKernelSmartAccount

Creates a KernelAccount instance controlled by a `SmartAccountSigner`.  Check out [this guide](/references/permissionless/how-to/accounts/use-kernel-account) for a complete tutorial.

## Usage

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

const kernelAccount = await signerToEcdsaKernelSmartAccount(publicClient, {
    signer,
    entryPoint: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789", // v0.6 entrypoint
    index: 0n, // optional
    address: "0x..." // optional, only if you are using an already created account
});
```

```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:** `KernelSmartAccount`

The Kernel smart account instance.

## Parameters

### signer

* **Type:** `SmartAccountSigner`

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

### entryPoint

* **Type:** `Address`

The address of the EntryPoint contract.

### index (optional)

* **Type:** `bigint`

The index (which is basically a salt) that will be used to deploy the smart account. If not provided, `0` will be used.

### 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.
