Skip to content
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

Add support for hardhat + ethers v6 #842

Open
fvictorio opened this issue May 30, 2023 · 1 comment
Open

Add support for hardhat + ethers v6 #842

fvictorio opened this issue May 30, 2023 · 1 comment

Comments

@fvictorio
Copy link
Contributor

I'm working on a new version of the hardhat-ethers plugin and I want to make sure that it works well with typechain. From what I can see, typechain's hardhat plugin hasn't been updated yet (which makes sense, because we haven't updated our plugin 😅).

Some comments from looking at the codebase:

  • The version of ethers used in @typechain/hardhat should be updated, and the dependency on @typechain/ethers-v5 should be replaced with @typechain/ethers-v6
  • I think some peer dependencies (@ethersproject/abi and @ethersproject/providers) in @typechain/hardhat could be dependencies. This is no strictly necessary, but reducing peer dependencies prevents conflicts down the road.
  • codegen/hardhat.ts in @typechain/target-ethers-v6 will need to be updated. Here I think we'll have to coordinate, but at the very least:
    • The new version of the plugin will be called @nomicfoundation/hardhat-ethers, not @nomiclabs.
    • getContractAt will also accept an Addressable as the address, so those types should be changed to string | Addressable.

I'll be working on this today and I'll comment here anything else I find.

@fvictorio
Copy link
Contributor Author

Some other things that need to be done.

In @typechain/hardhat:

  • Change the default target in the config to ethers-v6

In @typechain/ethers-v6:

  • Add generated typings for deployContract
  • Change ethers.utils.BytesLike to ethers.BytesLike

I think these changes should be enough. This would mean though that the next major version of @typechain/hardhat uses ethers v6 by default. The alternative is to release a separate plugin for v6... but I don't think that makes sense here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
@fvictorio and others