Lisk APIs Wrapper
Introduction ¶
This library aims to make LISK APIs easy/smart to use.
Note: Lisk is a blockchain application platform and crypto-currency, which offers an all round solution for Node.js and JavaScript developers to deploy their own blockchain applications.
The library smart handle all the Lisk APIs call with options like sorting and pagination.
The dApps calls are not included at the moment since they are under strong development.
Installation
The library is available through the
-
npm package manager
$ npm install liskapi
Configuration
To performs the requests the library can use a local or remote Lisk node:
-
Require the lib using a local node
const lisk = require ('liskapi')();
-
Require the lib using a remote node
const params = { host: 'othernode.com', port: 8000, ssl: true }; const lisk = require ('liskapi')(params);
Accounts ¶
API calls related to Account functionality.
openAccount
Create a Lisk account.
-
Parameters
- secret: “some secret sentence” (required, string)
-
Usage
lisk.openAccount () .data ( { secret: 'some secret' } ) .call () .then ((res) => { console.log (`Post for opening an account\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error opening an account\n', err); });
-
Response 200 (application/json)
{ "success": true, "account": { "address": "Address of account. String", "unconfirmedBalance": "Unconfirmed balance of account. String", "balance": "Balance of account. String", "publicKey": "Public key of account. Hex", "unconfirmedSignature": "If account enabled second signature, but it's still not confirmed. Integer", "secondSignature": "If account enabled second signature. Integer", "secondPublicKey": "Second public key of account. Hex", "multisignatures": "Multisignatures. Array" "u_multisignatures": "uMultisignatures. Array" } }
getBalance
Request the balance of an account by address.
-
Parameters
- address: “some address” (string)
-
Usage
lisk.getBalance ( { address: 'address' } ) .call () .then ((res) => { console.log (`Get balance\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error in getting balance\n', err); });
-
Response 200 (application/json)
{ "success": true, "balance": "Balance of account", "unconfirmedBalance": "Unconfirmed balance of account" }
getPublicKey
Get the public key of an account.
-
Parameters
- address: “some address” (string)
-
Usage
lisk.getPublicKey ( { address: 'address' } ) .call () .then ((res) => { console.log (`Get public key\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error in getting public key\n', err); });
-
Response 200 (application/json)
{ "success": true, "publicKey": "Public key of account. Hex" }
generatePublicKey
Returns the public key of the provided secret key.
-
Parameters
- secret: “some secret sentence” (required, string)
-
Usage
lisk.generatePublicKey () .data ( { secret: 'some secret' } ) .call () .then ((res) => { console.log (`Post for generating a publicKey\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error generating a publicKey\n', err); });
-
Response 200 (application/json)
{ "success": true, "publicKey": "Public key of account. Hex" }
getAccount
Returns account information of an address.
-
Parameters
- address: “some address” (string)
-
Usage
lisk.getAccount ( { address: 'some address' } ) .call () .then ((res) => { console.log (`Getting an account\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error getting an account\n', err); });
-
Response 200 (application/json)
{ "success": true, "account": { "address": "Address of account. String", "unconfirmedBalance": "Unconfirmed balance of account. Integer", "balance": "Balance of account. Integer", "publicKey": "Public key of account. Hex", "unconfirmedSignature": "If account enabled second signature, but it's still not confirmed. Boolean: true or false", "secondSignature": "If account enabled second signature. Boolean: true or false", "multisignatures": "Multisignatures. Array" "u_multisignatures": "uMultisignatures. Array" } }
getDelegatesByAddress
Returns delegate accounts by address.
-
Parameters
- address: “some address” (string)
-
Usage
lisk.getDelegatesByAddress ( { address: 'some address' } ) .call () .then ((res) => { console.log (`Get delegates by address\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error in getting delegates by address\n', err); });
-
Response 200 (application/json)
{ "success": true, "delegates": [ "array of delegates object. (see below the delegate object response)" ] }
voteDelegates
Add or remove votes to a delegate by address.
-
Parameters
-
secret: “some secret” (required, string)
-
publicKey “address public key” (required, string)
-
secondSecret “second address secret” (string)
-
“delegates” : “Array of string in the following format: [”+DelegatePublicKey"] OR ["-DelegatePublicKey"]. Use + to UPvote, - to DOWNvote" (required, array)
-
-
Usage
lisk.voteDelegates () .data ( { secret: 'some secret', publicKey: 'some public key', delegates: ["+AddVoteToSomePublicKey", "-AddVoteToSomePublicKey"] } ) .call () .then ((res) => { console.log (`Put for voting delegates\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error voting delegates\n', err); });
-
Response 200 (application/json)
{ "success": true, "transaction": { "type": "Type of transaction. Integer", "amount": "Amount. Integer", "senderPublicKey": "Sender public key. String", "requesterPublicKey": "Requester public key. String", "timestamp": "Timestamp. Integer", "asset":{ "votes":[ "+VotedPublickKey", "-RemovedVotePublicKey" ] }, "recipientId": "Recipient address. String", "signature": "Signature. String", "signSignature": "Sign signature. String", "id": "Tx ID. String", "fee": "Fee. Integer", "senderId": "Sender address. String", "relays": "Propagation. Integer", "receivedAt": "Time. String" } }
Loader ¶
Provides the synchronization and loading information of a client. These API calls will only work if the client is syncing or loading.
getLoadingStatus
Returns the status of the blockchain.
-
Usage
lisk.getLoadingStatus ().call () .then ((res) => { console.log (`Get loading status\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error', err); });
-
Response 200 (application/json)
{ "success": true, "loaded": "Is blockchain loaded? Boolean: true or false", "now": "Last block loaded during loading time. Integer", "blocksCount": "Total blocks count in blockchain at loading time. Integer" }
getSyncStatus
Get the synchronization status of the client.
-
Usage
lisk.getSyncStatus ().call () .then ((res) => { console.log (`Get sync status data\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error', err); });
-
Response 200 (application/json)
{ "success": true, "syncing": "Is wallet is syncing with another peers? Boolean: true or false", "blocks": "Number of blocks remaining to sync. Integer", "height": "Total blocks in blockchain. Integer", "broadhash": "Broadhash. String", "consensus": "Consensus. Integer" }
getBlockReceiptStatus
Get the status of last received block. Returns true if block was received in the past 120 seconds.
-
Usage
lisk.getBlockReceiptStatus ().call () .then ((res) => { console.log (`Get receipt status data\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error', err); });
-
Response 200 (application/json)
{ "success": true }
Transactions ¶
API calls related to transactions.
getTransactions
List of transactions matched by provided parameters.
-
Parameters
- blockId: “some block id” (string)
- senderId: “sender address” (string)
- recipientId: “recipient of transaction” (string)
- limit: “limit of transaction to send in response” (default 20, number)
- offset: “offset to load” (number)
-
Options
- pagination (limit and offset)
- sorting
-
Usage
lisk.getTransactions ( { blockId: 'some block id' } ) .paginate ( { limit: 100, offset: 0 } ) .call () .then ((res) => { console.log (`Get TXs data with pagination options\n ${JSON.stringify (res)`); }) .catch ((err) => { console.log ('Got an error getting TXs', err); });
-
Response 200 (application/json)
{ "success": true, "transactions": [ "list of transactions objects (see below the transaction object response)" ] }
sendTransaction
Send transaction to broadcast network.
-
Parameters
- secret: “some secret sentence” (required, string)
- amount: “amount of tx” (required, number)
- recipientId: “recipient of transaction” (required, string)
- publicKey: “public key of sender account” (required, string)
- secondSecret: “required if user uses second signature” (string)
-
Usage
lisk.sendTransaction () .data ( { secret: 'some secret', amount: 20, recipientId: 'some address', publicKey: 'some publicKey' } ) .call () .then ((res) => { console.log (`Put for sending LSK\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error sending LSK\n', err); });
-
Response 200 (application/json)
{ "success": true, "transactionId": "id of added transaction" }
getTransaction
Get transaction that matches the provided id.
-
Parameters
- id: “tx id” (string)
-
Usage
lisk.getTransaction ( { id: 'some tx id' } ) .call () .then ((res) => { console.log (`Get tx data\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error in getting tx data\n', err); });
-
Response 200 (application/json)
{ "success": true, "transaction": { "id": "Id of transaction. String", "height": "Tx blockchain height. Integer", "blockId" "Tx blockId. String", "type": "Type of transaction. Integer", "timestamp": "Timestamp of transaction. Integer", "senderPublicKey": "Sender public key of transaction. Hex", "senderId": "Address of transaction sender. String", "recipientId": "Recipient id of transaction. String", "amount": "Amount. Integer", "fee": "Fee. Integer", "signature": "Signature. Hex", "signatures": "Signatures. Array", "confirmations": "Number of confirmations. Integer", "asset": "Resources. Object" } }
getUnconfirmedTransaction
Get unconfirmed transaction that matches the provided id.
-
Parameters
+ id: "unConfirmedTx id" (string)
-
Usage
lisk.getUnconfirmedTransaction ( { id: 'some unConfirmedTx' } ) .call () .then ((res) => { console.log (`Get unConfirmedTx data\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error in getting unConfirmedTx data\n', err); });
-
Response 200 (application/json)
{ "success": true, "transaction": { "type": "Type of transaction. Integer", "amount": "Amount. Integer", "senderPublicKey": "Sender public key of transaction. Hex", "timestamp": "Timestamp of transaction. Integer", "asset": "Resources. Object" "recipientId": "Recipient id of transaction. String", "signature": "Signature. Hex", "id": "Id of transaction. String", "fee": "Fee. Integer", "senderId": "Address of transaction sender. String", "relays": "Propagation. Integer", "receivedAt": "Timestamp. String" } }
getUnconfirmedTransactions
Gets a list of unconfirmed transactions.
-
Usage
lisk.getUnconfirmedTransactions () .call () .then ((res) => { console.log (`Get unConfirmedTxS data\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error in getting unConfirmedTxS data\n', err); });
-
Response 200 (application/json)
{ "success": true, "transactions": [list of transaction objects] }
getQueuedTransactions
Gets a list of queued transactions.
-
Usage
lisk.getQueuedTransactions () .call () .then ((res) => { console.log (`Get queuedTxS data\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error in getting queuedTxS data\n', err); });
-
Response 200 (application/json)
{ "success": true, "transactions": [list of transaction objects] }
getQueuedTransaction
Get queued transaction that matches the provided id.
-
Parameters
+ id: "queuedTx id" (string)
-
Usage
lisk.getQueuedTransaction () .call () .then ((res) => { console.log (`Get queuedTx data\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error in getting queuedTx data\n', err); });
-
Response 200 (application/json)
{ "success": true, "transaction": { "id": "Id of transaction. String", "type": "Type of transaction. Integer", "subtype": "Subtype of transaction. Integer", "timestamp": "Timestamp of transaction. Integer", "senderPublicKey": "Sender public key of transaction. Hex", "senderId": "Address of transaction sender. String", "recipientId": "Recipient id of transaction. String", "amount": "Amount. Integer", "fee": "Fee. Integer", "signature": "Signature. Hex", "signSignature": "Second signature. Hex", "confirmations": "Number of confirmations. Integer" } }
Peers ¶
Peers API.
getPeersList
Gets list of peers from provided filter parameters.
-
Parameters
+ state: "state of peer. 1 - disconnected. 2 - connected. 0 - banned." (number) + os: "peer operating system" (string) + version: "peer version" (string)
-
Options
- pagination (limit and offset)
- sorting
-
Usage
lisk.getPeersList ( { state: 1 } ) .paginate ( { limit: 10, offset: 5 } ) .call () .then ((res) => { console.log (`Get peers of Liskword\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error in getting peers\n', err); });
-
Response 200 (application/json)
{ "success": true, "peers": [ "list of peers as objects (see below the peer object response)" ] }
getPeer
Gets peer by IP address and port.
-
Parameters
+ ip: "host IP" (string) + port: "host port used for the Lisk application" (number)
-
Usage
lisk.getPeer ( { ip: 'IP', port: port } ) .call () .then ((res) => { console.log (`Get peer by IP\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error in getting peer\n', err); });
-
Response 200 (application/json)
{ "success": true, "peer": { "ip": "Requested ip. String", "port": "Requested port. Integer", "state": "1 - disconnected. 2 - connected. 0 - banned. Integer", "os": "Operating system. String", "version": "Lisk client version. String", "broadhash": "Peer block propagation efficiency and reliability. String", "height": "Blockchain height. Integer" } }
getPeerVersion
Gets a list peer versions and build times.
-
Usage
lisk.getPeerVersion () .call () .then ((res) => { console.log (`Get peer version\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error in getting peer version\n', err); });
-
Response 200 (application/json)
{ "success": true, "version": "Version of Lisk. String", "build": "Time of build. String" }
Blocks ¶
Blocks management API.
getBlock
Gets block by provided id.
-
Parameters
+ id: "block id" (string)
-
Usage
lisk.getBlock ( { id: 'some block id' } ) .call () .then ((res) => { console.log (`Get block by id\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error in getting block by id\n', err); });
-
Response 200 (application/json)
{ "success": true, "block": { "id": "Id of block. String", "version": "Version of block. Integer", "timestamp": "Timestamp of block. Integer", "height": "Height of block. Integer", "previousBlock": "Previous block id. String", "numberOfTransactions": "Number of transactions. Integer", "totalAmount": "Total amount of block. Integer", "totalFee": "Total fee of block. Integer", "reward": "Reward block. Integer", "payloadLength": "Payload length of block. Integer", "payloadHash": "Payload hash of block. Integer", "generatorPublicKey": "Generator public key. Hex", "generatorId": "Generator id. String.", "blockSignature": "Block signature. Hex", "confirmations": "Block confirmations. Integer", "totalForged": "Total block forged. Integer" } }
getBlocks
Gets all blocks by provided filter(s).
-
Parameters
+ generatorPublicKey: "generator block id" (string) + height: "height of block" (number) + previousBlock: "previous block" (string) + totalAmount: "total block amount" (number) + totalFee: "total block fee" (number)
-
Options
- pagination (limit and offset)
- sorting
-
Usage
lisk.getBlocks () .paginate ( { limit: 2, offset: 0 } ) .sort ( { height: 'asc' } ) .call () .then ((res) => { console.log (`Get blocks sorted and paginated\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error in getting blocks sorted and paginated\n', err); });
-
Response 200 (application/json)
{ "success": true, "blocks": [ "array of blocks (see above the block object response)" ] }
getFee
Get transaction fee for sending “normal” transactions.
-
Usage
lisk.getFee () .call () .then ((res) => { console.log (`Get blockchain fee\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error in getting blockchain fee\n', err); });
-
Response 200 (application/json)
{ "success": true, "fee": "Fee. Integer" }
getFees
Get transaction fee for all types of transactions.
-
Usage
lisk.getFees () .call () .then ((res) => { console.log (`Get blockchain fees schedule\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error in getting blockchain fees schedule\n', err); });
-
Response 200 (application/json)
{ "success": true, "fees": { "send": "Send. Integer", "vote": "Vote. Integer", "secondsignature": "Second signature. Integer", "delegate": "Delegate. Integer", "multisignature": "Multisignature. Integer", "dapp": "dApp. Integer" } }
getReward
Gets the forging reward for blocks.
-
Usage
lisk.getReward () .call () .then ((res) => { console.log (`Get blockchain reward schedule\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error in getting blockchain reward schedule\n', err); });
-
Response 200 (application/json)
{ "success": true, "reward": "Reward. Integer" }
getSupply
Gets the total amount of Lisk in circulation.
-
Usage
lisk.getSupply () .call () .then ((res) => { console.log (`Get supply\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error in getting supply\n', err); });
-
Response 200 (application/json)
{ "success": true, "supply": "Supply. Integer" }
getHeight
Gets the blockchain height of the client.
-
Usage
lisk.getHeight () .call () .then ((res) => { console.log (`Get height\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error in getting height\n', err); });
-
Response 200 (application/json)
{ "success": true, "height": "Height of blockchain. Integer" }
getStatus
Gets status of height, fee, milestone, blockreward and supply.
-
Usage
lisk.getStatus () .call () .then ((res) => { console.log (`Get status\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error in getting status\n', err); });
-
Response 200 (application/json)
{ "success": true, "height": "Height. Integer", "fee": "Fee. Integer", "milestone": "Milestone. Integer", "reward": "Reward. Integer", "supply": "Supply. Integer" }
getNethash
Gets the nethash of the blockchain on a client.
-
Usage
lisk.getNethash () .call () .then ((res) => { console.log (`Get nethash\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error in getting nethash\n', err); });
-
Response 200 (application/json)
{ "success": true, "nethash": "Nethash of the Blockchain. String" }
getMilestone
Gets the milestone of the blockchain on a client.
-
Usage
lisk.getMilestone () .call () .then ((res) => { console.log (`Get milestone\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error in getting milestone\n', err); });
-
Response 200 (application/json)
{ "success": true, "milestone": "Milestone. Integer" }
Signatures ¶
Signature management API.
getSignatureFee
Gets the second signature status of an account.
-
Usage
lisk.getSignatureFee () .call () .then ((res) => { console.log (`Get signature fee\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error in getting signature fee\n', err); });
-
Response 200 (application/json)
{ "success" : true, "fee" : "Fee. Integer" }
addSecondSignature
Add a second signature to an account.
-
Parameters
-
secret: “some address” (required, string)
-
secondSecret “second address secret” (string)
-
publicKey “address public key” (string)
-
-
Usage
lisk.addSecondSignature () .data ( { secret: 'some secret', secondSecret: 'some second secret' } ) .call () .then ((res) => { console.log (`Put for adding second signature\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error adding second signature\n', err); });
-
Response 200 (application/json)
{ "success":true, "transaction": { "type": "Type of transaction. Integer", "amount": "Amount. Integer", "senderPublicKey": "Sender public key. String", "requesterPublicKey": "Requester public key. String", "timestamp": "Timestamp. Integer", "asset":{ "signature":{ "publicKey": "Public key. String" } }, "recipientId": "Recipient address. String", "signature": "Signature. String", "id": "Tx ID. String", "fee": "Fee Integer", "senderId": "Sender address. String", "relays": "Propagation. Integer", "receivedAt": "Time. String" } }
Delegates ¶
Delegates API.
createDelegate
Puts request to create a delegate.
-
Parameters
-
secret: “some address” (required, string)
-
secondSecret “second address secret” (string)
-
username “delegate username” (required, string)
-
-
Usage
lisk.createDelegate () .data ( { secret: 'some secret', username: 'someusername' } ) .call () .then ((res) => { console.log (`Put for registering a delegate\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error registering a delegate\n', err); });
-
Response 200 (application/json)
{ "success":true, "transaction": { "type": "Type of transaction. Integer", "amount": "Amount. Integer", "senderPublicKey": "Sender public key. String", "requesterPublicKey": "Requester public key. String", "timestamp": "Time. Integer", "asset":{ "delegate":{ "username": "Delegate username. String", "publicKey": "Delegate public key. String" } }, "recipientId": "Recipient address. String", "signature": "Signature. String", "signSignature": "Sign signature. String", "id": "Tx ID. String", "fee": "Fee. Integer", "senderId": "Sender address. String", "relays": "Propagation. Integer", "receivedAt": "Time. String" } }
getDelegatesList
Gets list of delegates by provided filter.
-
Options
- pagination (limit and offset)
- sorting
-
Usage
lisk.getDelegatesList () .paginate ( { limit: 2, offset: 0 } ) .sort ( { rate: 'desc' } ) .call () .then ((res) => { console.log (`Get delegate list sorted and paginated\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error in getting delegate list sorted and paginated\n', err); });
-
Response 200 (application/json)
{ "success": true, "delegates": "Delegates objects array (see below the delegate object response)" }
getDelegateByPublicKey
Gets delegate by public key.
-
Parameters
- publicKey “delegate public key” (string)
-
Usage
lisk.getDelegateByPublicKey ( { publicKey: 'some delegate public key' } ) .call () .then ((res) => { console.log (`Get delegate by publickey\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error in getting delegate by publickey\n', err); });
-
Response 200 (application/json)
{ "success": true, "delegate": { "username": "Username. String", "address": "Address. String", "publicKey": "Public key. String", "vote": "Total votes. Integer", "producedblocks": "Produced blocks. Integer", "missedblocks": "Missed blocks. Integer", "rate": "Ranking. Integer", "approval": "Approval percentage. Float", "productivity": "Productivity percentage. Float" } }
getDelegateByUsername
Gets delegate by username.
-
Parameters
- username “delegate username” (string)
-
Usage
lisk.getDelegateByUsername ( { username: 'some username' } ) .call () .then ((res) => { console.log (`Get delegate by username\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error in getting delegate by username\n', err); });
-
Response 200 (application/json)
{ "success": true, "delegate": { "username": "Username. String", "address": "Address. String", "publicKey": "Public key. String", "vote": "Total votes. Integer", "producedblocks": "Produced blocks. Integer", "missedblocks": "Missed blocks. Integer", "rate": "Ranking. Integer", "approval": "Approval percentage. Float", "productivity": "Productivity percentage. Float" } }
searchForDelegates
Search for Delegates by “fuzzy” username.
-
Options
- sorting
-
Usage
lisk.searchForDelegates ( { q: 'some username' } ) .sort ( { producedblocks: 'asc' } ) .call () .then ((res) => { console.log (`Get delegate by username\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error in getting delegate by username\n', err); });
-
Response 200 (application/json)
{ "success": true, "delegates": [ "array of delegates (see above the delegate object)" ] }
getDelegatesCount
Get total count of registered delegates.
-
Usage
lisk.getDelegatesCount () .call () .then ((res) => { console.log (`Get delegates count\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error in getting delegates count\n', err); });
-
Response 200 (application/json)
{ "success": true, "count": "Count. Integer" }
getVotesOfAccount
Get votes by account wallet address.
-
Parameters
- address “delegate address” (required, string)
-
Usage
lisk.getVotesOfAccount ( { address: 'some delegate address' } ) .call () .then ((res) => { console.log (`Get votes of account\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error in getting votes of account\n', err); });
-
Response 200 (application/json)
{ "success": true, "delegates": [ "array of of delegates object (see above delegate object response)" ] }
getVoters
Get voters of delegate.
-
Parameters
- publicKey “delegate publicKey” (required, string)
-
Usage
lisk.getVoters ( { publicKey: 'some public key' } ) .call () .then ((res) => { console.log (`Get voters of account\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error in getting voters of account\n', err); });
-
Response 200 (application/json)
{ "success": true, "accounts": [ { username: "Voter username. String", address: "Voter address. String", publicKey: "Voter public key. String", balance: "Voter balance. String" } ] }
enableForging
Enables forging for a delegate on the client node.
-
Parameters
- secret: “some secret sentence” (required, string)
-
Usage
lisk.enableForging () .data ( { secret: 'some secret' } ) .call () .then ((res) => { console.log (`Post for enable forging\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error disable forging\n', err); });
-
Response 200 (application/json)
{ "success": true, "address": "Address. String" }
disableForging
Disables forging for a delegate on the client node.
-
Parameters
- secret: “some secret sentence” (required, string)
-
Usage
lisk.disableForging () .data ( { secret: 'some secret' } ) .call () .then ((res) => { console.log (`Post for disable forging\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error disable forging\n', err); });
-
Response 200 (application/json)
{ "success": true, "address": "address" }
getForgedByAccount
Get amount of Lisk forged by an account.
-
Parameters
- generatorPublicKey: “delegate generator public key” (required, string)
-
Usage
lisk.getForgedByAccount ({ generatorPublicKey: 'delegate generator public key' }) .call () .then ((res) => { console.log (`Get forged by account\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error in getting forged by account\n', err); });
-
Response 200 (application/json)
{ "success": true, "sum": "Forged amount. Integer" }
getNextForger
Get next delegate lining up to forge.
-
Options
- pagination (limit)
-
Usage
lisk.getNextForger () .paginate ({ limit: 2}) .call () .then ((res) => { console.log (`Get next forger\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error in getting next\n', err); });
-
Response 200 (application/json)
{ "success": true, "currentBlock": "Current block based on height. Integer", "currentSlot": "Current slot based on time. Integer", "delegates": [ "array of publicKeys. Strings" ] }
Multi-signature ¶
Multi-signature API.
createMultiSignatureAccount
Create a multi-signature account.
-
Parameters
-
secret: “multisig secret” (required, string)
-
secondSecret: “second secret of the account” (optional, string)
-
lifetime “tx time to live” (required, string)
-
min “min signatures needed for valid tx” (string)
-
keysgroup “members public keys” (array of strings - “+key”)
-
-
Usage
lisk.createMultiSignatureAccount () .data ( { secret: 'account secret', lifetime: 24, min: 2, keysgroup: ["+key", "+key"] } ) .call () .then ((res) => { console.log (`Put for creating a multi-sig account\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error creating a multi-sig account\n', err); });
-
Response 200 (application/json)
{ "success": true, "transactionId": "Transaction id. String" }
getMultiSignatureAccounts
Gets a list of accounts that belong to a multi-signature account.
-
Parameters
- publicKey: “public key of the account that have already sign a createMultiSignatureAccount tx ID response” (string)
-
Usage
lisk.getMultiSignatureAccounts ( { publicKey: 'public key of the member' } ) .call () .then ((res) => { console.log (`Get multi-sig account\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error getting a multi-sig account\n', err); });
-
Response 200 (application/json)
{ "success": true, "accounts": "array of accounts" "accounts": [ { "address": "Multisig account. String", "balance": "Multisig account balance. String", "multisignatures": [ "Multisig public key member. String" ], "multimin": "Min N of sign for a valid tx. Integer", "multilifetime": "Lifetime. Integer", "multisigaccounts": [ { "address": "Multisig address member. String", "publicKey": "Multisig public key member. String", "balance": "Multisig balance member. String" } ] } ] }
signTransaction
Signs a transaction that is awaiting signature.
-
Parameters
-
secret: “member secret” (required, string)
-
secondSecret: “second secret of the account” (optional, string)
-
transactionId “a createMultiSignatureAccount tx ID response” (required, string)
-
-
Usage
lisk.signTransaction () .data ( { secret: 'account secret', transactionId: 'createMultiSignatureAccount tx ID response' } ) .call () .then ((res) => { console.log (`Post for signing a multi-sig creation txID\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error signing a multi-sig creation txID\n', err); });
-
Response 200 (application/json)
{ "success": true, "transactionId": "Transaction id. String" }
getPendingMultiSignatureTransactions
Returns a list of multi-signature transactions that waiting for signature by publicKey.
-
Parameters
- publicKey: “multisig account public key” (string)
-
Usage
lisk.getPendingMultiSignatureTransactions ( { publicKey: 'public key of the multisig account' } ) .call () .then ((res) => { console.log (`Get pending multi-sig account\n ${JSON.stringify (res)}`); }) .catch ((err) => { console.log ('Got an error getting a pending multi-sig account\n', err); });
-
Response 200 (application/json)
{ "success": true, "transactions": [ { "max": "Max. Integer", "min": "Min. Integer", "lifetime": "Lifetime. Integer", "signed": true, "transaction": { "type": "Type of transaction. Integer", "amount": "Amount. Integer", "senderPublicKey": "Sender public key of transaction. Hex", "requesterPublicKey": "Requester public key. String", "timestamp": "Timestamp. Integer", "asset": { "multisignature": { "min": "Min signatures needed for valid tx. Integer", "keysgroup": [ "+Multisig public key member. String" ], "lifetime": "Lifetime. Integer", } }, "recipientId": "Recipient address. String", "signature": "Signature. String", "signSignature": "Sign signature. String", "id": "Tx ID", "fee": "Fee. Integer", "senderId": "Sender address. String", "relays": "Propagation. Integer", "receivedAt": Time. String", "signatures": [ "array of signatures" ], "ready": false } } ] }