ton-client-ruby 1.1.2 → 1.1.9
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/bin/ton-client-ruby +2 -2
- data/lib/code_generator/api.json +12230 -0
- data/lib/code_generator/code_generator.rb +2 -1
- data/lib/code_generator/release.rb +48 -0
- data/lib/ton-client-ruby/Client/Abi.rb +22 -0
- data/lib/ton-client-ruby/Client/Boc.rb +56 -1
- data/lib/ton-client-ruby/version.rb +1 -1
- metadata +5 -3
@@ -46,7 +46,8 @@ class CodeGenerator
|
|
46
46
|
content = %{
|
47
47
|
# Ruby Client for Free TON SDK
|
48
48
|
|
49
|
-
[](https://rubygems.org/gems/ton-client-ruby)
|
50
|
+
[](https://github.com/tonlabs/TON-SDK)
|
50
51
|
|
51
52
|
## Install
|
52
53
|
|
@@ -0,0 +1,48 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
script_file_path = File.expand_path(File.dirname(__FILE__))
|
4
|
+
|
5
|
+
require "#{script_file_path}/api_converter.rb"
|
6
|
+
require "#{script_file_path}/code_generator.rb"
|
7
|
+
GEM_DIR = "#{script_file_path}/../.."
|
8
|
+
|
9
|
+
|
10
|
+
`cd #{script_file_path} && curl https://raw.githubusercontent.com/tonlabs/TON-SDK/master/tools/api.json > api.json`
|
11
|
+
api_json_path = "#{script_file_path}/../../api.json"
|
12
|
+
json = ''
|
13
|
+
if File.exists?(api_json_path)
|
14
|
+
json = File.read(api_json_path)
|
15
|
+
else
|
16
|
+
p "File #{api_json_path} is not exist"
|
17
|
+
exit 0
|
18
|
+
end
|
19
|
+
converter = ApiConverter.new(json)
|
20
|
+
types = converter.convert
|
21
|
+
generator = CodeGenerator.new(types, GEM_DIR)
|
22
|
+
generator.generate_self_code
|
23
|
+
|
24
|
+
version_file = "#{script_file_path}/../ton-client-ruby/version.rb"
|
25
|
+
file = File.read(version_file)
|
26
|
+
|
27
|
+
p 'check version'
|
28
|
+
if file[/VERSION = "(\d+)\.(\d+)\.(\d+)"/]
|
29
|
+
major = $1
|
30
|
+
minor = $2
|
31
|
+
current = $3
|
32
|
+
version = "#{major}.#{minor}.#{current.to_i + 1}"
|
33
|
+
p version
|
34
|
+
data = "module TonClient\n VERSION = \"#{version}\"\nend\n\n"
|
35
|
+
p data
|
36
|
+
p version_file
|
37
|
+
File.open(version_file, 'wb') { |f| f.write(data) }
|
38
|
+
p 'update version'
|
39
|
+
|
40
|
+
puts "make release? Y/N"
|
41
|
+
option = gets
|
42
|
+
if option.strip.downcase == 'y'
|
43
|
+
system(%{cd #{GEM_DIR} && git add .})
|
44
|
+
system(%{cd #{GEM_DIR} && git commit -m 'version #{version}'})
|
45
|
+
system(%{cd #{GEM_DIR} && bash -lc 'rake release'})
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
@@ -138,6 +138,28 @@ module TonClient
|
|
138
138
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
139
139
|
end
|
140
140
|
|
141
|
+
# INPUT: ParamsOfUpdateInitialData
|
142
|
+
# abi: Value<Optional> - # # Contract ABI
|
143
|
+
# data: String - # # Data BOC or BOC handle
|
144
|
+
# initial_data: Value - # # List of initial values for contract's static variables. # # `abi` parameter should be provided to set initial data
|
145
|
+
# initial_pubkey: String<Optional> - # # Initial account owner's public key to set into account data
|
146
|
+
# boc_cache: BocCacheType<Optional> - # # Cache type to put the result. The BOC itself returned if no cache type provided.
|
147
|
+
# RESPONSE: ResultOfUpdateInitialData
|
148
|
+
# data: String - # # Updated data BOC or BOC handle
|
149
|
+
def update_initial_data(payload, &block)
|
150
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
151
|
+
end
|
152
|
+
|
153
|
+
# INPUT: ParamsOfDecodeInitialData
|
154
|
+
# abi: Value<Optional> - # # Contract ABI. # # Initial data is decoded if this parameter is provided
|
155
|
+
# data: String - # # Data BOC or BOC handle
|
156
|
+
# RESPONSE: ResultOfDecodeInitialData
|
157
|
+
# initial_data: Value<Optional> - # # List of initial values of contract's public variables. # # Initial data is decoded if `abi` input parameter is provided
|
158
|
+
# initial_pubkey: String - # # Initial account owner's public key
|
159
|
+
def decode_initial_data(payload, &block)
|
160
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
161
|
+
end
|
162
|
+
|
141
163
|
end
|
142
164
|
end
|
143
165
|
|
@@ -70,7 +70,7 @@ module TonClient
|
|
70
70
|
end
|
71
71
|
|
72
72
|
# INPUT: ParamsOfGetCodeFromTvc
|
73
|
-
# tvc: String - # # Contract TVC image
|
73
|
+
# tvc: String - # # Contract TVC image or image BOC handle
|
74
74
|
# RESPONSE: ResultOfGetCodeFromTvc
|
75
75
|
# code: String - # # Contract code encoded as base64
|
76
76
|
def get_code_from_tvc(payload, &block)
|
@@ -110,6 +110,61 @@ module TonClient
|
|
110
110
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
111
111
|
end
|
112
112
|
|
113
|
+
# INPUT: ParamsOfGetCodeSalt
|
114
|
+
# code: String - # # Contract code BOC encoded as base64 or code BOC handle
|
115
|
+
# boc_cache: BocCacheType<Optional> - # # Cache type to put the result. The BOC itself returned if no cache type provided.
|
116
|
+
# RESPONSE: ResultOfGetCodeSalt
|
117
|
+
# salt: String<Optional> - # # Contract code salt if present. # # BOC encoded as base64 or BOC handle
|
118
|
+
def get_code_salt(payload, &block)
|
119
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
120
|
+
end
|
121
|
+
|
122
|
+
# INPUT: ParamsOfSetCodeSalt
|
123
|
+
# code: String - # # Contract code BOC encoded as base64 or code BOC handle
|
124
|
+
# salt: String - # # Code salt to set. # # BOC encoded as base64 or BOC handle
|
125
|
+
# boc_cache: BocCacheType<Optional> - # # Cache type to put the result. The BOC itself returned if no cache type provided.
|
126
|
+
# RESPONSE: ResultOfSetCodeSalt
|
127
|
+
# code: String - # # Contract code with salt set. # # BOC encoded as base64 or BOC handle
|
128
|
+
def set_code_salt(payload, &block)
|
129
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
130
|
+
end
|
131
|
+
|
132
|
+
# INPUT: ParamsOfDecodeTvc
|
133
|
+
# tvc: String - # # Contract TVC image BOC encoded as base64 or BOC handle
|
134
|
+
# boc_cache: BocCacheType<Optional> - # # Cache type to put the result. The BOC itself returned if no cache type provided.
|
135
|
+
# RESPONSE: ResultOfDecodeTvc
|
136
|
+
# code: String<Optional> - # # Contract code BOC encoded as base64 or BOC handle
|
137
|
+
# data: String<Optional> - # # Contract data BOC encoded as base64 or BOC handle
|
138
|
+
# library: String<Optional> - # # Contract library BOC encoded as base64 or BOC handle
|
139
|
+
# tick: Boolean<Optional> - # # `special.tick` field. # # Specifies the contract ability to handle tick transactions
|
140
|
+
# tock: Boolean<Optional> - # # `special.tock` field. # # Specifies the contract ability to handle tock transactions
|
141
|
+
# split_depth: Number<Optional> - # # Is present and non-zero only in instances of large smart contracts
|
142
|
+
def decode_tvc(payload, &block)
|
143
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
144
|
+
end
|
145
|
+
|
146
|
+
# INPUT: ParamsOfEncodeTvc
|
147
|
+
# code: String<Optional> - # # Contract code BOC encoded as base64 or BOC handle
|
148
|
+
# data: String<Optional> - # # Contract data BOC encoded as base64 or BOC handle
|
149
|
+
# library: String<Optional> - # # Contract library BOC encoded as base64 or BOC handle
|
150
|
+
# tick: Boolean<Optional> - # # `special.tick` field. # # Specifies the contract ability to handle tick transactions
|
151
|
+
# tock: Boolean<Optional> - # # `special.tock` field. # # Specifies the contract ability to handle tock transactions
|
152
|
+
# split_depth: Number<Optional> - # # Is present and non-zero only in instances of large smart contracts
|
153
|
+
# boc_cache: BocCacheType<Optional> - # # Cache type to put the result. The BOC itself returned if no cache type provided.
|
154
|
+
# RESPONSE: ResultOfEncodeTvc
|
155
|
+
# tvc: String - # # Contract TVC image BOC encoded as base64 or BOC handle of boc_cache parameter was specified
|
156
|
+
def encode_tvc(payload, &block)
|
157
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
158
|
+
end
|
159
|
+
|
160
|
+
# INPUT: ParamsOfGetCompilerVersion
|
161
|
+
# code: String - # # Contract code BOC encoded as base64 or code BOC handle
|
162
|
+
# RESPONSE: ResultOfGetCompilerVersion
|
163
|
+
# version: String<Optional> - # # Compiler version, for example 'sol 0.49.0'
|
164
|
+
def get_compiler_version(payload, &block)
|
165
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
166
|
+
end
|
167
|
+
|
113
168
|
end
|
114
169
|
end
|
115
170
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ton-client-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- nerzh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -117,9 +117,11 @@ extensions: []
|
|
117
117
|
extra_rdoc_files: []
|
118
118
|
files:
|
119
119
|
- bin/ton-client-ruby
|
120
|
+
- lib/code_generator/api.json
|
120
121
|
- lib/code_generator/api_converter.rb
|
121
122
|
- lib/code_generator/code_generator.rb
|
122
123
|
- lib/code_generator/helpers.rb
|
124
|
+
- lib/code_generator/release.rb
|
123
125
|
- lib/ton-client-ruby.rb
|
124
126
|
- lib/ton-client-ruby/Binding/binding.rb
|
125
127
|
- lib/ton-client-ruby/Binding/struct.rb
|
@@ -154,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
154
156
|
- !ruby/object:Gem::Version
|
155
157
|
version: '0'
|
156
158
|
requirements: []
|
157
|
-
rubygems_version: 3.
|
159
|
+
rubygems_version: 3.1.6
|
158
160
|
signing_key:
|
159
161
|
specification_version: 4
|
160
162
|
summary: This is gem ton-client-ruby
|