caver.klay.net
A JavaScript wrapper to Klaytn APIs around the namespace 'net'.
The caver-klay-net
package allows you to interact with the Klaytn nodes' network properties.
getId
Gets the current network ID.
Parameters
Name | Type | Description |
---|---|---|
callback | Function | (optional) Optional callback, returns an error object as the first parameter and the result as the second. |
Return Value
Promise
returns Number
- The network ID.
Example
isListening
Checks if the node is listening for peers.
Parameters
Name | Type | Description |
---|---|---|
callback | Function | (optional) Optional callback, returns an error object as the first parameter and the result as the second. |
Return Value
Promise
returns Boolean
- true
if the node is listening for peers, false
otherwise.
Example
getPeerCount
Gets the number of peers connected to.
Parameters
Name | Type | Description |
---|---|---|
callback | Function | (optional) Optional callback, returns an error object as the first parameter and the result as the second. |
Return Value
Promise
returns Number
- The number of peers connected to.
Example
peerCountByType
Returns the number of connected nodes by type and the total number of connected nodes with key/value pairs.
Parameters
Name | Type | Description |
---|---|---|
callback | Function | (optional) Optional callback, returns an error object as the first parameter and the result as the second. |
Return Value
Promise
returns Object
- The number of connected peers by type as well as the total number of connected peers.
Example
Last updated