web3-eth 0.2.16 → 0.2.17

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: de95829830c0a0696d4c9c908c0a39addc9d2b19
4
- data.tar.gz: 189703e994df7b14129b1e2e4b3a3d91be0ad6a0
3
+ metadata.gz: 4758d5a4540a14b447eb213e16092e860146af3f
4
+ data.tar.gz: 3a1ac8621164a3c9b89e87c70453bb2025d20222
5
5
  SHA512:
6
- metadata.gz: d35616136d1d6e347ccca1f77fdafbd7ff27feddd37ffffd55f0c6207b6ba951ff7a742d1db829f7f254f69de81cf7a379a89b49c94666bf642a68f19785173e
7
- data.tar.gz: da1329d8c379331f1a1a1ffdf0fee2664e71064aad11e6f57a6c26a3887eee9c99a3dbe6ec68339976804a7c50201040d31c1e46e53399d5a4556a71d94f60df
6
+ metadata.gz: ae81f830cab286398b126134345614421417b3ac279fed512403344f431192251faaacef0a85fc0bd3a89f4f5c2b48deb8ed095a9febef2744bca7ec9c79bb1f
7
+ data.tar.gz: 1102a1c92255349f489f4568b609df283e6e77ed97a866f23524cd6fd76ad3bed641304219a732f0634ec2d9472880bb28609fb8b49005bfeda59814fb69f8c3
@@ -248,7 +248,9 @@ module Web3::Eth::Abi
248
248
  end
249
249
 
250
250
  def decode_type(type, arg)
251
- if %w(string bytes).include?(type.base) && type.sub.empty?
251
+ if type.kind_of?(Tuple)
252
+ decode_abi(type.types, arg)
253
+ elsif %w(string bytes).include?(type.base) && type.sub.empty?
252
254
  l = Utils.big_endian_to_int arg[0,32]
253
255
  data = arg[32..-1]
254
256
  data[0, l]
@@ -12,6 +12,11 @@ module Web3::Eth::Abi
12
12
  # 256, 128x128, nil), array component (eg. [], [45], nil)
13
13
  #
14
14
  def parse(type)
15
+
16
+ if type =~ /^\((.*)\)((\[[0-9]*\])*)/
17
+ return Tuple.new $1.split(','), $2.scan(/\[[0-9]*\]/)
18
+ end
19
+
15
20
  _, base, sub, dimension = /([a-z]*)([0-9]*x?[0-9]*)((\[[0-9]*\])*)/.match(type).to_a
16
21
 
17
22
  dims = dimension.scan(/\[[0-9]*\]/)
@@ -115,4 +120,26 @@ module Web3::Eth::Abi
115
120
  end
116
121
 
117
122
  end
123
+
124
+ class Tuple < Type
125
+
126
+ attr_reader :types
127
+ def initialize types, dims
128
+ super('tuple', '', dims)
129
+ @types = types
130
+ end
131
+
132
+ def ==(another_type)
133
+ another_type.kind_of?(Tuple) &&
134
+ another_type.types == types &&
135
+ another_type.dims == dims
136
+ end
137
+
138
+ def size
139
+ nil
140
+ end
141
+
142
+
143
+ end
144
+
118
145
  end
@@ -35,12 +35,20 @@ module Web3
35
35
  @abi = abi
36
36
  @name = abi['name']
37
37
  @constant = !!abi['constant']
38
- @input_types = abi['inputs'].map{|a| a['type']}
39
- @output_types = abi['outputs'].map{|a| a['type']} if abi['outputs']
38
+ @input_types = abi['inputs'].map{|a| parse_component_type a }
39
+ @output_types = abi['outputs'].map{|a| parse_component_type a } if abi['outputs']
40
40
  @signature = Abi::Utils.function_signature @name, @input_types
41
41
  @signature_hash = Abi::Utils.signature_hash @signature, (abi['type']=='event' ? 64 : 8)
42
42
  end
43
43
 
44
+ def parse_component_type argument
45
+ if argument['type']=='tuple'
46
+ argument['components'] ? "(#{argument['components'].collect{|c| c['type'] }.join(',')})" : '()'
47
+ else
48
+ argument['type']
49
+ end
50
+ end
51
+
44
52
  def parse_event_args log
45
53
 
46
54
  log_data = remove_0x_head log.raw_data['data']
@@ -1,5 +1,5 @@
1
1
  module Web3
2
2
  module Eth
3
- VERSION = "0.2.16"
3
+ VERSION = "0.2.17"
4
4
  end
5
5
  end
data/web3-eth.gemspec CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
7
7
  spec.name = "web3-eth"
8
8
  spec.version = Web3::Eth::VERSION
9
9
  spec.authors = ["studnev"]
10
- spec.email = ["studnev@izx.io"]
10
+ spec.email = ["aleksey@bloxy.info"]
11
11
 
12
12
  spec.summary = %q{Web3 client to connect to Ethereum node by RPC.}
13
13
  spec.description = %q{Calling RPC methods of Ethereum node with Ruby.}
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.16
4
+ version: 0.2.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - studnev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-05-31 00:00:00.000000000 Z
11
+ date: 2018-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rlp
@@ -82,7 +82,7 @@ dependencies:
82
82
  version: '5.0'
83
83
  description: Calling RPC methods of Ethereum node with Ruby.
84
84
  email:
85
- - studnev@izx.io
85
+ - aleksey@bloxy.info
86
86
  executables: []
87
87
  extensions: []
88
88
  extra_rdoc_files: []
@@ -135,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
135
  version: '0'
136
136
  requirements: []
137
137
  rubyforge_project:
138
- rubygems_version: 2.6.10
138
+ rubygems_version: 2.5.2.3
139
139
  signing_key:
140
140
  specification_version: 4
141
141
  summary: Web3 client to connect to Ethereum node by RPC.