import { type Chain, type Client, type Hex, type Transport } from "viem" import { privateKeyToAccount } from "viem/accounts" import type { ENTRYPOINT_ADDRESS_V06_TYPE, Prettify } from "../../types" import { type LightSmartAccount, type SignerToLightSmartAccountParameters, signerToLightSmartAccount } from "./signerToLightSmartAccount" export type PrivateKeyToLightSmartAccountParameters< entryPoint extends ENTRYPOINT_ADDRESS_V06_TYPE > = Prettify< { privateKey: Hex } & Omit, "signer"> > /** * @description Creates an Simple Account from a private key. * * @returns A Private Key Simple Account. */ export async function privateKeyToLightSmartAccount< entryPoint extends ENTRYPOINT_ADDRESS_V06_TYPE, TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined >( client: Client, { privateKey, ...rest }: PrivateKeyToLightSmartAccountParameters ): Promise> { const privateKeyAccount = privateKeyToAccount(privateKey) return signerToLightSmartAccount(client, { signer: privateKeyAccount, ...rest }) }