import type { AccountGroupType, MultichainAccountGroupId } from "@metamask/account-api"; import type { AccountGroupId } from "@metamask/account-api"; import type { AccountId } from "@metamask/accounts-controller"; import type { KeyringAccountType } from "@metamask/keyring-api"; import type { UpdatableField, ExtractFieldValues } from "./type-utils.cjs"; import type { AccountTreeControllerState } from "./types.cjs"; import type { AccountWalletObject } from "./wallet.cjs"; /** * Persisted metadata for account groups (stored in controller state for persistence/sync). */ export type AccountTreeGroupPersistedMetadata = { /** Custom name set by user, overrides default naming logic */ name?: UpdatableField; /** Whether this group is pinned in the UI */ pinned?: UpdatableField; /** Whether this group is hidden in the UI */ hidden?: UpdatableField; /** Timestamp of the last time this group was selected (local-only, not synced) */ lastSelected?: number; }; export declare const MAX_SORT_ORDER = 9999; /** * Order of account types. */ export declare const ACCOUNT_TYPE_TO_SORT_ORDER: Record; export type AccountTypeOrderKey = keyof typeof ACCOUNT_TYPE_TO_SORT_ORDER; /** * Tree metadata for account groups (required plain values extracted from persisted metadata). */ export type AccountTreeGroupMetadata = Required>; /** * Type constraint for a {@link AccountGroupObject}. If one of its union-members * does not match this contraint, {@link AccountGroupObject} will resolve * to `never`. */ type IsAccountGroupObject = Type; /** * Multichain-account group object. */ export type AccountGroupMultichainAccountObject = { type: AccountGroupType.MultichainAccount; id: MultichainAccountGroupId; accounts: [AccountId, ...AccountId[]]; metadata: AccountTreeGroupMetadata & { entropy: { groupIndex: number; }; }; }; /** * Multichain-account group object. */ export type AccountGroupSingleAccountObject = { type: AccountGroupType.SingleAccount; id: AccountGroupId; accounts: [AccountId]; metadata: AccountTreeGroupMetadata; }; /** * Account group object. */ export type AccountGroupObject = IsAccountGroupObject; export type AccountGroupObjectOf = Extract<{ type: AccountGroupType.MultichainAccount; object: AccountGroupMultichainAccountObject; } | { type: AccountGroupType.SingleAccount; object: AccountGroupSingleAccountObject; }, { type: GroupType; }>['object']; /** * Checks if a group name is unique within a specific wallet. * * @param wallet - The wallet to check within. * @param groupId - The account group ID to exclude from the check. * @param name - The name to validate for uniqueness. * @returns True if the name is unique within the wallet, false otherwise. */ export declare function isAccountGroupNameUniqueFromWallet(wallet: AccountWalletObject, groupId: AccountGroupId, name: string): boolean; /** * Checks if an account group name is unique within the same wallet. * * @param state - The account tree controller state. * @param groupId - The account group ID to exclude from the check. * @param name - The name to validate for uniqueness. * @returns True if the name is unique within the same wallet, false otherwise. * @throws Error if the group ID does not exist. */ export declare function isAccountGroupNameUnique(state: AccountTreeControllerState, groupId: AccountGroupId, name: string): boolean; export {}; //# sourceMappingURL=group.d.cts.map