Class: Coinbase::ContractEvent
- Inherits:
-
Object
- Object
- Coinbase::ContractEvent
- Defined in:
- lib/coinbase/contract_event.rb
Overview
Represents a single contract event
Instance Method Summary collapse
-
#block_height ⇒ Integer
Returns the block height of the ContractEvent.
-
#block_time ⇒ Time
Returns the block time of the ContractEvent.
-
#contract_address ⇒ String
Returns the contract address of the ContractEvent.
-
#contract_name ⇒ String
Returns the contract name of the ContractEvent.
-
#data ⇒ String
Returns the event data of the ContractEvent.
-
#event_index ⇒ Integer
Returns the event index of the ContractEvent.
-
#event_name ⇒ String
Returns the event name of the ContractEvent.
-
#four_bytes ⇒ String
Returns the four bytes of the Keccak hash of the event signature.
-
#initialize(model) ⇒ ContractEvent
constructor
Returns a new ContractEvent object.
-
#inspect ⇒ String
Same as to_s.
-
#network_id ⇒ String
Returns the network ID of the ContractEvent.
-
#protocol_name ⇒ String
Returns the protocol name of the ContractEvent.
-
#sig ⇒ String
Returns the signature of the ContractEvent.
-
#to_s ⇒ String
Returns a string representation of the ContractEvent.
-
#tx_hash ⇒ String
Returns the transaction hash of the ContractEvent.
-
#tx_index ⇒ Integer
Returns the transaction index of the ContractEvent.
Constructor Details
#initialize(model) ⇒ ContractEvent
Returns a new ContractEvent object.
8 9 10 |
# File 'lib/coinbase/contract_event.rb', line 8 def initialize(model) @model = model end |
Instance Method Details
#block_height ⇒ Integer
Returns the block height of the ContractEvent.
62 63 64 |
# File 'lib/coinbase/contract_event.rb', line 62 def block_height @model.block_height end |
#block_time ⇒ Time
Returns the block time of the ContractEvent.
56 57 58 |
# File 'lib/coinbase/contract_event.rb', line 56 def block_time Time.parse(@model.block_time) end |
#contract_address ⇒ String
Returns the contract address of the ContractEvent.
50 51 52 |
# File 'lib/coinbase/contract_event.rb', line 50 def contract_address @model.contract_address end |
#contract_name ⇒ String
Returns the contract name of the ContractEvent.
26 27 28 |
# File 'lib/coinbase/contract_event.rb', line 26 def contract_name @model.contract_name end |
#data ⇒ String
Returns the event data of the ContractEvent.
86 87 88 |
# File 'lib/coinbase/contract_event.rb', line 86 def data @model.data end |
#event_index ⇒ Integer
Returns the event index of the ContractEvent.
80 81 82 |
# File 'lib/coinbase/contract_event.rb', line 80 def event_index @model.event_index end |
#event_name ⇒ String
Returns the event name of the ContractEvent.
32 33 34 |
# File 'lib/coinbase/contract_event.rb', line 32 def event_name @model.event_name end |
#four_bytes ⇒ String
Returns the four bytes of the Keccak hash of the event signature.
44 45 46 |
# File 'lib/coinbase/contract_event.rb', line 44 def four_bytes @model.four_bytes end |
#inspect ⇒ String
Same as to_s.
100 101 102 |
# File 'lib/coinbase/contract_event.rb', line 100 def inspect to_s end |
#network_id ⇒ String
Returns the network ID of the ContractEvent.
14 15 16 |
# File 'lib/coinbase/contract_event.rb', line 14 def network_id @model.network_id end |
#protocol_name ⇒ String
Returns the protocol name of the ContractEvent.
20 21 22 |
# File 'lib/coinbase/contract_event.rb', line 20 def protocol_name @model.protocol_name end |
#sig ⇒ String
Returns the signature of the ContractEvent.
38 39 40 |
# File 'lib/coinbase/contract_event.rb', line 38 def sig @model.sig end |
#to_s ⇒ String
Returns a string representation of the ContractEvent.
92 93 94 95 96 |
# File 'lib/coinbase/contract_event.rb', line 92 def to_s "Coinbase::ContractEvent{network_id: '#{network_id}', protocol_name: '#{protocol_name}', " \ "contract_name: '#{contract_name}', event_name: '#{event_name}', contract_address: '#{contract_address}', " \ "block_height: #{block_height}, tx_hash: '#{tx_hash}', data: '#{data}'}" end |
#tx_hash ⇒ String
Returns the transaction hash of the ContractEvent.
68 69 70 |
# File 'lib/coinbase/contract_event.rb', line 68 def tx_hash @model.tx_hash end |
#tx_index ⇒ Integer
Returns the transaction index of the ContractEvent.
74 75 76 |
# File 'lib/coinbase/contract_event.rb', line 74 def tx_index @model.tx_index end |