mirror of
https://github.com/status-im/web3.js.git
synced 2025-02-24 03:58:13 +00:00
105 lines
1.4 KiB
ReStructuredText
105 lines
1.4 KiB
ReStructuredText
|
|
net.id
|
|
=========
|
|
|
|
.. code-block:: javascript
|
|
|
|
web3.eth.net.getId([callback])
|
|
web3.bzz.net.getId([callback])
|
|
web3.shh.net.getId([callback])
|
|
|
|
Gets the current network ID.
|
|
|
|
----------
|
|
Parameters
|
|
----------
|
|
|
|
none
|
|
|
|
-------
|
|
Returns
|
|
-------
|
|
|
|
``Promise`` returns ``Number``: The network ID.
|
|
|
|
-------
|
|
Example
|
|
-------
|
|
|
|
.. code-block:: javascript
|
|
|
|
web3.eth.getId()
|
|
.then(console.log);
|
|
> 1
|
|
|
|
------------------------------------------------------------------------------
|
|
|
|
|
|
net.isListening
|
|
=========
|
|
|
|
.. code-block:: javascript
|
|
|
|
web3.eth.net.isListening([callback])
|
|
web3.bzz.net.isListening([callback])
|
|
web3.shh.net.isListening([callback])
|
|
|
|
Checks if the node is listening for peers.
|
|
|
|
----------
|
|
Parameters
|
|
----------
|
|
|
|
none
|
|
|
|
-------
|
|
Returns
|
|
-------
|
|
|
|
``Promise`` returns ``Boolean``
|
|
|
|
-------
|
|
Example
|
|
-------
|
|
|
|
.. code-block:: javascript
|
|
|
|
web3.eth.isListening()
|
|
.then(console.log);
|
|
> true
|
|
|
|
------------------------------------------------------------------------------
|
|
|
|
net.getPeerCount
|
|
=========
|
|
|
|
.. code-block:: javascript
|
|
|
|
web3.eth.net.getPeerCount([callback])
|
|
web3.bzz.net.getPeerCount([callback])
|
|
web3.shh.net.getPeerCount([callback])
|
|
|
|
Get the number of peers connected to.
|
|
|
|
----------
|
|
Parameters
|
|
----------
|
|
|
|
none
|
|
|
|
-------
|
|
Returns
|
|
-------
|
|
|
|
``Promise`` returns ``Number``
|
|
|
|
-------
|
|
Example
|
|
-------
|
|
|
|
.. code-block:: javascript
|
|
|
|
web3.eth.getPeerCount()
|
|
.then(console.log);
|
|
> 25
|