UNPKG

@ledgerhq/live-common

Version:
180 lines • 6.87 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; featureFlags?: string[] | "*"; storage?: string[]; providerTestBaseUrl?: string; providerTestId?: string; content: { cta?: TranslatableString; subtitle?: TranslatableString; shortDescription: TranslatableString; description: TranslatableString; }; }; export declare const DappProvidersSchema: z.ZodEnum<{ evm: "evm"; }>; export declare const LiveAppManifestParamsNetworkSchema: z.ZodObject<{ currency: z.ZodString; chainID: z.ZodNumber; nodeURL: z.ZodOptional<z.ZodString>; }, z.core.$strip>; export declare const LiveAppManifestDappSchema: z.ZodObject<{ provider: z.ZodEnum<{ evm: "evm"; }>; networks: z.ZodArray<z.ZodObject<{ currency: z.ZodString; chainID: z.ZodNumber; nodeURL: z.ZodOptional<z.ZodString>; }, z.core.$strip>>; nanoApp: z.ZodString; dependencies: z.ZodOptional<z.ZodArray<z.ZodString>>; }, z.core.$strip>; 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: "evm"; }>; networks: z.ZodArray<z.ZodObject<{ currency: z.ZodString; chainID: z.ZodNumber; nodeURL: z.ZodOptional<z.ZodString>; }, z.core.$strip>>; nanoApp: z.ZodString; dependencies: z.ZodOptional<z.ZodArray<z.ZodString>>; }, z.core.$strip>>; homepageUrl: z.ZodString; supportUrl: z.ZodOptional<z.ZodString>; icon: z.ZodOptional<z.ZodNullable<z.ZodString>>; platforms: z.ZodArray<z.ZodEnum<{ ios: "ios"; android: "android"; desktop: "desktop"; }>>; apiVersion: z.ZodString; manifestVersion: z.ZodString; branch: z.ZodEnum<{ debug: "debug"; stable: "stable"; experimental: "experimental"; soon: "soon"; }>; permissions: z.ZodOptional<z.ZodArray<z.ZodString>>; domains: z.ZodArray<z.ZodString>; categories: z.ZodArray<z.ZodString>; currencies: z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodLiteral<"*">]>; visibility: z.ZodEnum<{ complete: "complete"; searchable: "searchable"; deep: "deep"; }>; highlight: z.ZodOptional<z.ZodBoolean>; featureFlags: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodLiteral<"*">]>>; 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>; }, z.core.$strip>; }, z.core.$strict>; 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) => Promise<PlatformCurrency[]>; export type PlatformSupportedCurrency = CryptoCurrency | TokenCurrency; //# sourceMappingURL=types.d.ts.map