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

Exposing web3.eth.Contract.setProvider() as per public documentation #4822

Merged

Conversation

sdesalas
Copy link

@sdesalas sdesalas commented Mar 4, 2022

Description

Fixes #4770 setProvider "does not exist on type 'typeof import(..." in typescript.

Type of change

  • *.ts Type Definitions

Checklist:

  • I have selected the correct base branch.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas (No code, only a type definition for TS).
  • I have made corresponding changes to the documentation (Fixes type defs in line with public documentation).
  • My changes generate no new warnings.
  • Any dependent changes have been merged and published in downstream modules (No dependent changes).
  • I ran npm run dtslint with success and extended the tests and types if necessary.
  • I ran npm run test:unit with success.
  • I ran npm run test:cov and my test cases cover all the lines and branches of the added code.
  • I ran npm run build and tested dist/web3.min.js in a browser.
  • I have tested my code on the live network (Unnecessary, only a missing type definition for TS).
  • I have checked the Deploy Preview and it looks correct (Unnecessary, only a missing type definition for TS).
  • I have updated the CHANGELOG.md file in the root folder (Not a notable change).

@jdevcs jdevcs added 1.x 1.0 related issues Review Needed Maintainer(s) need to review labels Mar 16, 2022
@coveralls
Copy link

coveralls commented Mar 16, 2022

Pull Request Test Coverage Report for Build 2246294533

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 429 unchanged lines in 7 files lost coverage.
  • Overall coverage decreased (-2.3%) to 72.211%

Files with Coverage Reduction New Missed Lines %
packages/web3-core-requestmanager/src/jsonrpc.js 1 88.0%
packages/web3-core-helpers/src/formatters.js 25 81.07%
packages/web3-core-helpers/src/errors.js 31 4.41%
packages/web3-utils/src/soliditySha3.js 55 5.13%
packages/web3-utils/src/index.js 62 29.31%
packages/web3-utils/src/utils.js 92 12.86%
packages/web3-eth-accounts/src/index.js 163 23.77%
Totals Coverage Status
Change from base Build 2236725384: -2.3%
Covered Lines: 3372
Relevant Lines: 4401

💛 - Coveralls

@@ -29,6 +29,8 @@ export class Contract {
options?: ContractOptions
);

static setProvider(provider: string): void;
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Author

@sdesalas sdesalas Mar 20, 2022

Choose a reason for hiding this comment

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

Hiya, thanks good point. Added TS defs for optional accounts parameter as suggested.

Copy link
Author

@sdesalas sdesalas Mar 20, 2022

Choose a reason for hiding this comment

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

And parameter provider is of type provider too (from web3-core). Fixing.

@sdesalas
Copy link
Author

Hiya. Can someone rerun the flaky e2e_windows tests? Thanks!

@nazarhussain
Copy link
Contributor

@sdesalas The e2e_windows tests requires to run from core contributors. Soon we will merge your PR in one of our branches and then run these tests.

@sdesalas
Copy link
Author

Updating latest changes from upstream.

@jdevcs jdevcs changed the base branch from 1.x to junaid/4822web3EthContractSetProviderexposingtests May 4, 2022 12:51
@jdevcs jdevcs merged commit 6b27967 into web3:junaid/4822web3EthContractSetProviderexposingtests May 4, 2022
jdevcs added a commit that referenced this pull request May 4, 2022
…5001)

* Exposing web3.eth.Contract.setProvider() as per public documentation (#4822)

* Additional TS defs for web3.eth.Contract.setProvider()

* changelog update

Co-authored-by: Steven de Salas <sdesalas@users.noreply.github.com>
@sdesalas
Copy link
Author

sdesalas commented May 9, 2022

Wohooo! 🙌

@jdevcs jdevcs mentioned this pull request May 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.x 1.0 related issues Review Needed Maintainer(s) need to review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

setProvider "does not exist on type 'typeof import(..." in typescript.
5 participants