Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Conversation

@Spacesai1or
Copy link
Contributor

Description

Fix default value for fromBlock option for logs subscriptions (defaults to latest)

Fixes #3882

I did test that that options here looks like {fromBlock: 'latest'} when logs subscription is initialized via:

var subscription = web3.eth.subscribe('logs', 
    {fromBlock: `latest` }, // Or a specific block number 
    function(error, result){ ... }

Type of change

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

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 new warnings.
  • Any dependent changes have been merged and published in downstream modules.
  • 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.
  • I have checked the Deploy Preview and it looks correct.
  • I have updated the CHANGELOG.md file in the root folder.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 510320721

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 17 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.04%) to 76.269%

Files with Coverage Reduction New Missed Lines %
packages/web3-core-helpers/src/formatters.js 1 82.27%
packages/web3-core-helpers/lib/formatters.js 16 81.27%
Totals Coverage Status
Change from base Build 504724575: 0.04%
Covered Lines: 3171
Relevant Lines: 3943

💛 - Coveralls

Copy link
Contributor

@GregTheGreek GregTheGreek left a comment

Choose a reason for hiding this comment

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

can you update the documentation to acknowledge a default :)

Copy link
Contributor

@frankiebee frankiebee left a comment

Choose a reason for hiding this comment

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

update docs

Copy link
Contributor

@GregTheGreek GregTheGreek left a comment

Choose a reason for hiding this comment

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

🍻

@Spacesai1or Spacesai1or dismissed frankiebee’s stale review January 25, 2021 23:17

She helped me come up with the docs update

@Spacesai1or Spacesai1or merged commit f91cf99 into 1.x Jan 25, 2021
@Spacesai1or Spacesai1or deleted the wyatt/3882-log-subscription branch January 25, 2021 23:18
@Spacesai1or Spacesai1or mentioned this pull request Jan 26, 2021
lingyun1133 added a commit to lingyun1133/web3.js that referenced this pull request Feb 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Subscribe logs error: Cannot read property 'fromBlock' of undefined

5 participants