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

web3.version.getNode() alternative in v1.0 using typescript #2514

Closed
oancius opened this issue Mar 15, 2019 · 8 comments
Closed

web3.version.getNode() alternative in v1.0 using typescript #2514

oancius opened this issue Mar 15, 2019 · 8 comments
Labels
Documentation Relates to project wiki or documentation

Comments

@oancius
Copy link

oancius commented Mar 15, 2019

Description

After updating from "web3": "0.20.3" to 1.0.0-beta34 i can't find anymore a method to get the type of the node that i am connected to

Expected behavior

Calling `await web3.version.getNode()` should return info about the node that you are connected to.

Actual behavior

The method can't be found anymore

Error Logs

Gists

Versions

  • web3.js: 1.0.0-beta34
  • nodejs: v10.15.3
  • browser: not related
  • ethereum node: not related
@nivida nivida added the Documentation Relates to project wiki or documentation label Mar 15, 2019
@nivida
Copy link
Contributor

nivida commented Mar 15, 2019

The method exists on the web3.eth module with the name getNodeInfo. I will update the documentation asap.

@oancius
Copy link
Author

oancius commented Mar 15, 2019

Thank you for the fast answer! Should i close the issue or it will be closed when the docs will be updated?

@oancius
Copy link
Author

oancius commented Mar 15, 2019

@nivida oh well... the method it's not in web3.eth, at least not in the @types for web3 (1.0.18)

i will attach a screenshot with what is available in index.d.ts for web3.eth
image

@ghost
Copy link

ghost commented Mar 19, 2019

web3.eth.getNodeInfo() will do the job

example)

async function detectNode() {
  var nodeInfo = await web3.eth.getNodeInfo();
  if (nodeInfo.split('/')[0].toLowerCase().includes('parity')) {
    console.log("Web3 has detected parity node configuration");
    web3explorer(web3);
  }
  console.log("Node version = " + nodeInfo); // logs `Node version = Parity-Ethereum//v2.4.0-beta-c7d8ee1-20190227/x86_64-linux-gnu/rustc1.32.0`
}
detectNode();

@oancius
Copy link
Author

oancius commented Mar 19, 2019

@btenterprise2020 i fully agree with you, but this can't be done in typescript because the the function wasn't added to the types file

@oancius oancius changed the title web3.version.getNode() alternative in v1.0 web3.version.getNode() alternative in v1.0 using typescript Mar 19, 2019
@nivida
Copy link
Contributor

nivida commented Mar 20, 2019

@oancius I'll close this issue after I've updated the documentation and the types.

@oancius
Copy link
Author

oancius commented Mar 20, 2019

Thank you very much!

@oancius
Copy link
Author

oancius commented Apr 5, 2019

i guess a new verision of typings will be also published on https://www.npmjs.com/package/@types/web3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Relates to project wiki or documentation
Projects
None yet
Development

No branches or pull requests

2 participants