[Typechain] Investigate how to support the attach method#6442
[Typechain] Investigate how to support the attach method#6442ChristopherDedominici merged 8 commits intov-nextfrom
Conversation
🦋 Changeset detectedLatest commit: 8f2403d The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 ↗︎
|
| ); | ||
| } | ||
|
|
||
| function addSupportForAttachMethod(modifiedContent: string): string { |
There was a problem hiding this comment.
As with the other logic in this file, since Typechain is no longer maintained, we cannot open PRs to the repository, so we need to find a workaround.
The logic behind this code is:
- Identify the files that extend
ContractFactory - Modify these files to add support for the
attachmethod - Add the required
ethersimport to support theattachmethod
There was a problem hiding this comment.
We discussed this possibility in the design doc but discarded it due to several maintenance complications
…Foundation/hardhat into add-attach-support-in-hh-typechain
| } | ||
|
|
||
| function addSupportForAttachMethod(modifiedContent: string): string { | ||
| const pattern = /class\s+(\w+)__factory/; // Pattern to find the contract name in factory files |
There was a problem hiding this comment.
Just a note for other reviewers because I checked it myself, \w+ is equivalent to [a-zA-Z0-9_]+. So it should cover all the characters allowed in contract names 👍
…Foundation/hardhat into add-attach-support-in-hh-typechain
Fixes this
Depends on: NomicFoundation/hardhat#6400.
This dependency exists because test files are still being compiled and do not extend ethers. However, since test files should not be compiled, this is not an issue.