UNPKG

@metamask/snaps-sdk

Version:

A library containing the core functionality for building MetaMask Snaps

146 lines 7.71 kB
import type { Infer } from "@metamask/superstruct"; import type { JSXElement } from "../jsx/index.mjs"; import type { Component } from "../ui/index.mjs"; /** * To avoid typing problems with the interface state when manipulating it we * have to differentiate the state of a form (that will be contained inside the * root state) and the root state since a key in the root stat can contain * either the value of an input or a sub-state of a form. */ export declare const StateStruct: import("@metamask/superstruct").Struct<string | boolean | { name: string; size: number; contentType: string; contents: string; } | { symbol: string; name: string; asset: `${string}:${string}/${string}:${string}`; }, null>; export declare const FormStateStruct: import("@metamask/superstruct").Struct<Record<string, string | boolean | { name: string; size: number; contentType: string; contents: string; } | { symbol: string; name: string; asset: `${string}:${string}/${string}:${string}`; } | null>, null>; export declare const InterfaceStateStruct: import("@metamask/superstruct").Struct<Record<string, string | boolean | { name: string; size: number; contentType: string; contents: string; } | { symbol: string; name: string; asset: `${string}:${string}/${string}:${string}`; } | Record<string, string | boolean | { name: string; size: number; contentType: string; contents: string; } | { symbol: string; name: string; asset: `${string}:${string}/${string}:${string}`; } | null> | null>, null>; export type State = Infer<typeof StateStruct>; export type FormState = Infer<typeof FormStateStruct>; export type InterfaceState = Infer<typeof InterfaceStateStruct>; export type ComponentOrElement = Component | JSXElement; export declare const ComponentOrElementStruct: import("@metamask/superstruct").Struct<{ value: string; type: import("../ui/index.mjs").NodeType.Copyable; sensitive?: boolean | undefined; } | { type: import("../ui/index.mjs").NodeType.Divider; } | { value: string; type: import("../ui/index.mjs").NodeType.Heading; } | { value: string; type: import("../ui/index.mjs").NodeType.Image; } | import("../ui/index.mjs").Panel | { type: import("../ui/index.mjs").NodeType.Spinner; } | { value: string; type: import("../ui/index.mjs").NodeType.Text; markdown?: boolean | undefined; } | { value: `0x${string}`; type: import("../ui/index.mjs").NodeType.Address; } | { value: { value: string; type: import("../ui/index.mjs").NodeType.Image; } | { value: string; type: import("../ui/index.mjs").NodeType.Text; markdown?: boolean | undefined; } | { value: `0x${string}`; type: import("../ui/index.mjs").NodeType.Address; }; type: import("../ui/index.mjs").NodeType.Row; label: string; variant?: "default" | "critical" | "warning" | undefined; } | { name: string; type: import("../ui/index.mjs").NodeType.Input; value?: string | undefined; label?: string | undefined; inputType?: "number" | "text" | "password" | undefined; placeholder?: string | undefined; error?: string | undefined; } | { value: string; type: import("../ui/index.mjs").NodeType.Button; name?: string | undefined; variant?: "primary" | "secondary" | undefined; buttonType?: "button" | "submit" | undefined; } | { name: string; type: import("../ui/index.mjs").NodeType.Form; children: ({ name: string; type: import("../ui/index.mjs").NodeType.Input; value?: string | undefined; label?: string | undefined; inputType?: "number" | "text" | "password" | undefined; placeholder?: string | undefined; error?: string | undefined; } | { value: string; type: import("../ui/index.mjs").NodeType.Button; name?: string | undefined; variant?: "primary" | "secondary" | undefined; buttonType?: "button" | "submit" | undefined; })[]; } | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").AssetSelectorProps, "AssetSelector"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").AddressInputProps, "AddressInput"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").IconProps, "Icon"> | import("../jsx/index.mjs").SnapElement<{ src: string; alt?: string | undefined; borderRadius?: import("../jsx/index.mjs").BorderRadius; }, "Image"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").ButtonProps, "Button"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").CheckboxProps, "Checkbox"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").FormProps, "Form"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").InputProps, "Input"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").DropdownProps, "Dropdown"> | import("../jsx/index.mjs").SnapElement<{ name: string; value?: string | undefined; children: import("../jsx/index.mjs").SnapsChildren<import("../jsx/index.mjs").SnapElement<{ value: string; children: string; disabled?: boolean | undefined; }, "Radio">>; disabled?: boolean | undefined; }, "RadioGroup"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").FileInputProps, "FileInput"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").AddressProps, "Address"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").CardProps, "Card"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").SelectorProps, "Selector"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").FieldProps, "Field"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").BoldProps, "Bold"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").ItalicProps, "Italic"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").AvatarProps, "Avatar"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").BoxProps, "Box"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").ContainerProps, "Container"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").CopyableProps, "Copyable"> | import("../jsx/index.mjs").SnapElement<Record<string, never>, "Divider"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").LinkProps, "Link"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").SkeletonProps, "Skeleton"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").TextProps, "Text"> | import("../jsx/index.mjs").SnapElement<{ children: import("../jsx/index.mjs").StringElement; size?: "md" | "sm" | "lg" | undefined; }, "Heading"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").RowProps, "Row"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").SectionProps, "Section"> | import("../jsx/index.mjs").SnapElement<Record<string, never>, "Spinner"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").TooltipProps, "Tooltip"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").BannerProps, "Banner">, null>; export declare const InterfaceContextStruct: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>; export type InterfaceContext = Infer<typeof InterfaceContextStruct>; export declare enum ContentType { Insight = "Insight", Dialog = "Dialog", Notification = "Notification", HomePage = "HomePage" } //# sourceMappingURL=interface.d.mts.map