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 contract types map to hardhat-viem #5398

Merged
merged 5 commits into from
Jun 25, 2024

Conversation

beepidibop
Copy link
Contributor

  • Because this PR includes a bug fix, relevant tests have been included.
  • Because this PR includes a new feature, the change was previously discussed on an Issue or with someone from the team.
  • I didn't do anything of this.

Adding a ContractTypesMap that returns GetContractReturnType<${ctd.typeName}["abi"]> to artifacts.d.ts by modifying generateArtifactsDefinition() and generateDuplicateArtifactsDefinition() can improve UX. Users will only need to do import { ContractTypesMap } from "hardhat/types"; and the contract type can be used like this

const contract: ContractTypesMap["ContractName"];

This PR was previously discussed here.

Add `ContractTypesMap` that returns `GetContractReturnType<${ctd.typeName}["abi"]>` to the `generateArtifactsDefinition()` and `generateDuplicateArtifactsDefinition()`.
Copy link

vercel bot commented Jun 15, 2024

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 Jun 25, 2024 4:44pm

Copy link

changeset-bot bot commented Jun 15, 2024

🦋 Changeset detected

Latest commit: 890bdee

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

Copy link
Member

@schaable schaable left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Tested in a sample project by importing the map and verifying that the types for the Lock contract match what is returned from deployContract and getContractAt.

@schaable schaable merged commit 53c422c into NomicFoundation:main Jun 25, 2024
11 checks passed
Copy link

gitpoap-bot bot commented Jun 25, 2024

Congrats, your important contribution to this open-source project has earned you a GitPOAP!

GitPOAP: 2024 Hardhat Contributor:

GitPOAP: 2024 Hardhat Contributor GitPOAP Badge

Head to gitpoap.io & connect your GitHub account to mint!

Learn more about GitPOAPs here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:ready This issue is ready to be worked on
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants