UNPKG

@metamask/snaps-sdk

Version:

A library containing the core functionality for building MetaMask Snaps

1 lines 1.44 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 * The request parameters for the `snap_notify` method.\n *\n * @property type - The type of notification to display.\n * @property message - The message to display in the notification.\n */\nexport type NotifyParams =\n | {\n type: EnumToUnion<NotificationType.Native>;\n message: string;\n }\n | {\n type: EnumToUnion<NotificationType.InApp>;\n message: string;\n }\n | {\n type: EnumToUnion<NotificationType.InApp>;\n message: string;\n content: ComponentOrElement;\n title: string;\n footerLink?: { href: string; text: string };\n };\n\n/**\n * The result returned by the `snap_notify` method.\n *\n * This method does not return anything.\n */\nexport type NotifyResult = null;\n"]}