Module: Api

Extended by:
T::Sig
Included in:
Nimiq::Client
Defined in:
lib/api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#rpcObject

Returns the value of attribute rpc.



21
22
23
# File 'lib/api.rb', line 21

def rpc
  @rpc
end

Instance Method Details

#accountsObject



27
28
29
30
# File 'lib/api.rb', line 27

def accounts
  result = @rpc.request("accounts")
  return result
end

#block_numberObject



35
36
37
38
# File 'lib/api.rb', line 35

def block_number
  result = @rpc.request("blockNumber")
  return result
end

#consensusObject



43
44
45
46
# File 'lib/api.rb', line 43

def consensus
  result = @rpc.request("consensus")
  return result
end

#constant(name, value = nil) ⇒ Object



56
57
58
59
60
61
62
63
# File 'lib/api.rb', line 56

def constant(name, value = nil)
  if value
    result = @rpc.request("constant", name, value)
  else
    result = @rpc.request("constant", name)
  end
  return result
end

#create_accountObject



68
69
70
71
# File 'lib/api.rb', line 68

def 
  result = @rpc.request("createAccount")
  return result
end

#create_raw_transaction(transaction) ⇒ Object



78
79
80
81
# File 'lib/api.rb', line 78

def create_raw_transaction(transaction)
  result = @rpc.request("createRawTransaction", transaction)
  return result
end

#get_account(address) ⇒ Object



97
98
99
100
# File 'lib/api.rb', line 97

def (address)
  result = @rpc.request("getAccount", address)
  return result
end

#get_balance(address) ⇒ Object



106
107
108
109
# File 'lib/api.rb', line 106

def get_balance(address)
  result = @rpc.request("getBalance", address)
  return result
end

#get_block_by_hash(block_hash, full_transactions = nil) ⇒ Object



116
117
118
119
120
121
122
123
# File 'lib/api.rb', line 116

def get_block_by_hash(block_hash, full_transactions = nil)
  if full_transactions
    result = @rpc.request("getBlockByHash", block_hash, full_transactions)
  else
    result = @rpc.request("getBlockByHash", block_hash)
  end
  return result
end

#get_block_by_number(block_number, full_transactions = nil) ⇒ Object



130
131
132
133
134
135
136
137
# File 'lib/api.rb', line 130

def get_block_by_number(block_number, full_transactions = nil)
  if full_transactions
    result = @rpc.request("getBlockByNumber", block_number, full_transactions)
  else
    result = @rpc.request("getBlockByNumber", block_number)
  end
  return result
end

#get_block_template(address = nil, data_field = nil) ⇒ Object



145
146
147
148
# File 'lib/api.rb', line 145

def get_block_template(address = nil, data_field = nil)
  result = @rpc.request("getBlockTemplate")
  return result
end

#get_block_transaction_count_by_hash(block_hash) ⇒ Object



154
155
156
157
# File 'lib/api.rb', line 154

def get_block_transaction_count_by_hash(block_hash)
  result = @rpc.request("getBlockTransactionCountByHash", block_hash)
  return result
end

#get_block_transaction_count_by_number(block_number) ⇒ Object



163
164
165
166
# File 'lib/api.rb', line 163

def get_block_transaction_count_by_number(block_number)
  result = @rpc.request("getBlockTransactionCountByNumber", block_number)
  return result
end

#get_raw_transaction_info(signed_transaction) ⇒ Object



88
89
90
91
# File 'lib/api.rb', line 88

def get_raw_transaction_info(signed_transaction)
  result = @rpc.request("getRawTransactionInfo", signed_transaction)
  return result
end

#get_transaction_by_block_hash_and_index(block_hash, transaction_index) ⇒ Object



173
174
175
176
# File 'lib/api.rb', line 173

def get_transaction_by_block_hash_and_index(block_hash, transaction_index)
  result = @rpc.request("getTransactionByBlockHashAndIndex", block_hash, transaction_index)
  return result
end

#get_transaction_by_block_number_and_index(block_hash_index, transaction_index) ⇒ Object



183
184
185
186
# File 'lib/api.rb', line 183

def get_transaction_by_block_number_and_index(block_hash_index, transaction_index)
  result = @rpc.request("getTransactionByBlockNumberAndIndex", block_hash_index, transaction_index)
  return result
end

#get_transaction_by_hash(transaction_hash) ⇒ Object



192
193
194
195
# File 'lib/api.rb', line 192

def get_transaction_by_hash(transaction_hash)
  result = @rpc.request("getTransactionByHash", transaction_hash)
  return result
end

#get_transaction_receipt(transaction_hash) ⇒ Object



