UNPKG

@metamask/snaps-sdk

Version:

A library containing the core functionality for building MetaMask Snaps

1 lines 2.53 kB
{"version":3,"file":"notify.mjs","sourceRoot":"","sources":["../../../src/types/methods/notify.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,MAAM,CAAN,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,mCAAe,CAAA;IACf,qCAAiB,CAAA;AACnB,CAAC,EAHW,gBAAgB,KAAhB,gBAAgB,QAG3B","sourcesContent":["import { type EnumToUnion } from '../../internals';\nimport type { ComponentOrElement } from '../interface';\n\n/**\n * The types of notifications that can be displayed.\n *\n * - `InApp` - A notification that is displayed in by the MetaMask extension.\n * - `Native` - A notification that is displayed by the operating system.\n */\nexport enum NotificationType {\n InApp = 'inApp',\n Native = 'native',\n}\n\n/**\n * An object containing the parameters for the `snap_notify` method.\n */\nexport type NotifyParams =\n | {\n /**\n * The literal string \"native\" to indicate that this is a native OS\n * notification. We recommend using `inApp` instead, as native\n * notifications may be rate-limited by the operating system.\n */\n type: EnumToUnion<NotificationType.Native>;\n\n /**\n * The message to display in the notification.\n */\n message: string;\n }\n | {\n /**\n * The literal string \"inApp\" to indicate that this is an in-app\n * notification displayed in the MetaMask UI.\n */\n type: EnumToUnion<NotificationType.InApp>;\n\n /**\n * The message to display in the notification.\n */\n message: string;\n }\n | {\n /**\n * The literal string \"inApp\" to indicate that this is an in-app\n * notification displayed in the MetaMask UI.\n */\n type: EnumToUnion<NotificationType.InApp>;\n\n /**\n * A short summary shown in the notification list.\n */\n message: string;\n\n /**\n * The custom UI content to display when the notification is expanded.\n */\n content: ComponentOrElement;\n\n /**\n * The title of the expanded notification.\n */\n title: string;\n\n /**\n * An optional link to display in the footer of the expanded notification.\n */\n footerLink?: {\n /**\n * The URL to navigate to when the link is clicked.\n */\n href: string;\n\n /**\n * The link text to display.\n */\n text: string;\n };\n };\n\n/**\n * This method does not return any data, so the result is always `null`.\n */\nexport type NotifyResult = null;\n"]}