tezos_client 0.2.1 → 0.2.2

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: a192811cdc281656ad008df4408d830283c77f7ccf66150c0282005a68505f7c
4
- data.tar.gz: d1c9561af9631e8db8c54b867983efc0e0c54c0628a8f88354fc0a0d55e861dd
3
+ metadata.gz: ffefe0d089bcd17b9465df8a4e4b7409d618679a9578c1458390860019bf0d70
4
+ data.tar.gz: a42e73bfeb06305e2036eaeb64aedb8d6f91b87588b80fe250f02539d23a92e9
5
5
  SHA512:
6
- metadata.gz: 334a46f80c4e6873dbd587413589d343eaba149881f6b99dcc44c658f5c904fded810ed938748aa3085bcd70db198f74564ae1e2e5a2099a6d55b40e2c425569
7
- data.tar.gz: bc6a850b461d0608f82d1929745a5c34493f4c34365e4018e3bcc1ee6f3ab7e8b26613d540e05556932166a7e6af3c4fea3db60e663898bef25518ba6593810d
6
+ metadata.gz: ecc48bac51f93003aeaf99e7b3b18098621d0bf0163c1c8547b4284e36995b76d9955e3bd35b52c608b01c90d961a35db2c89d54cbaa880539633f7b4cd8abd9
7
+ data.tar.gz: 5660b04412502fd92d95fc54e411afd7c542cc002b2f5e5e817d359d8fd076ada260284037d5e5cd3e9976142ce941cabfd7d13e0385f01ab36235e3e6cba149
data/.travis.yml CHANGED
@@ -1,7 +1,8 @@
1
1
  ---
2
2
  dist: trusty
3
3
  sudo: required
4
- language: ruby
4
+ #language: ruby
5
+ language: ocaml
5
6
  cache:
6
7
  bundler: true
7
8
  directories:
@@ -17,5 +18,4 @@ before_install:
17
18
  - sh travis-scripts/install-liquidity.sh
18
19
  - gem install bundler -v 1.16.3
19
20
  script:
20
- - eval $(opam config env)
21
21
  - bundle exec rake
data/Gemfile.lock CHANGED
@@ -11,20 +11,20 @@ PATH
11
11
  GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
- actionpack (5.2.1)
15
- actionview (= 5.2.1)
16
- activesupport (= 5.2.1)
14
+ actionpack (5.2.2)
15
+ actionview (= 5.2.2)
16
+ activesupport (= 5.2.2)
17
17
  rack (~> 2.0)
18
18
  rack-test (>= 0.6.3)
19
19
  rails-dom-testing (~> 2.0)
20
20
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
21
- actionview (5.2.1)
22
- activesupport (= 5.2.1)
21
+ actionview (5.2.2)
22
+ activesupport (= 5.2.2)
23
23
  builder (~> 3.1)
24
24
  erubi (~> 1.4)
25
25
  rails-dom-testing (~> 2.0)
26
26
  rails-html-sanitizer (~> 1.0, >= 1.0.3)
27
- activesupport (5.2.1)
27
+ activesupport (5.2.2)
28
28
  concurrent-ruby (~> 1.0, >= 1.0.2)
29
29
  i18n (>= 0.7, < 2)
30
30
  minitest (~> 5.1)
@@ -34,42 +34,43 @@ GEM
34
34
  ast (2.4.0)
35
35
  base58 (0.2.3)
36
36
  builder (3.2.3)
37
- concurrent-ruby (1.0.5)
37
+ concurrent-ruby (1.1.4)
38
38
  crack (0.4.3)
39
39
  safe_yaml (~> 1.0.0)
40
40
  crass (1.0.4)
41
41
  diff-lcs (1.3)
42
42
  domain_name (0.5.20180417)
43
43
  unf (>= 0.0.5, < 1.0.0)
44
- erubi (1.7.1)
45
- ffi (1.9.25)
46
- hashdiff (0.3.7)
44
+ erubi (1.8.0)
45
+ ffi (1.10.0)
46
+ hashdiff (0.3.8)
47
47
  http-cookie (1.0.3)
48
48
  domain_name (~> 0.5)
49
- httparty (0.16.2)
49
+ httparty (0.16.3)
50
+ mime-types (~> 3.0)
50
51
  multi_xml (>= 0.5.2)
51
- i18n (1.1.0)
52
+ i18n (1.5.1)
52
53
  concurrent-ruby (~> 1.0)
53
- jaro_winkler (1.5.1)
54
- loofah (2.2.2)
54
+ jaro_winkler (1.5.2)
55
+ loofah (2.2.3)
55
56
  crass (~> 1.0.2)
56
57
  nokogiri (>= 1.5.9)
57
- method_source (0.9.0)
58
+ method_source (0.9.2)
58
59
  mime-types (3.2.2)
