tezos_client 1.3.2 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -5
- data/Gemfile.lock +84 -74
- data/README.md +15 -37
- data/lib/tezos_client.rb +5 -3
- data/lib/tezos_client/crypto.rb +1 -1
- data/lib/tezos_client/logger.rb +1 -1
- data/lib/tezos_client/smartpy_interface.rb +39 -7
- data/lib/tezos_client/tools/annots_to_type.rb +31 -8
- data/lib/tezos_client/tools/convert_to_hash.rb +2 -2
- data/lib/tezos_client/tools/convert_to_hash/base.rb +1 -1
- data/lib/tezos_client/tools/convert_to_hash/big_map.rb +13 -6
- data/lib/tezos_client/tools/convert_to_hash/key.rb +11 -11
- data/lib/tezos_client/tools/convert_to_hash/timestamp.rb +2 -0
- data/lib/tezos_client/tools/hash_to_micheline.rb +12 -60
- data/lib/tezos_client/tools/hash_to_micheline/address.rb +14 -0
- data/lib/tezos_client/tools/hash_to_micheline/base.rb +52 -0
- data/lib/tezos_client/tools/hash_to_micheline/bytes.rb +14 -0
- data/lib/tezos_client/tools/hash_to_micheline/contract.rb +14 -0
- data/lib/tezos_client/tools/hash_to_micheline/int.rb +13 -0
- data/lib/tezos_client/tools/hash_to_micheline/key.rb +14 -0
- data/lib/tezos_client/tools/hash_to_micheline/nat.rb +13 -0
- data/lib/tezos_client/tools/hash_to_micheline/option.rb +23 -0
- data/lib/tezos_client/tools/hash_to_micheline/pair.rb +45 -0
- data/lib/tezos_client/tools/hash_to_micheline/signature.rb +14 -0
- data/lib/tezos_client/tools/hash_to_micheline/string.rb +14 -0
- data/lib/tezos_client/tools/hash_to_micheline/timestamp.rb +14 -0
- data/lib/tezos_client/version.rb +1 -1
- data/tezos_client.gemspec +5 -5
- data/travis-scripts/prepare-ubuntu.sh +6 -1
- metadata +25 -10
- data/lib/tezos_client/smartpy_inteface/micheline_serializer_wrapper.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92a3126df9c366800e22df7dceda0ac25f30ea97d53dd98aa9497d208047d428
|
4
|
+
data.tar.gz: 8eebd23077fe8aa0d6f79ed4620c40554aad2ce1ca7d9d0ffc63fb0b963c2559
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1d9dcffed8b093bbac4973667441caf9c665c4228f8119f72fe7e3593bc50422d9b11198a907521e911401ca464d9dd0dff975be2d77dc57e7cd8ee5639d7be
|
7
|
+
data.tar.gz: 68ffadaed7188bf5927e844213134de291e55230817c6340c4492b37181dbc520b460522a938faafa6a6eeeee759446bc858e19ffe4011b040eeddbae24b2db6
|
data/.travis.yml
CHANGED
@@ -13,11 +13,8 @@ rvm:
|
|
13
13
|
before_install:
|
14
14
|
- sh travis-scripts/prepare-ubuntu.sh
|
15
15
|
- mkdir -p $HOME/bin
|
16
|
-
- curl -s https://smartpy.io/
|
17
|
-
-
|
18
|
-
- ./SmartPy.sh local-install-auto $HOME/bin/smartpy/cli
|
19
|
-
- rm ./SmartPy.sh
|
20
|
-
- export PATH="$PATH:$HOME/bin/:$HOME/bin/smartpy/cli/"
|
16
|
+
- curl -s https://smartpy.io/cli/install.sh > SmartPyInstaller.sh && yes | sh SmartPyInstaller.sh
|
17
|
+
- export PATH="$PATH:$HOME/bin/:$HOME/smartpy-cli/"
|
21
18
|
- npm link michelson-to-micheline
|
22
19
|
- gem install bundler -v 1.16.3
|
23
20
|
script:
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
tezos_client (1.
|
5
|
-
active_interaction (
|
4
|
+
tezos_client (1.4.1)
|
5
|
+
active_interaction (>= 3.8)
|
6
6
|
activesupport (~> 6.0.0)
|
7
7
|
base58 (~> 0.2.3)
|
8
8
|
bip_mnemonic (~> 0.0.2)
|
@@ -14,24 +14,24 @@ PATH
|
|
14
14
|
GEM
|
15
15
|
remote: https://rubygems.org/
|
16
16
|
specs:
|
17
|
-
actionpack (6.0.3.
|
18
|
-
actionview (= 6.0.3.
|
19
|
-
activesupport (= 6.0.3.
|
17
|
+
actionpack (6.0.3.7)
|
18
|
+
actionview (= 6.0.3.7)
|
19
|
+
activesupport (= 6.0.3.7)
|
20
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.3.
|
25
|
-
activesupport (= 6.0.3.
|
24
|
+
actionview (6.0.3.7)
|
25
|
+
activesupport (= 6.0.3.7)
|
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
|
-
active_interaction (
|
31
|
-
activemodel (>=
|
32
|
-
activemodel (6.0.3.
|
33
|
-
activesupport (= 6.0.3.
|
34
|
-
activesupport (6.0.3.
|
30
|
+
active_interaction (4.0.1)
|
31
|
+
activemodel (>= 5, < 7)
|
32
|
+
activemodel (6.0.3.7)
|
33
|
+
activesupport (= 6.0.3.7)
|
34
|
+
activesupport (6.0.3.7)
|
35
35
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
36
36
|
i18n (>= 0.7, < 2)
|
37
37
|
minitest (~> 5.1)
|
@@ -39,51 +39,50 @@ GEM
|
|
39
39
|
zeitwerk (~> 2.2, >= 2.2.2)
|
40
40
|
addressable (2.7.0)
|
41
41
|
public_suffix (>= 2.0.2, < 5.0)
|
42
|
-
ast (2.4.
|
42
|
+
ast (2.4.2)
|
43
43
|
base58 (0.2.3)
|
44
44
|
bip_mnemonic (0.0.4)
|
45
45
|
builder (3.2.4)
|
46
|
-
coderay (1.1.
|
47
|
-
concurrent-ruby (1.1.
|
48
|
-
crack (0.4.
|
49
|
-
|
46
|
+
coderay (1.1.3)
|
47
|
+
concurrent-ruby (1.1.8)
|
48
|
+
crack (0.4.5)
|
49
|
+
rexml
|
50
50
|
crass (1.0.6)
|
51
|
-
diff-lcs (1.
|
51
|
+
diff-lcs (1.4.4)
|
52
52
|
domain_name (0.5.20190701)
|
53
53
|
unf (>= 0.0.5, < 1.0.0)
|
54
|
-
erubi (1.
|
55
|
-
ffi (1.
|
56
|
-
hashdiff (1.0.
|
54
|
+
erubi (1.10.0)
|
55
|
+
ffi (1.15.1)
|
56
|
+
hashdiff (1.0.1)
|
57
57
|
http-cookie (1.0.3)
|
58
58
|
domain_name (~> 0.5)
|
59
59
|
httparty (0.17.3)
|
60
60
|
mime-types (~> 3.0)
|
61
61
|
multi_xml (>= 0.5.2)
|
62
|
-
i18n (1.8.
|
62
|
+
i18n (1.8.10)
|
63
63
|
concurrent-ruby (~> 1.0)
|
64
|
-
|
65
|
-
loofah (2.7.0)
|
64
|
+
loofah (2.9.1)
|
66
65
|
crass (~> 1.0.2)
|
67
66
|
nokogiri (>= 1.5.9)
|
68
|
-
method_source (0.
|
67
|
+
method_source (1.0.0)
|
69
68
|
mime-types (3.3.1)
|
70
69
|
mime-types-data (~> 3.2015)
|
71
|
-
mime-types-data (3.
|
72
|
-
|
73
|
-
minitest (5.14.2)
|
70
|
+
mime-types-data (3.2021.0225)
|
71
|
+
minitest (5.14.4)
|
74
72
|
money-tree (0.10.0)
|
75
73
|
ffi
|
76
74
|
multi_xml (0.6.0)
|
77
75
|
netrc (0.11.0)
|
78
|
-
nokogiri (1.
|
79
|
-
|
80
|
-
parallel (1.
|
81
|
-
parser (
|
82
|
-
ast (~> 2.4.
|
83
|
-
pry (0.
|
84
|
-
coderay (~> 1.1
|
85
|
-
method_source (~>
|
86
|
-
public_suffix (4.0.
|
76
|
+
nokogiri (1.11.6-x86_64-darwin)
|
77
|
+
racc (~> 1.4)
|
78
|
+
parallel (1.20.1)
|
79
|
+
parser (3.0.1.1)
|
80
|
+
ast (~> 2.4.1)
|
81
|
+
pry (0.14.1)
|
82
|
+
coderay (~> 1.1)
|
83
|
+
method_source (~> 1.0)
|
84
|
+
public_suffix (4.0.6)
|
85
|
+
racc (1.5.2)
|
87
86
|
rack (2.2.3)
|
88
87
|
rack-test (1.1.0)
|
89
88
|
rack (>= 1.0, < 3)
|
@@ -92,72 +91,83 @@ GEM
|
|
92
91
|
nokogiri (>= 1.6)
|
93
92
|
rails-html-sanitizer (1.3.0)
|
94
93
|
loofah (~> 2.3)
|
95
|
-
railties (6.0.3.
|
96
|
-
actionpack (= 6.0.3.
|
97
|
-
activesupport (= 6.0.3.
|
94
|
+
railties (6.0.3.7)
|
95
|
+
actionpack (= 6.0.3.7)
|
96
|
+
activesupport (= 6.0.3.7)
|
98
97
|
method_source
|
99
98
|
rake (>= 0.8.7)
|
100
99
|
thor (>= 0.20.3, < 2.0)
|
101
100
|
rainbow (3.0.0)
|
102
|
-
rake (13.0.
|
101
|
+
rake (13.0.3)
|
103
102
|
rbnacl (5.0.0)
|
104
103
|
ffi
|
104
|
+
regexp_parser (2.1.1)
|
105
105
|
rest-client (2.0.2)
|
106
106
|
http-cookie (>= 1.0.2, < 2.0)
|
107
107
|
mime-types (>= 1.16, < 4.0)
|
108
108
|
netrc (~> 0.8)
|
109
|
-
|
110
|
-
|
111
|
-
rspec-
|
112
|
-
rspec-
|
113
|
-
|
114
|
-
|
115
|
-
|
109
|
+
rexml (3.2.5)
|
110
|
+
rspec (3.10.0)
|
111
|
+
rspec-core (~> 3.10.0)
|
112
|
+
rspec-expectations (~> 3.10.0)
|
113
|
+
rspec-mocks (~> 3.10.0)
|
114
|
+
rspec-core (3.10.1)
|
115
|
+
rspec-support (~> 3.10.0)
|
116
|
+
rspec-expectations (3.10.1)
|
116
117
|
diff-lcs (>= 1.2.0, < 2.0)
|
117
|
-
rspec-support (~> 3.
|
118
|
-
rspec-mocks (3.
|
118
|
+
rspec-support (~> 3.10.0)
|
119
|
+
rspec-mocks (3.10.2)
|
119
120
|
diff-lcs (>= 1.2.0, < 2.0)
|
120
|
-
rspec-support (~> 3.
|
121
|
-
rspec-support (3.
|
122
|
-
rubocop (
|
123
|
-
jaro_winkler (~> 1.5.1)
|
121
|
+
rspec-support (~> 3.10.0)
|
122
|
+
rspec-support (3.10.2)
|
123
|
+
rubocop (1.15.0)
|
124
124
|
parallel (~> 1.10)
|
125
|
-
parser (>=
|
125
|
+
parser (>= 3.0.0.0)
|
126
126
|
rainbow (>= 2.2.2, < 4.0)
|
127
|
+
regexp_parser (>= 1.8, < 3.0)
|
128
|
+
rexml
|
129
|
+
rubocop-ast (>= 1.5.0, < 2.0)
|
127
130
|
ruby-progressbar (~> 1.7)
|
128
|
-
unicode-display_width (>= 1.4.0, <
|
129
|
-
rubocop-
|
130
|
-
|
131
|
-
rubocop-
|
131
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
132
|
+
rubocop-ast (1.6.0)
|
133
|
+
parser (>= 3.0.1.1)
|
134
|
+
rubocop-packaging (0.5.1)
|
135
|
+
rubocop (>= 0.89, < 2.0)
|
136
|
+
rubocop-performance (1.11.3)
|
137
|
+
rubocop (>= 1.7.0, < 2.0)
|
138
|
+
rubocop-ast (>= 0.4.0)
|
139
|
+
rubocop-rails (2.10.1)
|
140
|
+
activesupport (>= 4.2.0)
|
132
141
|
rack (>= 1.1)
|
133
|
-
rubocop (>=
|
134
|
-
rubocop-rails_config (
|
135
|
-
railties (>=
|
136
|
-
rubocop (
|
137
|
-
rubocop-
|
142
|
+
rubocop (>= 1.7.0, < 2.0)
|
143
|
+
rubocop-rails_config (1.5.3)
|
144
|
+
railties (>= 5.0)
|
145
|
+
rubocop (>= 1.13)
|
146
|
+
rubocop-ast (>= 1.0.1)
|
147
|
+
rubocop-packaging (~> 0.5)
|
148
|
+
rubocop-performance (~> 1.11)
|
138
149
|
rubocop-rails (~> 2.0)
|
139
|
-
ruby-progressbar (1.
|
140
|
-
|
141
|
-
thor (1.0.1)
|
150
|
+
ruby-progressbar (1.11.0)
|
151
|
+
thor (1.1.0)
|
142
152
|
thread_safe (0.3.6)
|
143
|
-
tzinfo (1.2.
|
153
|
+
tzinfo (1.2.9)
|
144
154
|
thread_safe (~> 0.1)
|
145
155
|
unf (0.1.4)
|
146
156
|
unf_ext
|
147
157
|
unf_ext (0.0.7.7)
|
148
|
-
unicode-display_width (
|
158
|
+
unicode-display_width (2.0.0)
|
149
159
|
vcr (4.0.0)
|
150
|
-
webmock (3.
|
160
|
+
webmock (3.13.0)
|
151
161
|
addressable (>= 2.3.6)
|
152
162
|
crack (>= 0.3.2)
|
153
163
|
hashdiff (>= 0.4.0, < 2.0.0)
|
154
|
-
zeitwerk (2.4.
|
164
|
+
zeitwerk (2.4.2)
|
155
165
|
|
156
166
|
PLATFORMS
|
157
|
-
|
167
|
+
x86_64-darwin-19
|
158
168
|
|
159
169
|
DEPENDENCIES
|
160
|
-
bundler (~> 1
|
170
|
+
bundler (~> 2.1)
|
161
171
|
pry
|
162
172
|
rake (~> 13.0)
|
163
173
|
rspec (~> 3.0)
|
@@ -167,4 +177,4 @@ DEPENDENCIES
|
|
167
177
|
webmock
|
168
178
|
|
169
179
|
BUNDLED WITH
|
170
|
-
|
180
|
+
2.2.18
|
data/README.md
CHANGED
@@ -4,11 +4,12 @@
|
|
4
4
|
|
5
5
|
[![Build Status](https://travis-ci.org/moneytrackio/tezos_client.svg?branch=master)](https://travis-ci.org/moneytrackio/tezos_client)
|
6
6
|
|
7
|
-
Tezos Client
|
7
|
+
Tezos Client interacts with Tezos nodes using RPC commands.
|
8
8
|
|
9
|
-
## Requirements
|
10
|
-
|
11
|
-
|
9
|
+
## Requirements
|
10
|
+
|
11
|
+
Tezos client requires SmartPy to be installed in order to work properly.
|
12
|
+
To install it on Linux, you can basically follow the steps coded in travis-script folder.
|
12
13
|
|
13
14
|
## Dependency
|
14
15
|
|
@@ -18,16 +19,11 @@ sudo apt-get install nodejs
|
|
18
19
|
npm i -g michelson-to-micheline
|
19
20
|
```
|
20
21
|
|
21
|
-
### liquidity
|
22
|
-
[liquidity installation](http://www.liquidity-lang.org/doc/installation/index.html)
|
23
|
-
|
24
|
-
need the tezos version (not Dune version)
|
25
|
-
|
26
22
|
### SmartPy
|
27
|
-
[SmartPy](https://smartpy.io/)
|
23
|
+
[SmartPy](https://smartpy.io/releases/20210317-bc925bb73dc885ac2b4dde9689e805d9b0bc6125/)
|
28
24
|
|
29
25
|
```bash
|
30
|
-
sh <(curl -s https://smartpy.io/
|
26
|
+
sh <(curl -s https://smartpy.io/releases/20210317-bc925bb73dc885ac2b4dde9689e805d9b0bc6125/cli/install.sh)
|
31
27
|
export PATH=$PATH:$HOME/smartpy-cli/
|
32
28
|
```
|
33
29
|
|
@@ -54,9 +50,10 @@ Or install it yourself as:
|
|
54
50
|
|
55
51
|
## Usage
|
56
52
|
|
57
|
-
### Generate Tezos key
|
53
|
+
### Generate Tezos key pairs
|
54
|
+
|
55
|
+
Generate a perfectly random key pair:
|
58
56
|
|
59
|
-
Generate a prefectly random key pair:
|
60
57
|
```ruby
|
61
58
|
client = TezosClient.new
|
62
59
|
key = subject.generate_key
|
@@ -69,6 +66,7 @@ key = subject.generate_key
|
|
69
66
|
```
|
70
67
|
|
71
68
|
Generate a key pair from a seed and a BIP 44 Path:
|
69
|
+
|
72
70
|
```ruby
|
73
71
|
key = subject.generate_key(wallet_seed:"000102030405060708090a0b0c0d0e0f", path: "m/44'/1729'/0'/0'/0'")
|
74
72
|
expect(key[:address]).to eq "tz1RfnzRopJXH32SSDap2wMYGULBAnmHxdP1"
|
@@ -78,7 +76,8 @@ key = subject.generate_key(wallet_seed:"000102030405060708090a0b0c0d0e0f", path:
|
|
78
76
|
# :address=>"tz1a97x7GAvMDyrwwKTLQo131CoidXyUef48"
|
79
77
|
# }
|
80
78
|
```
|
81
|
-
Generate a key pair from a
|
79
|
+
Generate a key pair from a BIP-39 mnemonic sentence and a BIP 44 Path:
|
80
|
+
|
82
81
|
```ruby
|
83
82
|
key = subject.generate_key(
|
84
83
|
mnemonic: "below dove cushion divide future artefact orange congress maple fiscal flower enable",
|
@@ -118,28 +117,6 @@ client.transfer(
|
|
118
117
|
)
|
119
118
|
```
|
120
119
|
|
121
|
-
### Originate a contract written in liquidity
|
122
|
-
|
123
|
-
```ruby
|
124
|
-
script = File.expand_path("./spec/fixtures/demo.py")
|
125
|
-
source = "tz1ZWiiPXowuhN1UqNGVTrgNyf5tdxp4XUUq"
|
126
|
-
secret_key = "edsk4EcqupPmaebat5mP57ZQ3zo8NDkwv8vQmafdYZyeXxrSc72pjN"
|
127
|
-
amount = 0
|
128
|
-
init_params= "MyContract()"
|
129
|
-
client = TezosClient.new
|
130
|
-
|
131
|
-
res = client.originate_contract(
|
132
|
-
from: source,
|
133
|
-
amount: amount,
|
134
|
-
script: script,
|
135
|
-
secret_key: secret_key,
|
136
|
-
init_params: init_params
|
137
|
-
)
|
138
|
-
|
139
|
-
puts "Origination operation: #{res[:operation_id]}"
|
140
|
-
puts "Contract address: #{res[:originated_contract]}"
|
141
|
-
```
|
142
|
-
|
143
120
|
### Originate a contract written in SmartPy
|
144
121
|
|
145
122
|
```ruby
|
@@ -147,7 +124,7 @@ script = File.expand_path("./spec/fixtures/demo.py")
|
|
147
124
|
source = "tz1ZWiiPXowuhN1UqNGVTrgNyf5tdxp4XUUq"
|
148
125
|
secret_key = "edsk4EcqupPmaebat5mP57ZQ3zo8NDkwv8vQmafdYZyeXxrSc72pjN"
|
149
126
|
amount = 0
|
150
|
-
init_params
|
127
|
+
init_params= "MyContract()"
|
151
128
|
client = TezosClient.new
|
152
129
|
|
153
130
|
res = client.originate_contract(
|
@@ -163,6 +140,7 @@ puts "Contract address: #{res[:originated_contract]}"
|
|
163
140
|
```
|
164
141
|
|
165
142
|
### Call a contract written in SmartPy
|
143
|
+
|
166
144
|
```ruby
|
167
145
|
TezosClient.new.call_contract(
|
168
146
|
from: "tz1ZWiiPXowuhN1UqNGVTrgNyf5tdxp4XUUq",
|
data/lib/tezos_client.rb
CHANGED
@@ -4,6 +4,8 @@ require "pp"
|
|
4
4
|
require "active_support/core_ext/hash/indifferent_access"
|
5
5
|
require "active_support/core_ext/string/inflections"
|
6
6
|
require "active_support/core_ext/module/delegation"
|
7
|
+
require "active_support/core_ext/time"
|
8
|
+
require "active_support/core_ext/array"
|
7
9
|
require "timeout"
|
8
10
|
require "benchmark"
|
9
11
|
require "open3"
|
@@ -80,7 +82,7 @@ class TezosClient
|
|
80
82
|
#
|
81
83
|
# @return [Hash] result of the origination containing :operation_id, :operation_result and :originated_contract
|
82
84
|
#
|
83
|
-
def originate_contract(from:, amount:, secret_key: nil, script: nil, init_params:
|
85
|
+
def originate_contract(from:, amount:, secret_key: nil, script: nil, init_params: [], dry_run: false, **args)
|
84
86
|
origination_args = {
|
85
87
|
rpc_interface: rpc_interface,
|
86
88
|
from: from,
|
@@ -90,9 +92,9 @@ class TezosClient
|
|
90
92
|
}
|
91
93
|
|
92
94
|
origination_args[:script] = contract_interface(script).origination_script(
|
93
|
-
from: from,
|
94
95
|
script: script,
|
95
|
-
init_params: init_params
|
96
|
+
init_params: init_params,
|
97
|
+
**args
|
96
98
|
)
|
97
99
|
|
98
100
|
operation = OriginationOperation.new(origination_args)
|
data/lib/tezos_client/crypto.rb
CHANGED
data/lib/tezos_client/logger.rb
CHANGED
@@ -13,7 +13,7 @@ class TezosClient
|
|
13
13
|
self.class.logger << out + "\n"
|
14
14
|
end
|
15
15
|
|
16
|
-
FILTERED_KEYS = [:code, :contractCode]
|
16
|
+
FILTERED_KEYS = [:code, :contractCode, :contract_code]
|
17
17
|
def tezos_contents_log_filter(content)
|
18
18
|
if content.is_a? Array
|
19
19
|
content.map { |el| tezos_contents_log_filter(el) }
|
@@ -1,20 +1,18 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "smartpy_inteface/smartpy_wrapper"
|
4
|
-
require_relative "smartpy_inteface/micheline_serializer_wrapper"
|
5
4
|
|
6
5
|
class TezosClient
|
7
6
|
class SmartpyInterface
|
8
7
|
include Logger
|
9
8
|
include SmartpyWrapper
|
10
|
-
include MichelineSerializerWrapper
|
11
9
|
|
12
10
|
attr_reader :options
|
13
11
|
|
14
12
|
def json_scripts(args)
|
15
13
|
compile_to_michelson(args) do |contract_script_filename, init_script_filename|
|
16
14
|
micheline_contract = File.read(contract_script_filename)
|
17
|
-
micheline_storage =
|
15
|
+
micheline_storage = File.read(init_script_filename)
|
18
16
|
|
19
17
|
[JSON.parse(micheline_storage), JSON.parse(micheline_contract)]
|
20
18
|
end
|
@@ -34,12 +32,46 @@ class TezosClient
|
|
34
32
|
Tools::TemporaryFile.with_file_copy(args[:script]) do |script_copy_path|
|
35
33
|
script_basename = script_copy_path.split("/").last.sub(/.py$/, "")
|
36
34
|
script_path = "/tmp/#{script_basename}/"
|
37
|
-
init_script_filename = "
|
38
|
-
contract_script_filename = "
|
39
|
-
call_smartpy ["compile", script_copy_path, args[:init_params], script_path]
|
35
|
+
init_script_filename = "step_000_cont_0_storage.json"
|
36
|
+
contract_script_filename = "step_000_cont_0_contract.json"
|
40
37
|
|
41
|
-
|
38
|
+
cmd_line = ["compile", script_copy_path, script_path].concat(
|
39
|
+
optional_inputs(args[:smartpy_flags], args[:init_params])
|
40
|
+
)
|
41
|
+
|
42
|
+
call_smartpy cmd_line
|
43
|
+
|
44
|
+
yield(script_path + "default/" + contract_script_filename, script_path + "default/" + init_script_filename)
|
42
45
|
end
|
43
46
|
end
|
47
|
+
|
48
|
+
def optional_inputs(flags, init_params)
|
49
|
+
inputs = []
|
50
|
+
|
51
|
+
inputs.concat(optional_flags(flags))
|
52
|
+
inputs.concat(optional_args(init_params))
|
53
|
+
|
54
|
+
inputs
|
55
|
+
end
|
56
|
+
|
57
|
+
def optional_flags(flags)
|
58
|
+
(flags || {}).map do |key, value|
|
59
|
+
if value.is_a?(FalseClass) || value.is_a?(TrueClass)
|
60
|
+
"--#{key}"
|
61
|
+
else
|
62
|
+
["--#{key}", value.to_s]
|
63
|
+
end
|
64
|
+
end.flatten
|
65
|
+
end
|
66
|
+
|
67
|
+
def optional_args(init_params = [])
|
68
|
+
return [] if init_params.count.zero?
|
69
|
+
|
70
|
+
["--"].concat(
|
71
|
+
init_params.map do |init_param|
|
72
|
+
init_param.to_json
|
73
|
+
end
|
74
|
+
)
|
75
|
+
end
|
44
76
|
end
|
45
77
|
end
|
@@ -11,6 +11,17 @@ class TezosClient::Tools::AnnotsToType < ActiveInteraction::Base
|
|
11
11
|
|
12
12
|
validate :validate_types
|
13
13
|
|
14
|
+
TYPES_MAPPING = {
|
15
|
+
int: :int,
|
16
|
+
nat: :int,
|
17
|
+
string: :string,
|
18
|
+
signature: :string,
|
19
|
+
bytes: :bytes,
|
20
|
+
timestamp: :int,
|
21
|
+
key: :string,
|
22
|
+
address: :string
|
23
|
+
}.freeze
|
24
|
+
|
14
25
|
def execute
|
15
26
|
return { "prim" => typed_annots.values.first } if typed_annots.size == 1
|
16
27
|
|
@@ -18,16 +29,28 @@ class TezosClient::Tools::AnnotsToType < ActiveInteraction::Base
|
|
18
29
|
end
|
19
30
|
|
20
31
|
private
|
32
|
+
def micheline_type(annot_type, annot)
|
33
|
+
if annot_type.to_s.start_with?("optional_")
|
34
|
+
{
|
35
|
+
"prim" => "option",
|
36
|
+
"args" => [{ "prim" => annot_type.to_s.delete_prefix("optional_") }],
|
37
|
+
"annots" => ["%#{annot}"]
|
38
|
+
}
|
39
|
+
else
|
40
|
+
{
|
41
|
+
"prim" => annot_type,
|
42
|
+
"annots" => ["%#{annot}"]
|
43
|
+
}
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
21
47
|
def generate_type_args(annots)
|
22
48
|
annot = annots.pop
|
23
49
|
annot_type = typed_annots[annot]
|
24
50
|
|
25
51
|
unless annots.size == 1
|
26
52
|
return [
|
27
|
-
|
28
|
-
"prim" => annot_type,
|
29
|
-
"annots" => ["%#{annot}"]
|
30
|
-
},
|
53
|
+
micheline_type(annot_type, annot),
|
31
54
|
{
|
32
55
|
"prim" => "pair",
|
33
56
|
"args" => generate_type_args(annots)
|
@@ -35,10 +58,10 @@ class TezosClient::Tools::AnnotsToType < ActiveInteraction::Base
|
|
35
58
|
]
|
36
59
|
end
|
37
60
|
|
38
|
-
generated_args = [
|
61
|
+
generated_args = [micheline_type(annot_type, annot)]
|
39
62
|
annot = annots.pop
|
40
63
|
annot_type = typed_annots[annot]
|
41
|
-
generated_args.append(
|
64
|
+
generated_args.append(micheline_type(annot_type, annot))
|
42
65
|
|
43
66
|
generated_args
|
44
67
|
end
|
@@ -48,8 +71,8 @@ class TezosClient::Tools::AnnotsToType < ActiveInteraction::Base
|
|
48
71
|
end
|
49
72
|
|
50
73
|
def validate_types
|
51
|
-
allowed_types =
|
52
|
-
return if typed_annots.values.map(
|
74
|
+
allowed_types = TYPES_MAPPING.keys
|
75
|
+
return if typed_annots.values.map{|type| type.to_s.delete_prefix("optional_").to_sym}.all? { |type| allowed_types.include? type }
|
53
76
|
|
54
77
|
errors.add(:base, "The allowed types are: #{allowed_types.join(', ')}")
|
55
78
|
end
|
@@ -7,8 +7,8 @@ Dir[File.join(__dir__, "convert_to_hash", "*.rb")].each { |file| require file }
|
|
7
7
|
class TezosClient
|
8
8
|
module Tools
|
9
9
|
class ConvertToHash < ActiveInteraction::Base
|
10
|
-
interface :data
|
11
|
-
interface :type
|
10
|
+
interface :data, methods: []
|
11
|
+
interface :type, methods: []
|
12
12
|
|
13
13
|
def execute
|
14
14
|
TezosClient::Tools::ConvertToHash::Base.new(data: data, type: type).value
|
@@ -7,12 +7,19 @@ class TezosClient
|
|
7
7
|
class ConvertToHash < ActiveInteraction::Base
|
8
8
|
class BigMap < Base
|
9
9
|
def decode
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
10
|
+
if data.is_a? Hash
|
11
|
+
::TezosClient::BigMap.new(
|
12
|
+
var_name,
|
13
|
+
data[:int],
|
14
|
+
type[:args].second,
|
15
|
+
type[:args].first
|
16
|
+
)
|
17
|
+
else
|
18
|
+
TezosClient::Tools::ConvertToHash::Map.new(
|
19
|
+
data: data,
|
20
|
+
type: type
|
21
|
+
).value[var_name]
|
22
|
+
end
|
16
23
|
end
|
17
24
|
end
|
18
25
|
end
|
@@ -7,20 +7,20 @@ class TezosClient
|
|
7
7
|
include TezosClient::Crypto
|
8
8
|
|
9
9
|
def decode
|
10
|
-
if
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
encode_tz(:p2pk, data[:bytes][2..-1])
|
17
|
-
else
|
18
|
-
data[:bytes]
|
19
|
-
end
|
10
|
+
if tmp_data.start_with?("00")
|
11
|
+
encode_tz(:edpk, tmp_data[2..-1])
|
12
|
+
elsif tmp_data.start_with?("01")
|
13
|
+
encode_tz(:sppk, tmp_data[2..-1])
|
14
|
+
elsif tmp_data.start_with?("02")
|
15
|
+
encode_tz(:p2pk, tmp_data[2..-1])
|
20
16
|
else
|
21
|
-
|
17
|
+
tmp_data
|
22
18
|
end
|
23
19
|
end
|
20
|
+
|
21
|
+
def tmp_data
|
22
|
+
@tmp_data ||= data[:bytes] || data[:string]
|
23
|
+
end
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -8,6 +8,8 @@ class TezosClient
|
|
8
8
|
if data.key? :int
|
9
9
|
Time.zone.at(data[:int].to_i)
|
10
10
|
elsif data.key? :string
|
11
|
+
return Time.zone.at(data[:string].to_i) if data[:string].match?(/\A\d+\z/)
|
12
|
+
|
11
13
|
Time.zone.parse(data[:string])
|
12
14
|
else
|
13
15
|
raise "Can not convert timestamp: #{data}"
|
@@ -1,18 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
int: :int,
|
7
|
-
nat: :int,
|
8
|
-
string: :string,
|
9
|
-
signature: :string,
|
10
|
-
bytes: :bytes,
|
11
|
-
timestamp: :int,
|
12
|
-
key: :string,
|
13
|
-
address: :string
|
14
|
-
}.freeze
|
3
|
+
require_relative "hash_to_micheline/base"
|
4
|
+
|
5
|
+
Dir[File.join(__dir__, "hash_to_micheline", "*.rb")].each { |file| require file }
|
15
6
|
|
7
|
+
|
8
|
+
class TezosClient::Tools::HashToMicheline < ActiveInteraction::Base
|
16
9
|
string :contract_address, default: nil
|
17
10
|
string :entrypoint, default: nil
|
18
11
|
# example of params:
|
@@ -20,7 +13,7 @@ class TezosClient::Tools::HashToMicheline < ActiveInteraction::Base
|
|
20
13
|
# spending_ref: "toto",
|
21
14
|
# expires_at: Time.now
|
22
15
|
# }
|
23
|
-
|
16
|
+
interface :params, methods: []
|
24
17
|
hash :storage_type, strip: false, default: {}
|
25
18
|
interface :blockchain_client, methods: %i[entrypoint entrypoints select_entrypoint], default: -> { TezosClient.new }
|
26
19
|
|
@@ -29,59 +22,18 @@ class TezosClient::Tools::HashToMicheline < ActiveInteraction::Base
|
|
29
22
|
validate :storage_type_or_contract_address_presence
|
30
23
|
|
31
24
|
def execute
|
32
|
-
|
33
|
-
|
34
|
-
{ prim: "Pair", args: generate_micheline(_storage_type[:args]) }
|
25
|
+
TezosClient::Tools::HashToMicheline::Base.new(data: _params, type: _storage_type).value
|
35
26
|
end
|
36
27
|
|
37
28
|
private
|
38
|
-
def
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
if h[:prim] == "option"
|
45
|
-
value = params.fetch(annot)
|
46
|
-
if value
|
47
|
-
acc << {
|
48
|
-
"prim": "Some",
|
49
|
-
"args": [
|
50
|
-
hash_type_to_hash_data(h[:args][0][:prim], params.fetch(annot))
|
51
|
-
]
|
52
|
-
}
|
53
|
-
else
|
54
|
-
acc << {
|
55
|
-
"prim": "None"
|
56
|
-
}
|
57
|
-
end
|
58
|
-
else
|
59
|
-
acc << hash_type_to_hash_data(h[:prim], params.fetch(annot))
|
60
|
-
end
|
29
|
+
def _params
|
30
|
+
if params.respond_to?(:keys) && params.keys.size == 1 && !_storage_type.key?(:annots)
|
31
|
+
params.values.first
|
32
|
+
else
|
33
|
+
params
|
61
34
|
end
|
62
35
|
end
|
63
36
|
|
64
|
-
def convert_type(michelson_type)
|
65
|
-
TYPES_MAPPING.fetch(michelson_type.to_sym)
|
66
|
-
end
|
67
|
-
|
68
|
-
def hash_type_to_hash_data(michelson_type, value)
|
69
|
-
type = convert_type(michelson_type)
|
70
|
-
|
71
|
-
converted_value = case michelson_type.to_sym
|
72
|
-
when :nat, :int
|
73
|
-
value.to_s
|
74
|
-
when :timestamp
|
75
|
-
errors.add(:base, "timestamp input must be an instance of Time") unless value.is_a? Time
|
76
|
-
|
77
|
-
value.to_i.to_s
|
78
|
-
else
|
79
|
-
value
|
80
|
-
end
|
81
|
-
|
82
|
-
{ type => converted_value }
|
83
|
-
end
|
84
|
-
|
85
37
|
def _entrypoint
|
86
38
|
@_entrypoint ||= blockchain_client.select_entrypoint(
|
87
39
|
contract_address: contract_address,
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class TezosClient
|
4
|
+
module Tools
|
5
|
+
class HashToMicheline < ActiveInteraction::Base
|
6
|
+
class Address < Base
|
7
|
+
def encode
|
8
|
+
raise "#{data} #{data.class} Not a 'String' type" unless data.is_a? ::String
|
9
|
+
{ string: data }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class TezosClient
|
4
|
+
module Tools
|
5
|
+
class HashToMicheline < ActiveInteraction::Base
|
6
|
+
class Base
|
7
|
+
def initialize(data:, type:)
|
8
|
+
@data = data
|
9
|
+
@type = type
|
10
|
+
end
|
11
|
+
|
12
|
+
attr_accessor :data, :type
|
13
|
+
|
14
|
+
def value
|
15
|
+
@data = anonymous? ? @data : @data.fetch(var_name)
|
16
|
+
encode
|
17
|
+
end
|
18
|
+
|
19
|
+
protected
|
20
|
+
def encode
|
21
|
+
klass.new(
|
22
|
+
data: data,
|
23
|
+
type: type
|
24
|
+
).encode
|
25
|
+
|
26
|
+
rescue NameError
|
27
|
+
raise
|
28
|
+
raise NotImplementedError, "type '#{type[:prim]}' not implemented"
|
29
|
+
end
|
30
|
+
|
31
|
+
def anonymous?
|
32
|
+
!(type.key?(:annots) && type[:annots].any?)
|
33
|
+
end
|
34
|
+
|
35
|
+
def var_name_annot
|
36
|
+
type[:annots].first
|
37
|
+
end
|
38
|
+
|
39
|
+
def var_name
|
40
|
+
return nil if anonymous?
|
41
|
+
|
42
|
+
"#{var_name_annot[1..-1]}".to_sym
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
def klass
|
47
|
+
"#{self.class.name.deconstantize}::#{type[:prim].to_s.camelize}".constantize
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class TezosClient
|
4
|
+
module Tools
|
5
|
+
class HashToMicheline < ActiveInteraction::Base
|
6
|
+
class Bytes < Base
|
7
|
+
def encode
|
8
|
+
raise "#{data} #{data.class} Not a 'String' type" unless data.is_a? ::String
|
9
|
+
{ bytes: data }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class TezosClient
|
4
|
+
module Tools
|
5
|
+
class HashToMicheline < ActiveInteraction::Base
|
6
|
+
class Contract < Base
|
7
|
+
def encode
|
8
|
+
raise "#{data} #{data.class} Not a 'String' type" unless data.is_a? ::String
|
9
|
+
{ string: data }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class TezosClient
|
4
|
+
module Tools
|
5
|
+
class HashToMicheline < ActiveInteraction::Base
|
6
|
+
class Key < Base
|
7
|
+
def encode
|
8
|
+
raise "#{data} #{data.class} Not a 'String' type" unless data.is_a? ::String
|
9
|
+
{ string: data }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class TezosClient
|
4
|
+
module Tools
|
5
|
+
class HashToMicheline < ActiveInteraction::Base
|
6
|
+
class Option < Base
|
7
|
+
def encode
|
8
|
+
return { prim: "None" } if data.nil?
|
9
|
+
|
10
|
+
{
|
11
|
+
prim: "Some",
|
12
|
+
args: [
|
13
|
+
TezosClient::Tools::HashToMicheline::Base.new(
|
14
|
+
data: data,
|
15
|
+
type: type[:args][0]
|
16
|
+
).value
|
17
|
+
]
|
18
|
+
}
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class TezosClient
|
4
|
+
module Tools
|
5
|
+
class HashToMicheline < ActiveInteraction::Base
|
6
|
+
class Pair < Base
|
7
|
+
def encode
|
8
|
+
{
|
9
|
+
prim: "Pair",
|
10
|
+
args: [
|
11
|
+
TezosClient::Tools::HashToMicheline::Base.new(
|
12
|
+
data: data_0,
|
13
|
+
type: type[:args][0]
|
14
|
+
).value,
|
15
|
+
TezosClient::Tools::HashToMicheline::Base.new(
|
16
|
+
data: data_1,
|
17
|
+
type: type[:args][1]
|
18
|
+
).value
|
19
|
+
]
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
23
|
+
def data_0
|
24
|
+
if data.is_a? ::Array
|
25
|
+
data[0]
|
26
|
+
else
|
27
|
+
data
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def data_1
|
32
|
+
if data.is_a? ::Array
|
33
|
+
if data.size > 2
|
34
|
+
data.drop(1)
|
35
|
+
else
|
36
|
+
data[1]
|
37
|
+
end
|
38
|
+
else
|
39
|
+
data
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class TezosClient
|
4
|
+
module Tools
|
5
|
+
class HashToMicheline < ActiveInteraction::Base
|
6
|
+
class Signature < Base
|
7
|
+
def encode
|
8
|
+
raise "#{data} does not seem to be a signature" unless data.start_with?("edsig")
|
9
|
+
{ string: data }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class TezosClient
|
4
|
+
module Tools
|
5
|
+
class HashToMicheline < ActiveInteraction::Base
|
6
|
+
class String < Base
|
7
|
+
def encode
|
8
|
+
raise "#{data} #{data.class} Not a 'String' type" unless data.is_a? ::String
|
9
|
+
{ string: data }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class TezosClient
|
4
|
+
module Tools
|
5
|
+
class HashToMicheline < ActiveInteraction::Base
|
6
|
+
class Timestamp < Base
|
7
|
+
def encode
|
8
|
+
raise "timestamp input (#{data}) must be an instance of Time" unless data.is_a? Time
|
9
|
+
{ int: data.to_i.to_s }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/lib/tezos_client/version.rb
CHANGED
data/tezos_client.gemspec
CHANGED
@@ -7,12 +7,12 @@ require "tezos_client/version"
|
|
7
7
|
Gem::Specification.new do |spec|
|
8
8
|
spec.name = "tezos_client"
|
9
9
|
spec.version = TezosClient::VERSION
|
10
|
-
spec.authors = ["Pierre Michard"]
|
11
|
-
spec.email = ["pierre@moneytrack.io"]
|
10
|
+
spec.authors = ["Pierre Michard", "Sébastien Lauret", "Othmane El Kesri"]
|
11
|
+
spec.email = ["pierre@moneytrack.io", "sebastien@moneytrack.io", "othmane@moneytrack.io"]
|
12
12
|
|
13
13
|
spec.summary = "Wrapper to the tezos client."
|
14
14
|
spec.description = ""
|
15
|
-
spec.homepage = "
|
15
|
+
spec.homepage = "https://moneytrack.io"
|
16
16
|
spec.license = "MIT"
|
17
17
|
|
18
18
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
@@ -33,7 +33,7 @@ Gem::Specification.new do |spec|
|
|
33
33
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
34
34
|
spec.require_paths = ["lib"]
|
35
35
|
|
36
|
-
spec.add_development_dependency "bundler", "~> 1
|
36
|
+
spec.add_development_dependency "bundler", "~> 2.1"
|
37
37
|
spec.add_development_dependency "rake", "~> 13.0"
|
38
38
|
spec.add_development_dependency "rspec", "~> 3.0"
|
39
39
|
spec.add_development_dependency "rubocop-rails_config"
|
@@ -41,7 +41,7 @@ Gem::Specification.new do |spec|
|
|
41
41
|
spec.add_development_dependency "vcr", "~> 4.0.0"
|
42
42
|
spec.add_development_dependency "pry"
|
43
43
|
|
44
|
-
spec.add_dependency "active_interaction", "
|
44
|
+
spec.add_dependency "active_interaction", ">= 3.8"
|
45
45
|
spec.add_dependency "base58", "~> 0.2.3"
|
46
46
|
spec.add_dependency "httparty", "~> 0.17.0"
|
47
47
|
spec.add_dependency "rbnacl", "~> 5.0.0"
|
@@ -11,4 +11,9 @@ sudo add-apt-repository "deb http://fr.archive.ubuntu.com/ubuntu bionic main uni
|
|
11
11
|
sudo apt-get update -qq
|
12
12
|
sudo apt-get install -y -qq \
|
13
13
|
libsecp256k1-dev libsecp256k1-0 libsodium-dev libssl-dev \
|
14
|
-
bubblewrap libev-dev libhidapi-dev
|
14
|
+
bubblewrap libev-dev libhidapi-dev
|
15
|
+
|
16
|
+
wget -qO- https://deb.nodesource.com/setup_14.x | sudo -E bash -
|
17
|
+
sudo apt install -y nodejs
|
18
|
+
node --version
|
19
|
+
npm --version
|
metadata
CHANGED
@@ -1,14 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tezos_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pierre Michard
|
8
|
+
- Sébastien Lauret
|
9
|
+
- Othmane El Kesri
|
8
10
|
autorequire:
|
9
11
|
bindir: exe
|
10
12
|
cert_chain: []
|
11
|
-
date:
|
13
|
+
date: 2021-05-31 00:00:00.000000000 Z
|
12
14
|
dependencies:
|
13
15
|
- !ruby/object:Gem::Dependency
|
14
16
|
name: bundler
|
@@ -16,14 +18,14 @@ dependencies:
|
|
16
18
|
requirements:
|
17
19
|
- - "~>"
|
18
20
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1
|
21
|
+
version: '2.1'
|
20
22
|
type: :development
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
23
25
|
requirements:
|
24
26
|
- - "~>"
|
25
27
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1
|
28
|
+
version: '2.1'
|
27
29
|
- !ruby/object:Gem::Dependency
|
28
30
|
name: rake
|
29
31
|
requirement: !ruby/object:Gem::Requirement
|
@@ -112,16 +114,16 @@ dependencies:
|
|
112
114
|
name: active_interaction
|
113
115
|
requirement: !ruby/object:Gem::Requirement
|
114
116
|
requirements:
|
115
|
-
- - "
|
117
|
+
- - ">="
|
116
118
|
- !ruby/object:Gem::Version
|
117
|
-
version: '3.
|
119
|
+
version: '3.8'
|
118
120
|
type: :runtime
|
119
121
|
prerelease: false
|
120
122
|
version_requirements: !ruby/object:Gem::Requirement
|
121
123
|
requirements:
|
122
|
-
- - "
|
124
|
+
- - ">="
|
123
125
|
- !ruby/object:Gem::Version
|
124
|
-
version: '3.
|
126
|
+
version: '3.8'
|
125
127
|
- !ruby/object:Gem::Dependency
|
126
128
|
name: base58
|
127
129
|
requirement: !ruby/object:Gem::Requirement
|
@@ -223,6 +225,8 @@ dependencies:
|
|
223
225
|
description: ''
|
224
226
|
email:
|
225
227
|
- pierre@moneytrack.io
|
228
|
+
- sebastien@moneytrack.io
|
229
|
+
- othmane@moneytrack.io
|
226
230
|
executables: []
|
227
231
|
extensions: []
|
228
232
|
extra_rdoc_files: []
|
@@ -270,7 +274,6 @@ files:
|
|
270
274
|
- lib/tezos_client/rpc_interface/monitor.rb
|
271
275
|
- lib/tezos_client/rpc_interface/operations.rb
|
272
276
|
- lib/tezos_client/rpc_interface/request_manager.rb
|
273
|
-
- lib/tezos_client/smartpy_inteface/micheline_serializer_wrapper.rb
|
274
277
|
- lib/tezos_client/smartpy_inteface/smartpy_wrapper.rb
|
275
278
|
- lib/tezos_client/smartpy_interface.rb
|
276
279
|
- lib/tezos_client/string_utils.rb
|
@@ -292,12 +295,24 @@ files:
|
|
292
295
|
- lib/tezos_client/tools/convert_to_hash/timestamp.rb
|
293
296
|
- lib/tezos_client/tools/find_big_maps_in_storage.rb
|
294
297
|
- lib/tezos_client/tools/hash_to_micheline.rb
|
298
|
+
- lib/tezos_client/tools/hash_to_micheline/address.rb
|
299
|
+
- lib/tezos_client/tools/hash_to_micheline/base.rb
|
300
|
+
- lib/tezos_client/tools/hash_to_micheline/bytes.rb
|
301
|
+
- lib/tezos_client/tools/hash_to_micheline/contract.rb
|
302
|
+
- lib/tezos_client/tools/hash_to_micheline/int.rb
|
303
|
+
- lib/tezos_client/tools/hash_to_micheline/key.rb
|
304
|
+
- lib/tezos_client/tools/hash_to_micheline/nat.rb
|
305
|
+
- lib/tezos_client/tools/hash_to_micheline/option.rb
|
306
|
+
- lib/tezos_client/tools/hash_to_micheline/pair.rb
|
307
|
+
- lib/tezos_client/tools/hash_to_micheline/signature.rb
|
308
|
+
- lib/tezos_client/tools/hash_to_micheline/string.rb
|
309
|
+
- lib/tezos_client/tools/hash_to_micheline/timestamp.rb
|
295
310
|
- lib/tezos_client/tools/system_call.rb
|
296
311
|
- lib/tezos_client/tools/temporary_file.rb
|
297
312
|
- lib/tezos_client/version.rb
|
298
313
|
- tezos_client.gemspec
|
299
314
|
- travis-scripts/prepare-ubuntu.sh
|
300
|
-
homepage:
|
315
|
+
homepage: https://moneytrack.io
|
301
316
|
licenses:
|
302
317
|
- MIT
|
303
318
|
metadata:
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class TezosClient
|
4
|
-
class SmartpyInterface
|
5
|
-
module MichelineSerializerWrapper
|
6
|
-
def convert_michelson_to_micheline(script)
|
7
|
-
cmd = ["michelson-to-micheline", script]
|
8
|
-
|
9
|
-
Tools::SystemCall.execute(cmd)
|
10
|
-
end
|
11
|
-
|
12
|
-
def actual_project_path
|
13
|
-
TezosClient.root_path
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|