Sha256: 54203c5dd5ee6556b8a0b0e548d611f9a0485f0dec90479e7228c03c33ffbc5a

Contents?: true

Size: 652 Bytes

Versions: 13

Compression:

Stored size: 652 Bytes

Contents

module Etherlite
  module EventProvider
    extend self

    def register_contract_events(_contract_class)
      _contract_class.events.each { |e| register_event e }
    end

    def register_event(_event)
      event_by_topic[_event.topic] = _event
    end

    def parse_raw_log(_connection, _raw_log)
      event = event_by_topic[_raw_log["topics"].first]
      return nil if event.nil?
      event.decode(_connection, _raw_log)
    end

    def parse_raw_logs(_connection, _raw_logs)
      _raw_logs.map { |e| parse_raw_log(_connection, e) }.reject &:nil?
    end

    private

    def event_by_topic
      @event_by_topic ||= {}
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
etherlite-0.6.0 lib/etherlite/event_provider.rb
etherlite-0.5.3 lib/etherlite/event_provider.rb
etherlite-0.5.2 lib/etherlite/event_provider.rb
etherlite-0.5.1 lib/etherlite/event_provider.rb
etherlite-0.5.0 lib/etherlite/event_provider.rb
etherlite-0.4.2 lib/etherlite/event_provider.rb
etherlite-0.4.1 lib/etherlite/event_provider.rb
etherlite-0.4.0 lib/etherlite/event_provider.rb
etherlite-0.3.0 lib/etherlite/event_provider.rb
etherlite-0.2.6 lib/etherlite/event_provider.rb
etherlite-0.2.5 lib/etherlite/event_provider.rb
etherlite-0.2.4 lib/etherlite/event_provider.rb
etherlite-0.2.3 lib/etherlite/event_provider.rb