This repository demonstrates how to integrate Tenderly in every transactionr request on Metamask. This is similar to the feature available on Gnosis Safe.
It is built on top of MetaMask Snaps.
To interact with the Snaps, you will need to install MetaMask Flask, a canary distribution for developers that provides access to upcoming features.
yarn install && yarn startYou'll also need to configure Tenderly. To access the values required, it is recommended to install their command line. The following commands can be run after executing tenderly login.
There is a config file in packages/snap/src/config.ts. It requires four parameters:
TENDERLY_KEY: Must be generated in the Tenderly account settings.TENDERLY_ID:tenderly whoami, "ID"TENDERLY_PROJECT: In Tenderly, check the slug of your active project. (default: project)TENDERLY_USERNAME:tenderly whoami, "Username"
- You should be able to connect to
localhost:8000and install the Snap inside MetaMask Flask. - Try and make any transaction and check the new "Tenderly" tab next to "Details", "Data" and "Hex".
It leverages Tenderly Simulation API. When MetaMask receives a transaction and you open the tab, it makes a request to the API passing the transaction details (from address, to contract, data, chain id) and checks what results it gets.
It's then able to display the simulated transaction status and the link to see the details,
For the moment, there is no secure way to store the credentials inside a Snap. This is a blocker to release this Snap more widely unless somebody wants to give their Tenderly account for the simulations.