zemse / hardhat-tracer

🕵️ allows you to see internal calls, events and storage operations in the console
MIT License
341 stars 35 forks source link

add universal tasks #25

Closed inveker closed 1 year ago

inveker commented 1 year ago

Hi, I've added a tracer for the "deploy" task from the hardhat-deploy plugin. Is it possible to consider a universal solution so that new tasks do not have to copy-paste the same file?

fvictorio commented 1 year ago

Keep in mind that this will only work if hardhat-tracer is required in the config after hardhat-deploy. If it's included before, I think you'll get an error when runSuper is called.

Is it possible to consider a universal solution so that new tasks do not have to copy-paste the same file?

This is a good question. Maybe wrapHardhatProvider could be used in extendEnvironment, but I'm not really sure. applyCliArgsToTracer seems to emulate global args, which Hardhat doesn't support yet.

inveker commented 1 year ago

Hello, I added the ability to specify the necessary commands in the user's project config. You need to create a tracer.config.json file, at the level of the hardhat.config.json file, and write something like this in it

{
  "tasks": ["deploy"]
}

At the same time, I removed code duplicates from task files for "test", "node", "deploy"

zemse commented 1 year ago

I just add this to the main (v2) branch in ae4551c. I think it's better to use the hardhat config instead of having a separate config file for this. Published it temporarily to hardhat-tracer@2.1.0-beta.

// hardhat.config.ts
{
  tracer: {
    tasks: ['deploy']
  }
}
inveker commented 1 year ago

@zemse Yes, that's better! Thank you!