Class: Trx::Abi::ContractEvent
- Inherits:
-
Object
- Object
- Trx::Abi::ContractEvent
- Defined in:
- lib/trx/abi/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.
-
#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.
-
#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.
7 8 9 10 11 12 13 |
# File 'lib/trx/abi/contract_event.rb', line 7 def initialize(data) @name = data["name"] @input_types = data.fetch("inputs", []).map {|x| x["type"]} @inputs = data.fetch("inputs", []).map {|x| x["name"]} @event_string = "#{@name}(#{@input_types.join(",")})" @signature = Digest::Keccak.hexdigest(@event_string, 256) end |
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
5 6 7 |
# File 'lib/trx/abi/contract_event.rb', line 5 def address @address end |
#client ⇒ Object
Returns the value of attribute client.
5 6 7 |
# File 'lib/trx/abi/contract_event.rb', line 5 def client @client end |
#event_string ⇒ Object
Returns the value of attribute event_string.
5 6 7 |
# File 'lib/trx/abi/contract_event.rb', line 5 def event_string @event_string end |
#input_types ⇒ Object
Returns the value of attribute input_types.
5 6 7 |
# File 'lib/trx/abi/contract_event.rb', line 5 def input_types @input_types end |
#inputs ⇒ Object
Returns the value of attribute inputs.
5 6 7 |
# File 'lib/trx/abi/contract_event.rb', line 5 def inputs @inputs end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/trx/abi/contract_event.rb', line 5 def name @name end |
#signature ⇒ Object
Returns the value of attribute signature.
5 6 7 |
# File 'lib/trx/abi/contract_event.rb', line 5 def signature @signature end |
Instance Method Details
#set_address(address) ⇒ Object
15 16 17 |
# File 'lib/trx/abi/contract_event.rb', line 15 def set_address(address) @address = address end |
#set_client(client) ⇒ Object
19 20 21 |
# File 'lib/trx/abi/contract_event.rb', line 19 def set_client(client) @client = client end |