@ledgerhq/live-common
Version:
Common ground for the Ledger Live apps
31 lines • 1.46 kB
TypeScript
import type { InstalledItem } from "./types";
import type { App, Feature, FeatureId } from "@ledgerhq/types-live";
export type SortOptions = {
type?: "name" | "marketcap" | "default";
order?: "asc" | "desc";
};
export type AppType = "all" | "installed" | "not_installed" | "supported" | "not_supported" | "updatable";
export type FilterOptions = {
query?: string;
installQueue?: string[];
installedApps: InstalledItem[];
type: AppType[];
isFeature: (key: string) => boolean;
getFeature: (key: FeatureId) => Feature | null;
};
/**
* Checks if the app's associated currency is supported in Ledger Live.
*
* It boils down to: if the app has a currencyId, check if the currency is supported.
* The currency can be unsupported if there is a feature flag that disables it.
*/
export declare function isAppAssociatedCurrencySupported({ app, isFeature, getFeature, }: {
app: App;
isFeature: (key: string) => boolean;
getFeature: (key: FeatureId) => Feature | null;
}): boolean;
export declare const sortApps: (apps: App[], _options: SortOptions) => App[];
export declare const filterApps: (apps: App[], _options: FilterOptions) => App[];
export declare const sortFilterApps: (apps: App[], _filterOptions: FilterOptions, _sortOptions: SortOptions) => App[];
export declare const useSortedFilteredApps: (apps: App[], _filterOptions: FilterOptions, _sortOptions: SortOptions) => App[];
//# sourceMappingURL=filtering.d.ts.map