@metamask/dialog-example-snap

2.3.1 • Public • Published

@metamask/dialog-example-snap

This snap demonstrates the use of snap_dialog to display a dialog to the user.

Snap manifest

Note: Using snap_dialog requires the snap_dialog permission. Refer to the documentation for more information.

Along with other permissions, the manifest of this snap includes the snap_dialog permission:

{
  "initialPermissions": {
    "snap_dialog": {}
  }
}

This permission does not require any additional configuration.

Snap usage

This snap exposes an onRpcRequest handler, which supports the following JSON-RPC methods, one for each type of dialog:

  • showAlert: Displays an alert dialog to the user.
  • showConfirmation: Displays a confirmation dialog to the user.
  • showPrompt: Displays a prompt dialog to the user.

For the sake of simplicity, the methods do not accept any parameters, and return the value returned by snap_dialog directly.

For more information, you can refer to the end-to-end tests.

Readme

Keywords

none

Package Sidebar

Install

npm i @metamask/dialog-example-snap

Weekly Downloads

45

Version

2.3.1

License

(MIT-0 OR Apache-2.0)

Unpacked Size

43 kB

Total Files

7

Last publish

Collaborators

  • danfinlay
  • kumavis
  • mcmire
  • rekmarks
  • metamaskbot
  • gudahtt
  • nicholasellul
  • sethkfman
  • naugtur