tezos_client 0.4.6 → 0.4.7

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: 9ea0bb8309ad037eaa79cd877cd344fa3a2dea0f12b3fe3efe1ded6e6089929e
4
- data.tar.gz: 6fccb50a5c5c5938d61eebd5d4c5556faceccb402f02b0c6688afb3a3f8ee337
3
+ metadata.gz: a21029dab6eb8b945102361e51011ad6a580d80cee4bffe390b3280ccc901976
4
+ data.tar.gz: 8c1fa53542e21120978dc47629709b32f0ecbfc944ced46a7b85e434d2051260
5
5
  SHA512:
6
- metadata.gz: 2df80a4c2f4a966d2e4bf885e2e024be442a343a0f92fd08e56fb81f4d75f70c27e25f03f8fd4e308fa3df28367cf4066d22cc733697b7f43e87a5d2c57b0578
7
- data.tar.gz: 0c3324c44fd398a91460b85cf1a1bebaed9764dc78445eb32c2c12a5e53fd319f6428291b047dc4fe427f383639e8cc378354f022294af224a39d8d2075a51db
6
+ metadata.gz: 7a0bbbdaca9dd25288db693b6543b4c6c7be52927f8a423704e85633cd51028b14c5d502ea75798365891a9ed5f89e6cce7a4e6076c1df86963bb29423cdd5a3
7
+ data.tar.gz: a9e05d491808f5ddb3649bcaf50cba40c9142814966c85deaa35d6a1892d6bc55f419bf02c145c5b50984a0f23d1f7eca957cf210485c000d860b2f2f8756cc5
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tezos_client (0.4.6)
4
+ tezos_client (0.4.7)
5
5
  activesupport (~> 5.2.3)
6
6
  base58 (~> 0.2.3)
7
7
  bip_mnemonic (~> 0.0.2)
@@ -52,6 +52,8 @@ class TezosClient
52
52
  end
53
53
 
54
54
  class TezBalanceTooLow < OperationFailure
55
+ FIRST_ERROR_REGEXP = /proto\.[^.]*\.contract\.balance_too_low/
56
+
55
57
  attr_reader :contract
56
58
  attr_reader :balance
57
59
  attr_reader :amount
@@ -69,21 +71,22 @@ class TezosClient
69
71
  end
70
72
 
71
73
  class ScriptRuntimeError < OperationFailure
74
+ FIRST_ERROR_REGEXP = /proto.\d*-\w*\.(scriptRejectedRuntimeError|michelson_v\d\.runtime_error)/
75
+ ERROR_REGEXP = /proto.\d*-\w*\.(scriptRejectedRuntimeError|michelson_v\d\.script_rejected)/
76
+
72
77
  attr_reader :location
73
78
  attr_reader :with
74
79
  attr_reader :contract
75
80
 
76
81
  def initialize(metadata:, errors:, status:)
77
- error = errors[0]
78
- rejection_error = errors.detect { |error| error[:id] == "proto.003-PsddFKi3.scriptRejectedRuntimeError" }
82
+ first_error = errors[0]
83
+ rejection_error = errors.detect { |error| error[:id].match? ERROR_REGEXP }
79
84
 
80
85
  @location = rejection_error[:location]
81
- @contract = error[:contractHandle]
86
+ @contract = first_error[:contractHandle]
82
87
  @with = rejection_error[:with]
83
88
  @message = "Script runtime Error when executing #{contract}: #{with} (location: #{location})"
84
89
  super
85
90
  end
86
91
  end
87
-
88
-
89
- end
92
+ end
@@ -164,9 +164,9 @@ class TezosClient
164
164
  def exception_klass(errors)
165
165
  error = errors[0]
166
166
  case error[:id]
167
- when /proto\.[^.]*\.contract\.balance_too_low/
167
+ when TezBalanceTooLow::FIRST_ERROR_REGEXP
168
168
  TezBalanceTooLow
169
- when /proto\.[^.]*\.scriptRuntimeError/
169
+ when ScriptRuntimeError::FIRST_ERROR_REGEXP
170
170
  ScriptRuntimeError
171
171
  else
172
172
  OperationFailure
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class TezosClient
4
- VERSION = "0.4.6"
4
+ VERSION = "0.4.7"
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.6
4
+ version: 0.4.7
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-09-11 00:00:00.000000000 Z
11
+ date: 2019-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler