ethereum 0.4.38 → 0.4.40

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c47d8e41d8cadd766be88fc11e5b7dea7e0b2f5a
4
- data.tar.gz: c44e0d190a7654585d06e2f6ddb1b844fc8be4c4
3
+ metadata.gz: 50e0a092c6b90539e60fbc9f33a9737045786f17
4
+ data.tar.gz: 34caf69d6d45fad9b6d8c5e63711fc419f3da614
5
5
  SHA512:
6
- metadata.gz: efb67fbde82e4808424770e28735e107b55298a113690a5595f0ccef09677040c38a61c2c78a5de0ff2c93d3f76982e0520694c21674d3ee5b0e969f06096096
7
- data.tar.gz: 14143bb3e0c460ea7930cf57434dbc6136322b7279ec54156cd0180535df910d65c68018ba550e94561772c2f0280f81994ce7d51f19a106c7602191acf61d8d
6
+ metadata.gz: b8043912d4866be8a140ef6e68ffc8a721b001c1ec64d9f0308f6d33b6fc8b6f2d1d625e6f7a132b35dd3dececf1b814b2275c25cbb4ba5ea710c2611cb8f8d0
7
+ data.tar.gz: c4cca1936eb1bc030c305a672d88fae24a600591e101fec53bf3b7673395660bd3492228ce924b8882e6235eca0563800eb9ee1a6bfca2b050d8eea951319470
data/lib/ethereum.rb CHANGED
@@ -12,6 +12,7 @@ module Ethereum
12
12
  require 'ethereum/function'
13
13
  require 'ethereum/function_input'
14
14
  require 'ethereum/function_output'
15
+ require 'ethereum/contract_event'
15
16
  require 'ethereum/formatter'
16
17
  require 'ethereum/transaction'
17
18
  require 'ethereum/deployment'
@@ -1,17 +1,21 @@
1
1
  module Ethereum
2
2
  class Contract
3
3
 
4
- attr_accessor :code, :name, :functions, :abi, :constructor_inputs
4
+ attr_accessor :code, :name, :functions, :abi, :constructor_inputs, :events
5
5
 
6
6
  def initialize(name, code, abi)
7
7
  @name = name
8
8
  @code = code
9
9
  @abi = abi
10
10
  @functions = []
11
+ @events = []
11
12
  @constructor_inputs = @abi.detect {|x| x["type"] == "constructor"}["inputs"] rescue nil
12
13
  @abi.select {|x| x["type"] == "function" }.each do |abifun|
13
14
  @functions << Ethereum::Function.new(abifun)
14
15
  end
16
+ @abi.select {|x| x["type"] == "event" }.each do |abievt|
17
+ @events << Ethereum::ContractEvent.new(abievt)
18
+ end
15
19
  end
16
20
 
17
21
  def build(connection)
@@ -0,0 +1,17 @@
1
+ require 'pry'
2
+ module Ethereum
3
+ class ContractEvent
4
+
5
+ attr_accessor :name, :signature, :input_types, :inputs, :event_string
6
+
7
+ def initialize(data)
8
+ @name = data["name"]
9
+ @input_types = data["inputs"].collect {|x| x["type"]}
10
+ @inputs = data["inputs"].collect {|x| x["name"]}
11
+ @event_string = "#{@name}(#{@input_types.join(",")})"
12
+ @signature = Digest::SHA3.hexdigest(@event_string, 256)
13
+ end
14
+
15
+ end
16
+ end
17
+
@@ -1,3 +1,3 @@
1
1
  module Ethereum
2
- VERSION = "0.4.38"
2
+ VERSION = "0.4.40"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ethereum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.38
4
+ version: 0.4.40
5
5
  platform: ruby
6
6
  authors:
7
7
  - DigixGlobal Pte Ltd (https://dgx.io)
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-10-16 00:00:00.000000000 Z
11
+ date: 2015-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -118,6 +118,7 @@ files:
118
118
  - lib/ethereum.rb
119
119
  - lib/ethereum/client.rb
120
120
  - lib/ethereum/contract.rb
121
+ - lib/ethereum/contract_event.rb
121
122
  - lib/ethereum/deployment.rb
122
123
  - lib/ethereum/formatter.rb
123
124
  - lib/ethereum/function.rb