web3.js icon indicating copy to clipboard operation
web3.js copied to clipboard

Add typings for contract

Open Algoritm211 opened this issue 3 years ago • 5 comments

Description

The main goal of this PR is to add support for typing events and contract methods. At the moment, almost all TypeScript contract developers generate types for their contracts (using the built-in hardhat functionality or libraries like ethereum-abi-types-generator)

In addition, I noticed TODO on adding types to the contract and decided to do it. I am sure that this innovation will help to interact more conveniently with web3js by passing methods and events of their contracts at the time of creating a web3 instance

This greatly simplifies development, especially considering the auto-complete offered by IDEs such as WebStorm and VSCode.

Example

Before:

Снимок экрана 2022-05-24 в 00 47 20

After:

Снимок экрана 2022-05-24 в 00 46 48

As we can see, we have received full typing of our contract methods. I think this is amazing and should be included in a new library update as soon as possible.

Type of change

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • [x] I have selected the correct base branch.
  • [x] I have performed a self-review of my own code.
  • [x] I have commented my code, particularly in hard-to-understand areas.
  • [x] I have made corresponding changes to the documentation.
  • [x] My changes generate no new warnings.
  • [x] Any dependent changes have been merged and published in downstream modules.
  • [x] I ran npm run dtslint with success and extended the tests and types if necessary.
  • [x] I ran npm run test:cov and my test cases cover all the lines and branches of the added code.
  • [x] I ran npm run build with success.
  • [x] I have tested the built dist/web3.min.js in a browser.
  • [x] I have tested my code on the live network.
  • [x] I have checked the Deploy Preview and it looks correct.
  • [x] I have updated the CHANGELOG.md file in the root folder.

Algoritm211 avatar May 23 '22 21:05 Algoritm211

@jdevcs Can you please review it? Maybe you have some comments

Algoritm211 avatar May 30 '22 17:05 Algoritm211

@Algoritm211 Thanks for your contribution, In Web3.js 4.x we will be providing full types support. Could you have time for contributions in web3.js 4.x.

jdevcs avatar Jun 09 '22 14:06 jdevcs

This PR has been automatically marked as stale beacause it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment.

github-actions[bot] avatar Sep 15 '22 00:09 github-actions[bot]

This PR has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment.

I think it's actual

Algoritm211 avatar Sep 18 '22 18:09 Algoritm211

Pull Request Test Coverage Report for Build 3091513164

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 72.233%

Totals Coverage Status
Change from base Build 3091420932: 0.0%
Covered Lines: 3414
Relevant Lines: 4445

💛 - Coveralls

coveralls avatar Sep 20 '22 16:09 coveralls

This PR has been automatically marked as stale beacause it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment.

github-actions[bot] avatar Nov 20 '22 00:11 github-actions[bot]

This PR has been automatically marked as stale beacause it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment.

github-actions[bot] avatar Jan 30 '23 00:01 github-actions[bot]

Closing this in favor of web3 4.x

jdevcs avatar Feb 13 '23 11:02 jdevcs