web3-eth 0.2.13 → 0.2.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/web3/eth/contract.rb +22 -6
- data/lib/web3/eth/transaction.rb +4 -2
- data/lib/web3/eth/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef7c29f56dd299e95ab99030916ab74f49c8ab64
|
4
|
+
data.tar.gz: 37e532f820f44111b24985cb98821fb7e5773cfb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73178ab1c8530fbdbce1ad4fa8c489316e37e614b27f989c224d9a05e35ebf642340ea6d529532b025ee6ae43d1c802315cd0352f55c8a8faeb19da860e127e3
|
7
|
+
data.tar.gz: 3ab2344cff8b9b00cf7e06be974f5f89682bbbbfa5f126c2a5a1b7b913c3e6ce9d03d7b06bc8cd14d1188f2593b4a2ab9acf30095e0e3345018accf6b42c730f
|
data/lib/web3/eth/contract.rb
CHANGED
@@ -95,7 +95,7 @@ module Web3
|
|
95
95
|
|
96
96
|
end
|
97
97
|
|
98
|
-
attr_reader :web3_rpc, :abi, :functions, :events, :constructor
|
98
|
+
attr_reader :web3_rpc, :abi, :functions, :events, :constructor, :functions_by_hash, :events_by_hash
|
99
99
|
|
100
100
|
def initialize abi, web_rpc = nil
|
101
101
|
@web3_rpc = web_rpc
|
@@ -115,11 +115,11 @@ module Web3
|
|
115
115
|
end
|
116
116
|
|
117
117
|
def find_event_by_hash method_hash
|
118
|
-
|
118
|
+
@events_by_hash[method_hash]
|
119
119
|
end
|
120
120
|
|
121
121
|
def find_function_by_hash method_hash
|
122
|
-
|
122
|
+
@functions_by_hash[method_hash]
|
123
123
|
end
|
124
124
|
|
125
125
|
def parse_log_args log
|
@@ -142,9 +142,25 @@ module Web3
|
|
142
142
|
private
|
143
143
|
|
144
144
|
def parse_abi abi
|
145
|
-
@functions =
|
146
|
-
@events =
|
147
|
-
|
145
|
+
@functions = {}
|
146
|
+
@events = {}
|
147
|
+
|
148
|
+
@functions_by_hash = {}
|
149
|
+
@events_by_hash = {}
|
150
|
+
|
151
|
+
abi.each{|a|
|
152
|
+
method = ContractMethod.new(a)
|
153
|
+
case a['type']
|
154
|
+
when 'function'
|
155
|
+
@functions[method.name] = method
|
156
|
+
@functions_by_hash[method.signature_hash] = method
|
157
|
+
when 'event'
|
158
|
+
@events[method.name] = method
|
159
|
+
@events_by_hash[method.signature_hash] = method
|
160
|
+
when 'constructor'
|
161
|
+
@constructor = method
|
162
|
+
end
|
163
|
+
}
|
148
164
|
end
|
149
165
|
|
150
166
|
end
|
data/lib/web3/eth/transaction.rb
CHANGED
@@ -36,7 +36,9 @@ module Web3
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def block_number
|
39
|
-
|
39
|
+
# if transaction is less than 12 seconds old, blockNumber will be nil
|
40
|
+
# :. nil check before calling `to_hex` to avoid argument error
|
41
|
+
blockNumber && from_hex(blockNumber)
|
40
42
|
end
|
41
43
|
|
42
44
|
def value_wei
|
@@ -68,4 +70,4 @@ module Web3
|
|
68
70
|
|
69
71
|
end
|
70
72
|
end
|
71
|
-
end
|
73
|
+
end
|
data/lib/web3/eth/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: web3-eth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- studnev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-03-
|
11
|
+
date: 2018-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rlp
|