Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@metamask/insights-example-snap

Package Overview
Dependencies
Maintainers
12
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@metamask/insights-example-snap

MetaMask example snap demonstrating the use of the Transaction Insights API.

  • 2.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.1K
decreased by-51.14%
Maintainers
12
Weekly downloads
 
Created
Source

@metamask/transaction-insights-example-snap

This snap demonstrates how to use the endowment:transaction-insight permission to provide transaction insights to the user. This snap uses the onTransaction handler to provide insights for transactions that are sent by the user.

Transaction insights are displayed in the transaction confirmation screen, and can show any Snaps-based UI components.

Snap manifest

Note: Using onTransaction requires the endowment:transaction-insight permissions. Refer to the documentation for more information.

Along with other permissions, the manifest of this snap includes the endowment:transaction-insight permission:

{
  "initialPermissions": {
    "endowment:network-access": {}
  }
}

By default, the onTransaction does not receive the transaction origin. If you want to receive the origin, you can add the allowTransactionOrigin property to the permission definition:

{
  "initialPermissions": {
    "endowment:transaction-insight": {
      "allowTransactionOrigin": true
    }
  }
}

Snap usage

This snap exposes an onTransaction handler, which is called when a transaction is sent by the user. The handler receives the transaction details and the transaction origin (if the allowTransactionOrigin property is set to true).

The snap decodes the transaction data and returns the decoded data as the transaction insight.

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

FAQs

Package last updated on 13 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc