tezos_client 1.3.5 → 1.4.0
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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +2 -2
- data/lib/tezos_client.rb +3 -3
- data/lib/tezos_client/smartpy_interface.rb +39 -7
- data/lib/tezos_client/version.rb +1 -1
- metadata +3 -4
- 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: 2f5b9a5c58bf1640c1dea1b7e50476ec7f73d8921f643aae09ee78bc6c52831f
|
4
|
+
data.tar.gz: d6ab0bf0fe3a61153e932f826495cc63a4ef111d58059a998461f4a75a45dbe7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97e1173843fbd7856cd3b533cdb7dafc0377825709756c07f32ac17b2645264b77fa3bc96dffba72bcd9142c6312911497d2117b237dfe04c8b91aa26eeded29
|
7
|
+
data.tar.gz: 28f6dddae3bef46b9dfa12ec10195c33c6a4cef8dbae0a629123d8b6bea92a289a0e378fde25a27c68cb3c83f183a332b720b8ad2d89b72f2c7e11eeac749fc4
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -20,10 +20,10 @@ npm i -g michelson-to-micheline
|
|
20
20
|
```
|
21
21
|
|
22
22
|
### SmartPy
|
23
|
-
[SmartPy](https://smartpy.io/)
|
23
|
+
[SmartPy](https://smartpy.io/releases/20210317-bc925bb73dc885ac2b4dde9689e805d9b0bc6125/)
|
24
24
|
|
25
25
|
```bash
|
26
|
-
sh <(curl -s https://smartpy.io/
|
26
|
+
sh <(curl -s https://smartpy.io/releases/20210317-bc925bb73dc885ac2b4dde9689e805d9b0bc6125/cli/install.sh)
|
27
27
|
export PATH=$PATH:$HOME/smartpy-cli/
|
28
28
|
```
|
29
29
|
|
data/lib/tezos_client.rb
CHANGED
@@ -82,7 +82,7 @@ class TezosClient
|
|
82
82
|
#
|
83
83
|
# @return [Hash] result of the origination containing :operation_id, :operation_result and :originated_contract
|
84
84
|
#
|
85
|
-
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)
|
86
86
|
origination_args = {
|
87
87
|
rpc_interface: rpc_interface,
|
88
88
|
from: from,
|
@@ -92,9 +92,9 @@ class TezosClient
|
|
92
92
|
}
|
93
93
|
|
94
94
|
origination_args[:script] = contract_interface(script).origination_script(
|
95
|
-
from: from,
|
96
95
|
script: script,
|
97
|
-
init_params: init_params
|
96
|
+
init_params: init_params,
|
97
|
+
**args
|
98
98
|
)
|
99
99
|
|
100
100
|
operation = OriginationOperation.new(origination_args)
|
@@ -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
|
data/lib/tezos_client/version.rb
CHANGED
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.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pierre Michard
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -270,7 +270,6 @@ files:
|
|
270
270
|
- lib/tezos_client/rpc_interface/monitor.rb
|
271
271
|
- lib/tezos_client/rpc_interface/operations.rb
|
272
272
|
- lib/tezos_client/rpc_interface/request_manager.rb
|
273
|
-
- lib/tezos_client/smartpy_inteface/micheline_serializer_wrapper.rb
|
274
273
|
- lib/tezos_client/smartpy_inteface/smartpy_wrapper.rb
|
275
274
|
- lib/tezos_client/smartpy_interface.rb
|
276
275
|
- lib/tezos_client/string_utils.rb
|
@@ -329,7 +328,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
329
328
|
- !ruby/object:Gem::Version
|
330
329
|
version: '0'
|
331
330
|
requirements: []
|
332
|
-
rubygems_version: 3.0.
|
331
|
+
rubygems_version: 3.0.8
|
333
332
|
signing_key:
|
334
333
|
specification_version: 4
|
335
334
|
summary: Wrapper to the tezos client.
|
@@ -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
|