Class: EvmClient::ContractEvent
- Inherits:
-
Object
- Object
- EvmClient::ContractEvent
- Defined in:
- lib/evm_client/contract_event.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#client ⇒ Object
Returns the value of attribute client.
-
#event_string ⇒ Object
Returns the value of attribute event_string.
-
#indexed_inputs ⇒ Object
Returns the value of attribute indexed_inputs.
-
#indexed_outputs ⇒ Object
Returns the value of attribute indexed_outputs.
-
#input_types ⇒ Object
Returns the value of attribute input_types.
-
#inputs ⇒ Object
Returns the value of attribute inputs.
-
#name ⇒ Object
Returns the value of attribute name.
-
#non_indexed_inputs ⇒ Object
Returns the value of attribute non_indexed_inputs.
-
#non_indexed_outputs ⇒ Object
Returns the value of attribute non_indexed_outputs.
-
#signature ⇒ Object
Returns the value of attribute signature.
Instance Method Summary collapse
-
#initialize(data) ⇒ ContractEvent
constructor
A new instance of ContractEvent.
- #set_address(address) ⇒ Object
- #set_client(client) ⇒ Object
Constructor Details
#initialize(data) ⇒ ContractEvent
Returns a new instance of ContractEvent.
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/evm_client/contract_event.rb', line 9 def initialize(data) @name = data['name'] @input_types = data['inputs'].map {|x| x['type']} @inputs = data['inputs'].map {|x| x['name']} @event_string = "#{@name}(#{@input_types.join(",")})" @signature = Digest::SHA3.hexdigest(@event_string, 256) @indexed_inputs = Array(data['inputs']).select { |input| input['indexed'] == true } @non_indexed_inputs = Array(data['inputs']).select { |input| input['indexed'] == false } @indexed_outputs = Array(data['outputs']).select { |output| output['indexed'] == true } @non_indexed_outputs = Array(data['outputs']).select { |output| output['indexed'] == false } end |
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
4 5 6 |
# File 'lib/evm_client/contract_event.rb', line 4 def address @address end |
#client ⇒ Object
Returns the value of attribute client.
4 5 6 |
# File 'lib/evm_client/contract_event.rb', line 4 def client @client end |
#event_string ⇒ Object
Returns the value of attribute event_string.
4 5 6 |
# File 'lib/evm_client/contract_event.rb', line 4 def event_string @event_string end |
#indexed_inputs ⇒ Object
Returns the value of attribute indexed_inputs.
4 5 6 |
# File 'lib/evm_client/contract_event.rb', line 4 def indexed_inputs @indexed_inputs end |
#indexed_outputs ⇒ Object
Returns the value of attribute indexed_outputs.
4 5 6 |
# File 'lib/evm_client/contract_event.rb', line 4 def indexed_outputs @indexed_outputs end |
#input_types ⇒ Object
Returns the value of attribute input_types.
4 5 6 |
# File 'lib/evm_client/contract_event.rb', line 4 def input_types @input_types end |
#inputs ⇒ Object
Returns the value of attribute inputs.
4 5 6 |
# File 'lib/evm_client/contract_event.rb', line 4 def inputs @inputs end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/evm_client/contract_event.rb', line 4 def name @name end |
#non_indexed_inputs ⇒ Object
Returns the value of attribute non_indexed_inputs.
4 5 6 |
# File 'lib/evm_client/contract_event.rb', line 4 def non_indexed_inputs @non_indexed_inputs end |
#non_indexed_outputs ⇒ Object
Returns the value of attribute non_indexed_outputs.
4 5 6 |
# File 'lib/evm_client/contract_event.rb', line 4 def non_indexed_outputs @non_indexed_outputs end |
#signature ⇒ Object
Returns the value of attribute signature.
4 5 6 |
# File 'lib/evm_client/contract_event.rb', line 4 def signature @signature end |
Instance Method Details
#set_address(address) ⇒ Object
23 24 25 |
# File 'lib/evm_client/contract_event.rb', line 23 def set_address(address) @address = address end |
#set_client(client) ⇒ Object
27 28 29 |
# File 'lib/evm_client/contract_event.rb', line 27 def set_client(client) @client = client end |