Class: Nimiq::Client

Inherits:
Object
  • Object
show all
Includes:
Api
Defined in:
lib/nimiq-client.rb

Instance Attribute Summary

Attributes included from Api

#rpc

Instance Method Summary collapse

Methods included from Api

#accounts, #block_number, #consensus, #constant, #create_account, #create_raw_transaction, #get_account, #get_balance, #get_block_by_hash, #get_block_by_number, #get_block_template, #get_block_transaction_count_by_hash, #get_block_transaction_count_by_number, #get_raw_transaction_info, #get_transaction_by_block_hash_and_index, #get_transaction_by_block_number_and_index, #get_transaction_by_hash, #get_transaction_receipt, #get_transactions_by_address, #get_work, #hashrate, #log, #mempool, #mempool_content, #min_fee_per_byte, #miner_address, #miner_threads, #mining, #peer_count, #peer_list, #peer_state, #pool, #pool_confirmed_balance, #pool_connection_state, #send_raw_transaction, #send_transaction, #submit_block, #syncing

Constructor Details

#initialize(opts) ⇒ Client

Returns a new instance of Client.



30
31
32
33
# File 'lib/nimiq-client.rb', line 30

def initialize(opts)
  puts "Connecting to #{opts[:host]}:#{opts[:port]}"
  return @rpc = ClientRPC::Connect.new(opts)
end

Instance Method Details

#pingObject

Ping the Nimiq node.



41
42
43
44
# File 'lib/nimiq-client.rb', line 41

def ping
  @rpc.ping_node
  @pingres = @rpc.instance_variable_get(:@pingres)
end

#request(name, params = nil) ⇒ Object

Sends a raw request to the Nimiq node.



36
37
38
# File 'lib/nimiq-client.rb', line 36

def request(name, params = nil)
  return @rpc.request(name, params)
end