class EthereumContractABI::ContractInterface::Parsers::FunctionParser
Public Class Methods
from_hash(function_hash)
click to toggle source
# File lib/ethereum-contract-abi/contract/parsers/function_parser.rb, line 14 def self.from_hash(function_hash) function_hash = function_hash.transform_keys(&:to_sym) name = function_hash[:name] inputs = self.get_inputs(function_hash[:inputs]) outputs = self.get_inputs(function_hash[:outputs]) Function.new(name, inputs, outputs) end
Private Class Methods
get_inputs(inputs)
click to toggle source
# File lib/ethereum-contract-abi/contract/parsers/function_parser.rb, line 24 def self.get_inputs(inputs) inputs.map do |input_hash| hash = input_hash.transform_keys(&:to_sym) type = AbiTypeParser.from_string(hash[:type]) Input.new(name, type) end end
get_outputs(outputs)
click to toggle source
# File lib/ethereum-contract-abi/contract/parsers/function_parser.rb, line 32 def self.get_outputs(outputs) outputs.map do |input_hash| hash = input_hash.transform_keys(&:to_sym) type = AbiTypeParser.from_string(hash[:type]) Output.new(name, type) end end