tezos_client 1.2.0 → 1.2.1

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
  SHA256:
3
- metadata.gz: b34f7593bef70d5be1219dd4beba9e00f6114da81783148585312cd32eeb82e8
4
- data.tar.gz: 862385f6e2fbf82ac12ab9ce912939b9a9499a10a856d447da5d9878afc08ce5
3
+ metadata.gz: 37c983e5bf0b57cb2d3758165076d7c17e091214c61401b5107989fab6b3e09f
4
+ data.tar.gz: 301462a20464486d1ad37bf0708aa00d1e2db30105f1944eacc4dbd67074d6a8
5
5
  SHA512:
6
- metadata.gz: fbf5f33ee51bc2a45edaed55c67bfa7d58addbcc5668eb87198765cdfd50e387bda96769ef238f63011c78e66f802efc89ef293cdd2fb57d9f50de8e0ad2fa45
7
- data.tar.gz: 83682fe26418295979576a1a88d66d5b1af082ca2e4195b47286ccaf1a1cc3c24470a4b5ded42b0062bf17d97ad9ded3d5e1768f645c2985c9c683f9395b5c80
6
+ metadata.gz: ec1a70b4066f70964182d811877cc6a2cad18ae95403a4a86e3e3758a35413922c85115fcf7e3c26edaf9e34f1d27f00f5a109c4050dfa9cc001479a3916b570
7
+ data.tar.gz: 3e2d3c82e9b811990f2682f7d4ce8992c1399850f43dfa587d0fe9f5f2c88f3307235792677210d8c71348ae0d9f083844e7617b194c851e6bbbf2b1c86a2bc3
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tezos_client (1.2.0)
4
+ tezos_client (1.2.1)
5
5
  active_interaction (~> 3.7)
6
6
  activesupport (~> 6.0.0)
7
7
  base58 (~> 0.2.3)
@@ -14,40 +14,40 @@ PATH
14
14
  GEM
15
15
  remote: https://rubygems.org/
16
16
  specs:
17
- actionpack (6.0.0)
18
- actionview (= 6.0.0)
19
- activesupport (= 6.0.0)
20
- rack (~> 2.0)
17
+ actionpack (6.0.2.2)
18
+ actionview (= 6.0.2.2)
19
+ activesupport (= 6.0.2.2)
20
+ rack (~> 2.0, >= 2.0.8)
21
21
  rack-test (>= 0.6.3)
22
22
  rails-dom-testing (~> 2.0)
23
23
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
24
- actionview (6.0.0)
25
- activesupport (= 6.0.0)
24
+ actionview (6.0.2.2)
25
+ activesupport (= 6.0.2.2)
26
26
  builder (~> 3.1)
27
27
  erubi (~> 1.4)
28
28
  rails-dom-testing (~> 2.0)
29
29
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
30
30
  active_interaction (3.8.0)
31
31
  activemodel (>= 4, < 7)
32
- activemodel (6.0.0)
33
- activesupport (= 6.0.0)
34
- activesupport (6.0.0)
32
+ activemodel (6.0.2.2)
33
+ activesupport (= 6.0.2.2)
34
+ activesupport (6.0.2.2)
35
35
  concurrent-ruby (~> 1.0, >= 1.0.2)
36
36
  i18n (>= 0.7, < 2)
37
37
  minitest (~> 5.1)
38
38
  tzinfo (~> 1.1)
39
- zeitwerk (~> 2.1, >= 2.1.8)
39
+ zeitwerk (~> 2.2)
40
40
  addressable (2.7.0)
41
41
  public_suffix (>= 2.0.2, < 5.0)
42
42
  ast (2.4.0)
43
43
  base58 (0.2.3)
44
44
  bip_mnemonic (0.0.4)
45
- builder (3.2.3)
45
+ builder (3.2.4)
46
46
  coderay (1.1.2)
47
- concurrent-ruby (1.1.5)
47
+ concurrent-ruby (1.1.6)
48
48
  crack (0.4.3)
49
49
  safe_yaml (~> 1.0.0)
50
- crass (1.0.5)
50
+ crass (1.0.6)
51
51
  diff-lcs (1.3)
52
52
  domain_name (0.5.20190701)
53
53
  unf (>= 0.0.5, < 1.0.0)
@@ -59,10 +59,10 @@ GEM
59
59
  httparty (0.17.3)
60
60
  mime-types (~> 3.0)
61
61
  multi_xml (>= 0.5.2)
62
- i18n (1.7.0)
62
+ i18n (1.8.2)
63
63
  concurrent-ruby (~> 1.0)
64
64
  jaro_winkler (1.5.3)
