@ledgerhq/live-common
Version:
Common ground for the Ledger Live apps
87 lines • 3.07 kB
TypeScript
import { Observable } from "rxjs";
import type { AppAndVersion, ConnectAppEvent, Input as ConnectAppInput } from "../connectApp";
import type { Device, Action } from "./types";
import { AppOp, SkippedAppOp } from "../../apps/types";
import type { Account, DeviceInfo, FirmwareUpdateContext } from "@ledgerhq/types-live";
import type { CryptoCurrency, TokenCurrency } from "@ledgerhq/types-cryptoassets";
import { ImplementationType } from "./implementations";
export type State = {
isLoading: boolean;
requestQuitApp: boolean;
requestOpenApp: string | null | undefined;
requiresAppInstallation: {
appName: string;
appNames: string[];
} | null | undefined;
opened: boolean;
appAndVersion: AppAndVersion | null | undefined;
unresponsive: boolean;
allowOpeningRequestedWording: string | null | undefined;
allowOpeningGranted: boolean;
allowManagerRequested: boolean;
allowManagerGranted: boolean;
device: Device | null | undefined;
deviceInfo?: DeviceInfo | null | undefined;
latestFirmware?: FirmwareUpdateContext | null | undefined;
error: Error | null | undefined;
derivation: {
address: string;
} | null | undefined;
displayUpgradeWarning: boolean;
installingApp?: boolean;
progress?: number;
listingApps?: boolean;
request: AppRequest | undefined;
installQueue?: string[];
currentAppOp?: AppOp;
itemProgress?: number;
isLocked: boolean;
skippedAppOps: SkippedAppOp[];
listedApps?: boolean;
};
export type AppState = State & {
onRetry: () => void;
passWarning: () => void;
inWrongDeviceForAccount: {
accountName: string;
} | null | undefined;
};
export type AppRequest = {
appName?: string;
currency?: CryptoCurrency | null;
account?: Account;
tokenCurrency?: TokenCurrency;
dependencies?: AppRequest[];
withInlineInstallProgress?: boolean;
requireLatestFirmware?: boolean;
allowPartialDependencies?: boolean;
};
export type AppResult = {
device: Device;
appAndVersion: AppAndVersion | null | undefined;
appName?: string;
currency?: CryptoCurrency;
account?: Account;
tokenCurrency?: TokenCurrency;
dependencies?: AppRequest[];
withInlineInstallProgress?: boolean;
requireLatestFirmware?: boolean;
};
type AppAction = Action<AppRequest, AppState, AppResult>;
export type Event = {
type: "error";
error: Error;
device?: Device | null | undefined;
} | {
type: "deviceChange";
device: Device | null | undefined;
} | ConnectAppEvent | {
type: "display-upgrade-warning";
displayUpgradeWarning: boolean;
};
export declare let currentMode: keyof typeof ImplementationType;
export declare function setDeviceMode(mode: keyof typeof ImplementationType): void;
export declare const createAction: (connectAppExec: (arg0: ConnectAppInput) => Observable<ConnectAppEvent>) => AppAction;
export declare function dependenciesToAppRequests(dependencies?: string[]): AppRequest[];
export {};
//# sourceMappingURL=app.d.ts.map