@ledgerhq/live-common
Version:
Common ground for the Ledger Live apps
34 lines • 2 kB
TypeScript
import { Observable } from "rxjs";
import type { FirmwareUpdateContext, DeviceId, DeviceInfo } from "@ledgerhq/types-live";
import { GetLatestFirmwareTaskError } from "../tasks/getLatestFirmware";
import { GetDeviceInfoTaskError } from "../tasks/getDeviceInfo";
import { FullActionState } from "./core";
export type GetLatestAvailableFirmwareActionArgs = {
deviceId: DeviceId;
};
export type GetLatestAvailableFirmwareActionErrorName = GetDeviceInfoTaskError | GetLatestFirmwareTaskError;
export type GetLatestAvailableFirmwareActionState = FullActionState<{
error: {
type: "GetLatestAvailableFirmwareError";
name: GetLatestAvailableFirmwareActionErrorName;
} | null;
firmwareUpdateContext: FirmwareUpdateContext | null;
deviceInfo: DeviceInfo | null;
status: "idle" | "ongoing" | "error" | "no-available-firmware" | "available-firmware";
}>;
export declare const initialState: GetLatestAvailableFirmwareActionState;
/**
* Get the latest available firmware that the device could update to
*
* @param `deviceId` A device id, or an empty string if device is usb plugged
* @returns an Observables that emits the evolution of the state machine until finding (or not)
* the latest available firmware. The state is as follow (+ shared state with other actions):
* - `firmwareUpdateContext`: the `FirmwareUpdateContext` when retrieved, null otherwise
* - `deviceInfo`: the `DeviceInfo` when retrieved, null otherwise
* - `status`: the current status of the action: "error" | "no-available-firmware" | "available-firmware" meaning the action has finished
* - `error`: an error coming from the business logic, the device or internal. Some error are retried:
* `{ type`: "SharedError", retrying: true, ... }`
* - `...sharedActionState`
*/
export declare function getLatestAvailableFirmwareAction({ deviceId, }: GetLatestAvailableFirmwareActionArgs): Observable<GetLatestAvailableFirmwareActionState>;
//# sourceMappingURL=getLatestAvailableFirmware.d.ts.map