@metamask/snaps-sdk 10.3.0 → 11.0.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.
- package/CHANGELOG.md +28 -1
- package/dist/error-wrappers.d.cts +192 -192
- package/dist/error-wrappers.d.mts +192 -192
- package/dist/errors.cjs +27 -1
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.cts +14 -0
- package/dist/errors.d.cts.map +1 -1
- package/dist/errors.d.mts +14 -0
- package/dist/errors.d.mts.map +1 -1
- package/dist/errors.mjs +25 -1
- package/dist/errors.mjs.map +1 -1
- package/dist/images.cjs +1 -41
- package/dist/images.cjs.map +1 -1
- package/dist/images.d.cts +0 -49
- package/dist/images.d.cts.map +1 -1
- package/dist/images.d.mts +0 -49
- package/dist/images.d.mts.map +1 -1
- package/dist/images.mjs +0 -39
- package/dist/images.mjs.map +1 -1
- package/dist/index.cjs +8 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -0
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +8 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +8 -0
- package/dist/index.mjs.map +1 -1
- package/dist/internals/error-wrappers.d.cts +12 -12
- package/dist/internals/error-wrappers.d.mts +12 -12
- package/dist/jsx/components/Address.cjs +1 -0
- package/dist/jsx/components/Address.cjs.map +1 -1
- package/dist/jsx/components/Address.d.cts +4 -1
- package/dist/jsx/components/Address.d.cts.map +1 -1
- package/dist/jsx/components/Address.d.mts +4 -1
- package/dist/jsx/components/Address.d.mts.map +1 -1
- package/dist/jsx/components/Address.mjs +1 -0
- package/dist/jsx/components/Address.mjs.map +1 -1
- package/dist/jsx/components/Avatar.cjs +1 -0
- package/dist/jsx/components/Avatar.cjs.map +1 -1
- package/dist/jsx/components/Avatar.d.cts +4 -1
- package/dist/jsx/components/Avatar.d.cts.map +1 -1
- package/dist/jsx/components/Avatar.d.mts +4 -1
- package/dist/jsx/components/Avatar.d.mts.map +1 -1
- package/dist/jsx/components/Avatar.mjs +1 -0
- package/dist/jsx/components/Avatar.mjs.map +1 -1
- package/dist/jsx/components/Banner.cjs +1 -0
- package/dist/jsx/components/Banner.cjs.map +1 -1
- package/dist/jsx/components/Banner.d.cts +4 -1
- package/dist/jsx/components/Banner.d.cts.map +1 -1
- package/dist/jsx/components/Banner.d.mts +4 -1
- package/dist/jsx/components/Banner.d.mts.map +1 -1
- package/dist/jsx/components/Banner.mjs +1 -0
- package/dist/jsx/components/Banner.mjs.map +1 -1
- package/dist/jsx/components/Box.cjs +1 -0
- package/dist/jsx/components/Box.cjs.map +1 -1
- package/dist/jsx/components/Box.d.cts +4 -1
- package/dist/jsx/components/Box.d.cts.map +1 -1
- package/dist/jsx/components/Box.d.mts +4 -1
- package/dist/jsx/components/Box.d.mts.map +1 -1
- package/dist/jsx/components/Box.mjs +1 -0
- package/dist/jsx/components/Box.mjs.map +1 -1
- package/dist/jsx/components/Card.cjs +1 -0
- package/dist/jsx/components/Card.cjs.map +1 -1
- package/dist/jsx/components/Card.d.cts +4 -1
- package/dist/jsx/components/Card.d.cts.map +1 -1
- package/dist/jsx/components/Card.d.mts +4 -1
- package/dist/jsx/components/Card.d.mts.map +1 -1
- package/dist/jsx/components/Card.mjs +1 -0
- package/dist/jsx/components/Card.mjs.map +1 -1
- package/dist/jsx/components/Container.cjs +1 -0
- package/dist/jsx/components/Container.cjs.map +1 -1
- package/dist/jsx/components/Container.d.cts +4 -1
- package/dist/jsx/components/Container.d.cts.map +1 -1
- package/dist/jsx/components/Container.d.mts +4 -1
- package/dist/jsx/components/Container.d.mts.map +1 -1
- package/dist/jsx/components/Container.mjs +1 -0
- package/dist/jsx/components/Container.mjs.map +1 -1
- package/dist/jsx/components/Copyable.cjs +1 -0
- package/dist/jsx/components/Copyable.cjs.map +1 -1
- package/dist/jsx/components/Copyable.d.cts +4 -1
- package/dist/jsx/components/Copyable.d.cts.map +1 -1
- package/dist/jsx/components/Copyable.d.mts +4 -1
- package/dist/jsx/components/Copyable.d.mts.map +1 -1
- package/dist/jsx/components/Copyable.mjs +1 -0
- package/dist/jsx/components/Copyable.mjs.map +1 -1
- package/dist/jsx/components/Divider.cjs +1 -0
- package/dist/jsx/components/Divider.cjs.map +1 -1
- package/dist/jsx/components/Divider.d.cts +3 -1
- package/dist/jsx/components/Divider.d.cts.map +1 -1
- package/dist/jsx/components/Divider.d.mts +3 -1
- package/dist/jsx/components/Divider.d.mts.map +1 -1
- package/dist/jsx/components/Divider.mjs +1 -0
- package/dist/jsx/components/Divider.mjs.map +1 -1
- package/dist/jsx/components/Footer.cjs +1 -0
- package/dist/jsx/components/Footer.cjs.map +1 -1
- package/dist/jsx/components/Footer.d.cts +4 -1
- package/dist/jsx/components/Footer.d.cts.map +1 -1
- package/dist/jsx/components/Footer.d.mts +4 -1
- package/dist/jsx/components/Footer.d.mts.map +1 -1
- package/dist/jsx/components/Footer.mjs +1 -0
- package/dist/jsx/components/Footer.mjs.map +1 -1
- package/dist/jsx/components/Heading.cjs +1 -0
- package/dist/jsx/components/Heading.cjs.map +1 -1
- package/dist/jsx/components/Heading.d.cts +4 -1
- package/dist/jsx/components/Heading.d.cts.map +1 -1
- package/dist/jsx/components/Heading.d.mts +4 -1
- package/dist/jsx/components/Heading.d.mts.map +1 -1
- package/dist/jsx/components/Heading.mjs +1 -0
- package/dist/jsx/components/Heading.mjs.map +1 -1
- package/dist/jsx/components/Icon.cjs +1 -0
- package/dist/jsx/components/Icon.cjs.map +1 -1
- package/dist/jsx/components/Icon.d.cts +9 -2
- package/dist/jsx/components/Icon.d.cts.map +1 -1
- package/dist/jsx/components/Icon.d.mts +9 -2
- package/dist/jsx/components/Icon.d.mts.map +1 -1
- package/dist/jsx/components/Icon.mjs +1 -0
- package/dist/jsx/components/Icon.mjs.map +1 -1
- package/dist/jsx/components/Image.cjs +1 -0
- package/dist/jsx/components/Image.cjs.map +1 -1
- package/dist/jsx/components/Image.d.cts +4 -1
- package/dist/jsx/components/Image.d.cts.map +1 -1
- package/dist/jsx/components/Image.d.mts +4 -1
- package/dist/jsx/components/Image.d.mts.map +1 -1
- package/dist/jsx/components/Image.mjs +1 -0
- package/dist/jsx/components/Image.mjs.map +1 -1
- package/dist/jsx/components/Link.cjs +1 -0
- package/dist/jsx/components/Link.cjs.map +1 -1
- package/dist/jsx/components/Link.d.cts +4 -1
- package/dist/jsx/components/Link.d.cts.map +1 -1
- package/dist/jsx/components/Link.d.mts +4 -1
- package/dist/jsx/components/Link.d.mts.map +1 -1
- package/dist/jsx/components/Link.mjs +1 -0
- package/dist/jsx/components/Link.mjs.map +1 -1
- package/dist/jsx/components/Row.cjs +1 -0
- package/dist/jsx/components/Row.cjs.map +1 -1
- package/dist/jsx/components/Row.d.cts +4 -1
- package/dist/jsx/components/Row.d.cts.map +1 -1
- package/dist/jsx/components/Row.d.mts +4 -1
- package/dist/jsx/components/Row.d.mts.map +1 -1
- package/dist/jsx/components/Row.mjs +1 -0
- package/dist/jsx/components/Row.mjs.map +1 -1
- package/dist/jsx/components/Section.cjs +1 -0
- package/dist/jsx/components/Section.cjs.map +1 -1
- package/dist/jsx/components/Section.d.cts +4 -1
- package/dist/jsx/components/Section.d.cts.map +1 -1
- package/dist/jsx/components/Section.d.mts +4 -1
- package/dist/jsx/components/Section.d.mts.map +1 -1
- package/dist/jsx/components/Section.mjs +1 -0
- package/dist/jsx/components/Section.mjs.map +1 -1
- package/dist/jsx/components/Skeleton.cjs +1 -0
- package/dist/jsx/components/Skeleton.cjs.map +1 -1
- package/dist/jsx/components/Skeleton.d.cts +4 -1
- package/dist/jsx/components/Skeleton.d.cts.map +1 -1
- package/dist/jsx/components/Skeleton.d.mts +4 -1
- package/dist/jsx/components/Skeleton.d.mts.map +1 -1
- package/dist/jsx/components/Skeleton.mjs +1 -0
- package/dist/jsx/components/Skeleton.mjs.map +1 -1
- package/dist/jsx/components/Spinner.cjs +1 -0
- package/dist/jsx/components/Spinner.cjs.map +1 -1
- package/dist/jsx/components/Spinner.d.cts +3 -1
- package/dist/jsx/components/Spinner.d.cts.map +1 -1
- package/dist/jsx/components/Spinner.d.mts +3 -1
- package/dist/jsx/components/Spinner.d.mts.map +1 -1
- package/dist/jsx/components/Spinner.mjs +1 -0
- package/dist/jsx/components/Spinner.mjs.map +1 -1
- package/dist/jsx/components/Text.cjs +1 -0
- package/dist/jsx/components/Text.cjs.map +1 -1
- package/dist/jsx/components/Text.d.cts +4 -1
- package/dist/jsx/components/Text.d.cts.map +1 -1
- package/dist/jsx/components/Text.d.mts +4 -1
- package/dist/jsx/components/Text.d.mts.map +1 -1
- package/dist/jsx/components/Text.mjs +1 -0
- package/dist/jsx/components/Text.mjs.map +1 -1
- package/dist/jsx/components/Tooltip.cjs +1 -0
- package/dist/jsx/components/Tooltip.cjs.map +1 -1
- package/dist/jsx/components/Tooltip.d.cts +4 -1
- package/dist/jsx/components/Tooltip.d.cts.map +1 -1
- package/dist/jsx/components/Tooltip.d.mts +4 -1
- package/dist/jsx/components/Tooltip.d.mts.map +1 -1
- package/dist/jsx/components/Tooltip.mjs +1 -0
- package/dist/jsx/components/Tooltip.mjs.map +1 -1
- package/dist/jsx/components/Value.cjs +1 -0
- package/dist/jsx/components/Value.cjs.map +1 -1
- package/dist/jsx/components/Value.d.cts +4 -1
- package/dist/jsx/components/Value.d.cts.map +1 -1
- package/dist/jsx/components/Value.d.mts +4 -1
- package/dist/jsx/components/Value.d.mts.map +1 -1
- package/dist/jsx/components/Value.mjs +1 -0
- package/dist/jsx/components/Value.mjs.map +1 -1
- package/dist/jsx/components/form/AccountSelector.cjs +1 -0
- package/dist/jsx/components/form/AccountSelector.cjs.map +1 -1
- package/dist/jsx/components/form/AccountSelector.d.cts +4 -1
- package/dist/jsx/components/form/AccountSelector.d.cts.map +1 -1
- package/dist/jsx/components/form/AccountSelector.d.mts +4 -1
- package/dist/jsx/components/form/AccountSelector.d.mts.map +1 -1
- package/dist/jsx/components/form/AccountSelector.mjs +1 -0
- package/dist/jsx/components/form/AccountSelector.mjs.map +1 -1
- package/dist/jsx/components/form/AddressInput.cjs +1 -0
- package/dist/jsx/components/form/AddressInput.cjs.map +1 -1
- package/dist/jsx/components/form/AddressInput.d.cts +18 -0
- package/dist/jsx/components/form/AddressInput.d.cts.map +1 -1
- package/dist/jsx/components/form/AddressInput.d.mts +18 -0
- package/dist/jsx/components/form/AddressInput.d.mts.map +1 -1
- package/dist/jsx/components/form/AddressInput.mjs +1 -0
- package/dist/jsx/components/form/AddressInput.mjs.map +1 -1
- package/dist/jsx/components/form/AssetSelector.cjs +1 -0
- package/dist/jsx/components/form/AssetSelector.cjs.map +1 -1
- package/dist/jsx/components/form/AssetSelector.d.cts +8 -0
- package/dist/jsx/components/form/AssetSelector.d.cts.map +1 -1
- package/dist/jsx/components/form/AssetSelector.d.mts +8 -0
- package/dist/jsx/components/form/AssetSelector.d.mts.map +1 -1
- package/dist/jsx/components/form/AssetSelector.mjs +1 -0
- package/dist/jsx/components/form/AssetSelector.mjs.map +1 -1
- package/dist/jsx/components/form/Button.cjs +1 -0
- package/dist/jsx/components/form/Button.cjs.map +1 -1
- package/dist/jsx/components/form/Button.d.cts +4 -1
- package/dist/jsx/components/form/Button.d.cts.map +1 -1
- package/dist/jsx/components/form/Button.d.mts +4 -1
- package/dist/jsx/components/form/Button.d.mts.map +1 -1
- package/dist/jsx/components/form/Button.mjs +1 -0
- package/dist/jsx/components/form/Button.mjs.map +1 -1
- package/dist/jsx/components/form/Checkbox.cjs +1 -0
- package/dist/jsx/components/form/Checkbox.cjs.map +1 -1
- package/dist/jsx/components/form/Checkbox.d.cts +4 -1
- package/dist/jsx/components/form/Checkbox.d.cts.map +1 -1
- package/dist/jsx/components/form/Checkbox.d.mts +4 -1
- package/dist/jsx/components/form/Checkbox.d.mts.map +1 -1
- package/dist/jsx/components/form/Checkbox.mjs +1 -0
- package/dist/jsx/components/form/Checkbox.mjs.map +1 -1
- package/dist/jsx/components/form/DateTimePicker.cjs +1 -0
- package/dist/jsx/components/form/DateTimePicker.cjs.map +1 -1
- package/dist/jsx/components/form/DateTimePicker.d.cts +4 -1
- package/dist/jsx/components/form/DateTimePicker.d.cts.map +1 -1
- package/dist/jsx/components/form/DateTimePicker.d.mts +4 -1
- package/dist/jsx/components/form/DateTimePicker.d.mts.map +1 -1
- package/dist/jsx/components/form/DateTimePicker.mjs +1 -0
- package/dist/jsx/components/form/DateTimePicker.mjs.map +1 -1
- package/dist/jsx/components/form/Dropdown.cjs +1 -0
- package/dist/jsx/components/form/Dropdown.cjs.map +1 -1
- package/dist/jsx/components/form/Dropdown.d.cts +4 -1
- package/dist/jsx/components/form/Dropdown.d.cts.map +1 -1
- package/dist/jsx/components/form/Dropdown.d.mts +4 -1
- package/dist/jsx/components/form/Dropdown.d.mts.map +1 -1
- package/dist/jsx/components/form/Dropdown.mjs +1 -0
- package/dist/jsx/components/form/Dropdown.mjs.map +1 -1
- package/dist/jsx/components/form/Field.cjs +1 -0
- package/dist/jsx/components/form/Field.cjs.map +1 -1
- package/dist/jsx/components/form/Field.d.cts +4 -1
- package/dist/jsx/components/form/Field.d.cts.map +1 -1
- package/dist/jsx/components/form/Field.d.mts +4 -1
- package/dist/jsx/components/form/Field.d.mts.map +1 -1
- package/dist/jsx/components/form/Field.mjs +1 -0
- package/dist/jsx/components/form/Field.mjs.map +1 -1
- package/dist/jsx/components/form/FileInput.cjs +1 -0
- package/dist/jsx/components/form/FileInput.cjs.map +1 -1
- package/dist/jsx/components/form/FileInput.d.cts +4 -1
- package/dist/jsx/components/form/FileInput.d.cts.map +1 -1
- package/dist/jsx/components/form/FileInput.d.mts +4 -1
- package/dist/jsx/components/form/FileInput.d.mts.map +1 -1
- package/dist/jsx/components/form/FileInput.mjs +1 -0
- package/dist/jsx/components/form/FileInput.mjs.map +1 -1
- package/dist/jsx/components/form/Form.cjs +1 -0
- package/dist/jsx/components/form/Form.cjs.map +1 -1
- package/dist/jsx/components/form/Form.d.cts +4 -1
- package/dist/jsx/components/form/Form.d.cts.map +1 -1
- package/dist/jsx/components/form/Form.d.mts +4 -1
- package/dist/jsx/components/form/Form.d.mts.map +1 -1
- package/dist/jsx/components/form/Form.mjs +1 -0
- package/dist/jsx/components/form/Form.mjs.map +1 -1
- package/dist/jsx/components/form/Input.cjs +1 -0
- package/dist/jsx/components/form/Input.cjs.map +1 -1
- package/dist/jsx/components/form/Input.d.cts +16 -1
- package/dist/jsx/components/form/Input.d.cts.map +1 -1
- package/dist/jsx/components/form/Input.d.mts +16 -1
- package/dist/jsx/components/form/Input.d.mts.map +1 -1
- package/dist/jsx/components/form/Input.mjs +1 -0
- package/dist/jsx/components/form/Input.mjs.map +1 -1
- package/dist/jsx/components/form/Option.cjs +1 -0
- package/dist/jsx/components/form/Option.cjs.map +1 -1
- package/dist/jsx/components/form/Option.d.cts +4 -1
- package/dist/jsx/components/form/Option.d.cts.map +1 -1
- package/dist/jsx/components/form/Option.d.mts +4 -1
- package/dist/jsx/components/form/Option.d.mts.map +1 -1
- package/dist/jsx/components/form/Option.mjs +1 -0
- package/dist/jsx/components/form/Option.mjs.map +1 -1
- package/dist/jsx/components/form/Radio.cjs +1 -0
- package/dist/jsx/components/form/Radio.cjs.map +1 -1
- package/dist/jsx/components/form/Radio.d.cts +4 -1
- package/dist/jsx/components/form/Radio.d.cts.map +1 -1
- package/dist/jsx/components/form/Radio.d.mts +4 -1
- package/dist/jsx/components/form/Radio.d.mts.map +1 -1
- package/dist/jsx/components/form/Radio.mjs +1 -0
- package/dist/jsx/components/form/Radio.mjs.map +1 -1
- package/dist/jsx/components/form/RadioGroup.cjs +1 -0
- package/dist/jsx/components/form/RadioGroup.cjs.map +1 -1
- package/dist/jsx/components/form/RadioGroup.d.cts +4 -1
- package/dist/jsx/components/form/RadioGroup.d.cts.map +1 -1
- package/dist/jsx/components/form/RadioGroup.d.mts +4 -1
- package/dist/jsx/components/form/RadioGroup.d.mts.map +1 -1
- package/dist/jsx/components/form/RadioGroup.mjs +1 -0
- package/dist/jsx/components/form/RadioGroup.mjs.map +1 -1
- package/dist/jsx/components/form/Selector.cjs +1 -0
- package/dist/jsx/components/form/Selector.cjs.map +1 -1
- package/dist/jsx/components/form/Selector.d.cts +4 -1
- package/dist/jsx/components/form/Selector.d.cts.map +1 -1
- package/dist/jsx/components/form/Selector.d.mts +4 -1
- package/dist/jsx/components/form/Selector.d.mts.map +1 -1
- package/dist/jsx/components/form/Selector.mjs +1 -0
- package/dist/jsx/components/form/Selector.mjs.map +1 -1
- package/dist/jsx/components/form/SelectorOption.cjs +1 -0
- package/dist/jsx/components/form/SelectorOption.cjs.map +1 -1
- package/dist/jsx/components/form/SelectorOption.d.cts +4 -1
- package/dist/jsx/components/form/SelectorOption.d.cts.map +1 -1
- package/dist/jsx/components/form/SelectorOption.d.mts +4 -1
- package/dist/jsx/components/form/SelectorOption.d.mts.map +1 -1
- package/dist/jsx/components/form/SelectorOption.mjs +1 -0
- package/dist/jsx/components/form/SelectorOption.mjs.map +1 -1
- package/dist/jsx/components/formatting/Bold.cjs +1 -0
- package/dist/jsx/components/formatting/Bold.cjs.map +1 -1
- package/dist/jsx/components/formatting/Bold.d.cts +4 -1
- package/dist/jsx/components/formatting/Bold.d.cts.map +1 -1
- package/dist/jsx/components/formatting/Bold.d.mts +4 -1
- package/dist/jsx/components/formatting/Bold.d.mts.map +1 -1
- package/dist/jsx/components/formatting/Bold.mjs +1 -0
- package/dist/jsx/components/formatting/Bold.mjs.map +1 -1
- package/dist/jsx/components/formatting/Italic.cjs +1 -0
- package/dist/jsx/components/formatting/Italic.cjs.map +1 -1
- package/dist/jsx/components/formatting/Italic.d.cts +4 -1
- package/dist/jsx/components/formatting/Italic.d.cts.map +1 -1
- package/dist/jsx/components/formatting/Italic.d.mts +4 -1
- package/dist/jsx/components/formatting/Italic.d.mts.map +1 -1
- package/dist/jsx/components/formatting/Italic.mjs +1 -0
- package/dist/jsx/components/formatting/Italic.mjs.map +1 -1
- package/dist/jsx/index.cjs +22 -0
- package/dist/jsx/index.cjs.map +1 -1
- package/dist/jsx/index.d.cts +22 -0
- package/dist/jsx/index.d.cts.map +1 -1
- package/dist/jsx/index.d.mts +22 -0
- package/dist/jsx/index.d.mts.map +1 -1
- package/dist/jsx/index.mjs +22 -0
- package/dist/jsx/index.mjs.map +1 -1
- package/dist/jsx/validation.cjs +8 -1
- package/dist/jsx/validation.cjs.map +1 -1
- package/dist/jsx/validation.d.cts.map +1 -1
- package/dist/jsx/validation.d.mts.map +1 -1
- package/dist/jsx/validation.mjs +8 -1
- package/dist/jsx/validation.mjs.map +1 -1
- package/dist/types/handlers/assets-market-data.cjs.map +1 -1
- package/dist/types/handlers/assets-market-data.d.cts +1 -1
- package/dist/types/handlers/assets-market-data.d.mts +1 -1
- package/dist/types/handlers/assets-market-data.mjs.map +1 -1
- package/dist/types/methods/cancel-background-event.cjs.map +1 -1
- package/dist/types/methods/cancel-background-event.d.cts +6 -6
- package/dist/types/methods/cancel-background-event.d.cts.map +1 -1
- package/dist/types/methods/cancel-background-event.d.mts +6 -6
- package/dist/types/methods/cancel-background-event.d.mts.map +1 -1
- package/dist/types/methods/cancel-background-event.mjs.map +1 -1
- package/dist/types/methods/clear-state.cjs.map +1 -1
- package/dist/types/methods/clear-state.d.cts +8 -4
- package/dist/types/methods/clear-state.d.cts.map +1 -1
- package/dist/types/methods/clear-state.d.mts +8 -4
- package/dist/types/methods/clear-state.d.mts.map +1 -1
- package/dist/types/methods/clear-state.mjs.map +1 -1
- package/dist/types/methods/close-web-socket.cjs.map +1 -1
- package/dist/types/methods/close-web-socket.d.cts +3 -3
- package/dist/types/methods/close-web-socket.d.mts +3 -3
- package/dist/types/methods/close-web-socket.mjs.map +1 -1
- package/dist/types/methods/create-interface.cjs.map +1 -1
- package/dist/types/methods/create-interface.d.cts +14 -4
- package/dist/types/methods/create-interface.d.cts.map +1 -1
- package/dist/types/methods/create-interface.d.mts +14 -4
- package/dist/types/methods/create-interface.d.mts.map +1 -1
- package/dist/types/methods/create-interface.mjs.map +1 -1
- package/dist/types/methods/dialog.cjs.map +1 -1
- package/dist/types/methods/dialog.d.cts +49 -18
- package/dist/types/methods/dialog.d.cts.map +1 -1
- package/dist/types/methods/dialog.d.mts +49 -18
- package/dist/types/methods/dialog.d.mts.map +1 -1
- package/dist/types/methods/dialog.mjs.map +1 -1
- package/dist/types/methods/get-background-events.cjs.map +1 -1
- package/dist/types/methods/get-background-events.d.cts +17 -8
- package/dist/types/methods/get-background-events.d.cts.map +1 -1
- package/dist/types/methods/get-background-events.d.mts +17 -8
- package/dist/types/methods/get-background-events.d.mts.map +1 -1
- package/dist/types/methods/get-background-events.mjs.map +1 -1
- package/dist/types/methods/get-bip32-entropy.cjs.map +1 -1
- package/dist/types/methods/get-bip32-entropy.d.cts +2 -4
- package/dist/types/methods/get-bip32-entropy.d.cts.map +1 -1
- package/dist/types/methods/get-bip32-entropy.d.mts +2 -4
- package/dist/types/methods/get-bip32-entropy.d.mts.map +1 -1
- package/dist/types/methods/get-bip32-entropy.mjs.map +1 -1
- package/dist/types/methods/get-bip32-public-key.cjs.map +1 -1
- package/dist/types/methods/get-bip32-public-key.d.cts +3 -5
- package/dist/types/methods/get-bip32-public-key.d.cts.map +1 -1
- package/dist/types/methods/get-bip32-public-key.d.mts +3 -5
- package/dist/types/methods/get-bip32-public-key.d.mts.map +1 -1
- package/dist/types/methods/get-bip32-public-key.mjs.map +1 -1
- package/dist/types/methods/get-bip44-entropy.cjs.map +1 -1
- package/dist/types/methods/get-bip44-entropy.d.cts +3 -4
- package/dist/types/methods/get-bip44-entropy.d.cts.map +1 -1
- package/dist/types/methods/get-bip44-entropy.d.mts +3 -4
- package/dist/types/methods/get-bip44-entropy.d.mts.map +1 -1
- package/dist/types/methods/get-bip44-entropy.mjs.map +1 -1
- package/dist/types/methods/get-client-status.cjs.map +1 -1
- package/dist/types/methods/get-client-status.d.cts +5 -7
- package/dist/types/methods/get-client-status.d.cts.map +1 -1
- package/dist/types/methods/get-client-status.d.mts +5 -7
- package/dist/types/methods/get-client-status.d.mts.map +1 -1
- package/dist/types/methods/get-client-status.mjs.map +1 -1
- package/dist/types/methods/get-entropy.cjs.map +1 -1
- package/dist/types/methods/get-entropy.d.cts +6 -5
- package/dist/types/methods/get-entropy.d.cts.map +1 -1
- package/dist/types/methods/get-entropy.d.mts +6 -5
- package/dist/types/methods/get-entropy.d.mts.map +1 -1
- package/dist/types/methods/get-entropy.mjs.map +1 -1
- package/dist/types/methods/get-file.cjs.map +1 -1
- package/dist/types/methods/get-file.d.cts +9 -5
- package/dist/types/methods/get-file.d.cts.map +1 -1
- package/dist/types/methods/get-file.d.mts +9 -5
- package/dist/types/methods/get-file.d.mts.map +1 -1
- package/dist/types/methods/get-file.mjs.map +1 -1
- package/dist/types/methods/get-interface-context.cjs.map +1 -1
- package/dist/types/methods/get-interface-context.d.cts +5 -3
- package/dist/types/methods/get-interface-context.d.cts.map +1 -1
- package/dist/types/methods/get-interface-context.d.mts +5 -3
- package/dist/types/methods/get-interface-context.d.mts.map +1 -1
- package/dist/types/methods/get-interface-context.mjs.map +1 -1
- package/dist/types/methods/get-interface-state.cjs.map +1 -1
- package/dist/types/methods/get-interface-state.d.cts +10 -3
- package/dist/types/methods/get-interface-state.d.cts.map +1 -1
- package/dist/types/methods/get-interface-state.d.mts +10 -3
- package/dist/types/methods/get-interface-state.d.mts.map +1 -1
- package/dist/types/methods/get-interface-state.mjs.map +1 -1
- package/dist/types/methods/get-locale.cjs.map +1 -1
- package/dist/types/methods/get-locale.d.cts +1 -5
- package/dist/types/methods/get-locale.d.cts.map +1 -1
- package/dist/types/methods/get-locale.d.mts +1 -5
- package/dist/types/methods/get-locale.d.mts.map +1 -1
- package/dist/types/methods/get-locale.mjs.map +1 -1
- package/dist/types/methods/get-preferences.cjs.map +1 -1
- package/dist/types/methods/get-preferences.d.cts +39 -17
- package/dist/types/methods/get-preferences.d.cts.map +1 -1
- package/dist/types/methods/get-preferences.d.mts +39 -17
- package/dist/types/methods/get-preferences.d.mts.map +1 -1
- package/dist/types/methods/get-preferences.mjs.map +1 -1
- package/dist/types/methods/get-snaps.cjs.map +1 -1
- package/dist/types/methods/get-snaps.d.cts +1 -5
- package/dist/types/methods/get-snaps.d.cts.map +1 -1
- package/dist/types/methods/get-snaps.d.mts +1 -5
- package/dist/types/methods/get-snaps.d.mts.map +1 -1
- package/dist/types/methods/get-snaps.mjs.map +1 -1
- package/dist/types/methods/get-state.cjs.map +1 -1
- package/dist/types/methods/get-state.d.cts +8 -3
- package/dist/types/methods/get-state.d.cts.map +1 -1
- package/dist/types/methods/get-state.d.mts +8 -3
- package/dist/types/methods/get-state.d.mts.map +1 -1
- package/dist/types/methods/get-state.mjs.map +1 -1
- package/dist/types/methods/get-web-sockets.cjs.map +1 -1
- package/dist/types/methods/get-web-sockets.d.cts +10 -3
- package/dist/types/methods/get-web-sockets.d.cts.map +1 -1
- package/dist/types/methods/get-web-sockets.d.mts +10 -3
- package/dist/types/methods/get-web-sockets.d.mts.map +1 -1
- package/dist/types/methods/get-web-sockets.mjs.map +1 -1
- package/dist/types/methods/index.cjs.map +1 -1
- package/dist/types/methods/index.d.cts +1 -2
- package/dist/types/methods/index.d.cts.map +1 -1
- package/dist/types/methods/index.d.mts +1 -2
- package/dist/types/methods/index.d.mts.map +1 -1
- package/dist/types/methods/index.mjs.map +1 -1
- package/dist/types/methods/invoke-keyring.cjs.map +1 -1
- package/dist/types/methods/invoke-keyring.d.cts +5 -4
- package/dist/types/methods/invoke-keyring.d.cts.map +1 -1
- package/dist/types/methods/invoke-keyring.d.mts +5 -4
- package/dist/types/methods/invoke-keyring.d.mts.map +1 -1
- package/dist/types/methods/invoke-keyring.mjs.map +1 -1
- package/dist/types/methods/invoke-snap.cjs.map +1 -1
- package/dist/types/methods/invoke-snap.d.cts +10 -6
- package/dist/types/methods/invoke-snap.d.cts.map +1 -1
- package/dist/types/methods/invoke-snap.d.mts +10 -6
- package/dist/types/methods/invoke-snap.d.mts.map +1 -1
- package/dist/types/methods/invoke-snap.mjs.map +1 -1
- package/dist/types/methods/list-entropy-sources.cjs.map +1 -1
- package/dist/types/methods/list-entropy-sources.d.cts +2 -2
- package/dist/types/methods/list-entropy-sources.d.mts +2 -2
- package/dist/types/methods/list-entropy-sources.mjs.map +1 -1
- package/dist/types/methods/manage-accounts.cjs.map +1 -1
- package/dist/types/methods/manage-accounts.d.cts +10 -9
- package/dist/types/methods/manage-accounts.d.cts.map +1 -1
- package/dist/types/methods/manage-accounts.d.mts +10 -9
- package/dist/types/methods/manage-accounts.d.mts.map +1 -1
- package/dist/types/methods/manage-accounts.mjs.map +1 -1
- package/dist/types/methods/manage-state.cjs.map +1 -1
- package/dist/types/methods/manage-state.d.cts +35 -32
- package/dist/types/methods/manage-state.d.cts.map +1 -1
- package/dist/types/methods/manage-state.d.mts +35 -32
- package/dist/types/methods/manage-state.d.mts.map +1 -1
- package/dist/types/methods/manage-state.mjs.map +1 -1
- package/dist/types/methods/methods.cjs.map +1 -1
- package/dist/types/methods/methods.d.cts +5 -2
- package/dist/types/methods/methods.d.cts.map +1 -1
- package/dist/types/methods/methods.d.mts +5 -2
- package/dist/types/methods/methods.d.mts.map +1 -1
- package/dist/types/methods/methods.mjs.map +1 -1
- package/dist/types/methods/{provider-request.cjs → multichain/create-session.cjs} +1 -1
- package/dist/types/methods/multichain/create-session.cjs.map +1 -0
- package/dist/types/methods/multichain/create-session.d.cts +34 -0
- package/dist/types/methods/multichain/create-session.d.cts.map +1 -0
- package/dist/types/methods/multichain/create-session.d.mts +34 -0
- package/dist/types/methods/multichain/create-session.d.mts.map +1 -0
- package/dist/types/methods/multichain/create-session.mjs +2 -0
- package/dist/types/methods/multichain/create-session.mjs.map +1 -0
- package/dist/types/methods/{get-currency-rate.cjs → multichain/get-session.cjs} +1 -1
- package/dist/types/methods/multichain/get-session.cjs.map +1 -0
- package/dist/types/methods/multichain/get-session.d.cts +14 -0
- package/dist/types/methods/multichain/get-session.d.cts.map +1 -0
- package/dist/types/methods/multichain/get-session.d.mts +14 -0
- package/dist/types/methods/multichain/get-session.d.mts.map +1 -0
- package/dist/types/methods/multichain/get-session.mjs +2 -0
- package/dist/types/methods/multichain/get-session.mjs.map +1 -0
- package/dist/types/methods/multichain/index.cjs +3 -0
- package/dist/types/methods/multichain/index.cjs.map +1 -0
- package/dist/types/methods/multichain/index.d.cts +5 -0
- package/dist/types/methods/multichain/index.d.cts.map +1 -0
- package/dist/types/methods/multichain/index.d.mts +5 -0
- package/dist/types/methods/multichain/index.d.mts.map +1 -0
- package/dist/types/methods/multichain/index.mjs +2 -0
- package/dist/types/methods/multichain/index.mjs.map +1 -0
- package/dist/types/methods/multichain/invoke-method.cjs +3 -0
- package/dist/types/methods/multichain/invoke-method.cjs.map +1 -0
- package/dist/types/methods/multichain/invoke-method.d.cts +18 -0
- package/dist/types/methods/multichain/invoke-method.d.cts.map +1 -0
- package/dist/types/methods/multichain/invoke-method.d.mts +18 -0
- package/dist/types/methods/multichain/invoke-method.d.mts.map +1 -0
- package/dist/types/methods/multichain/invoke-method.mjs +2 -0
- package/dist/types/methods/multichain/invoke-method.mjs.map +1 -0
- package/dist/types/methods/multichain/revoke-session.cjs +3 -0
- package/dist/types/methods/multichain/revoke-session.cjs.map +1 -0
- package/dist/types/methods/multichain/revoke-session.d.cts +13 -0
- package/dist/types/methods/multichain/revoke-session.d.cts.map +1 -0
- package/dist/types/methods/multichain/revoke-session.d.mts +13 -0
- package/dist/types/methods/multichain/revoke-session.d.mts.map +1 -0
- package/dist/types/methods/multichain/revoke-session.mjs +2 -0
- package/dist/types/methods/multichain/revoke-session.mjs.map +1 -0
- package/dist/types/methods/notify.cjs.map +1 -1
- package/dist/types/methods/notify.d.cts +39 -7
- package/dist/types/methods/notify.d.cts.map +1 -1
- package/dist/types/methods/notify.d.mts +39 -7
- package/dist/types/methods/notify.d.mts.map +1 -1
- package/dist/types/methods/notify.mjs.map +1 -1
- package/dist/types/methods/open-web-socket.cjs.map +1 -1
- package/dist/types/methods/open-web-socket.d.cts +6 -3
- package/dist/types/methods/open-web-socket.d.cts.map +1 -1
- package/dist/types/methods/open-web-socket.d.mts +6 -3
- package/dist/types/methods/open-web-socket.d.mts.map +1 -1
- package/dist/types/methods/open-web-socket.mjs.map +1 -1
- package/dist/types/methods/request-snaps.cjs.map +1 -1
- package/dist/types/methods/request-snaps.d.cts +5 -6
- package/dist/types/methods/request-snaps.d.cts.map +1 -1
- package/dist/types/methods/request-snaps.d.mts +5 -6
- package/dist/types/methods/request-snaps.d.mts.map +1 -1
- package/dist/types/methods/request-snaps.mjs.map +1 -1
- package/dist/types/methods/resolve-interface.cjs.map +1 -1
- package/dist/types/methods/resolve-interface.d.cts +1 -1
- package/dist/types/methods/resolve-interface.d.mts +1 -1
- package/dist/types/methods/resolve-interface.mjs.map +1 -1
- package/dist/types/methods/schedule-background-event.cjs.map +1 -1
- package/dist/types/methods/schedule-background-event.d.cts +18 -8
- package/dist/types/methods/schedule-background-event.d.cts.map +1 -1
- package/dist/types/methods/schedule-background-event.d.mts +18 -8
- package/dist/types/methods/schedule-background-event.d.mts.map +1 -1
- package/dist/types/methods/schedule-background-event.mjs.map +1 -1
- package/dist/types/methods/send-web-socket-message.cjs.map +1 -1
- package/dist/types/methods/send-web-socket-message.d.cts +9 -5
- package/dist/types/methods/send-web-socket-message.d.cts.map +1 -1
- package/dist/types/methods/send-web-socket-message.d.mts +9 -5
- package/dist/types/methods/send-web-socket-message.d.mts.map +1 -1
- package/dist/types/methods/send-web-socket-message.mjs.map +1 -1
- package/dist/types/methods/set-state.cjs.map +1 -1
- package/dist/types/methods/set-state.d.cts +6 -2
- package/dist/types/methods/set-state.d.cts.map +1 -1
- package/dist/types/methods/set-state.d.mts +6 -2
- package/dist/types/methods/set-state.d.mts.map +1 -1
- package/dist/types/methods/set-state.mjs.map +1 -1
- package/dist/types/methods/update-interface.cjs.map +1 -1
- package/dist/types/methods/update-interface.d.cts +13 -5
- package/dist/types/methods/update-interface.d.cts.map +1 -1
- package/dist/types/methods/update-interface.d.mts +13 -5
- package/dist/types/methods/update-interface.d.mts.map +1 -1
- package/dist/types/methods/update-interface.mjs.map +1 -1
- package/dist/types/permissions.cjs.map +1 -1
- package/dist/types/permissions.d.cts +32 -2
- package/dist/types/permissions.d.cts.map +1 -1
- package/dist/types/permissions.d.mts +32 -2
- package/dist/types/permissions.d.mts.map +1 -1
- package/dist/types/permissions.mjs.map +1 -1
- package/dist/ui/components/address.cjs +1 -18
- package/dist/ui/components/address.cjs.map +1 -1
- package/dist/ui/components/address.d.cts +0 -28
- package/dist/ui/components/address.d.cts.map +1 -1
- package/dist/ui/components/address.d.mts +0 -28
- package/dist/ui/components/address.d.mts.map +1 -1
- package/dist/ui/components/address.mjs +0 -17
- package/dist/ui/components/address.mjs.map +1 -1
- package/dist/ui/components/button.cjs +1 -26
- package/dist/ui/components/button.cjs.map +1 -1
- package/dist/ui/components/button.d.cts +0 -42
- package/dist/ui/components/button.d.cts.map +1 -1
- package/dist/ui/components/button.d.mts +0 -42
- package/dist/ui/components/button.d.mts.map +1 -1
- package/dist/ui/components/button.mjs +0 -25
- package/dist/ui/components/button.mjs.map +1 -1
- package/dist/ui/components/copyable.cjs +1 -22
- package/dist/ui/components/copyable.cjs.map +1 -1
- package/dist/ui/components/copyable.d.cts +0 -38
- package/dist/ui/components/copyable.d.cts.map +1 -1
- package/dist/ui/components/copyable.d.mts +0 -38
- package/dist/ui/components/copyable.d.mts.map +1 -1
- package/dist/ui/components/copyable.mjs +0 -21
- package/dist/ui/components/copyable.mjs.map +1 -1
- package/dist/ui/components/divider.cjs +1 -12
- package/dist/ui/components/divider.cjs.map +1 -1
- package/dist/ui/components/divider.d.cts +0 -17
- package/dist/ui/components/divider.d.cts.map +1 -1
- package/dist/ui/components/divider.d.mts +0 -17
- package/dist/ui/components/divider.d.mts.map +1 -1
- package/dist/ui/components/divider.mjs +0 -11
- package/dist/ui/components/divider.mjs.map +1 -1
- package/dist/ui/components/form.cjs +1 -28
- package/dist/ui/components/form.cjs.map +1 -1
- package/dist/ui/components/form.d.cts +0 -86
- package/dist/ui/components/form.d.cts.map +1 -1
- package/dist/ui/components/form.d.mts +0 -86
- package/dist/ui/components/form.d.mts.map +1 -1
- package/dist/ui/components/form.mjs +0 -27
- package/dist/ui/components/form.mjs.map +1 -1
- package/dist/ui/components/heading.cjs +1 -18
- package/dist/ui/components/heading.cjs.map +1 -1
- package/dist/ui/components/heading.d.cts +0 -30
- package/dist/ui/components/heading.d.cts.map +1 -1
- package/dist/ui/components/heading.d.mts +0 -30
- package/dist/ui/components/heading.d.mts.map +1 -1
- package/dist/ui/components/heading.mjs +0 -17
- package/dist/ui/components/heading.mjs.map +1 -1
- package/dist/ui/components/image.cjs +1 -17
- package/dist/ui/components/image.cjs.map +1 -1
- package/dist/ui/components/image.d.cts +0 -29
- package/dist/ui/components/image.d.cts.map +1 -1
- package/dist/ui/components/image.d.mts +0 -29
- package/dist/ui/components/image.d.mts.map +1 -1
- package/dist/ui/components/image.mjs +0 -16
- package/dist/ui/components/image.mjs.map +1 -1
- package/dist/ui/components/index.cjs +2 -5
- package/dist/ui/components/index.cjs.map +1 -1
- package/dist/ui/components/index.d.cts +2 -3
- package/dist/ui/components/index.d.cts.map +1 -1
- package/dist/ui/components/index.d.mts +2 -3
- package/dist/ui/components/index.d.mts.map +1 -1
- package/dist/ui/components/index.mjs +2 -2
- package/dist/ui/components/index.mjs.map +1 -1
- package/dist/ui/components/input.cjs +1 -29
- package/dist/ui/components/input.cjs.map +1 -1
- package/dist/ui/components/input.d.cts +0 -50
- package/dist/ui/components/input.d.cts.map +1 -1
- package/dist/ui/components/input.d.mts +0 -50
- package/dist/ui/components/input.d.mts.map +1 -1
- package/dist/ui/components/input.mjs +0 -28
- package/dist/ui/components/input.mjs.map +1 -1
- package/dist/ui/components/panel.cjs +5 -27
- package/dist/ui/components/panel.cjs.map +1 -1
- package/dist/ui/components/panel.d.cts +0 -108
- package/dist/ui/components/panel.d.cts.map +1 -1
- package/dist/ui/components/panel.d.mts +0 -108
- package/dist/ui/components/panel.d.mts.map +1 -1
- package/dist/ui/components/panel.mjs +4 -26
- package/dist/ui/components/panel.mjs.map +1 -1
- package/dist/ui/components/row.cjs +1 -24
- package/dist/ui/components/row.cjs.map +1 -1
- package/dist/ui/components/row.d.cts +0 -69
- package/dist/ui/components/row.d.cts.map +1 -1
- package/dist/ui/components/row.d.mts +0 -69
- package/dist/ui/components/row.d.mts.map +1 -1
- package/dist/ui/components/row.mjs +0 -23
- package/dist/ui/components/row.mjs.map +1 -1
- package/dist/ui/components/spinner.cjs +1 -12
- package/dist/ui/components/spinner.cjs.map +1 -1
- package/dist/ui/components/spinner.d.cts +0 -18
- package/dist/ui/components/spinner.d.cts.map +1 -1
- package/dist/ui/components/spinner.d.mts +0 -18
- package/dist/ui/components/spinner.d.mts.map +1 -1
- package/dist/ui/components/spinner.mjs +0 -11
- package/dist/ui/components/spinner.mjs.map +1 -1
- package/dist/ui/components/text.cjs +1 -24
- package/dist/ui/components/text.cjs.map +1 -1
- package/dist/ui/components/text.d.cts +0 -38
- package/dist/ui/components/text.d.cts.map +1 -1
- package/dist/ui/components/text.d.mts +0 -38
- package/dist/ui/components/text.d.mts.map +1 -1
- package/dist/ui/components/text.mjs +0 -23
- package/dist/ui/components/text.mjs.map +1 -1
- package/dist/ui/index.cjs +0 -1
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.d.cts +0 -1
- package/dist/ui/index.d.cts.map +1 -1
- package/dist/ui/index.d.mts +0 -1
- package/dist/ui/index.d.mts.map +1 -1
- package/dist/ui/index.mjs +0 -1
- package/dist/ui/index.mjs.map +1 -1
- package/package.json +7 -4
- package/dist/types/methods/get-currency-rate.cjs.map +0 -1
- package/dist/types/methods/get-currency-rate.d.cts +0 -29
- package/dist/types/methods/get-currency-rate.d.cts.map +0 -1
- package/dist/types/methods/get-currency-rate.d.mts +0 -29
- package/dist/types/methods/get-currency-rate.d.mts.map +0 -1
- package/dist/types/methods/get-currency-rate.mjs +0 -2
- package/dist/types/methods/get-currency-rate.mjs.map +0 -1
- package/dist/types/methods/provider-request.cjs.map +0 -1
- package/dist/types/methods/provider-request.d.cts +0 -25
- package/dist/types/methods/provider-request.d.cts.map +0 -1
- package/dist/types/methods/provider-request.d.mts +0 -25
- package/dist/types/methods/provider-request.d.mts.map +0 -1
- package/dist/types/methods/provider-request.mjs +0 -2
- package/dist/types/methods/provider-request.mjs.map +0 -1
- package/dist/ui/builder.cjs +0 -49
- package/dist/ui/builder.cjs.map +0 -1
- package/dist/ui/builder.d.cts +0 -43
- package/dist/ui/builder.d.cts.map +0 -1
- package/dist/ui/builder.d.mts +0 -43
- package/dist/ui/builder.d.mts.map +0 -1
- package/dist/ui/builder.mjs +0 -45
- package/dist/ui/builder.mjs.map +0 -1
- package/dist/ui/component.cjs +0 -29
- package/dist/ui/component.cjs.map +0 -1
- package/dist/ui/component.d.cts +0 -18
- package/dist/ui/component.d.cts.map +0 -1
- package/dist/ui/component.d.mts +0 -18
- package/dist/ui/component.d.mts.map +0 -1
- package/dist/ui/component.mjs +0 -24
- package/dist/ui/component.mjs.map +0 -1
package/dist/errors.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getJsonError = exports.SnapError = void 0;
|
|
3
|
+
exports.isSnapError = exports.isSerializedSnapError = exports.getJsonError = exports.SnapError = void 0;
|
|
4
4
|
const utils_1 = require("@metamask/utils");
|
|
5
5
|
const internals_1 = require("./internals/index.cjs");
|
|
6
6
|
/**
|
|
@@ -160,4 +160,30 @@ error) {
|
|
|
160
160
|
};
|
|
161
161
|
}
|
|
162
162
|
exports.getJsonError = getJsonError;
|
|
163
|
+
/**
|
|
164
|
+
* Check if a JSON-RPC error is a `SnapError`.
|
|
165
|
+
*
|
|
166
|
+
* @param error - The object to check.
|
|
167
|
+
* @returns Whether the object is a `SnapError`.
|
|
168
|
+
*/
|
|
169
|
+
function isSerializedSnapError(error) {
|
|
170
|
+
return error.code === internals_1.SNAP_ERROR_CODE && error.message === internals_1.SNAP_ERROR_MESSAGE;
|
|
171
|
+
}
|
|
172
|
+
exports.isSerializedSnapError = isSerializedSnapError;
|
|
173
|
+
/**
|
|
174
|
+
* Check if an object is a `SnapError`.
|
|
175
|
+
*
|
|
176
|
+
* @param error - The object to check.
|
|
177
|
+
* @returns Whether the object is a `SnapError`.
|
|
178
|
+
*/
|
|
179
|
+
function isSnapError(error) {
|
|
180
|
+
if ((0, utils_1.isObject)(error) &&
|
|
181
|
+
'serialize' in error &&
|
|
182
|
+
typeof error.serialize === 'function') {
|
|
183
|
+
const serialized = error.serialize();
|
|
184
|
+
return (0, utils_1.isJsonRpcError)(serialized) && isSerializedSnapError(serialized);
|
|
185
|
+
}
|
|
186
|
+
return false;
|
|
187
|
+
}
|
|
188
|
+
exports.isSnapError = isSnapError;
|
|
163
189
|
//# sourceMappingURL=errors.cjs.map
|
package/dist/errors.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.cjs","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"errors.cjs","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"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","sourcesContent":["import type { Json, JsonRpcError } from '@metamask/utils';\nimport { isJsonRpcError, isObject } from '@metamask/utils';\n\nimport {\n getErrorCause,\n getErrorCode,\n getErrorData,\n getErrorMessage,\n getErrorName,\n getErrorStack,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n} from './internals';\nimport type { TrackableError } from './types';\n\n/**\n * A generic error which can be thrown by a Snap, without it causing the Snap to\n * crash.\n */\nexport class SnapError extends Error {\n readonly #code: number;\n\n readonly #message: string;\n\n readonly #data?: Record<string, Json>;\n\n readonly #stack?: string;\n\n /**\n * Create a new `SnapError`.\n *\n * @param error - The error to create the `SnapError` from. If this is a\n * `string`, it will be used as the error message. If this is an `Error`, its\n * `message` property will be used as the error message. If this is a\n * `JsonRpcError`, its `message` property will be used as the error message\n * and its `code` property will be used as the error code. Otherwise, the\n * error will be converted to a string and used as the error message.\n * @param data - Additional data to include in the error. This will be merged\n * with the error data, if any.\n */\n constructor(\n error: string | Error | JsonRpcError,\n data: Record<string, Json> = {},\n ) {\n const message = getErrorMessage(error);\n super(message);\n\n this.#message = message;\n this.#code = getErrorCode(error);\n\n const mergedData = { ...getErrorData(error), ...data };\n if (Object.keys(mergedData).length > 0) {\n this.#data = mergedData;\n }\n\n this.#stack = super.stack;\n }\n\n /**\n * The error name.\n *\n * @returns The error name.\n */\n get name() {\n return 'SnapError';\n }\n\n /**\n * The error code.\n *\n * @returns The error code.\n */\n get code() {\n return this.#code;\n }\n\n /**\n * The error message.\n *\n * @returns The error message.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get message() {\n return this.#message;\n }\n\n /**\n * Additional data for the error.\n *\n * @returns Additional data for the error.\n */\n get data() {\n return this.#data;\n }\n\n /**\n * The error stack.\n *\n * @returns The error stack.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get stack() {\n return this.#stack;\n }\n\n /**\n * Convert the error to a JSON object.\n *\n * @returns The JSON object.\n */\n toJSON(): SerializedSnapError {\n return {\n code: SNAP_ERROR_CODE,\n message: SNAP_ERROR_MESSAGE,\n data: {\n cause: {\n code: this.code,\n message: this.message,\n stack: this.stack,\n ...(this.data ? { data: this.data } : {}),\n },\n },\n };\n }\n\n /**\n * Serialize the error to a JSON object. This is called by\n * `@metamask/rpc-errors` when serializing the error.\n *\n * @returns The JSON object.\n */\n serialize() {\n return this.toJSON();\n }\n}\n\n/**\n * A serialized {@link SnapError}. It's JSON-serializable, so it can be sent\n * over the RPC. The original error is wrapped in the `cause` property.\n *\n * @property code - The error code. This is always `-31002`.\n * @property message - The error message. This is always `'Snap Error'`.\n * @property data - The error data.\n * @property data.cause - The cause of the error.\n * @property data.cause.code - The error code.\n * @property data.cause.message - The error message.\n * @property data.cause.stack - The error stack.\n * @property data.cause.data - Additional data for the error.\n * @see SnapError\n */\nexport type SerializedSnapError = {\n code: typeof SNAP_ERROR_CODE;\n message: typeof SNAP_ERROR_MESSAGE;\n data: {\n cause: JsonRpcError;\n };\n};\n\n/**\n * Get a serialised JSON error from a given error. This is intended to be used\n * with `snap_trackError` to convert an error to a JSON object that can be\n * tracked by the Sentry instance in the client.\n *\n * @param error - The error to convert to a JSON error. This can be a string, an\n * `Error`, a `JsonRpcError`, or any other type. If it is not a string or an\n * `Error`, it will be converted to a string using its `toString()` method.\n * @returns A JSON object containing the error message and stack trace, if\n * available.\n * @example\n * try {\n * // Some code that may throw an error\n * } catch (error) {\n * await snap.request({\n * method: 'snap_trackError',\n * params: {\n * error: getJsonError(error),\n * },\n * });\n * }\n */\nexport function getJsonError(\n // TypeScript will narrow this to `unknown`, but we specify all the types for\n // clarity.\n error: string | Error | JsonRpcError | unknown,\n): TrackableError {\n if (typeof error === 'string') {\n return {\n name: 'Error',\n message: error,\n stack: null,\n cause: null,\n };\n }\n\n if (isJsonRpcError(error)) {\n return {\n name: 'JsonRpcError',\n message: getErrorMessage(error),\n stack: getErrorStack(error) ?? getErrorStack(error.data) ?? null,\n cause: null,\n };\n }\n\n const cause = getErrorCause(error);\n\n return {\n name: getErrorName(error),\n message: getErrorMessage(error),\n stack: getErrorStack(error) ?? null,\n cause: cause === null ? null : getJsonError(cause),\n };\n}\n\n/**\n * Check if a JSON-RPC error is a `SnapError`.\n *\n * @param error - The object to check.\n * @returns Whether the object is a `SnapError`.\n */\nexport function isSerializedSnapError(\n error: JsonRpcError,\n): error is SerializedSnapError {\n return error.code === SNAP_ERROR_CODE && error.message === SNAP_ERROR_MESSAGE;\n}\n\n/**\n * Check if an object is a `SnapError`.\n *\n * @param error - The object to check.\n * @returns Whether the object is a `SnapError`.\n */\nexport function isSnapError(error: unknown): error is SnapError {\n if (\n isObject(error) &&\n 'serialize' in error &&\n typeof error.serialize === 'function'\n ) {\n const serialized = error.serialize();\n return isJsonRpcError(serialized) && isSerializedSnapError(serialized);\n }\n\n return false;\n}\n"]}
|
package/dist/errors.d.cts
CHANGED
|
@@ -108,4 +108,18 @@ export type SerializedSnapError = {
|
|
|
108
108
|
* }
|
|
109
109
|
*/
|
|
110
110
|
export declare function getJsonError(error: string | Error | JsonRpcError | unknown): TrackableError;
|
|
111
|
+
/**
|
|
112
|
+
* Check if a JSON-RPC error is a `SnapError`.
|
|
113
|
+
*
|
|
114
|
+
* @param error - The object to check.
|
|
115
|
+
* @returns Whether the object is a `SnapError`.
|
|
116
|
+
*/
|
|
117
|
+
export declare function isSerializedSnapError(error: JsonRpcError): error is SerializedSnapError;
|
|
118
|
+
/**
|
|
119
|
+
* Check if an object is a `SnapError`.
|
|
120
|
+
*
|
|
121
|
+
* @param error - The object to check.
|
|
122
|
+
* @returns Whether the object is a `SnapError`.
|
|
123
|
+
*/
|
|
124
|
+
export declare function isSnapError(error: unknown): error is SnapError;
|
|
111
125
|
//# sourceMappingURL=errors.d.cts.map
|
package/dist/errors.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.cts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,wBAAwB;AAG1D,OAAO,EAOL,eAAe,EACf,kBAAkB,EACnB,8BAAoB;AACrB,OAAO,KAAK,EAAE,cAAc,EAAE,0BAAgB;AAE9C;;;GAGG;AACH,qBAAa,SAAU,SAAQ,KAAK;;IASlC;;;;;;;;;;;OAWG;gBAED,KAAK,EAAE,MAAM,GAAG,KAAK,GAAG,YAAY,EACpC,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAM;IAgBjC;;;;OAIG;IACH,IAAI,IAAI,WAEP;IAED;;;;OAIG;IACH,IAAI,IAAI,WAEP;IAED;;;;OAIG;IAGH,IAAI,OAAO,WAEV;IAED;;;;OAIG;IACH,IAAI,IAAI,qCAEP;IAED;;;;OAIG;IAGH,IAAI,KAAK,uBAER;IAED;;;;OAIG;IACH,MAAM,IAAI,mBAAmB;IAe7B;;;;;OAKG;IACH,SAAS;CAGV;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,OAAO,eAAe,CAAC;IAC7B,OAAO,EAAE,OAAO,kBAAkB,CAAC;IACnC,IAAI,EAAE;QACJ,KAAK,EAAE,YAAY,CAAC;KACrB,CAAC;CACH,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,YAAY,CAG1B,KAAK,EAAE,MAAM,GAAG,KAAK,GAAG,YAAY,GAAG,OAAO,GAC7C,cAAc,CA2BhB"}
|
|
1
|
+
{"version":3,"file":"errors.d.cts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,wBAAwB;AAG1D,OAAO,EAOL,eAAe,EACf,kBAAkB,EACnB,8BAAoB;AACrB,OAAO,KAAK,EAAE,cAAc,EAAE,0BAAgB;AAE9C;;;GAGG;AACH,qBAAa,SAAU,SAAQ,KAAK;;IASlC;;;;;;;;;;;OAWG;gBAED,KAAK,EAAE,MAAM,GAAG,KAAK,GAAG,YAAY,EACpC,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAM;IAgBjC;;;;OAIG;IACH,IAAI,IAAI,WAEP;IAED;;;;OAIG;IACH,IAAI,IAAI,WAEP;IAED;;;;OAIG;IAGH,IAAI,OAAO,WAEV;IAED;;;;OAIG;IACH,IAAI,IAAI,qCAEP;IAED;;;;OAIG;IAGH,IAAI,KAAK,uBAER;IAED;;;;OAIG;IACH,MAAM,IAAI,mBAAmB;IAe7B;;;;;OAKG;IACH,SAAS;CAGV;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,OAAO,eAAe,CAAC;IAC7B,OAAO,EAAE,OAAO,kBAAkB,CAAC;IACnC,IAAI,EAAE;QACJ,KAAK,EAAE,YAAY,CAAC;KACrB,CAAC;CACH,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,YAAY,CAG1B,KAAK,EAAE,MAAM,GAAG,KAAK,GAAG,YAAY,GAAG,OAAO,GAC7C,cAAc,CA2BhB;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,YAAY,GAClB,KAAK,IAAI,mBAAmB,CAE9B;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,CAW9D"}
|
package/dist/errors.d.mts
CHANGED
|
@@ -108,4 +108,18 @@ export type SerializedSnapError = {
|
|
|
108
108
|
* }
|
|
109
109
|
*/
|
|
110
110
|
export declare function getJsonError(error: string | Error | JsonRpcError | unknown): TrackableError;
|
|
111
|
+
/**
|
|
112
|
+
* Check if a JSON-RPC error is a `SnapError`.
|
|
113
|
+
*
|
|
114
|
+
* @param error - The object to check.
|
|
115
|
+
* @returns Whether the object is a `SnapError`.
|
|
116
|
+
*/
|
|
117
|
+
export declare function isSerializedSnapError(error: JsonRpcError): error is SerializedSnapError;
|
|
118
|
+
/**
|
|
119
|
+
* Check if an object is a `SnapError`.
|
|
120
|
+
*
|
|
121
|
+
* @param error - The object to check.
|
|
122
|
+
* @returns Whether the object is a `SnapError`.
|
|
123
|
+
*/
|
|
124
|
+
export declare function isSnapError(error: unknown): error is SnapError;
|
|
111
125
|
//# sourceMappingURL=errors.d.mts.map
|
package/dist/errors.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.mts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,wBAAwB;AAG1D,OAAO,EAOL,eAAe,EACf,kBAAkB,EACnB,8BAAoB;AACrB,OAAO,KAAK,EAAE,cAAc,EAAE,0BAAgB;AAE9C;;;GAGG;AACH,qBAAa,SAAU,SAAQ,KAAK;;IASlC;;;;;;;;;;;OAWG;gBAED,KAAK,EAAE,MAAM,GAAG,KAAK,GAAG,YAAY,EACpC,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAM;IAgBjC;;;;OAIG;IACH,IAAI,IAAI,WAEP;IAED;;;;OAIG;IACH,IAAI,IAAI,WAEP;IAED;;;;OAIG;IAGH,IAAI,OAAO,WAEV;IAED;;;;OAIG;IACH,IAAI,IAAI,qCAEP;IAED;;;;OAIG;IAGH,IAAI,KAAK,uBAER;IAED;;;;OAIG;IACH,MAAM,IAAI,mBAAmB;IAe7B;;;;;OAKG;IACH,SAAS;CAGV;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,OAAO,eAAe,CAAC;IAC7B,OAAO,EAAE,OAAO,kBAAkB,CAAC;IACnC,IAAI,EAAE;QACJ,KAAK,EAAE,YAAY,CAAC;KACrB,CAAC;CACH,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,YAAY,CAG1B,KAAK,EAAE,MAAM,GAAG,KAAK,GAAG,YAAY,GAAG,OAAO,GAC7C,cAAc,CA2BhB"}
|
|
1
|
+
{"version":3,"file":"errors.d.mts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,wBAAwB;AAG1D,OAAO,EAOL,eAAe,EACf,kBAAkB,EACnB,8BAAoB;AACrB,OAAO,KAAK,EAAE,cAAc,EAAE,0BAAgB;AAE9C;;;GAGG;AACH,qBAAa,SAAU,SAAQ,KAAK;;IASlC;;;;;;;;;;;OAWG;gBAED,KAAK,EAAE,MAAM,GAAG,KAAK,GAAG,YAAY,EACpC,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAM;IAgBjC;;;;OAIG;IACH,IAAI,IAAI,WAEP;IAED;;;;OAIG;IACH,IAAI,IAAI,WAEP;IAED;;;;OAIG;IAGH,IAAI,OAAO,WAEV;IAED;;;;OAIG;IACH,IAAI,IAAI,qCAEP;IAED;;;;OAIG;IAGH,IAAI,KAAK,uBAER;IAED;;;;OAIG;IACH,MAAM,IAAI,mBAAmB;IAe7B;;;;;OAKG;IACH,SAAS;CAGV;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,OAAO,eAAe,CAAC;IAC7B,OAAO,EAAE,OAAO,kBAAkB,CAAC;IACnC,IAAI,EAAE;QACJ,KAAK,EAAE,YAAY,CAAC;KACrB,CAAC;CACH,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,YAAY,CAG1B,KAAK,EAAE,MAAM,GAAG,KAAK,GAAG,YAAY,GAAG,OAAO,GAC7C,cAAc,CA2BhB;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,YAAY,GAClB,KAAK,IAAI,mBAAmB,CAE9B;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,CAW9D"}
|
package/dist/errors.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isJsonRpcError } from "@metamask/utils";
|
|
1
|
+
import { isJsonRpcError, isObject } from "@metamask/utils";
|
|
2
2
|
import { getErrorCause, getErrorCode, getErrorData, getErrorMessage, getErrorName, getErrorStack, SNAP_ERROR_CODE, SNAP_ERROR_MESSAGE } from "./internals/index.mjs";
|
|
3
3
|
/**
|
|
4
4
|
* A generic error which can be thrown by a Snap, without it causing the Snap to
|
|
@@ -155,4 +155,28 @@ error) {
|
|
|
155
155
|
cause: cause === null ? null : getJsonError(cause),
|
|
156
156
|
};
|
|
157
157
|
}
|
|
158
|
+
/**
|
|
159
|
+
* Check if a JSON-RPC error is a `SnapError`.
|
|
160
|
+
*
|
|
161
|
+
* @param error - The object to check.
|
|
162
|
+
* @returns Whether the object is a `SnapError`.
|
|
163
|
+
*/
|
|
164
|
+
export function isSerializedSnapError(error) {
|
|
165
|
+
return error.code === SNAP_ERROR_CODE && error.message === SNAP_ERROR_MESSAGE;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Check if an object is a `SnapError`.
|
|
169
|
+
*
|
|
170
|
+
* @param error - The object to check.
|
|
171
|
+
* @returns Whether the object is a `SnapError`.
|
|
172
|
+
*/
|
|
173
|
+
export function isSnapError(error) {
|
|
174
|
+
if (isObject(error) &&
|
|
175
|
+
'serialize' in error &&
|
|
176
|
+
typeof error.serialize === 'function') {
|
|
177
|
+
const serialized = error.serialize();
|
|
178
|
+
return isJsonRpcError(serialized) && isSerializedSnapError(serialized);
|
|
179
|
+
}
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
158
182
|
//# sourceMappingURL=errors.mjs.map
|
package/dist/errors.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.mjs","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,wBAAwB;
|
|
1
|
+
{"version":3,"file":"errors.mjs","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"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","sourcesContent":["import type { Json, JsonRpcError } from '@metamask/utils';\nimport { isJsonRpcError, isObject } from '@metamask/utils';\n\nimport {\n getErrorCause,\n getErrorCode,\n getErrorData,\n getErrorMessage,\n getErrorName,\n getErrorStack,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n} from './internals';\nimport type { TrackableError } from './types';\n\n/**\n * A generic error which can be thrown by a Snap, without it causing the Snap to\n * crash.\n */\nexport class SnapError extends Error {\n readonly #code: number;\n\n readonly #message: string;\n\n readonly #data?: Record<string, Json>;\n\n readonly #stack?: string;\n\n /**\n * Create a new `SnapError`.\n *\n * @param error - The error to create the `SnapError` from. If this is a\n * `string`, it will be used as the error message. If this is an `Error`, its\n * `message` property will be used as the error message. If this is a\n * `JsonRpcError`, its `message` property will be used as the error message\n * and its `code` property will be used as the error code. Otherwise, the\n * error will be converted to a string and used as the error message.\n * @param data - Additional data to include in the error. This will be merged\n * with the error data, if any.\n */\n constructor(\n error: string | Error | JsonRpcError,\n data: Record<string, Json> = {},\n ) {\n const message = getErrorMessage(error);\n super(message);\n\n this.#message = message;\n this.#code = getErrorCode(error);\n\n const mergedData = { ...getErrorData(error), ...data };\n if (Object.keys(mergedData).length > 0) {\n this.#data = mergedData;\n }\n\n this.#stack = super.stack;\n }\n\n /**\n * The error name.\n *\n * @returns The error name.\n */\n get name() {\n return 'SnapError';\n }\n\n /**\n * The error code.\n *\n * @returns The error code.\n */\n get code() {\n return this.#code;\n }\n\n /**\n * The error message.\n *\n * @returns The error message.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get message() {\n return this.#message;\n }\n\n /**\n * Additional data for the error.\n *\n * @returns Additional data for the error.\n */\n get data() {\n return this.#data;\n }\n\n /**\n * The error stack.\n *\n * @returns The error stack.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get stack() {\n return this.#stack;\n }\n\n /**\n * Convert the error to a JSON object.\n *\n * @returns The JSON object.\n */\n toJSON(): SerializedSnapError {\n return {\n code: SNAP_ERROR_CODE,\n message: SNAP_ERROR_MESSAGE,\n data: {\n cause: {\n code: this.code,\n message: this.message,\n stack: this.stack,\n ...(this.data ? { data: this.data } : {}),\n },\n },\n };\n }\n\n /**\n * Serialize the error to a JSON object. This is called by\n * `@metamask/rpc-errors` when serializing the error.\n *\n * @returns The JSON object.\n */\n serialize() {\n return this.toJSON();\n }\n}\n\n/**\n * A serialized {@link SnapError}. It's JSON-serializable, so it can be sent\n * over the RPC. The original error is wrapped in the `cause` property.\n *\n * @property code - The error code. This is always `-31002`.\n * @property message - The error message. This is always `'Snap Error'`.\n * @property data - The error data.\n * @property data.cause - The cause of the error.\n * @property data.cause.code - The error code.\n * @property data.cause.message - The error message.\n * @property data.cause.stack - The error stack.\n * @property data.cause.data - Additional data for the error.\n * @see SnapError\n */\nexport type SerializedSnapError = {\n code: typeof SNAP_ERROR_CODE;\n message: typeof SNAP_ERROR_MESSAGE;\n data: {\n cause: JsonRpcError;\n };\n};\n\n/**\n * Get a serialised JSON error from a given error. This is intended to be used\n * with `snap_trackError` to convert an error to a JSON object that can be\n * tracked by the Sentry instance in the client.\n *\n * @param error - The error to convert to a JSON error. This can be a string, an\n * `Error`, a `JsonRpcError`, or any other type. If it is not a string or an\n * `Error`, it will be converted to a string using its `toString()` method.\n * @returns A JSON object containing the error message and stack trace, if\n * available.\n * @example\n * try {\n * // Some code that may throw an error\n * } catch (error) {\n * await snap.request({\n * method: 'snap_trackError',\n * params: {\n * error: getJsonError(error),\n * },\n * });\n * }\n */\nexport function getJsonError(\n // TypeScript will narrow this to `unknown`, but we specify all the types for\n // clarity.\n error: string | Error | JsonRpcError | unknown,\n): TrackableError {\n if (typeof error === 'string') {\n return {\n name: 'Error',\n message: error,\n stack: null,\n cause: null,\n };\n }\n\n if (isJsonRpcError(error)) {\n return {\n name: 'JsonRpcError',\n message: getErrorMessage(error),\n stack: getErrorStack(error) ?? getErrorStack(error.data) ?? null,\n cause: null,\n };\n }\n\n const cause = getErrorCause(error);\n\n return {\n name: getErrorName(error),\n message: getErrorMessage(error),\n stack: getErrorStack(error) ?? null,\n cause: cause === null ? null : getJsonError(cause),\n };\n}\n\n/**\n * Check if a JSON-RPC error is a `SnapError`.\n *\n * @param error - The object to check.\n * @returns Whether the object is a `SnapError`.\n */\nexport function isSerializedSnapError(\n error: JsonRpcError,\n): error is SerializedSnapError {\n return error.code === SNAP_ERROR_CODE && error.message === SNAP_ERROR_MESSAGE;\n}\n\n/**\n * Check if an object is a `SnapError`.\n *\n * @param error - The object to check.\n * @returns Whether the object is a `SnapError`.\n */\nexport function isSnapError(error: unknown): error is SnapError {\n if (\n isObject(error) &&\n 'serialize' in error &&\n typeof error.serialize === 'function'\n ) {\n const serialized = error.serialize();\n return isJsonRpcError(serialized) && isSerializedSnapError(serialized);\n }\n\n return false;\n}\n"]}
|
package/dist/images.cjs
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getImageData = void 0;
|
|
4
4
|
const utils_1 = require("@metamask/utils");
|
|
5
|
-
const ui_1 = require("./ui/index.cjs");
|
|
6
5
|
/**
|
|
7
6
|
* Get raw image data from a URL.
|
|
8
7
|
*
|
|
@@ -39,8 +38,6 @@ async function getRawImageData(url, options) {
|
|
|
39
38
|
* </svg>
|
|
40
39
|
* `;
|
|
41
40
|
*
|
|
42
|
-
* // Render the SVG in a Snap UI.
|
|
43
|
-
* const ui = image(svg);
|
|
44
41
|
* @param url - The URL to get the image data from.
|
|
45
42
|
* @param options - The options to use when fetching the image data. This is
|
|
46
43
|
* passed directly to `fetch`.
|
|
@@ -52,41 +49,4 @@ async function getImageData(url, options) {
|
|
|
52
49
|
return `data:${blob.type};base64,${(0, utils_1.bytesToBase64)(bytes)}`;
|
|
53
50
|
}
|
|
54
51
|
exports.getImageData = getImageData;
|
|
55
|
-
/**
|
|
56
|
-
* Get an image component from a URL. This is useful for embedding images inside
|
|
57
|
-
* Snap UIs. Only JPEG and PNG images are supported.
|
|
58
|
-
*
|
|
59
|
-
* Note: This function uses `fetch` to get the image data. This means that using
|
|
60
|
-
* it requires the `endowment:network-access` permission.
|
|
61
|
-
*
|
|
62
|
-
* @example
|
|
63
|
-
* const component = await getImage('https://cataas.com/cat');
|
|
64
|
-
*
|
|
65
|
-
* return await snap.request({
|
|
66
|
-
* method: 'snap_dialog',
|
|
67
|
-
* params: {
|
|
68
|
-
* type: 'alert',
|
|
69
|
-
* content: panel([
|
|
70
|
-
* component,
|
|
71
|
-
* ]),
|
|
72
|
-
* },
|
|
73
|
-
* });
|
|
74
|
-
* @param url - The URL to get the image data from.
|
|
75
|
-
* @param options - The options to use when fetching and rendering the image.
|
|
76
|
-
* @param options.width - The width of the image.
|
|
77
|
-
* @param options.height - The height of the image. If this is not provided, the
|
|
78
|
-
* width will be used as the height.
|
|
79
|
-
* @param options.request - The options to use when fetching the image data.
|
|
80
|
-
* This is passed directly to `fetch`.
|
|
81
|
-
* @returns A promise that resolves to the image data as an image component.
|
|
82
|
-
* @deprecated Use `<Image src="external_url" />` instead. This function will be removed in a future release.
|
|
83
|
-
*/
|
|
84
|
-
async function getImageComponent(url, { width, height = width, request }) {
|
|
85
|
-
(0, utils_1.assert)(typeof width === 'number' && width > 0, 'Expected width to be a number greater than 0.');
|
|
86
|
-
(0, utils_1.assert)(typeof height === 'number' && height > 0, 'Expected height to be a number greater than 0.');
|
|
87
|
-
const imageData = await getImageData(url, request);
|
|
88
|
-
const size = `width="${width}" height="${height}"`;
|
|
89
|
-
return (0, ui_1.image)(`<svg ${size.trim()} xmlns="http://www.w3.org/2000/svg"><image ${size.trim()} href="${imageData}" /></svg>`);
|
|
90
|
-
}
|
|
91
|
-
exports.getImageComponent = getImageComponent;
|
|
92
52
|
//# sourceMappingURL=images.cjs.map
|
package/dist/images.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"images.cjs","sourceRoot":"","sources":["../src/images.ts"],"names":[],"mappings":";;;AAAA,2CAAwD;AAExD
|
|
1
|
+
{"version":3,"file":"images.cjs","sourceRoot":"","sources":["../src/images.ts"],"names":[],"mappings":";;;AAAA,2CAAwD;AAExD;;;;;;;GAOG;AACH,KAAK,UAAU,eAAe,CAAC,GAAW,EAAE,OAAqB;IAC/D,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE,CAAC;QAChC,MAAM,IAAI,KAAK,CACb,oCAAoC,GAAG,4EAA4E,CACpH,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;QACjD,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CACb,oCAAoC,GAAG,MAAM,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,EAAE,CACtF,CAAC;QACJ,CAAC;QAED,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACnC,IAAA,cAAM,EACJ,IAAI,CAAC,IAAI,KAAK,YAAY,IAAI,IAAI,CAAC,IAAI,KAAK,WAAW,EACvD,gDAAgD,CACjD,CAAC;QAEF,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACI,KAAK,UAAU,YAAY,CAAC,GAAW,EAAE,OAAqB;IACnE,MAAM,IAAI,GAAG,MAAM,eAAe,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACjD,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;IAEvD,OAAO,QAAQ,IAAI,CAAC,IAAI,WAAW,IAAA,qBAAa,EAAC,KAAK,CAAC,EAAE,CAAC;AAC5D,CAAC;AALD,oCAKC","sourcesContent":["import { assert, bytesToBase64 } from '@metamask/utils';\n\n/**\n * Get raw image data from a URL.\n *\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n * @returns A promise that resolves to the image data as a blob.\n */\nasync function getRawImageData(url: string, options?: RequestInit) {\n if (typeof fetch !== 'function') {\n throw new Error(\n `Failed to fetch image data from \"${url}\": Using this function requires the \"endowment:network-access\" permission.`,\n );\n }\n\n return fetch(url, options).then(async (response) => {\n if (!response.ok) {\n throw new Error(\n `Failed to fetch image data from \"${url}\": ${response.status} ${response.statusText}`,\n );\n }\n\n const blob = await response.blob();\n assert(\n blob.type === 'image/jpeg' || blob.type === 'image/png',\n 'Expected image data to be a JPEG or PNG image.',\n );\n\n return blob;\n });\n}\n\n/**\n * Get image data as data-string from a URL. This is useful for embedding images\n * inside of SVGs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const imageData = await getImageData('https://cataas.com/cat');\n * const svg = `\n * <svg width=\"100\" height=\"100\" xmlns=\"http://www.w3.org/2000/svg\">\n * <image href=\"${imageData}\" />\n * </svg>\n * `;\n *\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n * @returns A promise that resolves to the image data as a data-string.\n */\nexport async function getImageData(url: string, options?: RequestInit) {\n const blob = await getRawImageData(url, options);\n const bytes = new Uint8Array(await blob.arrayBuffer());\n\n return `data:${blob.type};base64,${bytesToBase64(bytes)}`;\n}\n"]}
|
package/dist/images.d.cts
CHANGED
|
@@ -13,59 +13,10 @@
|
|
|
13
13
|
* </svg>
|
|
14
14
|
* `;
|
|
15
15
|
*
|
|
16
|
-
* // Render the SVG in a Snap UI.
|
|
17
|
-
* const ui = image(svg);
|
|
18
16
|
* @param url - The URL to get the image data from.
|
|
19
17
|
* @param options - The options to use when fetching the image data. This is
|
|
20
18
|
* passed directly to `fetch`.
|
|
21
19
|
* @returns A promise that resolves to the image data as a data-string.
|
|
22
20
|
*/
|
|
23
21
|
export declare function getImageData(url: string, options?: RequestInit): Promise<string>;
|
|
24
|
-
/**
|
|
25
|
-
* Options for getting an SVG image element from a URL.
|
|
26
|
-
*
|
|
27
|
-
* @property width - The width of the image.
|
|
28
|
-
* @property height - The height of the image. If this is not provided, the
|
|
29
|
-
* width will be used as the height.
|
|
30
|
-
* @property request - The options to use when fetching the image data. This is
|
|
31
|
-
* passed directly to `fetch`.
|
|
32
|
-
*/
|
|
33
|
-
export type ImageOptions = {
|
|
34
|
-
width: number;
|
|
35
|
-
height?: number;
|
|
36
|
-
request?: RequestInit;
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* Get an image component from a URL. This is useful for embedding images inside
|
|
40
|
-
* Snap UIs. Only JPEG and PNG images are supported.
|
|
41
|
-
*
|
|
42
|
-
* Note: This function uses `fetch` to get the image data. This means that using
|
|
43
|
-
* it requires the `endowment:network-access` permission.
|
|
44
|
-
*
|
|
45
|
-
* @example
|
|
46
|
-
* const component = await getImage('https://cataas.com/cat');
|
|
47
|
-
*
|
|
48
|
-
* return await snap.request({
|
|
49
|
-
* method: 'snap_dialog',
|
|
50
|
-
* params: {
|
|
51
|
-
* type: 'alert',
|
|
52
|
-
* content: panel([
|
|
53
|
-
* component,
|
|
54
|
-
* ]),
|
|
55
|
-
* },
|
|
56
|
-
* });
|
|
57
|
-
* @param url - The URL to get the image data from.
|
|
58
|
-
* @param options - The options to use when fetching and rendering the image.
|
|
59
|
-
* @param options.width - The width of the image.
|
|
60
|
-
* @param options.height - The height of the image. If this is not provided, the
|
|
61
|
-
* width will be used as the height.
|
|
62
|
-
* @param options.request - The options to use when fetching the image data.
|
|
63
|
-
* This is passed directly to `fetch`.
|
|
64
|
-
* @returns A promise that resolves to the image data as an image component.
|
|
65
|
-
* @deprecated Use `<Image src="external_url" />` instead. This function will be removed in a future release.
|
|
66
|
-
*/
|
|
67
|
-
export declare function getImageComponent(url: string, { width, height, request }: ImageOptions): Promise<{
|
|
68
|
-
value: string;
|
|
69
|
-
type: import("./ui/index.cjs").NodeType.Image;
|
|
70
|
-
}>;
|
|
71
22
|
//# sourceMappingURL=images.d.cts.map
|
package/dist/images.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"images.d.cts","sourceRoot":"","sources":["../src/images.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"images.d.cts","sourceRoot":"","sources":["../src/images.ts"],"names":[],"mappings":"AAkCA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,mBAKpE"}
|
package/dist/images.d.mts
CHANGED
|
@@ -13,59 +13,10 @@
|
|
|
13
13
|
* </svg>
|
|
14
14
|
* `;
|
|
15
15
|
*
|
|
16
|
-
* // Render the SVG in a Snap UI.
|
|
17
|
-
* const ui = image(svg);
|
|
18
16
|
* @param url - The URL to get the image data from.
|
|
19
17
|
* @param options - The options to use when fetching the image data. This is
|
|
20
18
|
* passed directly to `fetch`.
|
|
21
19
|
* @returns A promise that resolves to the image data as a data-string.
|
|
22
20
|
*/
|
|
23
21
|
export declare function getImageData(url: string, options?: RequestInit): Promise<string>;
|
|
24
|
-
/**
|
|
25
|
-
* Options for getting an SVG image element from a URL.
|
|
26
|
-
*
|
|
27
|
-
* @property width - The width of the image.
|
|
28
|
-
* @property height - The height of the image. If this is not provided, the
|
|
29
|
-
* width will be used as the height.
|
|
30
|
-
* @property request - The options to use when fetching the image data. This is
|
|
31
|
-
* passed directly to `fetch`.
|
|
32
|
-
*/
|
|
33
|
-
export type ImageOptions = {
|
|
34
|
-
width: number;
|
|
35
|
-
height?: number;
|
|
36
|
-
request?: RequestInit;
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* Get an image component from a URL. This is useful for embedding images inside
|
|
40
|
-
* Snap UIs. Only JPEG and PNG images are supported.
|
|
41
|
-
*
|
|
42
|
-
* Note: This function uses `fetch` to get the image data. This means that using
|
|
43
|
-
* it requires the `endowment:network-access` permission.
|
|
44
|
-
*
|
|
45
|
-
* @example
|
|
46
|
-
* const component = await getImage('https://cataas.com/cat');
|
|
47
|
-
*
|
|
48
|
-
* return await snap.request({
|
|
49
|
-
* method: 'snap_dialog',
|
|
50
|
-
* params: {
|
|
51
|
-
* type: 'alert',
|
|
52
|
-
* content: panel([
|
|
53
|
-
* component,
|
|
54
|
-
* ]),
|
|
55
|
-
* },
|
|
56
|
-
* });
|
|
57
|
-
* @param url - The URL to get the image data from.
|
|
58
|
-
* @param options - The options to use when fetching and rendering the image.
|
|
59
|
-
* @param options.width - The width of the image.
|
|
60
|
-
* @param options.height - The height of the image. If this is not provided, the
|
|
61
|
-
* width will be used as the height.
|
|
62
|
-
* @param options.request - The options to use when fetching the image data.
|
|
63
|
-
* This is passed directly to `fetch`.
|
|
64
|
-
* @returns A promise that resolves to the image data as an image component.
|
|
65
|
-
* @deprecated Use `<Image src="external_url" />` instead. This function will be removed in a future release.
|
|
66
|
-
*/
|
|
67
|
-
export declare function getImageComponent(url: string, { width, height, request }: ImageOptions): Promise<{
|
|
68
|
-
value: string;
|
|
69
|
-
type: import("./ui/index.mjs").NodeType.Image;
|
|
70
|
-
}>;
|
|
71
22
|
//# sourceMappingURL=images.d.mts.map
|
package/dist/images.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"images.d.mts","sourceRoot":"","sources":["../src/images.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"images.d.mts","sourceRoot":"","sources":["../src/images.ts"],"names":[],"mappings":"AAkCA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,mBAKpE"}
|
package/dist/images.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { assert, bytesToBase64 } from "@metamask/utils";
|
|
2
|
-
import { image } from "./ui/index.mjs";
|
|
3
2
|
/**
|
|
4
3
|
* Get raw image data from a URL.
|
|
5
4
|
*
|
|
@@ -36,8 +35,6 @@ async function getRawImageData(url, options) {
|
|
|
36
35
|
* </svg>
|
|
37
36
|
* `;
|
|
38
37
|
*
|
|
39
|
-
* // Render the SVG in a Snap UI.
|
|
40
|
-
* const ui = image(svg);
|
|
41
38
|
* @param url - The URL to get the image data from.
|
|
42
39
|
* @param options - The options to use when fetching the image data. This is
|
|
43
40
|
* passed directly to `fetch`.
|
|
@@ -48,40 +45,4 @@ export async function getImageData(url, options) {
|
|
|
48
45
|
const bytes = new Uint8Array(await blob.arrayBuffer());
|
|
49
46
|
return `data:${blob.type};base64,${bytesToBase64(bytes)}`;
|
|
50
47
|
}
|
|
51
|
-
/**
|
|
52
|
-
* Get an image component from a URL. This is useful for embedding images inside
|
|
53
|
-
* Snap UIs. Only JPEG and PNG images are supported.
|
|
54
|
-
*
|
|
55
|
-
* Note: This function uses `fetch` to get the image data. This means that using
|
|
56
|
-
* it requires the `endowment:network-access` permission.
|
|
57
|
-
*
|
|
58
|
-
* @example
|
|
59
|
-
* const component = await getImage('https://cataas.com/cat');
|
|
60
|
-
*
|
|
61
|
-
* return await snap.request({
|
|
62
|
-
* method: 'snap_dialog',
|
|
63
|
-
* params: {
|
|
64
|
-
* type: 'alert',
|
|
65
|
-
* content: panel([
|
|
66
|
-
* component,
|
|
67
|
-
* ]),
|
|
68
|
-
* },
|
|
69
|
-
* });
|
|
70
|
-
* @param url - The URL to get the image data from.
|
|
71
|
-
* @param options - The options to use when fetching and rendering the image.
|
|
72
|
-
* @param options.width - The width of the image.
|
|
73
|
-
* @param options.height - The height of the image. If this is not provided, the
|
|
74
|
-
* width will be used as the height.
|
|
75
|
-
* @param options.request - The options to use when fetching the image data.
|
|
76
|
-
* This is passed directly to `fetch`.
|
|
77
|
-
* @returns A promise that resolves to the image data as an image component.
|
|
78
|
-
* @deprecated Use `<Image src="external_url" />` instead. This function will be removed in a future release.
|
|
79
|
-
*/
|
|
80
|
-
export async function getImageComponent(url, { width, height = width, request }) {
|
|
81
|
-
assert(typeof width === 'number' && width > 0, 'Expected width to be a number greater than 0.');
|
|
82
|
-
assert(typeof height === 'number' && height > 0, 'Expected height to be a number greater than 0.');
|
|
83
|
-
const imageData = await getImageData(url, request);
|
|
84
|
-
const size = `width="${width}" height="${height}"`;
|
|
85
|
-
return image(`<svg ${size.trim()} xmlns="http://www.w3.org/2000/svg"><image ${size.trim()} href="${imageData}" /></svg>`);
|
|
86
|
-
}
|
|
87
48
|
//# sourceMappingURL=images.mjs.map
|
package/dist/images.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"images.mjs","sourceRoot":"","sources":["../src/images.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,wBAAwB;AAExD
|
|
1
|
+
{"version":3,"file":"images.mjs","sourceRoot":"","sources":["../src/images.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,wBAAwB;AAExD;;;;;;;GAOG;AACH,KAAK,UAAU,eAAe,CAAC,GAAW,EAAE,OAAqB;IAC/D,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE,CAAC;QAChC,MAAM,IAAI,KAAK,CACb,oCAAoC,GAAG,4EAA4E,CACpH,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;QACjD,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CACb,oCAAoC,GAAG,MAAM,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,EAAE,CACtF,CAAC;QACJ,CAAC;QAED,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACnC,MAAM,CACJ,IAAI,CAAC,IAAI,KAAK,YAAY,IAAI,IAAI,CAAC,IAAI,KAAK,WAAW,EACvD,gDAAgD,CACjD,CAAC;QAEF,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,GAAW,EAAE,OAAqB;IACnE,MAAM,IAAI,GAAG,MAAM,eAAe,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACjD,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;IAEvD,OAAO,QAAQ,IAAI,CAAC,IAAI,WAAW,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;AAC5D,CAAC","sourcesContent":["import { assert, bytesToBase64 } from '@metamask/utils';\n\n/**\n * Get raw image data from a URL.\n *\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n * @returns A promise that resolves to the image data as a blob.\n */\nasync function getRawImageData(url: string, options?: RequestInit) {\n if (typeof fetch !== 'function') {\n throw new Error(\n `Failed to fetch image data from \"${url}\": Using this function requires the \"endowment:network-access\" permission.`,\n );\n }\n\n return fetch(url, options).then(async (response) => {\n if (!response.ok) {\n throw new Error(\n `Failed to fetch image data from \"${url}\": ${response.status} ${response.statusText}`,\n );\n }\n\n const blob = await response.blob();\n assert(\n blob.type === 'image/jpeg' || blob.type === 'image/png',\n 'Expected image data to be a JPEG or PNG image.',\n );\n\n return blob;\n });\n}\n\n/**\n * Get image data as data-string from a URL. This is useful for embedding images\n * inside of SVGs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const imageData = await getImageData('https://cataas.com/cat');\n * const svg = `\n * <svg width=\"100\" height=\"100\" xmlns=\"http://www.w3.org/2000/svg\">\n * <image href=\"${imageData}\" />\n * </svg>\n * `;\n *\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n * @returns A promise that resolves to the image data as a data-string.\n */\nexport async function getImageData(url: string, options?: RequestInit) {\n const blob = await getRawImageData(url, options);\n const bytes = new Uint8Array(await blob.arrayBuffer());\n\n return `data:${blob.type};base64,${bytesToBase64(bytes)}`;\n}\n"]}
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* The main entry point for the Snaps SDK, which can be accessed by importing
|
|
4
|
+
* from `@metamask/snaps-sdk`.
|
|
5
|
+
*
|
|
6
|
+
* @module Main
|
|
7
|
+
* @primaryExport
|
|
8
|
+
* @showGroups
|
|
9
|
+
*/
|
|
2
10
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
11
|
if (k2 === undefined) k2 = k;
|
|
4
12
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;;;;;;;;;;;;;AAKH,mDAcqB;AAbnB,yGAAA,YAAY,OAAA;AACZ,4GAAA,eAAe,OAAA;AACf,0GAAA,aAAa,OAAA;AACb,4GAAA,eAAe,OAAA;AACf,+GAAA,kBAAkB,OAAA;AAClB,oGAAA,OAAO,OAAA;AACP,kGAAA,KAAK,OAAA;AACL,sGAAA,SAAS,OAAA;AACT,uGAAA,UAAU,OAAA;AACV,2GAAA,cAAc,OAAA;AACd,2GAAA,cAAc,OAAA;AACd,8GAAA,iBAAiB,OAAA;AACjB,gGAAA,GAAG,OAAA;AAUL,yCAAyC;AAAhC,+FAAA,MAAM,OAAA;AAEf,+CAAyB;AACzB,uDAAiC;AACjC,+CAAyB;AACzB,oDAAwB;AACxB,iDAAqB","sourcesContent":["/**\n * The main entry point for the Snaps SDK, which can be accessed by importing\n * from `@metamask/snaps-sdk`.\n *\n * @module Main\n * @primaryExport\n * @showGroups\n */\n\n// Only internals that are used by other Snaps packages should be exported here.\nexport type { EnumToUnion } from './internals';\nexport type { UriOptions } from './internals';\nexport {\n getErrorData,\n getErrorMessage,\n getErrorStack,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n literal,\n union,\n enumValue,\n typedUnion,\n selectiveUnion,\n nonEmptyRecord,\n ISO8601DateStruct,\n uri,\n} from './internals';\n\n// Re-exported from `@metamask/utils` for convenience.\nexport type {\n Json,\n JsonRpcError,\n JsonRpcRequest,\n JsonRpcParams,\n} from '@metamask/utils';\nexport { assert } from '@metamask/utils';\n\nexport * from './errors';\nexport * from './error-wrappers';\nexport * from './images';\nexport * from './types';\nexport * from './ui';\n"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The main entry point for the Snaps SDK, which can be accessed by importing
|
|
3
|
+
* from `@metamask/snaps-sdk`.
|
|
4
|
+
*
|
|
5
|
+
* @module Main
|
|
6
|
+
* @primaryExport
|
|
7
|
+
* @showGroups
|
|
8
|
+
*/
|
|
1
9
|
export type { EnumToUnion } from "./internals/index.cjs";
|
|
2
10
|
export type { UriOptions } from "./internals/index.cjs";
|
|
3
11
|
export { getErrorData, getErrorMessage, getErrorStack, SNAP_ERROR_CODE, SNAP_ERROR_MESSAGE, literal, union, enumValue, typedUnion, selectiveUnion, nonEmptyRecord, ISO8601DateStruct, uri, } from "./internals/index.cjs";
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,YAAY,EAAE,WAAW,EAAE,8BAAoB;AAC/C,YAAY,EAAE,UAAU,EAAE,8BAAoB;AAC9C,OAAO,EACL,YAAY,EACZ,eAAe,EACf,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,OAAO,EACP,KAAK,EACL,SAAS,EACT,UAAU,EACV,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,GAAG,GACJ,8BAAoB;AAGrB,YAAY,EACV,IAAI,EACJ,YAAY,EACZ,cAAc,EACd,aAAa,GACd,wBAAwB;AACzB,OAAO,EAAE,MAAM,EAAE,wBAAwB;AAEzC,6BAAyB;AACzB,qCAAiC;AACjC,6BAAyB;AACzB,kCAAwB;AACxB,+BAAqB"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The main entry point for the Snaps SDK, which can be accessed by importing
|
|
3
|
+
* from `@metamask/snaps-sdk`.
|
|
4
|
+
*
|
|
5
|
+
* @module Main
|
|
6
|
+
* @primaryExport
|
|
7
|
+
* @showGroups
|
|
8
|
+
*/
|
|
1
9
|
export type { EnumToUnion } from "./internals/index.mjs";
|
|
2
10
|
export type { UriOptions } from "./internals/index.mjs";
|
|
3
11
|
export { getErrorData, getErrorMessage, getErrorStack, SNAP_ERROR_CODE, SNAP_ERROR_MESSAGE, literal, union, enumValue, typedUnion, selectiveUnion, nonEmptyRecord, ISO8601DateStruct, uri, } from "./internals/index.mjs";
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,YAAY,EAAE,WAAW,EAAE,8BAAoB;AAC/C,YAAY,EAAE,UAAU,EAAE,8BAAoB;AAC9C,OAAO,EACL,YAAY,EACZ,eAAe,EACf,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,OAAO,EACP,KAAK,EACL,SAAS,EACT,UAAU,EACV,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,GAAG,GACJ,8BAAoB;AAGrB,YAAY,EACV,IAAI,EACJ,YAAY,EACZ,cAAc,EACd,aAAa,GACd,wBAAwB;AACzB,OAAO,EAAE,MAAM,EAAE,wBAAwB;AAEzC,6BAAyB;AACzB,qCAAiC;AACjC,6BAAyB;AACzB,kCAAwB;AACxB,+BAAqB"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The main entry point for the Snaps SDK, which can be accessed by importing
|
|
3
|
+
* from `@metamask/snaps-sdk`.
|
|
4
|
+
*
|
|
5
|
+
* @module Main
|
|
6
|
+
* @primaryExport
|
|
7
|
+
* @showGroups
|
|
8
|
+
*/
|
|
1
9
|
export { getErrorData, getErrorMessage, getErrorStack, SNAP_ERROR_CODE, SNAP_ERROR_MESSAGE, literal, union, enumValue, typedUnion, selectiveUnion, nonEmptyRecord, ISO8601DateStruct, uri } from "./internals/index.mjs";
|
|
2
10
|
export { assert } from "@metamask/utils";
|
|
3
11
|
export * from "./errors.mjs";
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,EACL,YAAY,EACZ,eAAe,EACf,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,OAAO,EACP,KAAK,EACL,SAAS,EACT,UAAU,EACV,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,GAAG,EACJ,8BAAoB;AASrB,OAAO,EAAE,MAAM,EAAE,wBAAwB;AAEzC,6BAAyB;AACzB,qCAAiC;AACjC,6BAAyB;AACzB,kCAAwB;AACxB,+BAAqB","sourcesContent":["/**\n * The main entry point for the Snaps SDK, which can be accessed by importing\n * from `@metamask/snaps-sdk`.\n *\n * @module Main\n * @primaryExport\n * @showGroups\n */\n\n// Only internals that are used by other Snaps packages should be exported here.\nexport type { EnumToUnion } from './internals';\nexport type { UriOptions } from './internals';\nexport {\n getErrorData,\n getErrorMessage,\n getErrorStack,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n literal,\n union,\n enumValue,\n typedUnion,\n selectiveUnion,\n nonEmptyRecord,\n ISO8601DateStruct,\n uri,\n} from './internals';\n\n// Re-exported from `@metamask/utils` for convenience.\nexport type {\n Json,\n JsonRpcError,\n JsonRpcRequest,\n JsonRpcParams,\n} from '@metamask/utils';\nexport { assert } from '@metamask/utils';\n\nexport * from './errors';\nexport * from './error-wrappers';\nexport * from './images';\nexport * from './types';\nexport * from './ui';\n"]}
|