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 +4 -4
- data/lib/ethereum.rb +1 -0
- data/lib/ethereum/contract.rb +5 -1
- data/lib/ethereum/contract_event.rb +17 -0
- data/lib/ethereum/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50e0a092c6b90539e60fbc9f33a9737045786f17
|
4
|
+
data.tar.gz: 34caf69d6d45fad9b6d8c5e63711fc419f3da614
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8043912d4866be8a140ef6e68ffc8a721b001c1ec64d9f0308f6d33b6fc8b6f2d1d625e6f7a132b35dd3dececf1b814b2275c25cbb4ba5ea710c2611cb8f8d0
|
7
|
+
data.tar.gz: c4cca1936eb1bc030c305a672d88fae24a600591e101fec53bf3b7673395660bd3492228ce924b8882e6235eca0563800eb9ee1a6bfca2b050d8eea951319470
|
data/lib/ethereum.rb
CHANGED
data/lib/ethereum/contract.rb
CHANGED
@@ -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
|
+
|
data/lib/ethereum/version.rb
CHANGED
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.
|
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-
|
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
|