Add typings for contract
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:
After:
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 dtslintwith success and extended the tests and types if necessary. - [x] I ran
npm run test:covand my test cases cover all the lines and branches of the added code. - [x] I ran
npm run buildwith success. - [x] I have tested the built
dist/web3.min.jsin 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.mdfile in the root folder.
@jdevcs Can you please review it? Maybe you have some comments
@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.
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.
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
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 | |
|---|---|
| Change from base Build 3091420932: | 0.0% |
| Covered Lines: | 3414 |
| Relevant Lines: | 4445 |
💛 - 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.
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.
Closing this in favor of web3 4.x