Lisk Elements API Client: Node Resource

This is a resource for interacting with the node endpoint provided by the Lisk public API. Each of the following methods can be accessed via the node property of an APIClient instance.

getConstants

This returns all current constants data on the system. For example, the Lisk epoch time and version.

Syntax

getConstants([options])

Parameters

options: Please see the options in the following link: Core API documentation.

Return value

Promise: Resolves to an API response object.

Examples

client.node.getConstants()
    .then(res => {
        console.log(res.data);
    })

getStatus

This returns all current status data of the node. For example, the height and broadhash.

Syntax

getStatus([options])

Parameters

options: Please see the options in the following link: Core API documentation.

Return value

Promise: Resolves to an API response object.

Examples

client.node.getStatus()
    .then(res => {
        console.log(res.data);
    })

getForgingStatus

Please take note: This is a private endpoint ONLY authorized to whitelisted IPs.

This responds with the forging status of a delegate on a node.

Syntax

getForgingStatus([options])

Parameters

options: Please see the options in the following link: Core API documentation.

Return value

Promise: Resolves to an API response object.

Examples

client.node.getForgingStatus()
    .then(res => {
        console.log(res.data);
    })

updateForgingStatus

Please take note: This is a private endpoint ONLY authorized to whitelisted IPs.

After inputting the correct password and publicKey, forging will be enabled or disabled for the delegate of this particular node. The password can be generated locally by encrypting your passphrase, either by using Lisk Commander or with Lisk Elements.

Syntax

updateForgingStatus([options])

Parameters

options: Please see the options in the following link: Core API documentation.

Return value

Promise: Resolves to an API response object.

Examples

client.node.updateForgingStatus({
    forging: true,
    password: 'happy tree friends',
    publicKey: '968ba2fa993ea9dc27ed740da0daf49eddd740dbd7cb1cb4fc5db3a20baf341b',
})
    .then(res => {
        console.log(res.data);
    })

getTransactions

By specifying the state of the transactions, this outputs a list of unprocessed transactions matching this state.

Syntax

getTransactions(state, [options])

Parameters

state: One of unprocessed, unconfirmed or unsigned.

options: Please see the options in the following link: Core API documentation.

Return value

Promise: Resolves to an API response object.

Examples

client.node.getTransactions('unconfirmed')
    .then(res => {
        console.log(res.data);
    })