202
203
204
205
# File 'lib/api.rb', line 202

def get_transaction_receipt(transaction_hash)
  result = @rpc.request("getTransactionReceipt", transaction_hash)
  return result
end

#get_transactions_by_address(address, transactions_number = nil) ⇒ Object



212
213
214
215
216
217
218
219
# File 'lib/api.rb', line 212

def get_transactions_by_address(address, transactions_number = nil)
  if transactions_number
    result = @rpc.request("getTransactionsByAddress", address, transactions_number)
  else
    result = @rpc.request("getTransactionsByAddress", address)
  end
  return result
end

#get_work(address = nil, data_field = nil) ⇒ Object



226
227
228
229
# File 'lib/api.rb', line 226

def get_work(address = nil, data_field = nil)
  result = @rpc.request("getWork", address, data_field)
  return result
end

#hashrateObject



234
235
236
237
# File 'lib/api.rb', line 234

def hashrate
  result = @rpc.request("hashrate")
  return result
end

#log(tag, log_level) ⇒ Object



244
245
246
247
# File 'lib/api.rb', line 244

def log(tag, log_level)
  result = @rpc.request("log", tag, log_level)
  return result
end

#mempoolObject



252
253
254
255
# File 'lib/api.rb', line 252

def mempool
  result = @rpc.request("mempool")
  return result
end

#mempool_content(include_full_transactions = nil) ⇒ Object



260
261
262
263
# File 'lib/api.rb', line 260

def mempool_content(include_full_transactions = nil)
  result = @rpc.request("mempoolContent")
  return result
end

#min_fee_per_byte(set_min_fee = nil) ⇒ Object



290
291
292
293
294
295
296
297
# File 'lib/api.rb', line 290

def min_fee_per_byte(set_min_fee = nil)
  if set_min_fee
    result = @rpc.request("minFeePerByte", set_min_fee)
  else
    result = @rpc.request("minFeePerByte")
  end
  return result
end

#miner_addressObject



268
269
270
271
# File 'lib/api.rb', line 268

def miner_address
  result = @rpc.request("minerAddress")
  return result
end

#miner_threads(set_threads = nil) ⇒ Object



277
278
279
280
281
282
283
284
# File 'lib/api.rb', line 277

def miner_threads(set_threads = nil)
  if set_threads
    result = @rpc.request("minerThreads", set_threads)
  else
    result = @rpc.request("minerThreads")
  end
  return result
end

#miningObject



302
303
304
305
# File 'lib/api.rb', line 302

def mining
  result = @rpc.request("mining")
  return result
end

#peer_countObject



310
311
312
313
# File 'lib/api.rb', line 310

def peer_count
  result = @rpc.request("peerCount")
  return result
end

#peer_listObject



318
319
320
321
# File 'lib/api.rb', line 318

def peer_list
  result = @rpc.request("peerList")
  return result
end

#peer_state(peer_address) ⇒ Object



327
328
329
330
# File 'lib/api.rb', line 327

def peer_state(peer_address)
  result = @rpc.request("peerState", peer_address)
  return result
end

#pool(pool_address_or_action = nil) ⇒ Object



337
338
339
340
341
342
343
344
# File 'lib/api.rb', line 337

def pool(pool_address_or_action = nil)
  if pool_address_or_action
    result = @rpc.request("pool", pool_address_or_action)
  else
    result = @rpc.request("pool")
  end
  return result
end

#pool_confirmed_balanceObject



349
350
351
352
# File 'lib/api.rb', line 349

def pool_confirmed_balance
  result = @rpc.request("poolConfirmedBalance")
  return result
end

#pool_connection_stateObject



357
358
359
360
# File 'lib/api.rb', line 357

def pool_connection_state
  result = @rpc.request("poolConnectionState")
  return result
end

#send_raw_transaction(signed_transaction) ⇒ Object



366
367
368
369
# File 'lib/api.rb', line 366

def send_raw_transaction(signed_transaction)
  result = @rpc.request("sendRawTransaction", signed_transaction)
  return result
end

#send_transaction(transaction) ⇒ Object



375
376
377
378
# File 'lib/api.rb', line 375

def send_transaction(transaction)
  result = @rpc.request("sendTransaction", transaction)
  return result
end

#submit_block(block) ⇒ Object



385
386
387
388
# File 'lib/api.rb', line 385

def submit_block(block)
  result = @rpc.request("submitBlock", block)
  return result
end

#syncingObject



393
394
395
396
# File 'lib/api.rb', line 393

def syncing
  result = @rpc.request("syncing")
  return result
end