UNPKG

@ledgerhq/live-common

Version:
302 lines • 10.8 kB
import type { SignedOperation } from "@ledgerhq/types-live"; import type { CryptoCurrency, TokenCurrency } from "@ledgerhq/types-cryptoassets"; import { AccountFilters, CurrencyFilters } from "./filters"; import { Account as PlatformAccount, Currency as PlatformCurrency, FAMILIES } from "@ledgerhq/live-app-sdk"; import { z } from "zod"; export declare const FAMILIES_MAPPING_PLATFORM_TO_LL: { readonly ethereum: "evm"; readonly ripple: "xrp"; }; export declare const FAMILIES_MAPPING_LL_TO_PLATFORM: Record<"evm" | "xrp", "ethereum" | "ripple">; /** * this is a hack to add the "evm" family to the list of supported families of * the deprecated @ledgerhq/live-app-sdk, still used by some live apps. * Since "evm" will be (is) the new family of original currencies under the * "ethereum" family, following the "ethereum" / "evm" families merge * (and removal of the "ethereum" family) */ export declare const PLATFORM_FAMILIES: ("evm" | "xrp" | FAMILIES)[]; export { FAMILIES as PLATFORM_FAMILIES_ENUM }; export type { Account as PlatformAccount, Currency as PlatformCurrency, Unit as PlatformUnit, Transaction as PlatformTransaction, CryptoCurrency as PlatformCryptoCurrency, ERC20TokenCurrency as PlatformERC20TokenCurrency, } from "@ledgerhq/live-app-sdk"; export { CurrencyType as PlatformCurrencyType, TokenStandard as PlatformTokenStandard, } from "@ledgerhq/live-app-sdk"; export type TranslatableString = { en: string; [locale: string]: string; }; export type Loadable<T> = { error: any | null; isLoading: boolean; value: T | null; }; export type AppPlatform = "ios" | "android" | "desktop"; export type AppBranch = "stable" | "experimental" | "soon" | "debug"; export type Visibility = "complete" | "searchable" | "deep"; export type ParamsWithDappUrl = { dappUrl: string; }; export type ParamsWithNetwork = { networks: Array<LiveAppManifestParamsNetwork>; }; export type LiveAppManifestParamsDappWithNetwork = ParamsWithDappUrl & ParamsWithNetwork; export type LiveAppManifestParamsDappWithNetworkAndNanoApp = LiveAppManifestParamsDappWithNetwork & { nanoApp: string; dappName: string; }; export type LiveAppManifestParamsDapp = LiveAppManifestParamsDappWithNetwork | LiveAppManifestParamsDappWithNetworkAndNanoApp; export type LiveAppManifestParamsWebApp = { currencies: string[]; webAppName: string; webUrl: string; }; export type LiveAppManifestParams = LiveAppManifestParamsDapp | LiveAppManifestParamsWebApp | ParamsWithNetwork | Array<string>; export type LiveAppManifestParamsNetwork = { currency: string; chainID: number; nodeURL?: string; }; export type DappProviders = "evm"; export type LiveAppManifestDapp = { provider: DappProviders; networks: Array<LiveAppManifestParamsNetwork>; nanoApp: string; dependencies?: string[]; }; export type LiveAppManifest = { id: string; author?: string; private?: boolean; cacheBustingId?: number; nocache?: boolean; name: string; url: string | URL; params?: LiveAppManifestParams; dapp?: LiveAppManifestDapp; homepageUrl: string; supportUrl?: string; icon?: string | null; platforms: AppPlatform[]; apiVersion: string; manifestVersion: string; branch: AppBranch; permissions: string[]; domains: string[]; categories: string[]; currencies: string[] | "*"; visibility: Visibility; highlight?: boolean; providerTestBaseUrl?: string; providerTestId?: string; content: { cta?: TranslatableString; subtitle?: TranslatableString; shortDescription: TranslatableString; description: TranslatableString; }; }; export declare const DappProvidersSchema: z.ZodEnum<["evm"]>; export declare const LiveAppManifestParamsNetworkSchema: z.ZodObject<{ currency: z.ZodString; chainID: z.ZodNumber; nodeURL: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { currency: string; chainID: number; nodeURL?: string | undefined; }, { currency: string; chainID: number; nodeURL?: string | undefined; }>; export declare const LiveAppManifestDappSchema: z.ZodObject<{ provider: z.ZodEnum<["evm"]>; networks: z.ZodArray<z.ZodObject<{ currency: z.ZodString; chainID: z.ZodNumber; nodeURL: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { currency: string; chainID: number; nodeURL?: string | undefined; }, { currency: string; chainID: number; nodeURL?: string | undefined; }>, "many">; nanoApp: z.ZodString; dependencies: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; }, "strip", z.ZodTypeAny, { provider: "evm"; networks: { currency: string; chainID: number; nodeURL?: string | undefined; }[]; nanoApp: string; dependencies?: string[] | undefined; }, { provider: "evm"; networks: { currency: string; chainID: number; nodeURL?: string | undefined; }[]; nanoApp: string; dependencies?: string[] | undefined; }>; export declare const LiveAppManifestSchema: z.ZodObject<{ id: z.ZodString; author: z.ZodOptional<z.ZodString>; private: z.ZodOptional<z.ZodBoolean>; cacheBustingId: z.ZodOptional<z.ZodNumber>; nocache: z.ZodOptional<z.ZodBoolean>; name: z.ZodString; url: z.ZodString; dapp: z.ZodOptional<z.ZodObject<{ provider: z.ZodEnum<["evm"]>; networks: z.ZodArray<z.ZodObject<{ currency: z.ZodString; chainID: z.ZodNumber; nodeURL: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { currency: string; chainID: number; nodeURL?: string | undefined; }, { currency: string; chainID: number; nodeURL?: string | undefined; }>, "many">; nanoApp: z.ZodString; dependencies: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; }, "strip", z.ZodTypeAny, { provider: "evm"; networks: { currency: string; chainID: number; nodeURL?: string | undefined; }[]; nanoApp: string; dependencies?: string[] | undefined; }, { provider: "evm"; networks: { currency: string; chainID: number; nodeURL?: string | undefined; }[]; nanoApp: string; dependencies?: string[] | undefined; }>>; homepageUrl: z.ZodString; supportUrl: z.ZodOptional<z.ZodString>; icon: z.ZodOptional<z.ZodNullable<z.ZodString>>; platforms: z.ZodArray<z.ZodEnum<["ios", "android", "desktop"]>, "many">; apiVersion: z.ZodString; manifestVersion: z.ZodString; branch: z.ZodEnum<["stable", "experimental", "soon", "debug"]>; permissions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; domains: z.ZodArray<z.ZodString, "many">; categories: z.ZodArray<z.ZodString, "many">; currencies: z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodLiteral<"*">]>; visibility: z.ZodEnum<["complete", "searchable", "deep"]>; highlight: z.ZodOptional<z.ZodBoolean>; content: z.ZodObject<{ cta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>; subtitle: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>; shortDescription: z.ZodRecord<z.ZodString, z.ZodString>; description: z.ZodRecord<z.ZodString, z.ZodString>; }, "strip", z.ZodTypeAny, { description: Record<string, string>; shortDescription: Record<string, string>; cta?: Record<string, string> | undefined; subtitle?: Record<string, string> | undefined; }, { description: Record<string, string>; shortDescription: Record<string, string>; cta?: Record<string, string> | undefined; subtitle?: Record<string, string> | undefined; }>; }, "strict", z.ZodTypeAny, { id: string; name: string; url: string; currencies: string[] | "*"; homepageUrl: string; platforms: ("ios" | "android" | "desktop")[]; apiVersion: string; manifestVersion: string; branch: "debug" | "stable" | "experimental" | "soon"; domains: string[]; categories: string[]; visibility: "complete" | "searchable" | "deep"; content: { description: Record<string, string>; shortDescription: Record<string, string>; cta?: Record<string, string> | undefined; subtitle?: Record<string, string> | undefined; }; icon?: string | null | undefined; author?: string | undefined; private?: boolean | undefined; cacheBustingId?: number | undefined; nocache?: boolean | undefined; dapp?: { provider: "evm"; networks: { currency: string; chainID: number; nodeURL?: string | undefined; }[]; nanoApp: string; dependencies?: string[] | undefined; } | undefined; supportUrl?: string | undefined; permissions?: string[] | undefined; highlight?: boolean | undefined; }, { id: string; name: string; url: string; currencies: string[] | "*"; homepageUrl: string; platforms: ("ios" | "android" | "desktop")[]; apiVersion: string; manifestVersion: string; branch: "debug" | "stable" | "experimental" | "soon"; domains: string[]; categories: string[]; visibility: "complete" | "searchable" | "deep"; content: { description: Record<string, string>; shortDescription: Record<string, string>; cta?: Record<string, string> | undefined; subtitle?: Record<string, string> | undefined; }; icon?: string | null | undefined; author?: string | undefined; private?: boolean | undefined; cacheBustingId?: number | undefined; nocache?: boolean | undefined; dapp?: { provider: "evm"; networks: { currency: string; chainID: number; nodeURL?: string | undefined; }[]; nanoApp: string; dependencies?: string[] | undefined; } | undefined; supportUrl?: string | undefined; permissions?: string[] | undefined; highlight?: boolean | undefined; }>; export type LiveAppManifestSchemaType = z.infer<typeof LiveAppManifestSchema>; export type PlatformApi = { fetchManifest: () => Promise<LiveAppManifest[]>; }; export type PlatformSignedTransaction = SignedOperation; export type ListPlatformAccount = (filters?: AccountFilters) => PlatformAccount[]; export type ListPlatformCurrency = (filters?: CurrencyFilters) => PlatformCurrency[]; export type PlatformSupportedCurrency = CryptoCurrency | TokenCurrency; //# sourceMappingURL=types.d.ts.map