class Lisk::API
Helper functions to wrap raw legacy APIs into meaningul methods.
Public Instance Methods
get_available_supply()
click to toggle source
Get the available supply.
# File lib/lisk/api.rb, line 141 def get_available_supply blocks = self.blocks_get_supply if blocks["success"] return blocks["supply"] else return nil end end
get_banned_peers()
click to toggle source
Get an array of all banned peers.
# File lib/lisk/api.rb, line 182 def get_banned_peers filter_by_state = { :state => 0 } banned = self.peers filter_by_state end
get_best_block()
click to toggle source
Get the height of the local best known block.
# File lib/lisk/api.rb, line 60 def get_best_block synced = self.loader_status_sync if synced["success"] return synced["height"] else return nil end end
get_block_reward()
click to toggle source
Get the current block reward.
# File lib/lisk/api.rb, line 131 def get_block_reward blocks = self.blocks_get_reward if blocks["success"] return blocks["reward"] else return nil end end
get_broadhash()
click to toggle source
Get the broad hash.
# File lib/lisk/api.rb, line 90 def get_broadhash blocks = self.blocks_get_status if blocks["success"] return blocks["broadhash"] else return nil end end
get_chain_best_block()
click to toggle source
Get the global best block in the network.
# File lib/lisk/api.rb, line 80 def get_chain_best_block blocks = self.blocks_get_height if blocks["success"] return blocks["height"] else return nil end end
get_connected_peers()
click to toggle source
Get an array of all connected peers.
# File lib/lisk/api.rb, line 170 def get_connected_peers filter_by_state = { :state => 2 } connected = self.peers filter_by_state end
get_disconnected_peers()
click to toggle source
Get an array of all disconnected peers.
# File lib/lisk/api.rb, line 176 def get_disconnected_peers filter_by_state = { :state => 1 } disconnected = self.peers filter_by_state end
get_epoch()
click to toggle source
Get the current epoch date.
# File lib/lisk/api.rb, line 110 def get_epoch blocks = self.blocks_get_status if blocks["success"] epoch = Time.parse blocks["epoch"] return epoch else return nil end end
get_milestone()
click to toggle source
Get the current milestone.
# File lib/lisk/api.rb, line 121 def get_milestone blocks = self.blocks_get_milestone if blocks["success"] return blocks["milestone"] else return nil end end
get_nethash()
click to toggle source
Get the net hash.
# File lib/lisk/api.rb, line 100 def get_nethash blocks = self.blocks_get_nethash if blocks["success"] return blocks["nethash"] else return nil end end
get_peer_count()
click to toggle source
Get the number of all known peers.
# File lib/lisk/api.rb, line 160 def get_peer_count peers = self.get_peers if not peers.nil? count = peers.count else count = 0 end end
get_peers()
click to toggle source
Get an array of all known peers.
# File lib/lisk/api.rb, line 155 def get_peers peers = self.peers end
get_remaining_blocks()
click to toggle source
Get the number of remaining local sync blocks.
# File lib/lisk/api.rb, line 70 def get_remaining_blocks synced = self.loader_status_sync if synced["success"] return synced["blocks"] else return nil end end
get_version()
click to toggle source
Get the Lisk node version string.
# File lib/lisk/api.rb, line 30 def get_version version = self.peers_version if version["success"] return version["version"] else return nil end end
get_version_build()
click to toggle source
Get the Lisk node version build date.
# File lib/lisk/api.rb, line 40 def get_version_build version = self.peers_version if version["success"] return version["build"] else return nil end end
get_version_commit()
click to toggle source
Get the Lisk node version commit.
# File lib/lisk/api.rb, line 50 def get_version_commit version = self.peers_version if version["success"] return version["commit"] else return nil end end
is_chain_loaded?()
click to toggle source
Returns true if chain is loaded.
# File lib/lisk/api.rb, line 20 def is_chain_loaded? loaded = self.loader_status if loaded["success"] return loaded["loaded"] else return nil end end
is_syncing?()
click to toggle source
Returns true if chain is syncing.
# File lib/lisk/api.rb, line 10 def is_syncing? synced = self.loader_status_sync if synced["success"] return synced["syncing"] else return nil end end
method_missing(name, *args, &block)
click to toggle source
Handles unimplemented methods
# File lib/lisk/api.rb, line 188 def method_missing name, *args, &block todo "#{self}::#{name} METHOD MISSING" end