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

Expose utils from Web3 class as static property #1

Open
wants to merge 1 commit into
base: 1.0
Choose a base branch
from

Conversation

teef
Copy link

@teef teef commented Mar 11, 2019

Description

Utilities are now static readonly property of Web3 class. This is not breaking change and no change in implementation is needed.
Typing test adjusted.
Web3 tests supplemented with test case.

Missing utilities added to utils property of Web3 class:

  • isBigNumber(): added
  • leftPad(): added for compatibility with TS Interface
  • rightPad(): added for compatibility with TS Interface
  • unitMap(): added

Known issues:

  • testAddress(): defined but implementation is missing
  • testTopic(): defined but implementation is missing
    both methods do not exist in documentation of version 1.0.

Type of change

  • Bug fix
  • Enhancement

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.
  • I have made corresponding changes to the documentation.
  • My changes generate no warnings.
  • I have updated or added types for all modules I've changed
  • Any dependent changes have been merged and published in downstream modules.
  • I ran npm run test in the root folder with success and extended the tests if necessary.
  • I ran npm run build in the root folder and tested it in the browser and with node.
  • I ran npm run dtslint in the root folder and tested that all my types are correct
  • I have tested my code on an ethereum test network.

*
* @returns {Object} Utility functions for Ethereum dapps
*/
static get utils() {
Copy link

Choose a reason for hiding this comment

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

I guess the place is wrong, static's seem to be below

@@ -37,7 +37,7 @@ export default class Web3 extends AbstractWeb3Module {
static modules: Modules;
static readonly givenProvider: provider | null;

utils: Utils;
static readonly utils: Utils;
Copy link

Choose a reason for hiding this comment

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

I guess this isn't needed since we have static function instead of property?

Copy link

@pknuth pknuth left a comment

Choose a reason for hiding this comment

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

  • Static utils at the end of file
  • Remove expendable property

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 this pull request may close these issues.

2 participants