---
# System prepended metadata

title: signerToZeroDevSmartAccount() Implementation

---

# signerToZeroDevSmartAccount() Implementation

For more details check out the ZeroDev docs [here](signerToZeroDevSmartAccount).

```tsx
import {
  createKernelAccount,
  createZeroDevPaymasterClient,
  createKernelAccountClient,
  KernelEIP1193Provider,
  KernelAccountClient
} from "@zerodev/sdk"
import { signerToEcdsaValidator } from "@zerodev/ecdsa-validator"
import { ENTRYPOINT_ADDRESS_V07, providerToSmartAccountSigner } from "permissionless"
import { http, createPublicClient, EIP1193Provider } from "viem"
import { baseSepolia } from "viem/chains"
import { EntryPoint } from "permissionless/_types/types"

// Create a public client
const publicClient = createPublicClient({
  transport: http(process.env.BUNDLER_RPC),
})
const entryPoint = ENTRYPOINT_ADDRESS_V07;

export const signerToZeroDevSmartAccount = async ({
  signer,
}: {
  signer: EIP1193Provider;
}): Promise<EIP1193Provider> => {
  // Convert EIP1193Provider for the embedded wallet to a signer
  const smartAccountSigner = await providerToSmartAccountSigner(
    signer,
  );

  // Create an ECDSA validator
  const ecdsaValidator = await signerToEcdsaValidator(publicClient, {
    signer: smartAccountSigner,
    entryPoint,
  })

  // Create a Kernel account
  const account = await createKernelAccount(publicClient, {
    plugins: {
      sudo: ecdsaValidator,
    },
    entryPoint,
  })

  // Initialize a Kernel (smart account) client from the signer
  const kernelClient = createKernelAccountClient({
    account,
    entryPoint,
    chain: baseSepolia,
    bundlerTransport: http(process.env.BUNDLER_RPC),
    middleware: {
      sponsorUserOperation: async ({ userOperation }) => {
        const paymasterClient = createZeroDevPaymasterClient({
          chain: baseSepolia,
          transport: http(process.env.PAYMASTER_RPC),
          entryPoint,
        })
        return paymasterClient.sponsorUserOperation({
          userOperation,
          entryPoint,
        })
      },
    },
  }) as KernelAccountClient<EntryPoint>

  // Get an EIP1193Provider for the Kernel smart account and return it
  const kernelProvider = new KernelEIP1193Provider(kernelClient);
  return kernelProvider as EIP1193Provider;
};
```