hardhat
hardhat copied to clipboard
issues/4652: added support for library linking in `hardhat-viem`
Related to: https://github.com/NomicFoundation/hardhat/issues/4652,
Scope of changes: hardhat-core
, hardhat-ethers
, hardhat-viem
.
Hi guys, that's my very first contribution to your project. Thanks for the all work you've done so far I really enjoy working with hardhat!
Motivation for this change's basically lack of support for linking the libraries within the hardhat-viem
plugin and as I've stumbled upon that in another project and been blocked by it; I've come up with a workaround, so I decided to share that work with the rest of the community here.
What I've done so far is;
- moved type definitions that were allocated within the
hardhat-ethers
into thehardhat-core
that were related to libraries - will appreciate your feedback on that, - once types were shared I could use it within the
hardhat-viem
and that's where I have added linking functionality that mimics the interface of what we already have inhardhat-ethers
,- you're able to deploy a contract using;
-
deployContract("ContractName", [], { libraries: { LibraryName: "0xLibraryAddress" })
, -
sendDeploymentTransaction("ContractName", [], { libraries: { LibraryName: "0xLibraryAddress" } })
,
-
- tried to replicate errors;
-
AmbigousLibraryNameError
, thrown whenever library name is just not enough and fully qualified name is recommended, -
UnnecessaryLibraryLinkError
, thrown once linked library is not referenced by the contract we try to deploy, -
MissingLibraryAddressError
, thrown whenever at least one library link is missing, -
InvalidLibraryAddressError
, thrown anytime the linked address is in incorrect format,
-
- you're able to deploy a contract using;
- covered that with tests in
integration.ts
spec file,
I wasn't sure If hardhat-core
should be aware of libraries linking, so I am looking forward towards your feedback. 🙌
🦋 Changeset detected
Latest commit: 581ae2ba06d6b54a67bf59561a2edb6d096f0eb6
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 1 package
Name | Type |
---|---|
@nomicfoundation/hardhat-viem | Patch |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
hardhat | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Apr 19, 2024 9:15pm |
Hi @Chlebamaticon, sorry for the delay with your PR. I'll do my best to review it during next week.
Hi @Chlebamaticon, sorry for the delay with your PR. I'll do my best to review it during next week.
@schaable just rebased to ease the review. Will appreciate your feedback. 🙌
Howdy? @schaable
Hi @Chlebamaticon, sorry again for the delay in reviewing this PR. I made a initial pass through the code and added some suggestions. Feel free to ask if you need any help or further clarification.
Thanks @schaable for your feedback; will apply desired changes later Today.
Hi @Chlebamaticon, sorry again for the delay in reviewing this PR. I made a initial pass through the code and added some suggestions. Feel free to ask if you need any help or further clarification.
Made all suggested changes. 🙌