Module: Etherlite::Api::Node

Extended by:
Forwardable
Includes:
Address
Included in:
Etherlite, Client
Defined in:
lib/etherlite/api/node.rb

Instance Method Summary collapse

Methods included from Address

#address, #get_balance

Instance Method Details

#accountsObject



24
25
26
27
28
# File 'lib/etherlite/api/node.rb', line 24

def accounts
  connection.ipc_call(:eth_accounts).map do |address|
    Etherlite::Account.new @connection, Etherlite::Utils.normalize_address(address)
  end
end

#first_accountObject



30
31
32
# File 'lib/etherlite/api/node.rb', line 30

def 
  @first_account ||= accounts.first
end

#get_block_numberObject



7
8
9
# File 'lib/etherlite/api/node.rb', line 7

def get_block_number
  Etherlite::Utils.hex_to_uint connection.ipc_call(:eth_blockNumber)
end

#get_gas_priceObject



11
12
13
# File 'lib/etherlite/api/node.rb', line 11

def get_gas_price
  Etherlite::Utils.hex_to_uint connection.ipc_call(:eth_gasPrice)
end

#get_transaction_receipt(_tx_hash) ⇒ Object



15
16
17
# File 'lib/etherlite/api/node.rb', line 15

def get_transaction_receipt(_tx_hash)
  connection.ipc_call(:eth_getTransactionReceipt, _tx_hash)
end

#register_account(_passphrase) ⇒ Object



19
20
21
22
# File 'lib/etherlite/api/node.rb', line 19

def (_passphrase)
  address = connection.ipc_call(:personal_newAccount, _passphrase)
  Etherlite::Account.new @connection, Etherlite::Utils.normalize_address(address)
end