-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow plugins to provide more artifacts #1040
Comments
If I'm understanding correctly, you would like to add extra fields to the JSON artifacts, and then be able to consume them, is that correct? One thing to keep in mind is that if you add fields, the current type of |
It is not about adding extra field to artifacts, but being able for a plugin to add more artifacts, from different sources. And having that reachable to other plugin hardhat-deploy already offer that feature but these artifacts are not seen by other plugins |
Any plan to support that somehow? It has resurfaced with my update of hardhat-deploy-ethers (wip) that is now an extension of hardhat-ethers hardhat-deploy-ethers used to re-write the function of hardhat-ethers but now this is not easily possible, nor recommended (would need to guess any future addition of function) One of the reason for the re-write was to ensure It would be a lot better if somehow plugin could override hre.artifacts directly, this wwould make any plugin using artifacts.readArtifact support the extra artifacts provided. |
I would very much like this feature to be able to use external libraries in my Hardhat project! |
I started to look at implementating it but I am not sure what is the best way forward Currently the Artifacts object is instantiated synchrnously at the time the HRE is constructed (https://github.com/nomiclabs/hardhat/blob/e5b5041e15908fe81ee7ad5ec984f74f3fde253d/packages/hardhat-core/src/internal/core/runtime-environment.ts#L76). I think the change would probably be a breaking change as the way it is done now, do not allow for async hooks. Did you start thinking how we could use the This is to me the last piece needed to make my On that note, it might be interesting to allow artifacts to belong to a specific network (Without overwriting other). THis would be useful for network like optimism which require a different compiler on their network |
Running into this again. Any progress? |
We've discussed this in private and decided that we are ok with adding an api like this one: // This callback is only called if the built-in artifacts resolution fails, and no other extension was declared before and succeded
extendArtifactsResolution((name: string) => {
return somehowGetTheArtifactAndAdaptItsFormatIfNecessaryOrUndefinedIfNotFound(name);
}) We'll probably add other ways of loading dependencies artifacts, but this is a good quick way to allow plugins to do it. Unfortunately we can't prioritize this yet, but are willing to accept a PR implementing it. |
Hi, I think this should be higher priority. The hardhat ecosystem is missing something to manage deployments, and something like Please consider prioritizing this higher, or at least taking an hour or two to sketch out "the right way" to do it in order for someone else to come in and help out. |
Somehow I only just discovered Hardhat Ignition yesterday, via #381 (comment). I'm not sure if I'm understanding correctly, but I get the impression that Nomic Foundation maybe don't want to spend extra effort supporting |
@aspiers I took a look at https://github.com/NomicFoundation/hardhat-ignition , and there haven't been any commits since July 2021. There is only a single release on npm https://www.npmjs.com/package/hardhat-ignition from a year ago. It seems to me that project is not maintained 🤔 Even if Will comment in the other issue you linked to. Thanks. |
@KholdStare commented on April 1, 2022 2:57 PM:
Thanks, hadn't spotted that.
I totally agree. |
I agree this issue should have a higher priority. It will also enable a better integration between |
Thanks for the comments folks. We'll discuss this internally and see if we can move this forward on our roadmap. |
Any update on that ? There is more and more plugin that hardcode dependency on hardhat-ethers and until this issue is resolved this put hardhat-deploy-ethers in a difficult situation While I do not think these library should hard code libraries like that (As this prevent user to provide their own implementation), it seems to be a trend and this cause typing issue on hardhat-deploy-ethers see : wighawag/hardhat-deploy-ethers#12 |
Sorry @wighawag, we'll try to prioritize this. |
+1 running into this as well |
+1 me too. |
@sharp2448 you can use hardhat toolbox and hardhat-deploy (or any plugin not included in the toolbox) together |
@fvictorio the issue is that hardhat toolbox hardcode dependencies to hardhat-ethers and this prevent
|
Would be really great to have documented support and compatibility between I really wanna switch to using |
First of all thanks for your hard work and commitment. Any progress on this topic? Its pretty annoying not being able to use hardhat-deploy without hardhat-deploy-ethers due to that functionality. |
+1 on this |
Hope that all things go well. For anything stuck, we can discuss it publicly and work together. |
+1 |
Currently hardhat offer a function
hre.artifacts.readArtifact
(as well as other method inhre.artifacts
)Unfortunately such
artifacts
field is hardwired at runtime creation with a specific folder and as a read-only field it is not supposed to be modified.hardhat-deploy
(and evenbuilder-deploy
before) offer a mechanism for external import of artifacts, it support different format like truffle too. It does so with its own custom function so user can deploy these artifacts.But since hardhat, as mentioned do not allow plugin to override the canonical way to get artifacts, other plugin that offer new features to artifacts are not aware of hardhat-deploy artifacts, even if they are compatible.
There are different approches to solve this. One approach is to allow plugin to hook into the
getArtifact
process so plugins can import artifact from other sources, even transforming it to fit hardhat expected format.This way any plugin that add features to artifacts can access them via a standard mechanism
The text was updated successfully, but these errors were encountered: