Skip to content
This repository has been archived by the owner on Jul 15, 2022. It is now read-only.

Latest commit

 

History

History
81 lines (47 loc) · 2.65 KB

apps.md

File metadata and controls

81 lines (47 loc) · 2.65 KB

Apps store logic: manage your ledger device apps

Don't know what is an App?

You can find more about them on our support page.

The Apps store logic provides a set of tools and interfaces to manage your ledger device apps.

You can install, uninstall, update and check your ledger device status.

Communicate with your device

hw

Holds transport logic to execute App operations on your device and fetch the Apps State.

execWithTransport executes a given App operation - AppOp on the device

Used to install, uninstall or update device Apps.

Returns Observable<{ progress: number }>

import { execWithTransport } from "@ledgerhq/live-common/lib/apps/hw";

const appOp = { type: "install", name: app.name };

const appsObservable$ = execWithTransport(transport)(appOp, targetId, app);

listApps is used to retrieve apps data per device.

Available Apps and versions vary from device firmware version and model.

Returns an Observable<ListAppEvents>

import { listApps } from "@ledgerhq/live-common/lib/apps/hw";

const appsObservable$ = listApps(transport, deviceInfo).pipe(
  filter(({ type }) => type === "result"),
  map(({ result }) => result)
);

View and manage your device state

logic

Hold the device state logic used by the AppOp runner.

reducer is used to manage changes in the device State.

distribute gives the device app storage distribution from a given State

Returns AppsDistribution.

predictOptimisticState helps retrieve the future State after an AppOp is successfully run on your device.

react

Holds react specific logic with hooks to manage the device state.

useAppsRunner react hook to handle a device State with an AppOp dispatcher. Returns UseAppsRunnerResult

filtering

React hooks used to search and filter through a given list of apps.

runner

Transform the device communication during App Operations into the Apps logic State reducer.

runAppOp executes a given AppOp on the device. Used in useAppsRunner.

Returns an Observable of RunnerEvents.

types