Method: EvmClient::Formatter#to_wei

Defined in:
lib/evm_client/formatter.rb

#to_wei(amount, unit = "ether") ⇒ Object



74
75
76
77
# File 'lib/evm_client/formatter.rb', line 74

def to_wei(amount, unit = "ether")
  return nil if amount.nil?
  BigDecimal(UNITS[unit.to_sym] * amount, 16).to_s.to_i rescue nil
end