Class: Lisk::API
Overview
Helper functions to wrap raw legacy APIs into meaningul methods.
Instance Attribute Summary
Attributes inherited from Legacy
Instance Method Summary collapse
-
#get_available_supply ⇒ Object
Get the available supply.
-
#get_banned_peers ⇒ Object
Get an array of all banned peers.
-
#get_best_block ⇒ Object
Get the height of the local best known block.
-
#get_block(id) ⇒ Object
Get the number of remaining local sync blocks.
-
#get_block_health ⇒ Object
Get block ping, returns true if block received in 120 seconds.
-
#get_block_reward ⇒ Object
Get the current block reward.
-
#get_broadhash ⇒ Object
Get the broad hash.
-
#get_chain_best_block ⇒ Object
Get the global best block in the network.
-
#get_connected_peers ⇒ Object
Get an array of all connected peers.
-
#get_disconnected_peers ⇒ Object
Get an array of all disconnected peers.
-
#get_epoch ⇒ Object
Get the current epoch date.
-
#get_fee_dapp ⇒ Object
Get fees for dapps registration.
-
#get_fee_delegate ⇒ Object
Get fees for delegate registration.
-
#get_fee_multisignature ⇒ Object
Get fees for multisignature registration.
-
#get_fee_secondsignature ⇒ Object
Get fees for second signatures.
-
#get_fee_send ⇒ Object
Get fees for sending transactions.
-
#get_fee_vote ⇒ Object
Get fees for voting.
-
#get_milestone ⇒ Object
Get the current milestone.
-
#get_nethash ⇒ Object
Get the net hash.
-
#get_peer_count ⇒ Object
Get the number of all known peers.
-
#get_peers ⇒ Object
Get an array of all known peers.
-
#get_remaining_blocks ⇒ Object
Get the number of remaining local sync blocks.
-
#get_version ⇒ Object
Get the Lisk node version string.
-
#get_version_build ⇒ Object
Get the Lisk node version build date.
-
#get_version_commit ⇒ Object
Get the Lisk node version commit.
-
#is_chain_loaded? ⇒ Boolean
Returns true if chain is loaded.
-
#is_syncing? ⇒ Boolean
Returns true if chain is syncing.
-
#method_missing(name, *args, &block) ⇒ Object
Handles unimplemented methods.
Methods inherited from Legacy
#accounts, #accounts_delegates, #accounts_delegates_get_by_address, #accounts_delegates_put, #accounts_generate_public_key, #accounts_get_balance, #accounts_get_public_key, #accounts_open, #blocks, #blocks_get_by_id, #blocks_get_fee, #blocks_get_fees, #blocks_get_height, #blocks_get_milestone, #blocks_get_nethash, #blocks_get_reward, #blocks_get_status, #blocks_get_supply, #dapps, #dapps_categories, #dapps_get_by_id, #dapps_install, #dapps_installed, #dapps_installed_ids, #dapps_installing, #dapps_launch, #dapps_launched, #dapps_put, #dapps_search, #dapps_stop, #dapps_uninstall, #dapps_uninstalling, #delegates, #delegates_count, #delegates_forging_disable, #delegates_forging_enable, #delegates_forging_get_forged_by_account, #delegates_get_by_key, #delegates_get_by_name, #delegates_get_next_forgers, #delegates_put, #delegates_search, #delegates_voters, #initialize, #loader_status, #loader_status_ping, #loader_status_sync, #multisignatures_accounts, #multisignatures_pending, #multisignatures_put, #multisignatures_sign, #peers, #peers_get, #peers_version, #signatures_fee, #signatures_put, #transactions, #transactions_get_by_id, #transactions_put, #transactions_queued, #transactions_queued_get_by_id, #transactions_unconfirmed, #transactions_unconfirmed_get_by_id
Constructor Details
This class inherits a constructor from Lisk::Legacy
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
Handles unimplemented methods
260 261 262 |
# File 'lib/lisk/api.rb', line 260 def method_missing name, *args, &block todo "#{self}::#{name} METHOD MISSING" end |
Instance Method Details
#get_available_supply ⇒ Object
Get the available supply.
157 158 159 160 161 162 163 164 |
# File 'lib/lisk/api.rb', line 157 def get_available_supply blocks = self.blocks_get_supply if blocks["success"] return blocks["supply"] else return nil end end |
#get_banned_peers ⇒ Object
Get an array of all banned peers.
254 255 256 257 |
# File 'lib/lisk/api.rb', line 254 def get_banned_peers filter_by_state = { :state => 0 } banned = self.peers filter_by_state end |
#get_best_block ⇒ Object
Get the height of the local best known block.
60 61 62 63 64 65 66 67 |
# 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(id) ⇒ Object
Get the number of remaining local sync blocks.
80 81 82 83 84 85 86 87 |
# File 'lib/lisk/api.rb', line 80 def get_block id block = self.blocks_get_by_id id if block["success"] return block["block"] else return nil end end |
#get_block_health ⇒ Object
Get block ping, returns true if block received in 120 seconds.
90 91 92 93 |
# File 'lib/lisk/api.rb', line 90 def get_block_health healthy = self.loader_status_ping return healthy["success"] end |
#get_block_reward ⇒ Object
Get the current block reward.
147 148 149 150 151 152 153 154 |
# File 'lib/lisk/api.rb', line 147 def get_block_reward blocks = self.blocks_get_reward if blocks["success"] return blocks["reward"] else return nil end end |
#get_broadhash ⇒ Object
Get the broad hash.
106 107 108 109 110 111 112 113 |
# File 'lib/lisk/api.rb', line 106 def get_broadhash blocks = self.blocks_get_status if blocks["success"] return blocks["broadhash"] else return nil end end |
#get_chain_best_block ⇒ Object
Get the global best block in the network.
96 97 98 99 100 101 102 103 |
# File 'lib/lisk/api.rb', line 96 def get_chain_best_block blocks = self.blocks_get_height if blocks["success"] return blocks["height"] else return nil end end |
#get_connected_peers ⇒ Object
Get an array of all connected peers.
242 243 244 245 |
# File 'lib/lisk/api.rb', line 242 def get_connected_peers filter_by_state = { :state => 2 } connected = self.peers filter_by_state end |
#get_disconnected_peers ⇒ Object
Get an array of all disconnected peers.
248 249 250 251 |
# File 'lib/lisk/api.rb', line 248 def get_disconnected_peers filter_by_state = { :state => 1 } disconnected = self.peers filter_by_state end |
#get_epoch ⇒ Object
Get the current epoch date.
126 127 128 129 130 131 132 133 134 |
# File 'lib/lisk/api.rb', line 126 def get_epoch blocks = self.blocks_get_status if blocks["success"] epoch = Time.parse blocks["epoch"] return epoch else return nil end end |
#get_fee_dapp ⇒ Object
Get fees for dapps registration
217 218 219 220 221 222 223 224 |
# File 'lib/lisk/api.rb', line 217 def get_fee_dapp fee = self.blocks_get_fees if fee["success"] return fee["fees"]["dapp"] else return nil end end |
#get_fee_delegate ⇒ Object
Get fees for delegate registration
197 198 199 200 201 202 203 204 |
# File 'lib/lisk/api.rb', line 197 def get_fee_delegate fee = self.blocks_get_fees if fee["success"] return fee["fees"]["delegate"] else return nil end end |
#get_fee_multisignature ⇒ Object
Get fees for multisignature registration
207 208 209 210 211 212 213 214 |
# File 'lib/lisk/api.rb', line 207 def get_fee_multisignature fee = self.blocks_get_fees if fee["success"] return fee["fees"]["multisignature"] else return nil end end |
#get_fee_secondsignature ⇒ Object
Get fees for second signatures
187 188 189 190 191 192 193 194 |
# File 'lib/lisk/api.rb', line 187 def get_fee_secondsignature fee = self.blocks_get_fees if fee["success"] return fee["fees"]["secondsignature"] else return nil end end |
#get_fee_send ⇒ Object
Get fees for sending transactions
167 168 169 170 171 172 173 174 |
# File 'lib/lisk/api.rb', line 167 def get_fee_send fee = self.blocks_get_fees if fee["success"] return fee["fees"]["send"] else return nil end end |
#get_fee_vote ⇒ Object
Get fees for voting
177 178 179 180 181 182 183 184 |
# File 'lib/lisk/api.rb', line 177 def get_fee_vote fee = self.blocks_get_fees if fee["success"] return fee["fees"]["vote"] else return nil end end |
#get_milestone ⇒ Object
Get the current milestone.
137 138 139 140 141 142 143 144 |
# File 'lib/lisk/api.rb', line 137 def get_milestone blocks = self.blocks_get_milestone if blocks["success"] return blocks["milestone"] else return nil end end |
#get_nethash ⇒ Object
Get the net hash.
116 117 118 119 120 121 122 123 |
# File 'lib/lisk/api.rb', line 116 def get_nethash blocks = self.blocks_get_nethash if blocks["success"] return blocks["nethash"] else return nil end end |
#get_peer_count ⇒ Object
Get the number of all known peers.
232 233 234 235 236 237 238 239 |
# File 'lib/lisk/api.rb', line 232 def get_peer_count peers = self.get_peers if not peers.nil? count = peers.count else count = 0 end end |
#get_peers ⇒ Object
Get an array of all known peers.
227 228 229 |
# File 'lib/lisk/api.rb', line 227 def get_peers peers = self.peers end |
#get_remaining_blocks ⇒ Object
Get the number of remaining local sync blocks.
70 71 72 73 74 75 76 77 |
# 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 ⇒ Object
Get the Lisk node version string.
30 31 32 33 34 35 36 37 |
# 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 ⇒ Object
Get the Lisk node version build date.
40 41 42 43 44 45 46 47 |
# 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 ⇒ Object
Get the Lisk node version commit.
50 51 52 53 54 55 56 57 |
# 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? ⇒ Boolean
Returns true if chain is loaded.
20 21 22 23 24 25 26 27 |
# 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? ⇒ Boolean
Returns true if chain is syncing.
10 11 12 13 14 15 16 17 |
# 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 |