UNPKG

@ledgerhq/live-common

Version:
64 lines 2.43 kB
import { z } from "zod"; import type { RecentAddress } from "@ledgerhq/types-live"; /** * Zod schema for legacy string address format (backward compatibility) * Migrates old string-only addresses to the new format with metadata */ export declare const LegacyStringAddressSchema: z.ZodPipe<z.ZodString, z.ZodTransform<RecentAddress, string>>; /** * Zod schema for correct recent address format */ export declare const CorrectAddressSchema: z.ZodObject<{ address: z.ZodString; lastUsed: z.ZodNumber; ensName: z.ZodOptional<z.ZodString>; }, z.core.$strip>; /** * Zod schema for corrupted nested address format * Handles data corruption from previous migration issues * Expected corrupted format: { address: { address: string, lastUsed?: number, ensName?: string }, index?: number } */ export declare const CorruptedNestedAddressSchema: z.ZodPipe<z.ZodObject<{ address: z.ZodObject<{ address: z.ZodString; lastUsed: z.ZodOptional<z.ZodNumber>; ensName: z.ZodOptional<z.ZodString>; }, z.core.$strip>; index: z.ZodOptional<z.ZodNumber>; }, z.core.$strip>, z.ZodTransform<RecentAddress, { address: { address: string; lastUsed?: number | undefined; ensName?: string | undefined; }; index?: number | undefined; }>>; /** * Union schema for all recent address formats * Supports: legacy strings, correct format, and corrupted nested format */ export declare const RecentAddressSchema: z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<RecentAddress, string>>, z.ZodObject<{ address: z.ZodString; lastUsed: z.ZodNumber; ensName: z.ZodOptional<z.ZodString>; }, z.core.$strip>, z.ZodPipe<z.ZodObject<{ address: z.ZodObject<{ address: z.ZodString; lastUsed: z.ZodOptional<z.ZodNumber>; ensName: z.ZodOptional<z.ZodString>; }, z.core.$strip>; index: z.ZodOptional<z.ZodNumber>; }, z.core.$strip>, z.ZodTransform<RecentAddress, { address: { address: string; lastUsed?: number | undefined; ensName?: string | undefined; }; index?: number | undefined; }>>]>; /** * Schema for array of recent addresses with sanitization * Filters out invalid entries while preserving valid addresses */ export declare const RecentAddressesArraySchema: z.ZodPipe<z.ZodArray<z.ZodUnknown>, z.ZodTransform<RecentAddress[], unknown[]>>; //# sourceMappingURL=recentAddresses.d.ts.map