65
- loofah (2.3.1)
65
+ loofah (2.4.0)
66
66
  crass (~> 1.0.2)
67
67
  nokogiri (>= 1.5.9)
68
68
  method_source (0.9.2)
@@ -70,12 +70,12 @@ GEM
70
70
  mime-types-data (~> 3.2015)
71
71
  mime-types-data (3.2019.1009)
72
72
  mini_portile2 (2.4.0)
73
- minitest (5.13.0)
73
+ minitest (5.14.0)
74
74
  money-tree (0.10.0)
75
75
  ffi
76
76
  multi_xml (0.6.0)
77
77
  netrc (0.11.0)
78
- nokogiri (1.10.8)
78
+ nokogiri (1.10.9)
79
79
  mini_portile2 (~> 2.4.0)
80
80
  parallel (1.18.0)
81
81
  parser (2.6.5.0)
@@ -84,7 +84,7 @@ GEM
84
84
  coderay (~> 1.1.0)
85
85
  method_source (~> 0.9.0)
86
86
  public_suffix (4.0.1)
87
- rack (2.0.8)
87
+ rack (2.2.2)
88
88
  rack-test (1.1.0)
89
89
  rack (>= 1.0, < 3)
90
90
  rails-dom-testing (2.0.3)
@@ -92,9 +92,9 @@ GEM
92
92
  nokogiri (>= 1.6)
93
93
  rails-html-sanitizer (1.3.0)
94
94
  loofah (~> 2.3)
95
- railties (6.0.0)
96
- actionpack (= 6.0.0)
97
- activesupport (= 6.0.0)
95
+ railties (6.0.2.2)
96
+ actionpack (= 6.0.2.2)
97
+ activesupport (= 6.0.2.2)
98
98
  method_source
99
99
  rake (>= 0.8.7)
100
100
  thor (>= 0.20.3, < 2.0)
@@ -138,9 +138,9 @@ GEM
138
138
  rubocop-rails (~> 2.0)
139
139
  ruby-progressbar (1.10.1)
140
140
  safe_yaml (1.0.5)
141
- thor (0.20.3)
141
+ thor (1.0.1)
142
142
  thread_safe (0.3.6)
143
- tzinfo (1.2.5)
143
+ tzinfo (1.2.6)
144
144
  thread_safe (~> 0.1)
145
145
  unf (0.1.4)
146
146
  unf_ext
@@ -151,7 +151,7 @@ GEM
151
151
  addressable (>= 2.3.6)
152
152
  crack (>= 0.3.2)
153
153
  hashdiff (>= 0.4.0, < 2.0.0)
154
- zeitwerk (2.2.1)
154
+ zeitwerk (2.3.0)
155
155
 
156
156
  PLATFORMS
157
157
  ruby
@@ -184,7 +184,8 @@ class TezosClient
184
184
  operations: rpc_operation_args,
185
185
  signature: base_58_signature,
186
186
  protocol: protocol,
187
- branch: branch)
187
+ branch: branch
188
+ )
188
189
 
189
190
  ensure_applied!(rpc_responses)
190
191
 
@@ -237,4 +238,4 @@ class TezosClient
237
238
  raise exception_klass(errors).new(metadata: metadata, errors: errors, status: status)
238
239
  end
239
240
  end
240
- end
241
+ end
@@ -13,7 +13,6 @@ class TezosClient
13
13
  def execute
14
14
  TezosClient::Tools::ConvertToHash::Base.new(data: data, type: type).value
15
15
  end
16
-
17
16
  end
18
17
  end
19
18
  end
@@ -26,4 +26,4 @@ class TezosClient
26
26
  end
27
27
  end
28
28
  end
29
- end
29
+ end
@@ -3,7 +3,6 @@
3
3
  class TezosClient
4
4
  module Tools
5
5
  class ConvertToHash < ActiveInteraction::Base
6
-
7
6
  class Base
8
7
  def initialize(data:, type:)
9
8
  @data = data
@@ -17,34 +16,35 @@ class TezosClient
17
16
  end
18
17
 
19
18
  protected
19
+ def decode
20
+ klass.new(
21
+ data: data,
22
+ type: type
23
+ ).decode
20
24
 
21
- def decode
22
- klass.new(data: data, type: type).decode
23
-
24
- rescue NameError
25
- raise NotImplementedError, "type '#{type[:prim]}' not implemented"
26
- end
25
+ rescue NameError => e
26
+ raise NotImplementedError, "type '#{type[:prim]}' not implemented"
27
+ end
27
28
 
28
- def anonymous?
29
- !(type.key?(:annots) && type[:annots].any?)
30
- end
29
+ def anonymous?
30
+ !(type.key?(:annots) && type[:annots].any?)
31
+ end
31
32
 
