@metamask/snaps-sdk 6.17.1 → 6.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/CHANGELOG.md +13 -1
  2. package/dist/error-wrappers.d.cts +192 -192
  3. package/dist/error-wrappers.d.mts +192 -192
  4. package/dist/internals/error-wrappers.d.cts +12 -12
  5. package/dist/internals/error-wrappers.d.mts +12 -12
  6. package/dist/jsx/components/Box.cjs.map +1 -1
  7. package/dist/jsx/components/Box.d.cts +2 -0
  8. package/dist/jsx/components/Box.d.cts.map +1 -1
  9. package/dist/jsx/components/Box.d.mts +2 -0
  10. package/dist/jsx/components/Box.d.mts.map +1 -1
  11. package/dist/jsx/components/Box.mjs.map +1 -1
  12. package/dist/jsx/validation.cjs +1 -0
  13. package/dist/jsx/validation.cjs.map +1 -1
  14. package/dist/jsx/validation.d.cts.map +1 -1
  15. package/dist/jsx/validation.d.mts.map +1 -1
  16. package/dist/jsx/validation.mjs +1 -0
  17. package/dist/jsx/validation.mjs.map +1 -1
  18. package/dist/types/caip.cjs.map +1 -1
  19. package/dist/types/caip.d.cts +6 -2
  20. package/dist/types/caip.d.cts.map +1 -1
  21. package/dist/types/caip.d.mts +6 -2
  22. package/dist/types/caip.d.mts.map +1 -1
  23. package/dist/types/caip.mjs.map +1 -1
  24. package/dist/types/handlers/name-lookup.cjs.map +1 -1
  25. package/dist/types/handlers/name-lookup.d.cts +3 -4
  26. package/dist/types/handlers/name-lookup.d.cts.map +1 -1
  27. package/dist/types/handlers/name-lookup.d.mts +3 -4
  28. package/dist/types/handlers/name-lookup.d.mts.map +1 -1
  29. package/dist/types/handlers/name-lookup.mjs.map +1 -1
  30. package/dist/types/handlers/transaction.cjs.map +1 -1
  31. package/dist/types/handlers/transaction.d.cts +3 -3
  32. package/dist/types/handlers/transaction.d.cts.map +1 -1
  33. package/dist/types/handlers/transaction.d.mts +3 -3
  34. package/dist/types/handlers/transaction.d.mts.map +1 -1
  35. package/dist/types/handlers/transaction.mjs.map +1 -1
  36. package/dist/types/methods/get-preferences.cjs.map +1 -1
  37. package/dist/types/methods/get-preferences.d.cts +14 -0
  38. package/dist/types/methods/get-preferences.d.cts.map +1 -1
  39. package/dist/types/methods/get-preferences.d.mts +14 -0
  40. package/dist/types/methods/get-preferences.d.mts.map +1 -1
  41. package/dist/types/methods/get-preferences.mjs.map +1 -1
  42. package/dist/types/permissions.cjs.map +1 -1
  43. package/dist/types/permissions.d.cts +2 -3
  44. package/dist/types/permissions.d.cts.map +1 -1
  45. package/dist/types/permissions.d.mts +2 -3
  46. package/dist/types/permissions.d.mts.map +1 -1
  47. package/dist/types/permissions.mjs.map +1 -1
  48. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"validation.mjs","sourceRoot":"","sources":["../../src/jsx/validation.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,EAAE,EACF,OAAO,EACP,QAAQ,EACR,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,MAAM,EACN,MAAM,EACN,MAAM,EACN,KAAK,EACL,MAAM,EACN,MAAM,EACN,KAAK,EACN,8BAA8B;AAC/B,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,wBAAwB,EACxB,aAAa,EACb,UAAU,EACX,wBAAwB;AAGzB,OAAO,EACL,OAAO,EACP,SAAS,EACT,cAAc,EACd,GAAG,EACH,UAAU,EACX,+BAAqB;AAatB,OAAO,EAmCL,QAAQ,EACT,+BAAqB;AAEtB;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAkB,SAAS,CAAC,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;AAExE;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAA4B,QAAQ,CAAC;IACnE,MAAM,EAAE;CACT,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAiC,MAAM,CAAC;IAChE,IAAI,EAAE,MAAM,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;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,4EAA4E;IAC5E,0EAA0E;IAC1E,2DAA2D;IAC3D,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CACb,wCAAwC,IAAI,CAAC,SAAS,CACpD,KAAK,CACN,qFAAqF,CACvF,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["import type {\n AnyStruct,\n Infer,\n InferStructTuple,\n ObjectSchema,\n Struct,\n} from '@metamask/superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n refine,\n assign,\n union,\n} from '@metamask/superstruct';\nimport {\n CaipAccountIdStruct,\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\n\nimport type { Describe } from '../internals';\nimport {\n literal,\n nullUnion,\n selectiveUnion,\n svg,\n typedUnion,\n} from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapChildren,\n GenericSnapElement,\n JsonObject,\n Key,\n Nestable,\n SnapElement,\n SnapsChildren,\n StringElement,\n} from './component';\nimport type { AvatarElement, SkeletonElement } from './components';\nimport {\n type AddressElement,\n type BoldElement,\n type BoxElement,\n type ButtonElement,\n type CheckboxElement,\n type CardElement,\n type CopyableElement,\n type DividerElement,\n type DropdownElement,\n type OptionElement,\n type RadioElement,\n type RadioGroupElement,\n type FieldElement,\n type FormElement,\n type HeadingElement,\n type ImageElement,\n type InputElement,\n type ItalicElement,\n type JSXElement,\n type LinkElement,\n type RowElement,\n type SpinnerElement,\n type StandardFormattingElement,\n type TextElement,\n type TooltipElement,\n type ValueElement,\n type FileInputElement,\n type ContainerElement,\n type FooterElement,\n type IconElement,\n type SectionElement,\n type SelectorElement,\n type SelectorOptionElement,\n type BannerElement,\n IconName,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe<Key> = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe<StringElement> = children([\n string(),\n]);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe<GenericSnapElement> = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link Nestable} type.\n *\n * @param struct - The struct for the type to test.\n * @returns The struct for the nestable type.\n */\nfunction nestable<Type, Schema>(\n struct: Struct<Type, Schema>,\n): Struct<Nestable<Type>, any> {\n const nestableStruct: Struct<Nestable<Type>> = selectiveUnion((value) => {\n if (Array.isArray(value)) {\n return array(lazy(() => nestableStruct));\n }\n return struct;\n });\n\n return nestableStruct;\n}\n\n/**\n * A helper function for creating a struct which allows children of a specific\n * type, as well as `null` and `boolean`.\n *\n * @param structs - The structs to allow as children.\n * @returns The struct for the children.\n */\nfunction children<Head extends AnyStruct, Tail extends AnyStruct[]>(\n structs: [head: Head, ...tail: Tail],\n): Struct<\n Nestable<Infer<Head> | InferStructTuple<Tail>[number] | boolean | null>,\n null\n> {\n return nestable(\n nullable(\n selectiveUnion((value) => {\n if (typeof value === 'boolean') {\n return boolean();\n }\n if (structs.length === 1) {\n return structs[0];\n }\n return nullUnion(structs);\n }),\n ),\n ) as unknown as Struct<\n Nestable<Infer<Head> | InferStructTuple<Tail>[number] | boolean | null>,\n null\n >;\n}\n\n/**\n * A helper function for creating a struct which allows a single child of a specific\n * type, as well as `null` and `boolean`.\n *\n * @param struct - The struct to allow as a single child.\n * @returns The struct for the children.\n */\nfunction singleChild<Type extends AnyStruct>(\n struct: Type,\n): Struct<Infer<Type> | boolean | null, null> {\n return nullable(\n selectiveUnion((value) => {\n if (typeof value === 'boolean') {\n return boolean();\n }\n\n return struct;\n }),\n ) as unknown as Struct<Infer<Type> | boolean | null, null>;\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element<Name extends string, Props extends ObjectSchema = EmptyObject>(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct<Name, Name>,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A helper function for creating a struct for a JSX element with selective props.\n *\n * @param name - The name of the element.\n * @param selector - The selector function choosing the struct to validate with.\n * @returns The struct for the element.\n */\nfunction elementWithSelectiveProps<\n Name extends string,\n Selector extends (value: any) => AnyStruct,\n>(name: Name, selector: Selector) {\n return object({\n type: literal(name) as unknown as Struct<Name, Name>,\n props: selectiveUnion(selector),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * Shared struct used to validate border radius values used by various Snaps components.\n */\nexport const BorderRadiusStruct = nullUnion([\n literal('none'),\n literal('medium'),\n literal('full'),\n]);\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe<ImageElement> = element('Image', {\n src: svg(),\n alt: optional(string()),\n borderRadius: optional(BorderRadiusStruct),\n});\n\nconst IconNameStruct: Struct<`${IconName}`, null> = nullUnion(\n Object.values(IconName).map((name) => literal(name)) as any,\n);\n\n/**\n * A struct for the {@link IconElement} type.\n */\nexport const IconStruct: Describe<IconElement> = element('Icon', {\n name: IconNameStruct,\n color: optional(\n nullUnion([literal('default'), literal('primary'), literal('muted')]),\n ),\n size: optional(nullUnion([literal('md'), literal('inherit')])),\n});\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe<ButtonElement> = element('Button', {\n children: children([StringElementStruct, ImageStruct, IconStruct]),\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n size: optional(nullUnion([literal('sm'), literal('md')])),\n disabled: optional(boolean()),\n loading: optional(boolean()),\n form: optional(string()),\n});\n\n/**\n * A struct for the {@link CheckboxElement} type.\n */\nexport const CheckboxStruct: Describe<CheckboxElement> = element('Checkbox', {\n name: string(),\n checked: optional(boolean()),\n label: optional(string()),\n variant: optional(nullUnion([literal('default'), literal('toggle')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the generic input element props.\n */\nexport const GenericInputPropsStruct = object({\n name: string(),\n value: optional(string()),\n placeholder: optional(string()),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the text type input props.\n */\nexport const TextInputPropsStruct = assign(\n GenericInputPropsStruct,\n object({\n type: literal('text'),\n }),\n);\n\n/**\n * A struct for the password type input props.\n */\nexport const PasswordInputPropsStruct = assign(\n GenericInputPropsStruct,\n object({\n type: literal('password'),\n }),\n);\n\n/**\n * A struct for the number type input props.\n */\nexport const NumberInputPropsStruct = assign(\n GenericInputPropsStruct,\n object({\n type: literal('number'),\n min: optional(number()),\n max: optional(number()),\n step: optional(number()),\n }),\n);\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe<InputElement> = elementWithSelectiveProps(\n 'Input',\n (value) => {\n if (isPlainObject(value) && hasProperty(value, 'type')) {\n switch (value.type) {\n case 'text':\n return TextInputPropsStruct;\n case 'password':\n return PasswordInputPropsStruct;\n case 'number':\n return NumberInputPropsStruct;\n default:\n return GenericInputPropsStruct;\n }\n }\n return GenericInputPropsStruct;\n },\n);\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe<OptionElement> = element('Option', {\n value: string(),\n children: string(),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe<DropdownElement> = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: children([OptionStruct]),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe<AddressElement> = element('Address', {\n address: nullUnion([HexChecksumAddressStruct, CaipAccountIdStruct]),\n truncate: optional(boolean()),\n displayName: optional(boolean()),\n avatar: optional(boolean()),\n});\n\n/**\n * A struct for the {@link CardElement} type.\n */\nexport const CardStruct: Describe<CardElement> = element('Card', {\n image: optional(string()),\n title: selectiveUnion((value) => {\n if (typeof value === 'object') {\n return AddressStruct;\n }\n return string();\n }),\n description: optional(string()),\n value: string(),\n extra: optional(string()),\n});\n\n/**\n * A struct for the {@link SelectorOptionElement} type.\n */\nexport const SelectorOptionStruct: Describe<SelectorOptionElement> = element(\n 'SelectorOption',\n {\n value: string(),\n children: CardStruct,\n disabled: optional(boolean()),\n },\n);\n\n/**\n * A struct for the {@link SelectorElement} type.\n */\nexport const SelectorStruct: Describe<SelectorElement> = element('Selector', {\n name: string(),\n title: string(),\n value: optional(string()),\n children: children([SelectorOptionStruct]),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link RadioElement} type.\n */\nexport const RadioStruct: Describe<RadioElement> = element('Radio', {\n value: string(),\n children: string(),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link RadioGroupElement} type.\n */\nexport const RadioGroupStruct: Describe<RadioGroupElement> = element(\n 'RadioGroup',\n {\n name: string(),\n value: optional(string()),\n children: children([RadioStruct]),\n disabled: optional(boolean()),\n },\n);\n\n/**\n * A struct for the {@link FileInputElement} type.\n */\nexport const FileInputStruct: Describe<FileInputElement> = element(\n 'FileInput',\n {\n name: string(),\n accept: nullUnion([optional(array(string()))]),\n compact: optional(boolean()),\n disabled: optional(boolean()),\n },\n);\n\n/**\n * A subset of JSX elements that represent the tuple Box + Input of the Field children.\n */\nconst BOX_INPUT_LEFT = [\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n singleChild(lazy(() => BoxChildStruct)),\n InputStruct,\n] as [typeof BoxChildStruct, typeof InputStruct];\n\n/**\n * A subset of JSX elements that represent the tuple Input + Box of the Field children.\n */\nconst BOX_INPUT_RIGHT = [\n InputStruct,\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n singleChild(lazy(() => BoxChildStruct)),\n] as [typeof InputStruct, typeof BoxChildStruct];\n\n/**\n * A subset of JSX elements that represent the tuple Box + Input + Box of the Field children.\n */\nconst BOX_INPUT_BOTH = [\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n singleChild(lazy(() => BoxChildStruct)),\n InputStruct,\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n singleChild(lazy(() => BoxChildStruct)),\n] as [typeof BoxChildStruct, typeof InputStruct, typeof BoxChildStruct];\n\n/**\n * A subset of JSX elements that are allowed as single children of the Field component.\n */\nconst FIELD_CHILDREN_ARRAY = [\n InputStruct,\n DropdownStruct,\n RadioGroupStruct,\n FileInputStruct,\n CheckboxStruct,\n SelectorStruct,\n] as [\n typeof InputStruct,\n typeof DropdownStruct,\n typeof RadioGroupStruct,\n typeof FileInputStruct,\n typeof CheckboxStruct,\n typeof SelectorStruct,\n];\n\n/**\n * A union of the allowed children of the Field component.\n * This is mainly used in the simulator for validation purposes.\n */\nexport const FieldChildUnionStruct = nullUnion([\n ...FIELD_CHILDREN_ARRAY,\n ...BOX_INPUT_LEFT,\n ...BOX_INPUT_RIGHT,\n ...BOX_INPUT_BOTH,\n]);\n\n/**\n * A subset of JSX elements that are allowed as children of the Field component.\n */\nconst FieldChildStruct = selectiveUnion((value) => {\n const isArray = Array.isArray(value);\n if (isArray && value.length === 3) {\n return tuple(BOX_INPUT_BOTH);\n }\n\n if (isArray && value.length === 2) {\n return value[0]?.type === 'Box'\n ? tuple(BOX_INPUT_LEFT)\n : tuple(BOX_INPUT_RIGHT);\n }\n\n return typedUnion(FIELD_CHILDREN_ARRAY);\n}) as unknown as Struct<\n | [InputElement, GenericSnapChildren]\n | [GenericSnapChildren, InputElement]\n | [GenericSnapChildren, InputElement, GenericSnapChildren]\n | DropdownElement\n | RadioGroupElement\n | FileInputElement\n | InputElement\n | CheckboxElement\n | SelectorElement,\n null\n>;\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe<FieldElement> = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: FieldChildStruct,\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe<BoldElement> = element('Bold', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement<JsonObject, 'Italic'>\n >,\n ]),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe<ItalicElement> = element('Italic', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement<JsonObject, 'Bold'>\n >,\n ]),\n});\n\nexport const FormattingStruct: Describe<StandardFormattingElement> = typedUnion(\n [BoldStruct, ItalicStruct],\n);\n\n/**\n * A struct for the {@link AvatarElement} type.\n */\nexport const AvatarStruct = element('Avatar', {\n address: CaipAccountIdStruct,\n size: optional(nullUnion([literal('sm'), literal('md'), literal('lg')])),\n}) as unknown as Struct<AvatarElement, null>;\n\nexport const BoxChildrenStruct = children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [lazy(() => BoxChildStruct)],\n) as unknown as Struct<SnapsChildren<GenericSnapElement>, null>;\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe<BoxElement> = element('Box', {\n children: BoxChildrenStruct,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n center: optional(boolean()),\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Form component.\n */\nexport const FormChildStruct = BoxChildrenStruct;\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe<FormElement> = element('Form', {\n children: FormChildStruct,\n name: string(),\n});\n\nconst FooterButtonStruct = refine(ButtonStruct, 'FooterButton', (value) => {\n if (\n typeof value.props.children === 'string' ||\n typeof value.props.children === 'boolean' ||\n value.props.children === null\n ) {\n return true;\n }\n\n if (Array.isArray(value.props.children)) {\n const hasNonTextElements = value.props.children.some(\n (child) =>\n typeof child !== 'string' &&\n typeof child !== 'boolean' &&\n child !== null,\n );\n\n if (!hasNonTextElements) {\n return true;\n }\n }\n\n return 'Footer buttons may only contain text.';\n});\n\n/**\n * A struct for the {@link SectionElement} type.\n */\nexport const SectionStruct: Describe<SectionElement> = element('Section', {\n children: BoxChildrenStruct,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Footer component.\n * This set should include a single button or a tuple of two buttons.\n */\n\nexport const FooterChildStruct = selectiveUnion((value) => {\n if (Array.isArray(value)) {\n return tuple([FooterButtonStruct, FooterButtonStruct]);\n }\n return FooterButtonStruct;\n});\n\n/**\n * A struct for the {@link FooterElement} type.\n */\nexport const FooterStruct: Describe<FooterElement> = element('Footer', {\n children: FooterChildStruct,\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe<CopyableElement> = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe<DividerElement> = element('Divider');\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe<HeadingElement> = element('Heading', {\n children: StringElementStruct,\n size: optional(nullUnion([literal('sm'), literal('md'), literal('lg')])),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe<LinkElement> = element('Link', {\n href: string(),\n children: children([\n FormattingStruct,\n string(),\n IconStruct,\n ImageStruct,\n AddressStruct,\n ]),\n});\n\n/**\n * A struct for the {@link SkeletonElement} type.\n */\nexport const SkeletonStruct: Describe<SkeletonElement> = element('Skeleton', {\n width: optional(union([number(), string()])),\n height: optional(union([number(), string()])),\n borderRadius: optional(BorderRadiusStruct),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe<TextElement> = element('Text', {\n children: children([\n selectiveUnion((value) => {\n if (typeof value === 'string') {\n return string();\n }\n return typedUnion([\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n IconStruct,\n SkeletonStruct,\n ]);\n }),\n ]),\n alignment: optional(\n nullUnion([literal('start'), literal('center'), literal('end')]),\n ),\n color: optional(\n nullUnion([\n literal('default'),\n literal('alternative'),\n literal('muted'),\n literal('error'),\n literal('success'),\n literal('warning'),\n ]),\n ),\n size: optional(nullUnion([literal('sm'), literal('md')])),\n fontWeight: optional(\n nullUnion([literal('regular'), literal('medium'), literal('bold')]),\n ),\n});\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe<ValueElement> = element('Value', {\n value: selectiveUnion((value) => {\n if (typeof value === 'string') {\n return string();\n }\n\n return TextStruct;\n }),\n extra: selectiveUnion((value) => {\n if (typeof value === 'string') {\n return string();\n }\n\n return TextStruct;\n }),\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Tooltip component.\n * This set should include all text components and the Image.\n */\nexport const TooltipChildStruct = selectiveUnion((value) => {\n if (typeof value === 'boolean') {\n return boolean();\n }\n return typedUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n ImageStruct,\n IconStruct,\n ]);\n});\n\n/**\n * A subset of JSX elements that are allowed as content of the Tooltip component.\n * This set should include all text components.\n */\nexport const TooltipContentStruct = selectiveUnion((value) => {\n if (typeof value === 'string') {\n return string();\n }\n return typedUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n IconStruct,\n ]);\n});\n\n/**\n * A struct for the {@link TooltipElement} type.\n */\nexport const TooltipStruct: Describe<TooltipElement> = element('Tooltip', {\n children: nullable(TooltipChildStruct),\n content: TooltipContentStruct,\n});\n\n/**\n * A struct for the {@link BannerElement} type.\n */\nexport const BannerStruct: Describe<BannerElement> = element('Banner', {\n children: children([\n TextStruct,\n LinkStruct,\n IconStruct,\n ButtonStruct,\n BoldStruct,\n ItalicStruct,\n SkeletonStruct,\n ]),\n title: string(),\n severity: union([\n literal('danger'),\n literal('info'),\n literal('success'),\n literal('warning'),\n ]),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe<RowElement> = element('Row', {\n label: string(),\n children: typedUnion([\n AddressStruct,\n ImageStruct,\n TextStruct,\n ValueStruct,\n LinkStruct,\n SkeletonStruct,\n ]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('critical')]),\n ),\n tooltip: optional(string()),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe<SpinnerElement> = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set includes all components, except components that need to be nested in\n * another component (e.g., Field must be contained in a Form).\n */\nexport const BoxChildStruct = typedUnion([\n AddressStruct,\n BoldStruct,\n BoxStruct,\n ButtonStruct,\n CopyableStruct,\n DividerStruct,\n DropdownStruct,\n RadioGroupStruct,\n FieldStruct,\n FileInputStruct,\n FormStruct,\n HeadingStruct,\n InputStruct,\n ImageStruct,\n ItalicStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n TooltipStruct,\n CheckboxStruct,\n CardStruct,\n IconStruct,\n SelectorStruct,\n SectionStruct,\n AvatarStruct,\n BannerStruct,\n SkeletonStruct,\n]);\n\n/**\n * A struct for the {@link ContainerElement} type.\n */\nexport const ContainerStruct: Describe<ContainerElement> = element(\n 'Container',\n {\n children: selectiveUnion((value) => {\n if (Array.isArray(value)) {\n return tuple([BoxChildStruct, FooterStruct]);\n }\n return BoxChildStruct;\n }) as unknown as Struct<\n [GenericSnapElement, FooterElement] | GenericSnapElement,\n null\n >,\n backgroundColor: optional(\n nullUnion([literal('default'), literal('alternative')]),\n ),\n },\n);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = typedUnion([\n BoxChildStruct,\n ContainerStruct,\n]);\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe<JSXElement> = typedUnion([\n ButtonStruct,\n InputStruct,\n FileInputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n RadioGroupStruct,\n RadioStruct,\n ValueStruct,\n TooltipStruct,\n CheckboxStruct,\n FooterStruct,\n ContainerStruct,\n CardStruct,\n IconStruct,\n SelectorStruct,\n SelectorOptionStruct,\n SectionStruct,\n AvatarStruct,\n BannerStruct,\n SkeletonStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n"]}
1
+ {"version":3,"file":"validation.mjs","sourceR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n} from '@metamask/superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n refine,\n assign,\n union,\n} from '@metamask/superstruct';\nimport {\n CaipAccountIdStruct,\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\n\nimport type { Describe } from '../internals';\nimport {\n literal,\n nullUnion,\n selectiveUnion,\n svg,\n typedUnion,\n} from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapChildren,\n GenericSnapElement,\n JsonObject,\n Key,\n Nestable,\n SnapElement,\n SnapsChildren,\n StringElement,\n} from './component';\nimport type { AvatarElement, SkeletonElement } from './components';\nimport {\n type AddressElement,\n type BoldElement,\n type BoxElement,\n type ButtonElement,\n type CheckboxElement,\n type CardElement,\n type CopyableElement,\n type DividerElement,\n type DropdownElement,\n type OptionElement,\n type RadioElement,\n type RadioGroupElement,\n type FieldElement,\n type FormElement,\n type HeadingElement,\n type ImageElement,\n type InputElement,\n type ItalicElement,\n type JSXElement,\n type LinkElement,\n type RowElement,\n type SpinnerElement,\n type StandardFormattingElement,\n type TextElement,\n type TooltipElement,\n type ValueElement,\n type FileInputElement,\n type ContainerElement,\n type FooterElement,\n type IconElement,\n type SectionElement,\n type SelectorElement,\n type SelectorOptionElement,\n type BannerElement,\n IconName,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe<Key> = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe<StringElement> = children([\n string(),\n]);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe<GenericSnapElement> = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link Nestable} type.\n *\n * @param struct - The struct for the type to test.\n * @returns The struct for the nestable type.\n */\nfunction nestable<Type, Schema>(\n struct: Struct<Type, Schema>,\n): Struct<Nestable<Type>, any> {\n const nestableStruct: Struct<Nestable<Type>> = selectiveUnion((value) => {\n if (Array.isArray(value)) {\n return array(lazy(() => nestableStruct));\n }\n return struct;\n });\n\n return nestableStruct;\n}\n\n/**\n * A helper function for creating a struct which allows children of a specific\n * type, as well as `null` and `boolean`.\n *\n * @param structs - The structs to allow as children.\n * @returns The struct for the children.\n */\nfunction children<Head extends AnyStruct, Tail extends AnyStruct[]>(\n structs: [head: Head, ...tail: Tail],\n): Struct<\n Nestable<Infer<Head> | InferStructTuple<Tail>[number] | boolean | null>,\n null\n> {\n return nestable(\n nullable(\n selectiveUnion((value) => {\n if (typeof value === 'boolean') {\n return boolean();\n }\n if (structs.length === 1) {\n return structs[0];\n }\n return nullUnion(structs);\n }),\n ),\n ) as unknown as Struct<\n Nestable<Infer<Head> | InferStructTuple<Tail>[number] | boolean | null>,\n null\n >;\n}\n\n/**\n * A helper function for creating a struct which allows a single child of a specific\n * type, as well as `null` and `boolean`.\n *\n * @param struct - The struct to allow as a single child.\n * @returns The struct for the children.\n */\nfunction singleChild<Type extends AnyStruct>(\n struct: Type,\n): Struct<Infer<Type> | boolean | null, null> {\n return nullable(\n selectiveUnion((value) => {\n if (typeof value === 'boolean') {\n return boolean();\n }\n\n return struct;\n }),\n ) as unknown as Struct<Infer<Type> | boolean | null, null>;\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element<Name extends string, Props extends ObjectSchema = EmptyObject>(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct<Name, Name>,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A helper function for creating a struct for a JSX element with selective props.\n *\n * @param name - The name of the element.\n * @param selector - The selector function choosing the struct to validate with.\n * @returns The struct for the element.\n */\nfunction elementWithSelectiveProps<\n Name extends string,\n Selector extends (value: any) => AnyStruct,\n>(name: Name, selector: Selector) {\n return object({\n type: literal(name) as unknown as Struct<Name, Name>,\n props: selectiveUnion(selector),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * Shared struct used to validate border radius values used by various Snaps components.\n */\nexport const BorderRadiusStruct = nullUnion([\n literal('none'),\n literal('medium'),\n literal('full'),\n]);\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe<ImageElement> = element('Image', {\n src: svg(),\n alt: optional(string()),\n borderRadius: optional(BorderRadiusStruct),\n});\n\nconst IconNameStruct: Struct<`${IconName}`, null> = nullUnion(\n Object.values(IconName).map((name) => literal(name)) as any,\n);\n\n/**\n * A struct for the {@link IconElement} type.\n */\nexport const IconStruct: Describe<IconElement> = element('Icon', {\n name: IconNameStruct,\n color: optional(\n nullUnion([literal('default'), literal('primary'), literal('muted')]),\n ),\n size: optional(nullUnion([literal('md'), literal('inherit')])),\n});\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe<ButtonElement> = element('Button', {\n children: children([StringElementStruct, ImageStruct, IconStruct]),\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n size: optional(nullUnion([literal('sm'), literal('md')])),\n disabled: optional(boolean()),\n loading: optional(boolean()),\n form: optional(string()),\n});\n\n/**\n * A struct for the {@link CheckboxElement} type.\n */\nexport const CheckboxStruct: Describe<CheckboxElement> = element('Checkbox', {\n name: string(),\n checked: optional(boolean()),\n label: optional(string()),\n variant: optional(nullUnion([literal('default'), literal('toggle')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the generic input element props.\n */\nexport const GenericInputPropsStruct = object({\n name: string(),\n value: optional(string()),\n placeholder: optional(string()),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the text type input props.\n */\nexport const TextInputPropsStruct = assign(\n GenericInputPropsStruct,\n object({\n type: literal('text'),\n }),\n);\n\n/**\n * A struct for the password type input props.\n */\nexport const PasswordInputPropsStruct = assign(\n GenericInputPropsStruct,\n object({\n type: literal('password'),\n }),\n);\n\n/**\n * A struct for the number type input props.\n */\nexport const NumberInputPropsStruct = assign(\n GenericInputPropsStruct,\n object({\n type: literal('number'),\n min: optional(number()),\n max: optional(number()),\n step: optional(number()),\n }),\n);\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe<InputElement> = elementWithSelectiveProps(\n 'Input',\n (value) => {\n if (isPlainObject(value) && hasProperty(value, 'type')) {\n switch (value.type) {\n case 'text':\n return TextInputPropsStruct;\n case 'password':\n return PasswordInputPropsStruct;\n case 'number':\n return NumberInputPropsStruct;\n default:\n return GenericInputPropsStruct;\n }\n }\n return GenericInputPropsStruct;\n },\n);\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe<OptionElement> = element('Option', {\n value: string(),\n children: string(),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe<DropdownElement> = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: children([OptionStruct]),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe<AddressElement> = element('Address', {\n address: nullUnion([HexChecksumAddressStruct, CaipAccountIdStruct]),\n truncate: optional(boolean()),\n displayName: optional(boolean()),\n avatar: optional(boolean()),\n});\n\n/**\n * A struct for the {@link CardElement} type.\n */\nexport const CardStruct: Describe<CardElement> = element('Card', {\n image: optional(string()),\n title: selectiveUnion((value) => {\n if (typeof value === 'object') {\n return AddressStruct;\n }\n return string();\n }),\n description: optional(string()),\n value: string(),\n extra: optional(string()),\n});\n\n/**\n * A struct for the {@link SelectorOptionElement} type.\n */\nexport const SelectorOptionStruct: Describe<SelectorOptionElement> = element(\n 'SelectorOption',\n {\n value: string(),\n children: CardStruct,\n disabled: optional(boolean()),\n },\n);\n\n/**\n * A struct for the {@link SelectorElement} type.\n */\nexport const SelectorStruct: Describe<SelectorElement> = element('Selector', {\n name: string(),\n title: string(),\n value: optional(string()),\n children: children([SelectorOptionStruct]),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link RadioElement} type.\n */\nexport const RadioStruct: Describe<RadioElement> = element('Radio', {\n value: string(),\n children: string(),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link RadioGroupElement} type.\n */\nexport const RadioGroupStruct: Describe<RadioGroupElement> = element(\n 'RadioGroup',\n {\n name: string(),\n value: optional(string()),\n children: children([RadioStruct]),\n disabled: optional(boolean()),\n },\n);\n\n/**\n * A struct for the {@link FileInputElement} type.\n */\nexport const FileInputStruct: Describe<FileInputElement> = element(\n 'FileInput',\n {\n name: string(),\n accept: nullUnion([optional(array(string()))]),\n compact: optional(boolean()),\n disabled: optional(boolean()),\n },\n);\n\n/**\n * A subset of JSX elements that represent the tuple Box + Input of the Field children.\n */\nconst BOX_INPUT_LEFT = [\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n singleChild(lazy(() => BoxChildStruct)),\n InputStruct,\n] as [typeof BoxChildStruct, typeof InputStruct];\n\n/**\n * A subset of JSX elements that represent the tuple Input + Box of the Field children.\n */\nconst BOX_INPUT_RIGHT = [\n InputStruct,\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n singleChild(lazy(() => BoxChildStruct)),\n] as [typeof InputStruct, typeof BoxChildStruct];\n\n/**\n * A subset of JSX elements that represent the tuple Box + Input + Box of the Field children.\n */\nconst BOX_INPUT_BOTH = [\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n singleChild(lazy(() => BoxChildStruct)),\n InputStruct,\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n singleChild(lazy(() => BoxChildStruct)),\n] as [typeof BoxChildStruct, typeof InputStruct, typeof BoxChildStruct];\n\n/**\n * A subset of JSX elements that are allowed as single children of the Field component.\n */\nconst FIELD_CHILDREN_ARRAY = [\n InputStruct,\n DropdownStruct,\n RadioGroupStruct,\n FileInputStruct,\n CheckboxStruct,\n SelectorStruct,\n] as [\n typeof InputStruct,\n typeof DropdownStruct,\n typeof RadioGroupStruct,\n typeof FileInputStruct,\n typeof CheckboxStruct,\n typeof SelectorStruct,\n];\n\n/**\n * A union of the allowed children of the Field component.\n * This is mainly used in the simulator for validation purposes.\n */\nexport const FieldChildUnionStruct = nullUnion([\n ...FIELD_CHILDREN_ARRAY,\n ...BOX_INPUT_LEFT,\n ...BOX_INPUT_RIGHT,\n ...BOX_INPUT_BOTH,\n]);\n\n/**\n * A subset of JSX elements that are allowed as children of the Field component.\n */\nconst FieldChildStruct = selectiveUnion((value) => {\n const isArray = Array.isArray(value);\n if (isArray && value.length === 3) {\n return tuple(BOX_INPUT_BOTH);\n }\n\n if (isArray && value.length === 2) {\n return value[0]?.type === 'Box'\n ? tuple(BOX_INPUT_LEFT)\n : tuple(BOX_INPUT_RIGHT);\n }\n\n return typedUnion(FIELD_CHILDREN_ARRAY);\n}) as unknown as Struct<\n | [InputElement, GenericSnapChildren]\n | [GenericSnapChildren, InputElement]\n | [GenericSnapChildren, InputElement, GenericSnapChildren]\n | DropdownElement\n | RadioGroupElement\n | FileInputElement\n | InputElement\n | CheckboxElement\n | SelectorElement,\n null\n>;\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe<FieldElement> = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: FieldChildStruct,\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe<BoldElement> = element('Bold', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement<JsonObject, 'Italic'>\n >,\n ]),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe<ItalicElement> = element('Italic', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement<JsonObject, 'Bold'>\n >,\n ]),\n});\n\nexport const FormattingStruct: Describe<StandardFormattingElement> = typedUnion(\n [BoldStruct, ItalicStruct],\n);\n\n/**\n * A struct for the {@link AvatarElement} type.\n */\nexport const AvatarStruct = element('Avatar', {\n address: CaipAccountIdStruct,\n size: optional(nullUnion([literal('sm'), literal('md'), literal('lg')])),\n}) as unknown as Struct<AvatarElement, null>;\n\nexport const BoxChildrenStruct = children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [lazy(() => BoxChildStruct)],\n) as unknown as Struct<SnapsChildren<GenericSnapElement>, null>;\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe<BoxElement> = element('Box', {\n children: BoxChildrenStruct,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n crossAlignment: optional(\n nullUnion([literal('start'), literal('center'), literal('end')]),\n ),\n center: optional(boolean()),\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Form component.\n */\nexport const FormChildStruct = BoxChildrenStruct;\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe<FormElement> = element('Form', {\n children: FormChildStruct,\n name: string(),\n});\n\nconst FooterButtonStruct = refine(ButtonStruct, 'FooterButton', (value) => {\n if (\n typeof value.props.children === 'string' ||\n typeof value.props.children === 'boolean' ||\n value.props.children === null\n ) {\n return true;\n }\n\n if (Array.isArray(value.props.children)) {\n const hasNonTextElements = value.props.children.some(\n (child) =>\n typeof child !== 'string' &&\n typeof child !== 'boolean' &&\n child !== null,\n );\n\n if (!hasNonTextElements) {\n return true;\n }\n }\n\n return 'Footer buttons may only contain text.';\n});\n\n/**\n * A struct for the {@link SectionElement} type.\n */\nexport const SectionStruct: Describe<SectionElement> = element('Section', {\n children: BoxChildrenStruct,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Footer component.\n * This set should include a single button or a tuple of two buttons.\n */\n\nexport const FooterChildStruct = selectiveUnion((value) => {\n if (Array.isArray(value)) {\n return tuple([FooterButtonStruct, FooterButtonStruct]);\n }\n return FooterButtonStruct;\n});\n\n/**\n * A struct for the {@link FooterElement} type.\n */\nexport const FooterStruct: Describe<FooterElement> = element('Footer', {\n children: FooterChildStruct,\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe<CopyableElement> = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe<DividerElement> = element('Divider');\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe<HeadingElement> = element('Heading', {\n children: StringElementStruct,\n size: optional(nullUnion([literal('sm'), literal('md'), literal('lg')])),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe<LinkElement> = element('Link', {\n href: string(),\n children: children([\n FormattingStruct,\n string(),\n IconStruct,\n ImageStruct,\n AddressStruct,\n ]),\n});\n\n/**\n * A struct for the {@link SkeletonElement} type.\n */\nexport const SkeletonStruct: Describe<SkeletonElement> = element('Skeleton', {\n width: optional(union([number(), string()])),\n height: optional(union([number(), string()])),\n borderRadius: optional(BorderRadiusStruct),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe<TextElement> = element('Text', {\n children: children([\n selectiveUnion((value) => {\n if (typeof value === 'string') {\n return string();\n }\n return typedUnion([\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n IconStruct,\n SkeletonStruct,\n ]);\n }),\n ]),\n alignment: optional(\n nullUnion([literal('start'), literal('center'), literal('end')]),\n ),\n color: optional(\n nullUnion([\n literal('default'),\n literal('alternative'),\n literal('muted'),\n literal('error'),\n literal('success'),\n literal('warning'),\n ]),\n ),\n size: optional(nullUnion([literal('sm'), literal('md')])),\n fontWeight: optional(\n nullUnion([literal('regular'), literal('medium'), literal('bold')]),\n ),\n});\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe<ValueElement> = element('Value', {\n value: selectiveUnion((value) => {\n if (typeof value === 'string') {\n return string();\n }\n\n return TextStruct;\n }),\n extra: selectiveUnion((value) => {\n if (typeof value === 'string') {\n return string();\n }\n\n return TextStruct;\n }),\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Tooltip component.\n * This set should include all text components and the Image.\n */\nexport const TooltipChildStruct = selectiveUnion((value) => {\n if (typeof value === 'boolean') {\n return boolean();\n }\n return typedUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n ImageStruct,\n IconStruct,\n ]);\n});\n\n/**\n * A subset of JSX elements that are allowed as content of the Tooltip component.\n * This set should include all text components.\n */\nexport const TooltipContentStruct = selectiveUnion((value) => {\n if (typeof value === 'string') {\n return string();\n }\n return typedUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n IconStruct,\n ]);\n});\n\n/**\n * A struct for the {@link TooltipElement} type.\n */\nexport const TooltipStruct: Describe<TooltipElement> = element('Tooltip', {\n children: nullable(TooltipChildStruct),\n content: TooltipContentStruct,\n});\n\n/**\n * A struct for the {@link BannerElement} type.\n */\nexport const BannerStruct: Describe<BannerElement> = element('Banner', {\n children: children([\n TextStruct,\n LinkStruct,\n IconStruct,\n ButtonStruct,\n BoldStruct,\n ItalicStruct,\n SkeletonStruct,\n ]),\n title: string(),\n severity: union([\n literal('danger'),\n literal('info'),\n literal('success'),\n literal('warning'),\n ]),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe<RowElement> = element('Row', {\n label: string(),\n children: typedUnion([\n AddressStruct,\n ImageStruct,\n TextStruct,\n ValueStruct,\n LinkStruct,\n SkeletonStruct,\n ]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('critical')]),\n ),\n tooltip: optional(string()),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe<SpinnerElement> = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set includes all components, except components that need to be nested in\n * another component (e.g., Field must be contained in a Form).\n */\nexport const BoxChildStruct = typedUnion([\n AddressStruct,\n BoldStruct,\n BoxStruct,\n ButtonStruct,\n CopyableStruct,\n DividerStruct,\n DropdownStruct,\n RadioGroupStruct,\n FieldStruct,\n FileInputStruct,\n FormStruct,\n HeadingStruct,\n InputStruct,\n ImageStruct,\n ItalicStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n TooltipStruct,\n CheckboxStruct,\n CardStruct,\n IconStruct,\n SelectorStruct,\n SectionStruct,\n AvatarStruct,\n BannerStruct,\n SkeletonStruct,\n]);\n\n/**\n * A struct for the {@link ContainerElement} type.\n */\nexport const ContainerStruct: Describe<ContainerElement> = element(\n 'Container',\n {\n children: selectiveUnion((value) => {\n if (Array.isArray(value)) {\n return tuple([BoxChildStruct, FooterStruct]);\n }\n return BoxChildStruct;\n }) as unknown as Struct<\n [GenericSnapElement, FooterElement] | GenericSnapElement,\n null\n >,\n backgroundColor: optional(\n nullUnion([literal('default'), literal('alternative')]),\n ),\n },\n);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = typedUnion([\n BoxChildStruct,\n ContainerStruct,\n]);\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe<JSXElement> = typedUnion([\n ButtonStruct,\n InputStruct,\n FileInputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n RadioGroupStruct,\n RadioStruct,\n ValueStruct,\n TooltipStruct,\n CheckboxStruct,\n FooterStruct,\n ContainerStruct,\n CardStruct,\n IconStruct,\n SelectorStruct,\n SelectorOptionStruct,\n SectionStruct,\n AvatarStruct,\n BannerStruct,\n SkeletonStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"caip.cjs","sourceRoot":"","sources":["../../src/types/caip.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * A CAIP-2 chain ID, i.e., a human-readable namespace and reference.\n *\n * @see https://chainagnostic.org/CAIPs/caip-2\n */\nexport type ChainId = `${string}:${string}`;\n\n/**\n * A CAIP-10 account ID, i.e., a chain ID and an account address.\n *\n * @see https://chainagnostic.org/CAIPs/caip-10\n */\nexport type AccountId = `${ChainId}:${string}`;\n"]}
1
+ {"version":3,"file":"caip.cjs","sourceRoot":"","sources":["../../src/types/caip.ts"],"names":[],"mappings":"","sourcesContent":["import type { CaipAccountId, CaipChainId } from '@metamask/utils';\n\nexport type {\n CaipAccountId,\n CaipAssetType,\n CaipChainId,\n CaipNamespace,\n} from '@metamask/utils';\n\n/**\n * A CAIP-2 chain ID, i.e., a human-readable namespace and reference.\n *\n * @see https://chainagnostic.org/CAIPs/caip-2\n * @deprecated Use {@link CaipChainId} instead.\n */\nexport type ChainId = CaipChainId;\n\n/**\n * A CAIP-10 account ID, i.e., a chain ID and an account address.\n *\n * @see https://chainagnostic.org/CAIPs/caip-10\n * @deprecated Use {@link CaipAccountId} instead.\n */\nexport type AccountId = CaipAccountId;\n"]}
@@ -1,13 +1,17 @@
1
+ import type { CaipAccountId, CaipChainId } from "@metamask/utils";
2
+ export type { CaipAccountId, CaipAssetType, CaipChainId, CaipNamespace, } from "@metamask/utils";
1
3
  /**
2
4
  * A CAIP-2 chain ID, i.e., a human-readable namespace and reference.
3
5
  *
4
6
  * @see https://chainagnostic.org/CAIPs/caip-2
7
+ * @deprecated Use {@link CaipChainId} instead.
5
8
  */
6
- export type ChainId = `${string}:${string}`;
9
+ export type ChainId = CaipChainId;
7
10
  /**
8
11
  * A CAIP-10 account ID, i.e., a chain ID and an account address.
9
12
  *
10
13
  * @see https://chainagnostic.org/CAIPs/caip-10
14
+ * @deprecated Use {@link CaipAccountId} instead.
11
15
  */
12
- export type AccountId = `${ChainId}:${string}`;
16
+ export type AccountId = CaipAccountId;
13
17
  //# sourceMappingURL=caip.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"caip.d.cts","sourceRoot":"","sources":["../../src/types/caip.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,OAAO,GAAG,GAAG,MAAM,IAAI,MAAM,EAAE,CAAC;AAE5C;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,GAAG,OAAO,IAAI,MAAM,EAAE,CAAC"}
1
+ {"version":3,"file":"caip.d.cts","sourceRoot":"","sources":["../../src/types/caip.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,wBAAwB;AAElE,YAAY,EACV,aAAa,EACb,aAAa,EACb,WAAW,EACX,aAAa,GACd,wBAAwB;AAEzB;;;;;GAKG;AACH,MAAM,MAAM,OAAO,GAAG,WAAW,CAAC;AAElC;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,aAAa,CAAC"}
@@ -1,13 +1,17 @@
1
+ import type { CaipAccountId, CaipChainId } from "@metamask/utils";
2
+ export type { CaipAccountId, CaipAssetType, CaipChainId, CaipNamespace, } from "@metamask/utils";
1
3
  /**
2
4
  * A CAIP-2 chain ID, i.e., a human-readable namespace and reference.
3
5
  *
4
6
  * @see https://chainagnostic.org/CAIPs/caip-2
7
+ * @deprecated Use {@link CaipChainId} instead.
5
8
  */
6
- export type ChainId = `${string}:${string}`;
9
+ export type ChainId = CaipChainId;
7
10
  /**
8
11
  * A CAIP-10 account ID, i.e., a chain ID and an account address.
9
12
  *
10
13
  * @see https://chainagnostic.org/CAIPs/caip-10
14
+ * @deprecated Use {@link CaipAccountId} instead.
11
15
  */
12
- export type AccountId = `${ChainId}:${string}`;
16
+ export type AccountId = CaipAccountId;
13
17
  //# sourceMappingURL=caip.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"caip.d.mts","sourceRoot":"","sources":["../../src/types/caip.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,OAAO,GAAG,GAAG,MAAM,IAAI,MAAM,EAAE,CAAC;AAE5C;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,GAAG,OAAO,IAAI,MAAM,EAAE,CAAC"}
1
+ {"version":3,"file":"caip.d.mts","sourceRoot":"","sources":["../../src/types/caip.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,wBAAwB;AAElE,YAAY,EACV,aAAa,EACb,aAAa,EACb,WAAW,EACX,aAAa,GACd,wBAAwB;AAEzB;;;;;GAKG;AACH,MAAM,MAAM,OAAO,GAAG,WAAW,CAAC;AAElC;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,aAAa,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"caip.mjs","sourceRoot":"","sources":["../../src/types/caip.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * A CAIP-2 chain ID, i.e., a human-readable namespace and reference.\n *\n * @see https://chainagnostic.org/CAIPs/caip-2\n */\nexport type ChainId = `${string}:${string}`;\n\n/**\n * A CAIP-10 account ID, i.e., a chain ID and an account address.\n *\n * @see https://chainagnostic.org/CAIPs/caip-10\n */\nexport type AccountId = `${ChainId}:${string}`;\n"]}
1
+ {"version":3,"file":"caip.mjs","sourceRoot":"","sources":["../../src/types/caip.ts"],"names":[],"mappings":"","sourcesContent":["import type { CaipAccountId, CaipChainId } from '@metamask/utils';\n\nexport type {\n CaipAccountId,\n CaipAssetType,\n CaipChainId,\n CaipNamespace,\n} from '@metamask/utils';\n\n/**\n * A CAIP-2 chain ID, i.e., a human-readable namespace and reference.\n *\n * @see https://chainagnostic.org/CAIPs/caip-2\n * @deprecated Use {@link CaipChainId} instead.\n */\nexport type ChainId = CaipChainId;\n\n/**\n * A CAIP-10 account ID, i.e., a chain ID and an account address.\n *\n * @see https://chainagnostic.org/CAIPs/caip-10\n * @deprecated Use {@link CaipAccountId} instead.\n */\nexport type AccountId = CaipAccountId;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"name-lookup.cjs","sourceRoot":"","sources":["../../../src/types/handlers/name-lookup.ts"],"names":[],"mappings":"","sourcesContent":["import type { NonEmptyArray } from '@metamask/utils';\n\nimport type { ChainId } from '../caip';\n\ntype BaseOnNameLookupArgs = {\n chainId: ChainId;\n};\n\n/**\n * The arguments for a domain lookup.\n *\n * @property domain - The human-readable domain name that is to be resolved.\n */\nexport type DomainLookupArgs = BaseOnNameLookupArgs & {\n domain: string;\n address?: never;\n};\n\n/**\n * The arguments for an address lookup.\n *\n * @property address - The address that is to be resolved.\n */\nexport type AddressLookupArgs = BaseOnNameLookupArgs & {\n address: string;\n domain?: never;\n};\n\n/**\n * The address resolution object.\n *\n * @property protocol - The protocol that resolved the domain.\n * @property resolvedAddress - The resolved address.\n */\nexport type AddressResolution = {\n protocol: string;\n resolvedAddress: string;\n domainName: string;\n};\n\n/**\n * The domain resolution object.\n *\n * @property protocol - The protocol that resolved the address.\n * @property resolvedDomain - The resolved domain.\n */\nexport type DomainResolution = {\n protocol: string;\n resolvedDomain: string;\n};\n\n/**\n * The result of a domain lookup.\n *\n * @property resolvedAddress - The resolved address.\n */\nexport type DomainLookupResult = {\n resolvedAddresses: NonEmptyArray<AddressResolution>;\n resolvedDomains?: never;\n};\n\n/**\n * The result of an address lookup.\n *\n * @property resolvedDomain - The resolved domain name.\n */\nexport type AddressLookupResult = {\n resolvedDomains: NonEmptyArray<DomainResolution>;\n resolvedAddresses?: never;\n};\n\n/**\n * The `onNameLookup` handler, which is called when MetaMask needs to resolve an\n * address or domain.\n *\n * Note that using this handler requires the `endowment:name-lookup` permission.\n *\n * @param args - The request arguments.\n * @param args.chainId - The CAIP-2 {@link ChainId} of the network the\n * transaction is being submitted to.\n * @param args.domain - The human-readable address that is to be resolved. This\n * is mutually exclusive with `args.address`.\n * @param args.address - The address that is to be resolved. This is mutually\n * exclusive with `args.domain`.\n * @returns The resolved domain or address from the lookup. Must be either\n * {@link AddressLookupResult}, {@link DomainLookupResult}, or `null` if the\n * address or domain could not be resolved.\n */\nexport type OnNameLookupHandler = (\n args: AddressLookupArgs | DomainLookupArgs,\n) => Promise<AddressLookupResult | DomainLookupResult | null>;\n"]}
1
+ {"version":3,"file":"name-lookup.cjs","sourceRoot":"","sources":["../../../src/types/handlers/name-lookup.ts"],"names":[],"mappings":"","sourcesContent":["import type { CaipChainId, NonEmptyArray } from '@metamask/utils';\n\ntype BaseOnNameLookupArgs = {\n chainId: CaipChainId;\n};\n\n/**\n * The arguments for a domain lookup.\n *\n * @property domain - The human-readable domain name that is to be resolved.\n */\nexport type DomainLookupArgs = BaseOnNameLookupArgs & {\n domain: string;\n address?: never;\n};\n\n/**\n * The arguments for an address lookup.\n *\n * @property address - The address that is to be resolved.\n */\nexport type AddressLookupArgs = BaseOnNameLookupArgs & {\n address: string;\n domain?: never;\n};\n\n/**\n * The address resolution object.\n *\n * @property protocol - The protocol that resolved the domain.\n * @property resolvedAddress - The resolved address.\n */\nexport type AddressResolution = {\n protocol: string;\n resolvedAddress: string;\n domainName: string;\n};\n\n/**\n * The domain resolution object.\n *\n * @property protocol - The protocol that resolved the address.\n * @property resolvedDomain - The resolved domain.\n */\nexport type DomainResolution = {\n protocol: string;\n resolvedDomain: string;\n};\n\n/**\n * The result of a domain lookup.\n *\n * @property resolvedAddress - The resolved address.\n */\nexport type DomainLookupResult = {\n resolvedAddresses: NonEmptyArray<AddressResolution>;\n resolvedDomains?: never;\n};\n\n/**\n * The result of an address lookup.\n *\n * @property resolvedDomain - The resolved domain name.\n */\nexport type AddressLookupResult = {\n resolvedDomains: NonEmptyArray<DomainResolution>;\n resolvedAddresses?: never;\n};\n\n/**\n * The `onNameLookup` handler, which is called when MetaMask needs to resolve an\n * address or domain.\n *\n * Note that using this handler requires the `endowment:name-lookup` permission.\n *\n * @param args - The request arguments.\n * @param args.chainId - The CAIP-2 {@link CaipChainId} of the network the\n * transaction is being submitted to.\n * @param args.domain - The human-readable address that is to be resolved. This\n * is mutually exclusive with `args.address`.\n * @param args.address - The address that is to be resolved. This is mutually\n * exclusive with `args.domain`.\n * @returns The resolved domain or address from the lookup. Must be either\n * {@link AddressLookupResult}, {@link DomainLookupResult}, or `null` if the\n * address or domain could not be resolved.\n */\nexport type OnNameLookupHandler = (\n args: AddressLookupArgs | DomainLookupArgs,\n) => Promise<AddressLookupResult | DomainLookupResult | null>;\n"]}
@@ -1,7 +1,6 @@
1
- import type { NonEmptyArray } from "@metamask/utils";
2
- import type { ChainId } from "../caip.cjs";
1
+ import type { CaipChainId, NonEmptyArray } from "@metamask/utils";
3
2
  type BaseOnNameLookupArgs = {
4
- chainId: ChainId;
3
+ chainId: CaipChainId;
5
4
  };
6
5
  /**
7
6
  * The arguments for a domain lookup.
@@ -67,7 +66,7 @@ export type AddressLookupResult = {
67
66
  * Note that using this handler requires the `endowment:name-lookup` permission.
68
67
  *
69
68
  * @param args - The request arguments.
70
- * @param args.chainId - The CAIP-2 {@link ChainId} of the network the
69
+ * @param args.chainId - The CAIP-2 {@link CaipChainId} of the network the
71
70
  * transaction is being submitted to.
72
71
  * @param args.domain - The human-readable address that is to be resolved. This
73
72
  * is mutually exclusive with `args.address`.
@@ -1 +1 @@
1
- {"version":3,"file":"name-lookup.d.cts","sourceRoot":"","sources":["../../../src/types/handlers/name-lookup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,wBAAwB;AAErD,OAAO,KAAK,EAAE,OAAO,EAAE,oBAAgB;AAEvC,KAAK,oBAAoB,GAAG;IAC1B,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,GAAG;IACpD,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,KAAK,CAAC;CACjB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,oBAAoB,GAAG;IACrD,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,KAAK,CAAC;CAChB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;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;AAEF;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,iBAAiB,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;IACpD,eAAe,CAAC,EAAE,KAAK,CAAC;CACzB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,eAAe,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;IACjD,iBAAiB,CAAC,EAAE,KAAK,CAAC;CAC3B,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAChC,IAAI,EAAE,iBAAiB,GAAG,gBAAgB,KACvC,OAAO,CAAC,mBAAmB,GAAG,kBAAkB,GAAG,IAAI,CAAC,CAAC"}
@@ -1,7 +1,6 @@
1
- import type { NonEmptyArray } from "@metamask/utils";
2
- import type { ChainId } from "../caip.mjs";
1
+ import type { CaipChainId, NonEmptyArray } from "@metamask/utils";
3
2
  type BaseOnNameLookupArgs = {
4
- chainId: ChainId;
3
+ chainId: CaipChainId;
5
4
  };
6
5
  /**
7
6
  * The arguments for a domain lookup.
@@ -67,7 +66,7 @@ export type AddressLookupResult = {
67
66
  * Note that using this handler requires the `endowment:name-lookup` permission.
68
67
  *
69
68
  * @param args - The request arguments.
70
- * @param args.chainId - The CAIP-2 {@link ChainId} of the network the
69
+ * @param args.chainId - The CAIP-2 {@link CaipChainId} of the network the
71
70
  * transaction is being submitted to.
72
71
  * @param args.domain - The human-readable address that is to be resolved. This
73
72
  * is mutually exclusive with `args.address`.
@@ -1 +1 @@
1
- {"version":3,"file":"name-lookup.d.mts","sourceRoot":"","sources":["../../../src/types/handlers/name-lookup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,wBAAwB;AAErD,OAAO,KAAK,EAAE,OAAO,EAAE,oBAAgB;AAEvC,KAAK,oBAAoB,GAAG;IAC1B,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF;;;;GAIG;AAC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ACH,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,GAAG;IACpD,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,KAAK,CAAC;CACjB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,oBAAoB,GAAG;IACrD,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,KAAK,CAAC;CAChB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,iBAAiB,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;IACpD,eAAe,CAAC,EAAE,KAAK,CAAC;CACzB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,eAAe,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;IACjD,iBAAiB,CAAC,EAAE,KAAK,CAAC;CAC3B,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAChC,IAAI,EAAE,iBAAiB,GAAG,gBAAgB,KACvC,OAAO,CAAC,mBAAmB,GAAG,kBAAkB,GAAG,IAAI,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"name-lookup.mjs","sourceRoot":"","sources":["../../../src/types/handlers/name-lookup.ts"],"names":[],"mappings":"","sourcesContent":["import type { NonEmptyArray } from '@metamask/utils';\n\nimport type { ChainId } from '../caip';\n\ntype BaseOnNameLookupArgs = {\n chainId: ChainId;\n};\n\n/**\n * The arguments for a domain lookup.\n *\n * @property domain - The human-readable domain name that is to be resolved.\n */\nexport type DomainLookupArgs = BaseOnNameLookupArgs & {\n domain: string;\n address?: never;\n};\n\n/**\n * The arguments for an address lookup.\n *\n * @property address - The address that is to be resolved.\n */\nexport type AddressLookupArgs = BaseOnNameLookupArgs & {\n address: string;\n domain?: never;\n};\n\n/**\n * The address resolution object.\n *\n * @property protocol - The protocol that resolved the domain.\n * @property resolvedAddress - The resolved address.\n */\nexport type AddressResolution = {\n protocol: string;\n resolvedAddress: string;\n domainName: string;\n};\n\n/**\n * The domain resolution object.\n *\n * @property protocol - The protocol that resolved the address.\n * @property resolvedDomain - The resolved domain.\n */\nexport type DomainResolution = {\n protocol: string;\n resolvedDomain: string;\n};\n\n/**\n * The result of a domain lookup.\n *\n * @property resolvedAddress - The resolved address.\n */\nexport type DomainLookupResult = {\n resolvedAddresses: NonEmptyArray<AddressResolution>;\n resolvedDomains?: never;\n};\n\n/**\n * The result of an address lookup.\n *\n * @property resolvedDomain - The resolved domain name.\n */\nexport type AddressLookupResult = {\n resolvedDomains: NonEmptyArray<DomainResolution>;\n resolvedAddresses?: never;\n};\n\n/**\n * The `onNameLookup` handler, which is called when MetaMask needs to resolve an\n * address or domain.\n *\n * Note that using this handler requires the `endowment:name-lookup` permission.\n *\n * @param args - The request arguments.\n * @param args.chainId - The CAIP-2 {@link ChainId} of the network the\n * transaction is being submitted to.\n * @param args.domain - The human-readable address that is to be resolved. This\n * is mutually exclusive with `args.address`.\n * @param args.address - The address that is to be resolved. This is mutually\n * exclusive with `args.domain`.\n * @returns The resolved domain or address from the lookup. Must be either\n * {@link AddressLookupResult}, {@link DomainLookupResult}, or `null` if the\n * address or domain could not be resolved.\n */\nexport type OnNameLookupHandler = (\n args: AddressLookupArgs | DomainLookupArgs,\n) => Promise<AddressLookupResult | DomainLookupResult | null>;\n"]}
1
+ {"version":3,"file":"name-lookup.mjs","sourceRoot":"","sources":["../../../src/types/handlers/name-lookup.ts"],"names":[],"mappings":"","sourcesContent":["import type { CaipChainId, NonEmptyArray } from '@metamask/utils';\n\ntype BaseOnNameLookupArgs = {\n chainId: CaipChainId;\n};\n\n/**\n * The arguments for a domain lookup.\n *\n * @property domain - The human-readable domain name that is to be resolved.\n */\nexport type DomainLookupArgs = BaseOnNameLookupArgs & {\n domain: string;\n address?: never;\n};\n\n/**\n * The arguments for an address lookup.\n *\n * @property address - The address that is to be resolved.\n */\nexport type AddressLookupArgs = BaseOnNameLookupArgs & {\n address: string;\n domain?: never;\n};\n\n/**\n * The address resolution object.\n *\n * @property protocol - The protocol that resolved the domain.\n * @property resolvedAddress - The resolved address.\n */\nexport type AddressResolution = {\n protocol: string;\n resolvedAddress: string;\n domainName: string;\n};\n\n/**\n * The domain resolution object.\n *\n * @property protocol - The protocol that resolved the address.\n * @property resolvedDomain - The resolved domain.\n */\nexport type DomainResolution = {\n protocol: string;\n resolvedDomain: string;\n};\n\n/**\n * The result of a domain lookup.\n *\n * @property resolvedAddress - The resolved address.\n */\nexport type DomainLookupResult = {\n resolvedAddresses: NonEmptyArray<AddressResolution>;\n resolvedDomains?: never;\n};\n\n/**\n * The result of an address lookup.\n *\n * @property resolvedDomain - The resolved domain name.\n */\nexport type AddressLookupResult = {\n resolvedDomains: NonEmptyArray<DomainResolution>;\n resolvedAddresses?: never;\n};\n\n/**\n * The `onNameLookup` handler, which is called when MetaMask needs to resolve an\n * address or domain.\n *\n * Note that using this handler requires the `endowment:name-lookup` permission.\n *\n * @param args - The request arguments.\n * @param args.chainId - The CAIP-2 {@link CaipChainId} of the network the\n * transaction is being submitted to.\n * @param args.domain - The human-readable address that is to be resolved. This\n * is mutually exclusive with `args.address`.\n * @param args.address - The address that is to be resolved. This is mutually\n * exclusive with `args.domain`.\n * @returns The resolved domain or address from the lookup. Must be either\n * {@link AddressLookupResult}, {@link DomainLookupResult}, or `null` if the\n * address or domain could not be resolved.\n */\nexport type OnNameLookupHandler = (\n args: AddressLookupArgs | DomainLookupArgs,\n) => Promise<AddressLookupResult | DomainLookupResult | null>;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"transaction.cjs","sourceRoot":"","sources":["../../../src/types/handlers/transaction.ts"],"names":[],"mappings":";;;AAIA;;;;;;GAMG;AACH,IAAY,aAEX;AAFD,WAAY,aAAa;IACvB,sCAAqB,CAAA;AACvB,CAAC,EAFW,aAAa,6BAAb,aAAa,QAExB","sourcesContent":["import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\nimport type { ChainId } from '../caip';\n\n/**\n * The severity level of content being returned from a transaction insight.\n * Currently only one level is supported:\n *\n * - `critical` - The transaction is critical and should not be submitted by the\n * user.\n */\nexport enum SeverityLevel {\n Critical = 'critical',\n}\n\n/**\n * An EIP-1559 (type 2) transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property maxFeePerGas - The maximum fee per gas of the transaction.\n * @property maxPriorityFeePerGas - The maximum priority fee per gas of the\n * transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n * @see https://eips.ethereum.org/EIPS/eip-1559\n */\nexport type EIP1559Transaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n maxFeePerGas: string;\n maxPriorityFeePerGas: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A legacy (type \"0\") transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property gasPrice - The gas price of the transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n */\nexport type LegacyTransaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n gasPrice: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A transaction object. This can be either an EIP-1559 transaction or a legacy\n * transaction.\n *\n * @see EIP1559Transaction\n * @see LegacyTransaction\n */\nexport type Transaction = EIP1559Transaction | LegacyTransaction;\n\n/**\n * The `onTransaction` handler. This is called whenever a transaction is\n * submitted to the snap. It can return insights about the transaction, which\n * will be displayed to the user.\n *\n * Note that using this handler requires the `endowment:transaction-insights`\n * permission.\n *\n * @param args - The request arguments.\n * @param args.transaction - The transaction object, containing the address,\n * value, data, and other properties of the transaction.\n * @param args.chainId - The CAIP-2 {@link ChainId} of the network the\n * transaction is being submitted to.\n * @param args.transactionOrigin - The origin of the transaction. This is the\n * URL of the website that submitted the transaction. This is only available if\n * the Snap has enabled the `allowTransactionOrigin` option in the\n * `endowment:transaction-insight` permission.\n * @returns An object containing insights about the transaction. See\n * {@link OnTransactionResponse}. Can also return `null` if no insights are\n * available.\n */\nexport type OnTransactionHandler = (args: {\n transaction: Transaction;\n chainId: ChainId;\n transactionOrigin?: string;\n}) => Promise<OnTransactionResponse | null>;\n\n/**\n * The response from a Snap's `onTransaction` handler.\n *\n * @property component - A custom UI component, that will be shown in MetaMask.\n * @property id - A Snap interface ID.\n * @property severity - The severity level of the content. Currently only one\n * level is supported: `critical`.\n */\nexport type OnTransactionResponse =\n | {\n content: ComponentOrElement;\n severity?: EnumToUnion<SeverityLevel>;\n }\n | {\n id: string;\n severity?: EnumToUnion<SeverityLevel>;\n };\n"]}
1
+ {"version":3,"file":"transaction.cjs","sourceRoot":"","sources":["../../../src/types/handlers/transaction.ts"],"names":[],"mappings":";;;AAKA;;;;;;GAMG;AACH,IAAY,aAEX;AAFD,WAAY,aAAa;IACvB,sCAAqB,CAAA;AACvB,CAAC,EAFW,aAAa,6BAAb,aAAa,QAExB","sourcesContent":["import type { CaipChainId } from '@metamask/utils';\n\nimport type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The severity level of content being returned from a transaction insight.\n * Currently only one level is supported:\n *\n * - `critical` - The transaction is critical and should not be submitted by the\n * user.\n */\nexport enum SeverityLevel {\n Critical = 'critical',\n}\n\n/**\n * An EIP-1559 (type 2) transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property maxFeePerGas - The maximum fee per gas of the transaction.\n * @property maxPriorityFeePerGas - The maximum priority fee per gas of the\n * transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n * @see https://eips.ethereum.org/EIPS/eip-1559\n */\nexport type EIP1559Transaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n maxFeePerGas: string;\n maxPriorityFeePerGas: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A legacy (type \"0\") transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property gasPrice - The gas price of the transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n */\nexport type LegacyTransaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n gasPrice: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A transaction object. This can be either an EIP-1559 transaction or a legacy\n * transaction.\n *\n * @see EIP1559Transaction\n * @see LegacyTransaction\n */\nexport type Transaction = EIP1559Transaction | LegacyTransaction;\n\n/**\n * The `onTransaction` handler. This is called whenever a transaction is\n * submitted to the snap. It can return insights about the transaction, which\n * will be displayed to the user.\n *\n * Note that using this handler requires the `endowment:transaction-insights`\n * permission.\n *\n * @param args - The request arguments.\n * @param args.transaction - The transaction object, containing the address,\n * value, data, and other properties of the transaction.\n * @param args.chainId - The CAIP-2 {@link CaipChainId} of the network the\n * transaction is being submitted to.\n * @param args.transactionOrigin - The origin of the transaction. This is the\n * URL of the website that submitted the transaction. This is only available if\n * the Snap has enabled the `allowTransactionOrigin` option in the\n * `endowment:transaction-insight` permission.\n * @returns An object containing insights about the transaction. See\n * {@link OnTransactionResponse}. Can also return `null` if no insights are\n * available.\n */\nexport type OnTransactionHandler = (args: {\n transaction: Transaction;\n chainId: CaipChainId;\n transactionOrigin?: string;\n}) => Promise<OnTransactionResponse | null>;\n\n/**\n * The response from a Snap's `onTransaction` handler.\n *\n * @property component - A custom UI component, that will be shown in MetaMask.\n * @property id - A Snap interface ID.\n * @property severity - The severity level of the content. Currently only one\n * level is supported: `critical`.\n */\nexport type OnTransactionResponse =\n | {\n content: ComponentOrElement;\n severity?: EnumToUnion<SeverityLevel>;\n }\n | {\n id: string;\n severity?: EnumToUnion<SeverityLevel>;\n };\n"]}
@@ -1,6 +1,6 @@
1
+ import type { CaipChainId } from "@metamask/utils";
1
2
  import type { ComponentOrElement } from "../index.cjs";
2
3
  import type { EnumToUnion } from "../../internals/index.cjs";
3
- import type { ChainId } from "../caip.cjs";
4
4
  /**
5
5
  * The severity level of content being returned from a transaction insight.
6
6
  * Currently only one level is supported:
@@ -82,7 +82,7 @@ export type Transaction = EIP1559Transaction | LegacyTransaction;
82
82
  * @param args - The request arguments.
83
83
  * @param args.transaction - The transaction object, containing the address,
84
84
  * value, data, and other properties of the transaction.
85
- * @param args.chainId - The CAIP-2 {@link ChainId} of the network the
85
+ * @param args.chainId - The CAIP-2 {@link CaipChainId} of the network the
86
86
  * transaction is being submitted to.
87
87
  * @param args.transactionOrigin - The origin of the transaction. This is the
88
88
  * URL of the website that submitted the transaction. This is only available if
@@ -94,7 +94,7 @@ export type Transaction = EIP1559Transaction | LegacyTransaction;
94
94
  */
95
95
  export type OnTransactionHandler = (args: {
96
96
  transaction: Transaction;
97
- chainId: ChainId;
97
+ chainId: CaipChainId;
98
98
  transactionOrigin?: string;
99
99
  }) => Promise<OnTransactionResponse | null>;
100
100
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"transaction.d.cts","sourceRoot":"","sources":["../../../src/types/handlers/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,qBAAW;AAC7C,OAAO,KAAK,EAAE,WAAW,EAAE,kCAAwB;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,oBAAgB;AAEvC;;;;;;GAMG;AACH,oBAAY,aAAa;IACvB,QAAQ,aAAa;CACtB;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG,kBAAkB,GAAG,iBAAiB,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,IAAI,EAAE;IACxC,WAAW,EAAE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,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG,kBAAkB,GAAG,iBAAiB,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,IAAI,EAAE;IACxC,WAAW,EAAE,WAAW,CAAC;IACzB,OAAO,EAAE,WAAW,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,KAAK,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,CAAC;AAE5C;;;;;;;GAOG;AACH,MAAM,MAAM,qBAAqB,GAC7B;IACE,OAAO,EAAE,kBAAkB,CAAC;IAC5B,QAAQ,CAAC,EAAE,WAAW,CAAC,aAAa,CAAC,CAAC;CACvC,GACD;IACE,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,WAAW,CAAC,aAAa,CAAC,CAAC;CACvC,CAAC"}
@@ -1,6 +1,6 @@
1
+ import type { CaipChainId } from "@metamask/utils";
1
2
  import type { ComponentOrElement } from "../index.mjs";
2
3
  import type { EnumToUnion } from "../../internals/index.mjs";
3
- import type { ChainId } from "../caip.mjs";
4
4
  /**
5
5
  * The severity level of content being returned from a transaction insight.
6
6
  * Currently only one level is supported:
@@ -82,7 +82,7 @@ export type Transaction = EIP1559Transaction | LegacyTransaction;
82
82
  * @param args - The request arguments.
83
83
  * @param args.transaction - The transaction object, containing the address,
84
84
  * value, data, and other properties of the transaction.
85
- * @param args.chainId - The CAIP-2 {@link ChainId} of the network the
85
+ * @param args.chainId - The CAIP-2 {@link CaipChainId} of the network the
86
86
  * transaction is being submitted to.
87
87
  * @param args.transactionOrigin - The origin of the transaction. This is the
88
88
  * URL of the website that submitted the transaction. This is only available if
@@ -94,7 +94,7 @@ export type Transaction = EIP1559Transaction | LegacyTransaction;
94
94
  */
95
95
  export type OnTransactionHandler = (args: {
96
96
  transaction: Transaction;
97
- chainId: ChainId;
97
+ chainId: CaipChainId;
98
98
  transactionOrigin?: string;
99
99
  }) => Promise<OnTransactionResponse | null>;
100
100
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"transaction.d.mts","sourceRoot":"","sources":["../../../src/types/handlers/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,qBAAW;AAC7C,OAAO,KAAK,EAAE,WAAW,EAAE,kCAAwB;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,oBAAgB;AAEvC;;;;;;GAMG;AACH,oBAAY,aAAa;IACvB,QAAQ,aAAa;CACtB;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,WA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B,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG,kBAAkB,GAAG,iBAAiB,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,IAAI,EAAE;IACxC,WAAW,EAAE,WAAW,CAAC;IACzB,OAAO,EAAE,WAAW,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,KAAK,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,CAAC;AAE5C;;;;;;;GAOG;AACH,MAAM,MAAM,qBAAqB,GAC7B;IACE,OAAO,EAAE,kBAAkB,CAAC;IAC5B,QAAQ,CAAC,EAAE,WAAW,CAAC,aAAa,CAAC,CAAC;CACvC,GACD;IACE,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,WAAW,CAAC,aAAa,CAAC,CAAC;CACvC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"transaction.mjs","sourceRoot":"","sources":["../../../src/types/handlers/transaction.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,MAAM,CAAN,IAAY,aAEX;AAFD,WAAY,aAAa;IACvB,sCAAqB,CAAA;AACvB,CAAC,EAFW,aAAa,KAAb,aAAa,QAExB","sourcesContent":["import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\nimport type { ChainId } from '../caip';\n\n/**\n * The severity level of content being returned from a transaction insight.\n * Currently only one level is supported:\n *\n * - `critical` - The transaction is critical and should not be submitted by the\n * user.\n */\nexport enum SeverityLevel {\n Critical = 'critical',\n}\n\n/**\n * An EIP-1559 (type 2) transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property maxFeePerGas - The maximum fee per gas of the transaction.\n * @property maxPriorityFeePerGas - The maximum priority fee per gas of the\n * transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n * @see https://eips.ethereum.org/EIPS/eip-1559\n */\nexport type EIP1559Transaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n maxFeePerGas: string;\n maxPriorityFeePerGas: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A legacy (type \"0\") transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property gasPrice - The gas price of the transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n */\nexport type LegacyTransaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n gasPrice: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A transaction object. This can be either an EIP-1559 transaction or a legacy\n * transaction.\n *\n * @see EIP1559Transaction\n * @see LegacyTransaction\n */\nexport type Transaction = EIP1559Transaction | LegacyTransaction;\n\n/**\n * The `onTransaction` handler. This is called whenever a transaction is\n * submitted to the snap. It can return insights about the transaction, which\n * will be displayed to the user.\n *\n * Note that using this handler requires the `endowment:transaction-insights`\n * permission.\n *\n * @param args - The request arguments.\n * @param args.transaction - The transaction object, containing the address,\n * value, data, and other properties of the transaction.\n * @param args.chainId - The CAIP-2 {@link ChainId} of the network the\n * transaction is being submitted to.\n * @param args.transactionOrigin - The origin of the transaction. This is the\n * URL of the website that submitted the transaction. This is only available if\n * the Snap has enabled the `allowTransactionOrigin` option in the\n * `endowment:transaction-insight` permission.\n * @returns An object containing insights about the transaction. See\n * {@link OnTransactionResponse}. Can also return `null` if no insights are\n * available.\n */\nexport type OnTransactionHandler = (args: {\n transaction: Transaction;\n chainId: ChainId;\n transactionOrigin?: string;\n}) => Promise<OnTransactionResponse | null>;\n\n/**\n * The response from a Snap's `onTransaction` handler.\n *\n * @property component - A custom UI component, that will be shown in MetaMask.\n * @property id - A Snap interface ID.\n * @property severity - The severity level of the content. Currently only one\n * level is supported: `critical`.\n */\nexport type OnTransactionResponse =\n | {\n content: ComponentOrElement;\n severity?: EnumToUnion<SeverityLevel>;\n }\n | {\n id: string;\n severity?: EnumToUnion<SeverityLevel>;\n };\n"]}
1
+ {"version":3,"file":"transaction.mjs","sourceRoot":"","sources":["../../../src/types/handlers/transaction.ts"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,MAAM,CAAN,IAAY,aAEX;AAFD,WAAY,aAAa;IACvB,sCAAqB,CAAA;AACvB,CAAC,EAFW,aAAa,KAAb,aAAa,QAExB","sourcesContent":["import type { CaipChainId } from '@metamask/utils';\n\nimport type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The severity level of content being returned from a transaction insight.\n * Currently only one level is supported:\n *\n * - `critical` - The transaction is critical and should not be submitted by the\n * user.\n */\nexport enum SeverityLevel {\n Critical = 'critical',\n}\n\n/**\n * An EIP-1559 (type 2) transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property maxFeePerGas - The maximum fee per gas of the transaction.\n * @property maxPriorityFeePerGas - The maximum priority fee per gas of the\n * transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n * @see https://eips.ethereum.org/EIPS/eip-1559\n */\nexport type EIP1559Transaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n maxFeePerGas: string;\n maxPriorityFeePerGas: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A legacy (type \"0\") transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property gasPrice - The gas price of the transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n */\nexport type LegacyTransaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n gasPrice: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A transaction object. This can be either an EIP-1559 transaction or a legacy\n * transaction.\n *\n * @see EIP1559Transaction\n * @see LegacyTransaction\n */\nexport type Transaction = EIP1559Transaction | LegacyTransaction;\n\n/**\n * The `onTransaction` handler. This is called whenever a transaction is\n * submitted to the snap. It can return insights about the transaction, which\n * will be displayed to the user.\n *\n * Note that using this handler requires the `endowment:transaction-insights`\n * permission.\n *\n * @param args - The request arguments.\n * @param args.transaction - The transaction object, containing the address,\n * value, data, and other properties of the transaction.\n * @param args.chainId - The CAIP-2 {@link CaipChainId} of the network the\n * transaction is being submitted to.\n * @param args.transactionOrigin - The origin of the transaction. This is the\n * URL of the website that submitted the transaction. This is only available if\n * the Snap has enabled the `allowTransactionOrigin` option in the\n * `endowment:transaction-insight` permission.\n * @returns An object containing insights about the transaction. See\n * {@link OnTransactionResponse}. Can also return `null` if no insights are\n * available.\n */\nexport type OnTransactionHandler = (args: {\n transaction: Transaction;\n chainId: CaipChainId;\n transactionOrigin?: string;\n}) => Promise<OnTransactionResponse | null>;\n\n/**\n * The response from a Snap's `onTransaction` handler.\n *\n * @property component - A custom UI component, that will be shown in MetaMask.\n * @property id - A Snap interface ID.\n * @property severity - The severity level of the content. Currently only one\n * level is supported: `critical`.\n */\nexport type OnTransactionResponse =\n | {\n content: ComponentOrElement;\n severity?: EnumToUnion<SeverityLevel>;\n }\n | {\n id: string;\n severity?: EnumToUnion<SeverityLevel>;\n };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"get-preferences.cjs","sourceRoot":"","sources":["../../../src/types/methods/get-preferences.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * The request parameters for the `snap_getPreferences` method.\n *\n * This method does not accept any parameters.\n */\nexport type GetPreferencesParams = never;\n\n/**\n * The result returned by the `snap_getPreferences` method.\n *\n * It is the user selected preferences from the MetaMask client.\n *\n * @property locale - The user's selected locale.\n * @property currency - The user's selected currency.\n * @property hideBalances - Whether the user has chosen to hide balances.\n */\nexport type GetPreferencesResult = {\n locale: string;\n currency: string;\n hideBalances: boolean;\n};\n"]}
1
+ {"version":3,"file":"get-preferences.cjs","sourceRoot":"","sources":["../../../src/types/methods/get-preferences.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * The request parameters for the `snap_getPreferences` method.\n *\n * This method does not accept any parameters.\n */\nexport type GetPreferencesParams = never;\n\n/**\n * The result returned by the `snap_getPreferences` method.\n *\n * It is the user selected preferences from the MetaMask client.\n *\n * @property locale - The user's selected locale.\n * @property currency - The user's selected currency.\n * @property hideBalances - Whether the user has chosen to hide balances.\n * @property useSecurityAlerts - Whether to run transactions and signatures through security providers.\n * @property simulateOnChainActions - Whether to simulate transactions and signatures.\n * @property useTokenDetection - Whether to auto-detect tokens.\n * @property batchCheckBalances - Whether to fetch balances in an aggregated manner.\n * @property displayNftMedia - Whether to display NFT media.\n * @property useNftDetection - Whether to auto-detect NFTs.\n * @property useExternalPricingData - Whether to get token price data from an external source.\n */\nexport type GetPreferencesResult = {\n locale: string;\n currency: string;\n hideBalances: boolean;\n useSecurityAlerts: boolean;\n simulateOnChainActions: boolean;\n useTokenDetection: boolean;\n batchCheckBalances: boolean;\n displayNftMedia: boolean;\n useNftDetection: boolean;\n useExternalPricingData: boolean;\n};\n"]}
@@ -12,10 +12,24 @@ export type GetPreferencesParams = never;
12
12
  * @property locale - The user's selected locale.
13
13
  * @property currency - The user's selected currency.
14
14
  * @property hideBalances - Whether the user has chosen to hide balances.
15
+ * @property useSecurityAlerts - Whether to run transactions and signatures through security providers.
16
+ * @property simulateOnChainActions - Whether to simulate transactions and signatures.
17
+ * @property useTokenDetection - Whether to auto-detect tokens.
18
+ * @property batchCheckBalances - Whether to fetch balances in an aggregated manner.
19
+ * @property displayNftMedia - Whether to display NFT media.
20
+ * @property useNftDetection - Whether to auto-detect NFTs.
21
+ * @property useExternalPricingData - Whether to get token price data from an external source.
15
22
  */
16
23
  export type GetPreferencesResult = {
17
24
  locale: string;
18
25
  currency: string;
19
26
  hideBalances: boolean;
27
+ useSecurityAlerts: boolean;
28
+ simulateOnChainActions: boolean;
29
+ useTokenDetection: boolean;
30
+ batchCheckBalances: boolean;
31
+ displayNftMedia: boolean;
32
+ useNftDetection: boolean;
33
+ useExternalPricingData: boolean;
20
34
  };
21
35
  //# sourceMappingURL=get-preferences.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-preferences.d.cts","sourceRoot":"","sources":["../../../src/types/methods/get-preferences.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC;AAEzC;;;;;;;;GAQG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC"}
1
+ {"version":3,"file":"get-preferences.d.cts","sourceRoot":"","sources":["../../../src/types/methods/get-preferences.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC;AAEzC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,OAAO,CAAC;IACtB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,sBAAsB,EAAE,OAAO,CAAC;IAChC,iBAAiB,EAAE,OAAO,CAAC;IAC3B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,eAAe,EAAE,OAAO,CAAC;IACzB,eAAe,EAAE,OAAO,CAAC;IACzB,sBAAsB,EAAE,OAAO,CAAC;CACjC,CAAC"}
@@ -12,10 +12,24 @@ export type GetPreferencesParams = never;
12
12
  * @property locale - The user's selected locale.
13
13
  * @property currency - The user's selected currency.
14
14
  * @property hideBalances - Whether the user has chosen to hide balances.
15
+ * @property useSecurityAlerts - Whether to run transactions and signatures through security providers.
16
+ * @property simulateOnChainActions - Whether to simulate transactions and signatures.
17
+ * @property useTokenDetection - Whether to auto-detect tokens.
18
+ * @property batchCheckBalances - Whether to fetch balances in an aggregated manner.
19
+ * @property displayNftMedia - Whether to display NFT media.
20
+ * @property useNftDetection - Whether to auto-detect NFTs.
21
+ * @property useExternalPricingData - Whether to get token price data from an external source.
15
22
  */
16
23
  export type GetPreferencesResult = {
17
24
  locale: string;
18
25
  currency: string;
19
26
  hideBalances: boolean;
27
+ useSecurityAlerts: boolean;
28
+ simulateOnChainActions: boolean;
29
+ useTokenDetection: boolean;
30
+ batchCheckBalances: boolean;
31
+ displayNftMedia: boolean;
32
+ useNftDetection: boolean;
33
+ useExternalPricingData: boolean;
20
34
  };
21
35
  //# sourceMappingURL=get-preferences.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-preferences.d.mts","sourceRoot":"","sources":["../../../src/types/methods/get-preferences.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC;AAEzC;;;;;;;;GAQG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC"}
1
+ {"version":3,"file":"get-preferences.d.mts","sourceRoot":"","sources":["../../../src/types/methods/get-preferences.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC;AAEzC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,OAAO,CAAC;IACtB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,sBAAsB,EAAE,OAAO,CAAC;IAChC,iBAAiB,EAAE,OAAO,CAAC;IAC3B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,eAAe,EAAE,OAAO,CAAC;IACzB,eAAe,EAAE,OAAO,CAAC;IACzB,sBAAsB,EAAE,OAAO,CAAC;CACjC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"get-preferences.mjs","sourceRoot":"","sources":["../../../src/types/methods/get-preferences.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * The request parameters for the `snap_getPreferences` method.\n *\n * This method does not accept any parameters.\n */\nexport type GetPreferencesParams = never;\n\n/**\n * The result returned by the `snap_getPreferences` method.\n *\n * It is the user selected preferences from the MetaMask client.\n *\n * @property locale - The user's selected locale.\n * @property currency - The user's selected currency.\n * @property hideBalances - Whether the user has chosen to hide balances.\n */\nexport type GetPreferencesResult = {\n locale: string;\n currency: string;\n hideBalances: boolean;\n};\n"]}
1
+ {"version":3,"file":"get-preferences.mjs","sourceRoot":"","sources":["../../../src/types/methods/get-preferences.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * The request parameters for the `snap_getPreferences` method.\n *\n * This method does not accept any parameters.\n */\nexport type GetPreferencesParams = never;\n\n/**\n * The result returned by the `snap_getPreferences` method.\n *\n * It is the user selected preferences from the MetaMask client.\n *\n * @property locale - The user's selected locale.\n * @property currency - The user's selected currency.\n * @property hideBalances - Whether the user has chosen to hide balances.\n * @property useSecurityAlerts - Whether to run transactions and signatures through security providers.\n * @property simulateOnChainActions - Whether to simulate transactions and signatures.\n * @property useTokenDetection - Whether to auto-detect tokens.\n * @property batchCheckBalances - Whether to fetch balances in an aggregated manner.\n * @property displayNftMedia - Whether to display NFT media.\n * @property useNftDetection - Whether to auto-detect NFTs.\n * @property useExternalPricingData - Whether to get token price data from an external source.\n */\nexport type GetPreferencesResult = {\n locale: string;\n currency: string;\n hideBalances: boolean;\n useSecurityAlerts: boolean;\n simulateOnChainActions: boolean;\n useTokenDetection: boolean;\n batchCheckBalances: boolean;\n displayNftMedia: boolean;\n useNftDetection: boolean;\n useExternalPricingData: boolean;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"permissions.cjs","sourceRoot":"","sources":["../../src/types/permissions.ts"],"names":[],"mappings":"","sourcesContent":["import type { SupportedCurve } from '@metamask/key-tree';\nimport type { JsonRpcRequest } from '@metamask/utils';\n\nimport type { ChainId } from './caip';\n\nexport type EmptyObject = Record<string, never>;\n\nexport type Cronjob = {\n expression: string;\n request: Omit<JsonRpcRequest, 'jsonrpc' | 'id'>;\n};\n\nexport type NameLookupMatchers =\n | {\n tlds: string[];\n }\n | {\n schemes: string[];\n }\n | {\n tlds: string[];\n schemes: string[];\n };\n\nexport type Bip32Entropy = {\n curve: SupportedCurve;\n path: string[];\n};\n\nexport type Bip44Entropy = {\n coinType: number;\n};\n\nexport type RequestedSnap = {\n version?: string;\n};\n\nexport type InitialPermissions = Partial<{\n 'endowment:cronjob': {\n jobs?: Cronjob[];\n maxRequestTime?: number;\n };\n 'endowment:ethereum-provider': EmptyObject;\n 'endowment:keyring': {\n allowedOrigins?: string[];\n maxRequestTime?: number;\n };\n 'endowment:lifecycle-hooks'?: {\n maxRequestTime?: number;\n };\n 'endowment:name-lookup': {\n chains?: ChainId[];\n matchers?: NameLookupMatchers;\n maxRequestTime?: number;\n };\n 'endowment:network-access': EmptyObject;\n 'endowment:page-home'?: {\n maxRequestTime?: number;\n };\n 'endowment:page-settings'?: {\n maxRequestTime?: number;\n };\n 'endowment:rpc': {\n dapps?: boolean;\n snaps?: boolean;\n allowedOrigins?: string[];\n maxRequestTime?: number;\n };\n 'endowment:signature-insight': {\n allowSignatureOrigin?: boolean;\n maxRequestTime?: number;\n };\n 'endowment:transaction-insight': {\n allowTransactionOrigin?: boolean;\n maxRequestTime?: number;\n };\n 'endowment:webassembly': EmptyObject;\n\n /* eslint-disable @typescript-eslint/naming-convention */\n snap_dialog: EmptyObject;\n snap_getBip32Entropy: Bip32Entropy[];\n snap_getBip32PublicKey: Bip32Entropy[];\n snap_getBip44Entropy: Bip44Entropy[];\n snap_getEntropy: EmptyObject;\n snap_getLocale: EmptyObject;\n snap_manageAccounts: EmptyObject;\n snap_manageState: EmptyObject;\n snap_notify: EmptyObject;\n wallet_snap: Record<string, RequestedSnap>;\n /* eslint-enable @typescript-eslint/naming-convention */\n}>;\n"]}
1
+ {"version":3,"file":"permissions.cjs","sourceRoot":"","sources":["../../src/types/permissions.ts"],"names":[],"mappings":"","sourcesContent":["import type { SupportedCurve } from '@metamask/key-tree';\nimport type { CaipChainId, JsonRpcRequest } from '@metamask/utils';\n\nexport type EmptyObject = Record<string, never>;\n\nexport type Cronjob = {\n expression: string;\n request: Omit<JsonRpcRequest, 'jsonrpc' | 'id'>;\n};\n\nexport type NameLookupMatchers =\n | {\n tlds: string[];\n }\n | {\n schemes: string[];\n }\n | {\n tlds: string[];\n schemes: string[];\n };\n\nexport type Bip32Entropy = {\n curve: SupportedCurve;\n path: string[];\n};\n\nexport type Bip44Entropy = {\n coinType: number;\n};\n\nexport type RequestedSnap = {\n version?: string;\n};\n\nexport type InitialPermissions = Partial<{\n 'endowment:cronjob': {\n jobs?: Cronjob[];\n maxRequestTime?: number;\n };\n 'endowment:ethereum-provider': EmptyObject;\n 'endowment:keyring': {\n allowedOrigins?: string[];\n maxRequestTime?: number;\n };\n 'endowment:lifecycle-hooks'?: {\n maxRequestTime?: number;\n };\n 'endowment:name-lookup': {\n chains?: CaipChainId[];\n matchers?: NameLookupMatchers;\n maxRequestTime?: number;\n };\n 'endowment:network-access': EmptyObject;\n 'endowment:page-home'?: {\n maxRequestTime?: number;\n };\n 'endowment:page-settings'?: {\n maxRequestTime?: number;\n };\n 'endowment:rpc': {\n dapps?: boolean;\n snaps?: boolean;\n allowedOrigins?: string[];\n maxRequestTime?: number;\n };\n 'endowment:signature-insight': {\n allowSignatureOrigin?: boolean;\n maxRequestTime?: number;\n };\n 'endowment:transaction-insight': {\n allowTransactionOrigin?: boolean;\n maxRequestTime?: number;\n };\n 'endowment:webassembly': EmptyObject;\n\n /* eslint-disable @typescript-eslint/naming-convention */\n snap_dialog: EmptyObject;\n snap_getBip32Entropy: Bip32Entropy[];\n snap_getBip32PublicKey: Bip32Entropy[];\n snap_getBip44Entropy: Bip44Entropy[];\n snap_getEntropy: EmptyObject;\n snap_getLocale: EmptyObject;\n snap_manageAccounts: EmptyObject;\n snap_manageState: EmptyObject;\n snap_notify: EmptyObject;\n wallet_snap: Record<string, RequestedSnap>;\n /* eslint-enable @typescript-eslint/naming-convention */\n}>;\n"]}