59
60
  mime-types-data (~> 3.2015)
60
61
  mime-types-data (3.2018.0812)
61
- mini_portile2 (2.3.0)
62
+ mini_portile2 (2.4.0)
62
63
  minitest (5.11.3)
63
64
  multi_xml (0.6.0)
64
65
  netrc (0.11.0)
65
- nokogiri (1.8.4)
66
- mini_portile2 (~> 2.3.0)
66
+ nokogiri (1.10.0)
67
+ mini_portile2 (~> 2.4.0)
67
68
  parallel (1.12.1)
68
- parser (2.5.1.2)
69
+ parser (2.5.3.0)
69
70
  ast (~> 2.4.0)
70
71
  powerpack (0.1.2)
71
72
  public_suffix (3.0.3)
72
- rack (2.0.5)
73
+ rack (2.0.6)
73
74
  rack-test (1.1.0)
74
75
  rack (>= 1.0, < 3)
75
76
  rails-dom-testing (2.0.3)
@@ -77,9 +78,9 @@ GEM
77
78
  nokogiri (>= 1.6)
78
79
  rails-html-sanitizer (1.0.4)
79
80
  loofah (~> 2.2, >= 2.2.2)
80
- railties (5.2.1)
81
- actionpack (= 5.2.1)
82
- activesupport (= 5.2.1)
81
+ railties (5.2.2)
82
+ actionpack (= 5.2.2)
83
+ activesupport (= 5.2.2)
83
84
  method_source
84
85
  rake (>= 0.8.7)
85
86
  thor (>= 0.19.0, < 2.0)
@@ -91,42 +92,42 @@ GEM
91
92
  http-cookie (>= 1.0.2, < 2.0)
92
93
  mime-types (>= 1.16, < 4.0)
93
94
  netrc (~> 0.8)
94
- rspec (3.7.0)
95
- rspec-core (~> 3.7.0)
96
- rspec-expectations (~> 3.7.0)
97
- rspec-mocks (~> 3.7.0)
98
- rspec-core (3.7.1)
99
- rspec-support (~> 3.7.0)
100
- rspec-expectations (3.7.0)
95
+ rspec (3.8.0)
96
+ rspec-core (~> 3.8.0)
97
+ rspec-expectations (~> 3.8.0)
98
+ rspec-mocks (~> 3.8.0)
99
+ rspec-core (3.8.0)
100
+ rspec-support (~> 3.8.0)
101
+ rspec-expectations (3.8.2)
101
102
  diff-lcs (>= 1.2.0, < 2.0)
102
- rspec-support (~> 3.7.0)
103
- rspec-mocks (3.7.0)
103
+ rspec-support (~> 3.8.0)
104
+ rspec-mocks (3.8.0)
104
105
  diff-lcs (>= 1.2.0, < 2.0)
105
- rspec-support (~> 3.7.0)
106
- rspec-support (3.7.1)
107
- rubocop (0.58.2)
106
+ rspec-support (~> 3.8.0)
107
+ rspec-support (3.8.0)
108
+ rubocop (0.62.0)
108
109
  jaro_winkler (~> 1.5.1)
109
110
  parallel (~> 1.10)
110
111
  parser (>= 2.5, != 2.5.1.1)
111
112
  powerpack (~> 0.1)
112
113
  rainbow (>= 2.2.2, < 4.0)
113
114
  ruby-progressbar (~> 1.7)
114
- unicode-display_width (~> 1.0, >= 1.0.1)
115
- rubocop-rails_config (0.2.3)
115
+ unicode-display_width (~> 1.4.0)
116
+ rubocop-rails_config (0.4.0)
116
117
  railties (>= 3.0)
117
- rubocop (~> 0.56)
118
+ rubocop (~> 0.58)
118
119
  ruby-progressbar (1.10.0)
119
120
  safe_yaml (1.0.4)
120
- thor (0.20.0)
121
+ thor (0.20.3)
121
122
  thread_safe (0.3.6)
122
123
  tzinfo (1.2.5)
123
124
  thread_safe (~> 0.1)
124
125
  unf (0.1.4)
125
126
  unf_ext
126
127
  unf_ext (0.0.7.5)
127
- unicode-display_width (1.4.0)
128
+ unicode-display_width (1.4.1)
128
129
  vcr (4.0.0)
129
- webmock (3.4.2)
130
+ webmock (3.5.1)
130
131
  addressable (>= 2.3.6)
131
132
  crack (>= 0.3.2)
132
133
  hashdiff
@@ -51,7 +51,8 @@ class TezosClient
51
51
  run_result = run
52
52
 
53
53
  @operation_args[:gas_limit] = run_result[:consumed_gas] + 0.01
