import { createMultiOwnerLightAccount, multiOwnerLightAccountClientActions, type CreateMultiOwnerLightAccountParams, type MultiOwnerLightAccount, type MultiOwnerLightAccountClientActions, } from "@alchemy/aa-accounts"; import type { HttpTransport, SmartAccountSigner } from "@alchemy/aa-core"; import { custom, type Chain, type CustomTransport, type Transport } from "viem"; import { AlchemyProviderConfigSchema } from "../schema.js"; import { createAlchemySmartAccountClientFromRpcClient } from "./internal/smartAccountClientFromRpc.js"; import { createAlchemyPublicRpcClient } from "./rpcClient.js"; import { type AlchemySmartAccountClient, type AlchemySmartAccountClientConfig, } from "./smartAccountClient.js"; export type AlchemyMultiOwnerLightAccountClientConfig< TSigner extends SmartAccountSigner = SmartAccountSigner > = Omit< CreateMultiOwnerLightAccountParams, "transport" | "chain" > & Omit< AlchemySmartAccountClientConfig< Transport, Chain, MultiOwnerLightAccount >, "account" >; export async function createMultiOwnerLightAccountAlchemyClient< TSigner extends SmartAccountSigner = SmartAccountSigner >( params: AlchemyMultiOwnerLightAccountClientConfig ): Promise< AlchemySmartAccountClient< CustomTransport, Chain | undefined, MultiOwnerLightAccount, MultiOwnerLightAccountClientActions > >; export async function createMultiOwnerLightAccountAlchemyClient( config: AlchemyMultiOwnerLightAccountClientConfig ): Promise { const { chain, opts, ...connectionConfig } = AlchemyProviderConfigSchema.parse(config); const client = createAlchemyPublicRpcClient({ chain, connectionConfig, }); const account = await createMultiOwnerLightAccount({ transport: custom(client), ...config, }); return createAlchemySmartAccountClientFromRpcClient({ ...config, client, account, opts, }).extend(multiOwnerLightAccountClientActions); }