web3-eth 0.2.42 → 0.2.47
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/web3/eth/abi/abi_coder.rb +13 -1
- data/lib/web3/eth/abi/type.rb +2 -2
- data/lib/web3/eth/contract.rb +1 -1
- data/lib/web3/eth/debug/debug_module.rb +3 -1
- data/lib/web3/eth/utility.rb +1 -1
- data/lib/web3/eth/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8be6fa4b04cd58538038dbe11ccd90c2f197f5be205e5d204b7cdbc58f7cef45
|
4
|
+
data.tar.gz: a7b08dd6af5a133cf38f5c286da8dfe7eda81d5eeb65b1c68f0a99c18f050236
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f976abfae663d97f06f4b61ac441ef8c1178517f8791ffb0e8930fbd7d933f8f6f01b6d49c10e3f900f703422a27697de5e6562df975198f1a8e1e03cd115d13
|
7
|
+
data.tar.gz: 2897cb1de0fc173593bc9bb5ba82622d603727e6d30210da103455c474aa62fdeae491220aebdeccec468faaa0d397befed6ae12d41b8cc285240f546e245752
|
@@ -231,7 +231,7 @@ module Web3::Eth::Abi
|
|
231
231
|
|
232
232
|
pos += 32
|
233
233
|
else
|
234
|
-
outputs[i] = data
|
234
|
+
outputs[i] = zero_padding data, pos, t.size, start_positions
|
235
235
|
pos += t.size
|
236
236
|
end
|
237
237
|
end
|
@@ -266,6 +266,18 @@ module Web3::Eth::Abi
|
|
266
266
|
end
|
267
267
|
alias :decode :decode_abi
|
268
268
|
|
269
|
+
def zero_padding data, pos, count, start_positions
|
270
|
+
if pos >= data.size
|
271
|
+
start_positions[start_positions.size-1] += count
|
272
|
+
"\x00"*count
|
273
|
+
elsif pos + count > data.size
|
274
|
+
start_positions[start_positions.size-1] += ( count - (data.size-pos))
|
275
|
+
data[pos,data.size-pos] + "\x00"*( count - (data.size-pos))
|
276
|
+
else
|
277
|
+
data[pos, count]
|
278
|
+
end
|
279
|
+
end
|
280
|
+
|
269
281
|
def decode_typed_data type_name, data
|
270
282
|
decode_primitive_type Type.parse(type_name), data
|
271
283
|
end
|
data/lib/web3/eth/abi/type.rb
CHANGED
@@ -152,13 +152,13 @@ module Web3::Eth::Abi
|
|
152
152
|
end
|
153
153
|
collected << current unless current.empty?
|
154
154
|
|
155
|
-
Tuple.new collected, dims
|
155
|
+
Tuple.new collected, dims.map {|x| x[1...-1].to_i}
|
156
156
|
|
157
157
|
end
|
158
158
|
|
159
159
|
attr_reader :types, :parsed_types
|
160
160
|
def initialize types, dims
|
161
|
-
super('tuple', '', dims
|
161
|
+
super('tuple', '', dims)
|
162
162
|
@types = types
|
163
163
|
@parsed_types = types.map{|t| Type.parse t}
|
164
164
|
end
|
data/lib/web3/eth/contract.rb
CHANGED
@@ -34,7 +34,7 @@ module Web3
|
|
34
34
|
def initialize abi
|
35
35
|
@abi = abi
|
36
36
|
@name = abi['name']
|
37
|
-
@constant = !!abi['constant']
|
37
|
+
@constant = !!abi['constant'] || abi['stateMutability']=='view'
|
38
38
|
@input_types = abi['inputs'] ? abi['inputs'].map{|a| parse_component_type a } : []
|
39
39
|
@output_types = abi['outputs'].map{|a| parse_component_type a } if abi['outputs']
|
40
40
|
@signature = Abi::Utils.function_signature @name, @input_types
|
@@ -11,7 +11,9 @@ module Web3::Eth::Debug
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def traceTransaction hash, tracer = 'callTracer', convert_to_object = true
|
14
|
-
|
14
|
+
timeout = @web3_rpc.connect_options[:read_timeout] || 120
|
15
|
+
raw = @web3_rpc.request("#{PREFIX}#{__method__}", [hash, {tracer: tracer,
|
16
|
+
timeout: "#{timeout}s"}])
|
15
17
|
convert_to_object ? TransactionCallTrace.new(raw) : raw
|
16
18
|
end
|
17
19
|
|
data/lib/web3/eth/utility.rb
CHANGED
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.47
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- studnev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rlp
|