import { type EntryPointVersion, type GetAccountParameter, type OneOf, type SmartAccountSigner, type SmartContractAccount } from "@alchemy/aa-core"; import { type Address, type Chain } from "viem"; import type { LightAccountBase } from "./accounts/base"; export type LightAccountType = keyof IAccountVersionRegistry; export type AccountVersionDef = GetLightAccountVersion, TEntryPointVersion extends EntryPointVersion = EntryPointVersion> = { type: TLightAccountType; version: TLightAccountVersion; entryPointVersion: TEntryPointVersion; address: Record; }; export type LightAccountVersion = keyof IAccountVersionRegistry["LightAccount"] | keyof IAccountVersionRegistry["MultiOwnerLightAccount"]; export type GetLightAccountVersion = keyof IAccountVersionRegistry[TLightAccountType]; export type LightAccountVersionDef = GetLightAccountVersion> = IAccountVersionRegistry[TLightAccountType][TLightAccountVersion]; export interface IAccountVersionRegistry { LightAccount: { "v1.0.1": AccountVersionDef<"LightAccount", "v1.0.1", "0.6.0">; "v1.0.2": AccountVersionDef<"LightAccount", "v1.0.2", "0.6.0">; "v1.1.0": AccountVersionDef<"LightAccount", "v1.1.0", "0.6.0">; "v2.0.0": AccountVersionDef<"LightAccount", "v2.0.0", "0.7.0">; }; MultiOwnerLightAccount: { "v2.0.0": AccountVersionDef<"MultiOwnerLightAccount", "v2.0.0", "0.7.0">; }; } export type GetLightAccountVersionDefsForType = Extract; export type GetLightAccountVersionDef> = IAccountVersionRegistry[TType][TLightAccountVersion]; export type GetLightAccountVersionDefsForEntryPoint = Extract, { entryPointVersion: TEntryPointVersion; }>; export type GetLightAccountType = GetAccountParameter extends LightAccountBase ? OneOf : LightAccountType; export type GetLightAccountVersionFromAccount = GetAccountParameter extends LightAccountBase ? OneOf : LightAccountVersion; export type GetEntryPointForLightAccountVersion = GetLightAccountVersion> = GetLightAccountVersionDef extends AccountVersionDef ? TEntryPointVersion : EntryPointVersion; export type GetLightAccountTypesForVersion = TLightAccountVersion extends GetLightAccountVersion ? TLightAccountType : LightAccountType; export type GetDefaultLightAccountVersion = TLightAccountType extends "MultiOwnerLightAccount" ? "v2.0.0" & LightAccountVersion : "v1.1.0" & LightAccountVersion;