UNPKG

@ledgerhq/live-common

Version:
64 lines 2.85 kB
import { FAMILIES, } from "@ledgerhq/live-app-sdk"; import { z } from "zod"; import { reverseRecord } from "../helpers"; export const FAMILIES_MAPPING_PLATFORM_TO_LL = { ethereum: "evm", ripple: "xrp", }; export const FAMILIES_MAPPING_LL_TO_PLATFORM = reverseRecord(FAMILIES_MAPPING_PLATFORM_TO_LL); /** * 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 const PLATFORM_FAMILIES = [ ...Object.values(FAMILIES), ...Object.values(FAMILIES_MAPPING_PLATFORM_TO_LL), ]; export { FAMILIES as PLATFORM_FAMILIES_ENUM }; export { CurrencyType as PlatformCurrencyType, TokenStandard as PlatformTokenStandard, } from "@ledgerhq/live-app-sdk"; export const DappProvidersSchema = z.enum(["evm"]); export const LiveAppManifestParamsNetworkSchema = z.object({ currency: z.string().min(1), chainID: z.number(), nodeURL: z.string().optional(), }); export const LiveAppManifestDappSchema = z.object({ provider: DappProvidersSchema, networks: z.array(LiveAppManifestParamsNetworkSchema), nanoApp: z.string().min(1), dependencies: z.array(z.string()).optional(), }); export const LiveAppManifestSchema = z.strictObject({ id: z.string().trim().min(1), author: z.string().optional(), private: z.boolean().optional(), cacheBustingId: z.number().optional(), nocache: z.boolean().optional(), name: z.string().trim().min(1), url: z.string().trim().min(1), dapp: LiveAppManifestDappSchema.optional(), homepageUrl: z.string().trim().min(1), supportUrl: z.string().optional(), icon: z.string().nullable().optional(), platforms: z.array(z.enum(["ios", "android", "desktop"])).min(1), apiVersion: z.string().trim().min(1), manifestVersion: z.string().trim().min(1), branch: z.enum(["stable", "experimental", "soon", "debug"]), permissions: z.array(z.string().trim()).optional(), domains: z.array(z.string().trim()).min(1), categories: z.array(z.string().trim()).min(1), currencies: z.union([z.array(z.string().trim()).min(1), z.literal("*")]), visibility: z.enum(["complete", "searchable", "deep"]), highlight: z.boolean().optional(), featureFlags: z.union([z.array(z.string().trim()), z.literal("*")]).optional(), content: z.object({ cta: z.record(z.string(), z.string()).optional(), subtitle: z.record(z.string(), z.string()).optional(), shortDescription: z.record(z.string(), z.string().trim().min(1)), description: z.record(z.string(), z.string().trim().min(1)), }), }); //# sourceMappingURL=types.js.map