32
- def var_name_annot
33
- type[:annots].first
34
- end
33
+ def var_name_annot
34
+ type[:annots].first
35
+ end
35
36
 
36
- def var_name
37
- return nil if anonymous?
37
+ def var_name
38
+ return nil if anonymous?
38
39
 
39
- "#{var_name_annot[1..-1]}".to_sym
40
- end
40
+ "#{var_name_annot[1..-1]}".to_sym
41
+ end
41
42
 
42
43
  private
43
-
44
- def klass
45
- "TezosClient::Tools::ConvertToHash::#{type[:prim].camelize}".constantize
46
- end
44
+ def klass
45
+ "TezosClient::Tools::ConvertToHash::#{type[:prim].camelize}".constantize
46
+ end
47
47
  end
48
48
  end
49
49
  end
50
- end
50
+ end
@@ -17,4 +17,4 @@ class TezosClient
17
17
  end
18
18
  end
19
19
  end
20
- end
20
+ end
@@ -10,4 +10,4 @@ class TezosClient
10
10
  end
11
11
  end
12
12
  end
13
- end
13
+ end
@@ -10,4 +10,4 @@ class TezosClient
10
10
  end
11
11
  end
12
12
  end
13
- end
13
+ end
@@ -24,4 +24,4 @@ class TezosClient
24
24
  end
25
25
  end
26
26
  end
27
- end
27
+ end
@@ -19,4 +19,4 @@ class TezosClient
19
19
  end
20
20
  end
21
21
  end
22
- end
22
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ class TezosClient
4
+ module Tools
5
+ class ConvertToHash < ActiveInteraction::Base
6
+ class Map < Base
7
+ def decode
8
+ new_map = {}
9
+
10
+ data.each do |elem|
11
+ raise "Not a 'Map' type" unless elem[:prim] == "Elt"
12
+
13
+ key = TezosClient::Tools::ConvertToHash::Base.new(
14
+ data: elem[:args].first,
15
+ type: type[:args].first
16
+ ).value
17
+
18
+ value = TezosClient::Tools::ConvertToHash::Base.new(
19
+ data: elem[:args].second,
20
+ type: type[:args].second
21
+ ).value
22
+
23
+ new_map[key] = value
24
+ end
25
+
26
+ new_map
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -10,4 +10,4 @@ class TezosClient
10
10
  end
11
11
  end
12
12
  end
13
- end
13
+ end
@@ -18,4 +18,4 @@ class TezosClient
18
18
  end
19
19
  end
20
20
  end
21
- end
21
+ end
@@ -16,4 +16,4 @@ class TezosClient
16
16
  end
17
17
  end
18
18
  end
19
- end
19
+ end
@@ -10,4 +10,4 @@ class TezosClient
10
10
  end
11
11
  end
12
12
  end
13
- end
13
+ end
@@ -5,9 +5,15 @@ class TezosClient
5
5
  class ConvertToHash < ActiveInteraction::Base
6
6
  class Timestamp < Base
7
7
  def decode
8
- Time.zone.at(data[:int].to_i)
8
+ if data.key? :int
9
+ Time.zone.at(data[:int].to_i)
10
+ elsif data.key? :string
11
+ Time.zone.parse(data[:string])
12
+ else
13
+ raise "Can not convert timestamp: #{data}"
14
+ end
9
15
  end
10
16
  end
11
17
  end
12
18
  end
13
- end
19
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class TezosClient
4
- VERSION = "1.2.0"
4
+ VERSION = "1.2.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tezos_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pierre Michard
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-09 00:00:00.000000000 Z
11
+ date: 2020-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -282,6 +282,7 @@ files:
282
282
  - lib/tezos_client/tools/convert_to_hash/int.rb
283
283
  - lib/tezos_client/tools/convert_to_hash/key.rb
284
284
  - lib/tezos_client/tools/convert_to_hash/list.rb
285
+ - lib/tezos_client/tools/convert_to_hash/map.rb
285
286
  - lib/tezos_client/tools/convert_to_hash/nat.rb
286
287
  - lib/tezos_client/tools/convert_to_hash/pair.rb
287
288
  - lib/tezos_client/tools/convert_to_hash/signature.rb
@@ -313,8 +314,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
313
314
  - !ruby/object:Gem::Version
314
315
  version: '0'
315
316
  requirements: []
316
- rubyforge_project:
317
- rubygems_version: 2.7.6
317
+ rubygems_version: 3.0.6
318
318
  signing_key:
319
319
  specification_version: 4
320
320
  summary: Wrapper to the tezos client.