UNPKG

@ledgerhq/live-common

Version:
129 lines 4.32 kB
import { Observable } from "rxjs"; import type Transport from "@ledgerhq/hw-transport"; import { type DerivationMode, DeviceInfo, FirmwareUpdateContext } from "@ledgerhq/types-live"; import type { AppOp, SkippedAppOp } from "../apps/types"; import { LockedDeviceEvent } from "./actions/types"; import { DeviceId } from "@ledgerhq/client-ids/ids"; import { DeviceModelId as LLDeviceModelId } from "@ledgerhq/types-devices"; /** * Represents the deprecation status of a device. * * @property warningScreenVisible - Whether the generic deprecation warning screen should be shown. * @property clearSigningScreenVisible - Whether the clear signing deprecation warning screen should be shown. * @property errorScreenVisible - Whether the deprecation error screen should be shown (blocking usage). * @property modelId - The modeID of the affected product * @property date - The date when the deprecation becomes effective. * @property warningScreenRules - Optional configuration for the warning screen. * @property clearSigningScreenRules - Optional configuration for the clear signing screen. * @property errorScreenRules - Optional configuration for the error screen. * @property onContinue - Callback invoked when the user chooses to continue or throw an error despite the deprecation warning. */ export type DeviceDeprecationRules = { warningScreenVisible: boolean; clearSigningScreenVisible: boolean; errorScreenVisible: boolean; modelId: LLDeviceModelId; date: Date; warningScreenRules?: DeviceDeprecationScreenRules; clearSigningScreenRules?: DeviceDeprecationScreenRules; errorScreenRules?: DeviceDeprecationScreenRules; onContinue: (isError?: boolean) => void; }; /** * Configuration defining exceptions to device deprecation restrictions. * * @property exeption - List of token or main coin identifiers exempt from the restriction. * @property deprecatedFlow - List of flow identifiers (e.g., send, receive) to restrict. */ export type DeviceDeprecationScreenRules = { exception?: string[]; deprecatedFlow?: string[]; }; export type RequiresDerivation = { currencyId: string; path: string; derivationMode: DerivationMode; forceFormat?: string; }; export type Input = { deviceId: string; deviceName: string | null; request: ConnectAppRequest; }; export type ConnectAppRequest = { appName: string; requiresDerivation?: RequiresDerivation; dependencies?: string[]; requireLatestFirmware?: boolean; outdatedApp?: AppAndVersion; allowPartialDependencies: boolean; }; export type AppAndVersion = { name: string; version: string; flags: number | Buffer; }; export type ConnectAppEvent = { type: "unresponsiveDevice"; } | { type: "disconnected"; expected?: boolean; } | { type: "device-update-last-seen"; deviceInfo: DeviceInfo; latestFirmware: FirmwareUpdateContext | null | undefined; } | { type: "device-permission-requested"; } | { type: "device-permission-granted"; } | { type: "device-id"; deviceId: DeviceId; } | { type: "app-not-installed"; appNames: string[]; appName: string; } | { type: "inline-install"; progress: number; itemProgress: number; currentAppOp: AppOp; installQueue: string[]; } | { type: "deprecation"; deprecate: DeviceDeprecationRules; } | { type: "some-apps-skipped"; skippedAppOps: SkippedAppOp[]; } | { type: "listing-apps"; } | { type: "listed-apps"; installQueue: string[]; } | { type: "dependencies-resolved"; } | { type: "latest-firmware-resolved"; } | { type: "ask-quit-app"; } | { type: "ask-open-app"; appName: string; } | { type: "has-outdated-app"; outdatedApp: AppAndVersion; } | { type: "opened"; app?: AppAndVersion; derivation?: { address: string; }; } | { type: "display-upgrade-warning"; displayUpgradeWarning: boolean; } | LockedDeviceEvent; export declare const openAppFromDashboard: (transport: Transport, appName: string) => Observable<ConnectAppEvent>; export default function connectAppFactory({ isLdmkConnectAppEnabled, }?: { isLdmkConnectAppEnabled: boolean; }): ({ deviceId, deviceName, request }: Input) => Observable<ConnectAppEvent>; //# sourceMappingURL=connectApp.d.ts.map