Class: Ethereum::Connection

Inherits:
Client
  • Object
show all
Defined in:
lib/elchapo/ethereum/connection.rb

Constant Summary

Constants inherited from Client

Ethereum::Client::DEFAULT_GAS_LIMIT, Ethereum::Client::DEFAULT_GAS_PRICE, Ethereum::Client::RPC_COMMANDS, Ethereum::Client::RPC_MANAGEMENT_COMMANDS

Instance Attribute Summary collapse

Attributes inherited from Client

#command, #default_account, #gas_limit, #gas_price, #id, #log, #logger

Instance Method Summary collapse

Methods inherited from Client

#encode_params, #get_id, #int_to_hex, #reset_id, #send_command

Constructor Details

#initialize(ipcpath) ⇒ Connection

Returns a new instance of Connection.



6
7
8
9
# File 'lib/elchapo/ethereum/connection.rb', line 6

def initialize(ipcpath)
  super()
  @ipcpath = ipcpath
end

Instance Attribute Details

#ipcpathObject

Returns the value of attribute ipcpath.



4
5
6
# File 'lib/elchapo/ethereum/connection.rb', line 4

def ipcpath
  @ipcpath
end

Instance Method Details

#send_single(payload) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/elchapo/ethereum/connection.rb', line 11

def send_single(payload)
  socket = UNIXSocket.new(@ipcpath)
  socket.puts(payload)
  read = socket.recvmsg(nil)[0]
  socket.close
  return read
end