Class: Ethmo::Account

Inherits:
Object
  • Object
show all
Defined in:
lib/ethmo/account.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(address) ⇒ Account

Returns a new instance of Account.



8
9
10
# File 'lib/ethmo/account.rb', line 8

def initialize(address)
  @address = address
end

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



6
7
8
# File 'lib/ethmo/account.rb', line 6

def address
  @address
end

Instance Method Details

#balanceObject



12
13
14
15
16
17
18
19
# File 'lib/ethmo/account.rb', line 12

def balance
  # TODO: Add ETH value to Float Helper
  Client
    .balance_of(address, 'latest')
    .fetch('result', '0x0')
    .to_i(16)
    .to_f / Config::WEI
end