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

Wrong network ID and network type #2239

Closed
0x31 opened this issue Jan 28, 2019 · 0 comments · Fixed by #2242
Closed

Wrong network ID and network type #2239

0x31 opened this issue Jan 28, 2019 · 0 comments · Fixed by #2242
Labels
Bug Addressing a bug

Comments

@0x31
Copy link

0x31 commented Jan 28, 2019

Expected behavior

web3.eth.net.getId() should call net_version and return the current network id.

https://github.com/ethereum/web3.js/blob/1d9f6c0889c7f551b4ec1041cece0d50bc3ff2c8/packages/web3-net/src/index.js#L38-L43

Actual behavior

From 1.0.0-beta.38 onwards, web3.eth.net.getId calls eth_protocolVersion and returns the current ethereum protocol version.

https://github.com/ethereum/web3.js/blob/10face700362d124bc877ba6ea1390bde8364447/packages/web3-core-method/src/methods/network/VersionMethod.js#L25-L34

Steps to reproduce the behavior

> const Web3 = require("web3")
> let web3 = new Web3("https://mainnet.infura.io")
> web3.eth.net.getId().then(console.log)
63 // should be 1
> web3.eth.net.getNetworkType().then(console.log)
"private" // should be "main"

Versions

web3.js 1.0.0-beta.38 and 1.0.0-beta.39

@nivida nivida added the Bug Addressing a bug label Jan 28, 2019
@nivida nivida mentioned this issue Jan 28, 2019
12 tasks
@nivida nivida added the In Progress Currently being worked on label Jan 28, 2019
@nivida nivida removed the In Progress Currently being worked on label Jan 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Addressing a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants