Module: Web3::Eth::Utility
- Included in:
- Block, CallTrace, Contract::ContractMethod, EthModule, TraceModule, Transaction, TransactionReceipt
- Defined in:
- lib/web3ethereum/utility.rb
Instance Method Summary collapse
Instance Method Details
#from_hex(h) ⇒ Object
14 15 16 |
# File 'lib/web3ethereum/utility.rb', line 14 def from_hex h h.to_i 16 end |
#hex(num) ⇒ Object
6 7 8 |
# File 'lib/web3ethereum/utility.rb', line 6 def hex num '0x' + num.to_s(16) end |
#remove_0x_head(s) ⇒ Object
18 19 20 |
# File 'lib/web3ethereum/utility.rb', line 18 def remove_0x_head(s) s[0,2] == '0x' ? s[2..-1] : s end |
#wei_to_ether(wei) ⇒ Object
10 11 12 |
# File 'lib/web3ethereum/utility.rb', line 10 def wei_to_ether(wei) 1.0 * wei / 10**18 end |