Created
May 12, 2023 18:14
-
-
Save eggplantzzz/9a88903c1dbbda5995c533a2d9823ee1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set up for testing Truffle visual debugger | |
Truffle visual debugger needs compilations and source material for the contracts that it will displaying information | |
for. For example, if you want to debug a transaction involving 3 contracts, it will need the source material and | |
compilations for them; otherwise it won't be able to display this information. It obtains compilations/source material | |
from 3 sources: etherscan (for verified contracts), Truffle projects, and HardHat projects. | |
When the visual debugger determines that it is missing source material, it will automatically try and fetch it from | |
Etherscan and the user does not need any extra configuration. However, if you have your source material locally in | |
a Truffle or HardHat project, you will need to send those compilations to the visual debugger using the following steps. | |
-- sending compilations to the visual debugger using a Truffle project -- | |
1. install the Truffle dist release by running `npm install -g truffle@visual-debugger` in a terminal window | |
2. then navigate to your Truffle project (this directory should have a `truffle-config.js` file in it) and run | |
`truffle dashboard` - then use a web browser to navigate to the url it reports - this is normally | |
http://localhost:24012 | |
4. in another terminal window, once again navigate to your project directory and run | |
`truffle migrate --compile-all` to send your projects compilations to the browser | |
-- sending compilations to the visual debugger using a HardHat project -- | |
1. install the Truffle dist release by running `npm install -g truffle@visual-debugger` in a terminal window | |
2. then run `truffle dashboard` and in a browser navigate to the url that it reports - this is | |
normally http://localhost:24012 | |
3. in another terminal window, navigate to your HardHat project's root directory and install the | |
@truffle/dashboard-hardhat-plugin by running `npm install @truffle/dashboard-hardhat-plugin` | |
4. in your `hardhat-config.ts`, add `import "@truffle/dashboard-hardhat-plugin"` to the top of the file | |
5. then run `npx hardhat compile` to send the compilations to Truffle visual debugger | |
After saving the compilations to the browser, in Truffle Dashboard you can click on the Debugger button on the left, | |
and enter the transaction hash you wish to degbug. Make sure you have MetaMask connected to the page (you can use the | |
"Connect" button in the bottom left corner) and that MetaMask is connected to the appropriate network for the | |
transaction hash you are using. Happy debugging! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment