Skip to content

Node Pool

@aeternity/aepp-sdk/es/node-pool

NodePool module

Example

import NodePool from '@aeternity/aepp-sdk/es/node-pool'

exports.NodePool([options]) ⇒ Object

Node Pool Stamp This stamp allow you to make basic manipulation(add, remove, select) on list of nodes

Kind: Exported function
Returns: Object - NodePool instance
rtype: Stamp

Param Type Default Description
[options] Object {} Initializer object
[options.nodes] Array Array with Node instances

addNode(name, nodeInstance, select) ⇒ Void

Add Node

Kind: Exported function
rtype: (name: String, nodeInstance: Object, select: Boolean) => Void

Param Type Description
name String Node name
nodeInstance Object Node instance
select Boolean Select this node as current

Example

nodePool.addNode('testNode', awaitNode({ url, internalUrl }), true) // add and select new node with name 'testNode'

selectNode(name) ⇒ Void

Select Node

Kind: Exported function
rtype: (name: String) => Void

Param Type Description
name String Node name

Example

nodePool.selectNode('testNode')

getNetworkId() ⇒ String

Get NetworkId of current Node

Kind: Exported function
rtype: () => String Example

nodePool.getNetworkId()

isNodeConnected() ⇒ Boolean

Check if you have selected node

Kind: Exported function
rtype: () => Boolean Example

nodePool.isNodeConnected()

getNodeInfo() ⇒ Object

Get information about node

Kind: Exported function
rtype: () => Object Example

nodePool.getNodeInfo() // { name, version, networkId, protocol, ... }

getNodesInPool() ⇒ Array.<Object>

Get array of available nodes

Kind: Exported function
rtype: () => Object[] Example

nodePool.getNodesInPool()