54
- @operation_args[:storage_limit] = run_result[:consumed_storage]
54
+ #@operation_args[:storage_limit] = run_result[:consumed_storage]
55
+ @operation_args[:storage_limit] = 0.006
55
56
  end
56
57
 
57
58
  def to_hex
@@ -105,10 +106,21 @@ class TezosClient
105
106
  def run
106
107
  rpc_response = rpc_interface.run_operation(**operation_args, signature: base_58_signature)
107
108
 
108
- operation_result = ensure_applied!(rpc_response)
109
+ consumed_storage = 0
110
+ consumed_gas = 0
109
111
 
110
- consumed_storage = operation_result.fetch(:paid_storage_size_diff, "0").to_i.from_satoshi
111
- consumed_gas = operation_result.fetch(:consumed_gas, "0").to_i.from_satoshi
112
+ operation_result = ensure_applied!(rpc_response) do |result|
113
+ consumed_storage = (result.dig(:operation_result, :paid_storage_size_diff) || "0").to_i.from_satoshi
114
+ consumed_gas = (result.dig(:operation_result, :consumed_gas) || "0").to_i.from_satoshi
115
+
116
+ unless result[:internal_operation_results].nil?
117
+ result[:internal_operation_results].each do |internal_operation_result|
118
+ consumed_gas += (internal_operation_result[:result][:consumed_gas] || "0").to_i.from_satoshi
119
+ end
120
+ end
121
+
122
+ result[:operation_result]
123
+ end
112
124
 
113
125
  {
114
126
  status: :applied,
@@ -138,7 +150,11 @@ class TezosClient
138
150
  operation_result = rpc_response[:metadata][:operation_result]
139
151
  status = operation_result[:status]
140
152
  raise "Operation status != 'applied': #{status}\n #{rpc_response.pretty_inspect}" if status != "applied"
141
- operation_result
153
+ if block_given?
154
+ yield rpc_response[:metadata]
155
+ else
156
+ operation_result
157
+ end
142
158
  end
143
159
  end
144
160
  end
@@ -30,7 +30,7 @@ class TezosClient
30
30
 
31
31
  def default_args
32
32
  {
33
- gas_limit: 0.04,
33
+ gas_limit: 0.1,
34
34
  storage_limit: 0.006,
35
35
  fee: 0.05
36
36
  }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class TezosClient
4
- VERSION = "0.2.1"
4
+ VERSION = "0.2.2"
5
5
  end
@@ -4,22 +4,23 @@
4
4
  # BTW, it also show some needed system packages to build liquidity
5
5
  # Travis CI is done on Ubuntu trusty
6
6
 
7
- [ -d liquidity ] || git clone --depth=50 https://github.com/OCamlPro/liquidity.git liquidity
7
+ [ -d "liquidity/.git" ] || git clone --depth=50 https://github.com/OCamlPro/liquidity.git liquidity
8
8
  cd liquidity
9
9
  git pull
10
10
  git checkout next
11
11
 
12
12
  # currently, we only target OCaml 4.06.1 because we reuse the parser of OCaml
13
- opam switch create liquidity 4.06.1
13
+ opam switch create liquidity 4.06.1 || opam switch set liquidity
14
14
 
15
- eval $(opam config env)
15
+ eval `opam config env`
16
16
  opam update
17
- eval $(opam config env)
17
+ eval `opam config env`
18
18
 
19
- make build-deps
20
19
  make clone-tezos
21
20
  tezos/scripts/install_build_deps.raw.sh
22
- # make -C tezos build-deps
21
+
22
+ cd tezos && make build-deps all install && cd -
23
+ make build-deps
23
24
 
24
25
  make
25
26
  make install
@@ -4,13 +4,13 @@
4
4
  # Travis CI is done on Ubuntu trusty
5
5
 
6
6
  sudo apt-get update -qq
7
- sudo apt-get install -y -qq libgmp-dev pandoc # ocaml ocaml-native-compilers
7
+ sudo apt-get install -y -qq libgmp-dev pandoc make m4 gcc aspcud curl # ocaml ocaml-native-compilers
8
8
 
9
9
  # do this in a second step to only install libsecp256k1-dev libsecp256k1-0
10
10
  # for ubuntu, these packages are not available in trusty
11
- sudo add-apt-repository "deb http://cz.archive.ubuntu.com/ubuntu artful main universe"
11
+ sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu artful main universe"
12
12
  sudo apt-get update -qq
13
13
  sudo apt-get install -y -qq \
14
14
  libsecp256k1-dev libsecp256k1-0 libsodium-dev libssl-dev \
15
- bubblewrap libev-dev libhidapi-dev
15
+ bubblewrap libev-dev libhidapi-dev pkg-config
16
16
 
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.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pierre Michard
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-10-12 00:00:00.000000000 Z
11
+ date: 2019-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler