UNPKG

@metamask/snaps-sdk

Version:

A library containing the core functionality for building MetaMask Snaps

160 lines 8.42 kB
import type { Infer } from "@metamask/superstruct"; import type { JSXElement } from "../jsx/index.cjs"; import type { Component } from "../ui/index.cjs"; /** * 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 | { addresses: `${string}:${string}:${string}`[]; accountId: string; } | { 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 | { addresses: `${string}:${string}:${string}`[]; accountId: string; } | { 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 | { addresses: `${string}:${string}:${string}`[]; accountId: string; } | { name: string; size: number; contentType: string; contents: string; } | { symbol: string; name: string; asset: `${string}:${string}/${string}:${string}`; } | Record<string, string | boolean | { addresses: `${string}:${string}:${string}`[]; accountId: string; } | { 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.cjs").NodeType.Copyable; sensitive?: boolean | undefined; } | { type: import("../ui/index.cjs").NodeType.Divider; } | { value: string; type: import("../ui/index.cjs").NodeType.Heading; } | { value: string; type: import("../ui/index.cjs").NodeType.Image; } | import("../ui/index.cjs").Panel | { type: import("../ui/index.cjs").NodeType.Spinner; } | { value: string; type: import("../ui/index.cjs").NodeType.Text; markdown?: boolean | undefined; } | { value: `0x${string}`; type: import("../ui/index.cjs").NodeType.Address; } | { value: { value: string; type: import("../ui/index.cjs").NodeType.Image; } | { value: string; type: import("../ui/index.cjs").NodeType.Text; markdown?: boolean | undefined; } | { value: `0x${string}`; type: import("../ui/index.cjs").NodeType.Address; }; type: import("../ui/index.cjs").NodeType.Row; label: string; variant?: "default" | "critical" | "warning" | undefined; } | { type: import("../ui/index.cjs").NodeType.Input; name: string; value?: string | undefined; label?: string | undefined; inputType?: "number" | "text" | "password" | undefined; placeholder?: string | undefined; error?: string | undefined; } | { value: string; type: import("../ui/index.cjs").NodeType.Button; variant?: "primary" | "secondary" | undefined; name?: string | undefined; buttonType?: "button" | "submit" | undefined; } | { type: import("../ui/index.cjs").NodeType.Form; name: string; children: ({ type: import("../ui/index.cjs").NodeType.Input; name: string; value?: string | undefined; label?: string | undefined; inputType?: "number" | "text" | "password" | undefined; placeholder?: string | undefined; error?: string | undefined; } | { value: string; type: import("../ui/index.cjs").NodeType.Button; variant?: "primary" | "secondary" | undefined; name?: string | undefined; buttonType?: "button" | "submit" | undefined; })[]; } | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").AccountSelectorProps, "AccountSelector"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").AddressInputProps, "AddressInput"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").AssetSelectorProps, "AssetSelector"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").IconProps, "Icon"> | import("../jsx/index.cjs").SnapElement<{ src: string; alt?: string | undefined; borderRadius?: import("../jsx/index.cjs").BorderRadius; height?: number | undefined; width?: number | undefined; }, "Image"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").ButtonProps, "Button"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").CheckboxProps, "Checkbox"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").DateTimePickerProps, "DateTimePicker"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").FormProps, "Form"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").InputProps, "Input"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").DropdownProps, "Dropdown"> | import("../jsx/index.cjs").SnapElement<{ name: string; value?: string | undefined; children: import("../jsx/index.cjs").SnapsChildren<import("../jsx/index.cjs").SnapElement<{ value: string; children: string; disabled?: boolean | undefined; }, "Radio">>; disabled?: boolean | undefined; }, "RadioGroup"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").FileInputProps, "FileInput"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").AddressProps, "Address"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").CardProps, "Card"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").SelectorProps, "Selector"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").FieldProps, "Field"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").BoldProps, "Bold"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").ItalicProps, "Italic"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").AvatarProps, "Avatar"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").BoxProps, "Box"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").ContainerProps, "Container"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").CopyableProps, "Copyable"> | import("../jsx/index.cjs").SnapElement<Record<string, never>, "Divider"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").LinkProps, "Link"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").SkeletonProps, "Skeleton"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").TextProps, "Text"> | import("../jsx/index.cjs").SnapElement<{ children: import("../jsx/index.cjs").StringElement; size?: "md" | "sm" | "lg" | undefined; }, "Heading"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").RowProps, "Row"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").SectionProps, "Section"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").CollapsibleSectionProps, "CollapsibleSection"> | import("../jsx/index.cjs").SnapElement<Record<string, never>, "Spinner"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").TooltipProps, "Tooltip"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").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.cts.map