Class: Harmony::Api::Utilities

Inherits:
Object
  • Object
show all
Defined in:
lib/harmony/api/utilities.rb

Class Method Summary collapse

Class Method Details

.hex_to_int(string) ⇒ Object



7
8
9
# File 'lib/harmony/api/utilities.rb', line 7

def hex_to_int(string)
  string.to_i(16)
end

.int_to_hex(int) ⇒ Object



11
12
13
# File 'lib/harmony/api/utilities.rb', line 11

def int_to_hex(int)
  "0x#{int.to_s(16)}"
end

.wei_to_ether(wei) ⇒ Object



15
16
17
# File 'lib/harmony/api/utilities.rb', line 15

def wei_to_ether(wei)
  1.0 * wei / 10**18
end