Class: Jeth::IpcClient
Constant Summary
Constants inherited from Client
Client::RPC_COMMANDS, Client::RPC_MANAGEMENT_COMMANDS
Instance Method Summary collapse
- #default_path ⇒ Object
-
#initialize(ipcpath = default_path) ⇒ IpcClient
constructor
A new instance of IpcClient.
- #send_single(payload) ⇒ Object
Methods inherited from Client
#batch, #encode_params, #get_id, #reset_id, #send_batch
Constructor Details
#initialize(ipcpath = default_path) ⇒ IpcClient
Returns a new instance of IpcClient.
5 6 7 8 |
# File 'lib/jeth/ipc_client.rb', line 5 def initialize(ipcpath = default_path) super() @ipcpath = ipcpath end |
Instance Method Details
#default_path ⇒ Object
18 19 20 21 22 |
# File 'lib/jeth/ipc_client.rb', line 18 def default_path ["#{ENV['HOME']}/.ethereum/geth.ipc", "#{ENV['HOME']}/Library/Ethereum/geth.ipc"].each do |path| return path if File.exists?(path) end end |
#send_single(payload) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/jeth/ipc_client.rb', line 10 def send_single(payload) socket = UNIXSocket.new(@ipcpath) socket.puts(payload) read = socket.gets socket.close return read end |