web3-eth 0.2.41 → 0.2.46

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
  SHA256:
3
- metadata.gz: 3355f35916a408a0640e8d652741d134f429541110febf62f93773bc78b448c3
4
- data.tar.gz: 4870449d706dbccd3f3e7f8d72b7842aeee20c8a33990f94057b93397f26157b
3
+ metadata.gz: 60b209f8dcb72c54e859aeee15107817fab99bc19c3697c27b0ccd8c179bcb1a
4
+ data.tar.gz: cdc5042337271525198797a1b6b982b9a535cef74da4eefda1cffce02f1a8366
5
5
  SHA512:
6
- metadata.gz: 9aa5a5a22e95ec0cc64d58417f1cfb665dcf0668689a26127faa238a0aec12052d4640ae3b86703b2ec7d02e3839b5f5697ee0d65ca28eb9dbe52bb1b928af76
7
- data.tar.gz: e33b8e6d1bf96ad6a9886fc37a6def521b46ad36d1ed047a8b0ce974a2a3d0578ac10f69d284d2fb03f5aa0f84c28bc0c75545db3c8997f7236f326a6f882a59
6
+ metadata.gz: 5fecd35a08e849ccf8d11a79b883b8ca43ed630605bf1ed435f8c0432cafaef52334edac629b810b140f45b599aeed665e9a39461f4d38e35c42237f0d1e9f82
7
+ data.tar.gz: fbd99665d588e48ad66a8544752ede7ba8376bca67c5dd85923a43e67c44331a04cfa5bce266a22fb7fd7d52bcf324c8183a819cb2aa44005f536a6db689fa8c
@@ -231,7 +231,7 @@ module Web3::Eth::Abi
231
231
 
232
232
  pos += 32
233
233
  else
234
- outputs[i] = data[pos, t.size]
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
@@ -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.map {|x| x[1...-1].to_i})
161
+ super('tuple', '', dims)
162
162
  @types = types
163
163
  @parsed_types = types.map{|t| Type.parse t}
164
164
  end
@@ -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
@@ -53,7 +53,7 @@ module Web3
53
53
 
54
54
  raise "Error code #{response.code} on request #{@uri.to_s} #{request.body}" unless response.kind_of? Net::HTTPOK
55
55
 
56
- body = JSON.parse(response.body)
56
+ body = JSON.parse(response.body, max_nesting: 1500)
57
57
 
58
58
  if body['result']
59
59
  body['result']
@@ -12,7 +12,7 @@ module Web3
12
12
  end
13
13
 
14
14
  def from_hex h
15
- h.nil? ? 0 : h.to_i(16)
15
+ h.nil? ? 0 : (h.kind_of?(String) ? h.to_i(16) : h)
16
16
  end
17
17
 
18
18
  def remove_0x_head(s)
@@ -1,5 +1,5 @@
1
1
  module Web3
2
2
  module Eth
3
- VERSION = "0.2.41"
3
+ VERSION = "0.2.46"
4
4
  end
5
5
  end
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.41
4
+ version: 0.2.46
5
5
  platform: ruby
6
6
  authors:
7
7
  - studnev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-02 00:00:00.000000000 Z
11
+ date: 2020-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rlp