class EthereumContractABI::ContractInterface::Parsers::AbiTypeParser

Public Class Methods

from_string(string_type) click to toggle source
# File lib/ethereum-contract-abi/contract/parsers/abi_type_parser.rb, line 16
def self.from_string(string_type)
  uint = Uint.from_string(string_type)
  return uint unless uint.nil?

  bool = Bool.from_string(string_type)
  return bool unless bool.nil?

  decimal = Fixed.from_string(string_type)
  return decimal unless decimal.nil?

  str = EthereumContractABI::ContractInterface::AbiTypes::String.from_string(string_type)
  return str unless str.nil?

  bytes = Bytes.from_string(string_type)
  return bytes unless bytes.nil?

  address = Address.from_string(string_type)
  return address unless address.nil?

  raise ArgumentError.new('Unknown type')
end