tezos_client 0.4.3 → 0.4.4

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: d4c5dad55f0b785342d0811d8edd1ec74d1a5e1047f05fef7e40d6854544dab0
4
- data.tar.gz: ce42e736d7548502ed98b60758afcf49817394628df4a213706336c1caaf3274
3
+ metadata.gz: c7de27ae0b52ebd19a4fd74e3407aaa54fcdbcdc7b542039254618cf58c94baa
4
+ data.tar.gz: 6b4dae6eb590b8e3b54ef27086d873e2fbf83c7bf83406ed417e8f0fa9fcfb0f
5
5
  SHA512:
6
- metadata.gz: b448257c40fb3b65ca97fa9064fc12baaff43d4616caf2ea5862d84e6279ad8682fa9dfcef57cb98bf074bec80777eb5950f7c1649bbb5cc4799091c20e6b69c
7
- data.tar.gz: 9c1bcaf5c70e3e32fb5c5942e50f05a823f41c2826029c5b2dffa6cdea8c7146d66083c20a49aa8f3745fe533a6285dbb2bcac131d1c194c7e67ea0a69d94688
6
+ metadata.gz: e94b9ab12a4616933d9ed59ad83d55087ee70e566972eb4153bf70f4b43ae6825bf790b8a5a890c2ea2969d51be481d89f09e501fbabed18eaa737648d07b6ee
7
+ data.tar.gz: bcf9bf6ee40167ea0be0064f5b5f0e526673309389505ef1b504070accb35d454d8eb03bb5c2e2a973f2cf1243c9f3d35679b22f73bd0799d321773984a0c092
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tezos_client (0.4.3)
4
+ tezos_client (0.4.4)
5
5
  activesupport (~> 5.2.0)
6
6
  base58 (~> 0.2.3)
7
7
  bip_mnemonic (~> 0.0.2)
@@ -42,7 +42,7 @@ GEM
42
42
  safe_yaml (~> 1.0.0)
43
43
  crass (1.0.4)
44
44
  diff-lcs (1.3)
45
- domain_name (0.5.20180417)
45
+ domain_name (0.5.20190701)
46
46
  unf (>= 0.0.5, < 1.0.0)
47
47
  erubi (1.8.0)
48
48
  ffi (1.11.1)
@@ -96,9 +96,10 @@ class TezosClient
96
96
  consumed_storage = 0
97
97
  consumed_gas = 0
98
98
 
99
+ ensure_applied!(rpc_responses)
100
+
99
101
  operations_result = rpc_responses.map do |rpc_response|
100
102
  metadata = rpc_response[:metadata]
101
- ensure_applied!(metadata)
102
103
  consumed_storage += compute_consumed_storage(metadata)
103
104
  consumed_gas += compute_consumed_gas(metadata)
104
105
  metadata[:operation_result]
@@ -135,9 +136,7 @@ class TezosClient
135
136
  protocol: protocol,
136
137
  branch: branch)
137
138
 
138
- rpc_responses.map do |rpc_response|
139
- ensure_applied!(rpc_response[:metadata])
140
- end
139
+ ensure_applied!(rpc_responses)
141
140
  end
142
141
 
143
142
  def broadcast
@@ -146,25 +145,28 @@ class TezosClient
146
145
 
147
146
  private
148
147
 
149
- def ensure_applied!(metadata)
150
- operation_result = metadata[:operation_result]
148
+ def ensure_applied!(rpc_responses)
149
+ operation_results = rpc_responses.map { |response| response[:metadata][:operation_result] }
151
150
 
152
- unless operation_result.nil?
153
- status = operation_result[:status]
154
- if status != "applied"
155
- failed!(status, operation_result[:errors], metadata)
156
- end
151
+ failed = operation_results.detect do |operation_result|
152
+ operation_result != nil && operation_result[:status] != "applied"
153
+ end
154
+
155
+ return operation_results if failed.nil?
156
+
157
+ failed_operation_result = operation_results.detect do |operation_result|
158
+ operation_result[:status] == "failed"
157
159
  end
158
160
 
159
- operation_result
161
+ failed!("failed", failed_operation_result[:errors], operation_results)
160
162
  end
161
163
 
162
164
  def exception_klass(errors)
163
165
  error = errors[0]
164
166
  case error[:id]
165
- when "proto.003-PsddFKi3.contract.balance_too_low"
167
+ when /proto\.[^.]*\.contract\.balance_too_low/
166
168
  TezBalanceTooLow
167
- when "proto.003-PsddFKi3.scriptRuntimeError"
169
+ when /proto\.[^.]*\.scriptRuntimeError/
168
170
  ScriptRuntimeError
169
171
  else
170
172
  OperationFailure
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class TezosClient
4
- VERSION = "0.4.3"
4
+ VERSION = "0.4.4"
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: 0.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pierre Michard
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-06-27 00:00:00.000000000 Z
11
+ date: 2019-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler