Method: Web3::Eth::Contract::ContractMethod#initialize
- Defined in:
- lib/web3ethereum/contract.rb
#initialize(abi) ⇒ ContractMethod
Returns a new instance of ContractMethod.
34 35 36 37 38 39 40 41 42 |
# File 'lib/web3ethereum/contract.rb', line 34 def initialize abi @abi = abi @name = abi['name'] @constant = !!abi['constant'] @input_types = abi['inputs'].map{|a| a['type']} @output_types = abi['outputs'].map{|a| a['type']} if abi['outputs'] @signature = Abi::Utils.function_signature @name, @input_types @signature_hash = Abi::Utils.signature_hash @signature, (abi['type']=='event' ? 64 : 8) end |