ton_sdk_client 1.7.1 → 1.13.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/CHANGELOG.md +31 -0
- data/README.md +5 -6
- data/lib/ton_sdk_client/abi.rb +2 -2
- data/lib/ton_sdk_client/boc.rb +52 -109
- data/lib/ton_sdk_client/client.rb +8 -49
- data/lib/ton_sdk_client/config.rb +34 -22
- data/lib/ton_sdk_client/crypto.rb +37 -241
- data/lib/ton_sdk_client/debot.rb +56 -218
- data/lib/ton_sdk_client/interop.rb +1 -1
- data/lib/ton_sdk_client/net.rb +45 -78
- data/lib/ton_sdk_client/processing.rb +2 -15
- data/lib/ton_sdk_client/tvm.rb +22 -3
- data/lib/ton_sdk_client/utils.rb +63 -12
- data/lib/ton_sdk_client/version.rb +2 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d1c48c5f27ebe774498f9a6a471e384aa658c48d51a834bf09a9d62407b5b9a
|
4
|
+
data.tar.gz: cb6369381b1aaf376a19dddea4b3d2e3a6b32b681dde8e0ce7a9fa3358bbb630
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e2c8829e03117c75787b63f414a4e04dbf0466d27b4f25c7767b429942a2732db56e6ced5b91a2c7ee50e863a36843b356631a2164494dfb8c1f855f2ec2069
|
7
|
+
data.tar.gz: 495f0ac60ff7a8ea641afdf1169bc6accc5748fb7c01240f9246f5e47633bf24f222100ca5eff2a4c31df683b4b411076d3d095fc843c5cc2c7bbdccf03e796a
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,36 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
1.13.x
|
4
|
+
-----
|
5
|
+
* TON SDK version: 1.13.0
|
6
|
+
* internal refactoring
|
7
|
+
* the changes are according the ones of TON SDK
|
8
|
+
|
9
|
+
1.12.x
|
10
|
+
-----
|
11
|
+
* TON SDK version: 1.12.0
|
12
|
+
* internal refactoring
|
13
|
+
* the changes are according the ones of TON SDK
|
14
|
+
|
15
|
+
1.11.x
|
16
|
+
-----
|
17
|
+
* TON SDK version: 1.11.0
|
18
|
+
* the changes are according the ones of TON SDK
|
19
|
+
|
20
|
+
|
21
|
+
1.10.x
|
22
|
+
-----
|
23
|
+
* TON SDK version: 1.10.0
|
24
|
+
* the changes are according the ones of TON SDK
|
25
|
+
|
26
|
+
|
27
|
+
1.9.x
|
28
|
+
-----
|
29
|
+
* TON SDK version: 1.9.0
|
30
|
+
* remove TonSdk::NATIVE_LIB_VERSION, rename TonSdk::SDK_VERSION to TonSdk::NATIVE_SDK_VERSION
|
31
|
+
* the changes are according the ones of TON SDK
|
32
|
+
|
33
|
+
|
3
34
|
1.7.x
|
4
35
|
-----
|
5
36
|
* TON SDK version: 1.7.0
|
data/README.md
CHANGED
@@ -1,16 +1,15 @@
|
|
1
1
|
# TON SDK client in Ruby and for Ruby
|
2
2
|
|
3
3
|
[](https://badge.fury.io/rb/ton_sdk_client)
|
4
|
-
[](https://github.com/tonlabs/TON-SDK/tree/1.13.0)
|
5
5
|
|
6
6
|
Ruby gem-client bindings for [TON SDK](https://github.com/tonlabs/TON-SDK) which allows one to communicate with [FreeTON](https://freeton.org) blockchain in Ruby.
|
7
7
|
|
8
|
-
Note that there're
|
8
|
+
Note that there're 2 types of versions:
|
9
9
|
* `TonSdk::VERSION` - the version of the gem
|
10
|
-
* `TonSdk::
|
11
|
-
* `TonSdk::SDK_VERSION` - the version of SDK
|
10
|
+
* `TonSdk::NATIVE_SDK_VERSION` - the version of the original SDK
|
12
11
|
|
13
|
-
and they don't necessarily match each other.
|
12
|
+
and they don't necessarily have to match each other.
|
14
13
|
|
15
14
|
|
16
15
|
|
@@ -185,7 +184,7 @@ factorize
|
|
185
184
|
|
186
185
|
* MacOS Catalina 10.15.5
|
187
186
|
* Arch Linux x86_64
|
188
|
-
* TON client native library: `TonSdk::
|
187
|
+
* TON client native library: `TonSdk::NATIVE_SDK_VERSION`
|
189
188
|
|
190
189
|
|
191
190
|
## References
|
data/lib/ton_sdk_client/abi.rb
CHANGED
@@ -777,7 +777,7 @@ module TonSdk
|
|
777
777
|
attr_reader :abi, :address, :src_address, :deploy_set, :call_set, :value, :bounce, :enable_ihr
|
778
778
|
|
779
779
|
def initialize(
|
780
|
-
abi
|
780
|
+
abi: nil,
|
781
781
|
address: nil,
|
782
782
|
src_address: nil,
|
783
783
|
deploy_set: nil,
|
@@ -798,7 +798,7 @@ module TonSdk
|
|
798
798
|
|
799
799
|
def to_h
|
800
800
|
{
|
801
|
-
abi: @abi,
|
801
|
+
abi: @abi.nil? ? nil : @abi.to_h,
|
802
802
|
address: @address,
|
803
803
|
src_address: @src_address,
|
804
804
|
deploy_set: @deploy_set.nil? ? nil : @deploy_set.to_h,
|
data/lib/ton_sdk_client/boc.rb
CHANGED
@@ -5,33 +5,13 @@ module TonSdk
|
|
5
5
|
# types
|
6
6
|
#
|
7
7
|
|
8
|
-
|
9
|
-
attr_reader :boc
|
10
|
-
|
11
|
-
def initialize(a)
|
12
|
-
@boc = a
|
13
|
-
end
|
14
|
-
|
8
|
+
ParamsOfParse = Struct.new(:boc) do
|
15
9
|
def to_h = { boc: @boc }
|
16
10
|
end
|
17
11
|
|
18
|
-
|
19
|
-
attr_reader :parsed
|
20
|
-
|
21
|
-
def initialize(a)
|
22
|
-
@parsed = a
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
class ParamsOfParseShardstate
|
27
|
-
attr_reader :boc, :id, :workchain_id
|
28
|
-
|
29
|
-
def initialize(boc:, id_:, workchain_id:)
|
30
|
-
@boc = boc
|
31
|
-
@id_ = id_
|
32
|
-
@workchain_id = workchain_id
|
33
|
-
end
|
12
|
+
ResultOfParse = Struct.new(:parsed)
|
34
13
|
|
14
|
+
ParamsOfParseShardstate = Struct.new(:boc, :id, :workchain_id) do
|
35
15
|
def to_h
|
36
16
|
{
|
37
17
|
boc: @boc,
|
@@ -41,35 +21,13 @@ module TonSdk
|
|
41
21
|
end
|
42
22
|
end
|
43
23
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
def initialize(a)
|
48
|
-
@block_boc = a
|
49
|
-
end
|
50
|
-
|
51
|
-
def to_h
|
52
|
-
{
|
53
|
-
block_boc: @block_boc
|
54
|
-
}
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
class ResultOfGetBlockchainConfig
|
59
|
-
attr_reader :config_boc
|
60
|
-
|
61
|
-
def initialize(a)
|
62
|
-
@config_boc = a
|
63
|
-
end
|
24
|
+
ParamsOfGetBlockchainConfig = Struct.new(:block_boc) do
|
25
|
+
def to_h = { block_boc: @block_boc }
|
64
26
|
end
|
65
27
|
|
66
|
-
|
67
|
-
attr_reader :boc
|
68
|
-
|
69
|
-
def initialize(a)
|
70
|
-
@boc = a
|
71
|
-
end
|
28
|
+
ResultOfGetBlockchainConfig = Struct.new(:config_boc)
|
72
29
|
|
30
|
+
ParamsOfGetBocHash = Struct.new(:boc) do
|
73
31
|
def to_h
|
74
32
|
{
|
75
33
|
boc: @boc
|
@@ -77,53 +35,19 @@ module TonSdk
|
|
77
35
|
end
|
78
36
|
end
|
79
37
|
|
80
|
-
|
81
|
-
attr_reader :hash
|
38
|
+
ResultOfGetBocHash = Struct.new(:hash)
|
82
39
|
|
83
|
-
|
84
|
-
|
85
|
-
end
|
40
|
+
ParamsOfGetCodeFromTvc = Struct.new(:hash) do
|
41
|
+
def to_h = { tvc: @tvc }
|
86
42
|
end
|
87
43
|
|
88
|
-
|
89
|
-
attr_reader :tvc
|
90
|
-
|
91
|
-
def initialize(a)
|
92
|
-
@tvc = a
|
93
|
-
end
|
94
|
-
|
95
|
-
def to_h
|
96
|
-
{
|
97
|
-
tvc: @tvc
|
98
|
-
}
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
class ResultOfGetCodeFromTvc
|
103
|
-
attr_reader :code
|
104
|
-
|
105
|
-
def initialize(a)
|
106
|
-
@code = a
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
class ParamsOfBocCacheGet
|
111
|
-
attr_reader :boc_ref
|
112
|
-
|
113
|
-
def initialize(a)
|
114
|
-
@boc_ref = a
|
115
|
-
end
|
44
|
+
ResultOfGetCodeFromTvc = Struct.new(:code)
|
116
45
|
|
46
|
+
ParamsOfBocCacheGet = Struct.new(:boc_ref) do
|
117
47
|
def to_h = { boc_ref: @boc_ref }
|
118
48
|
end
|
119
49
|
|
120
|
-
|
121
|
-
attr_reader :boc
|
122
|
-
|
123
|
-
def initialize(boc: nil)
|
124
|
-
@boc = boc
|
125
|
-
end
|
126
|
-
end
|
50
|
+
ResultOfBocCacheGet = Struct.new(:boc)
|
127
51
|
|
128
52
|
class BocCacheType
|
129
53
|
TYPES = [
|
@@ -159,14 +83,7 @@ module TonSdk
|
|
159
83
|
end
|
160
84
|
end
|
161
85
|
|
162
|
-
|
163
|
-
attr_reader :boc, :cache_type
|
164
|
-
|
165
|
-
def initialize(boc:, cache_type:)
|
166
|
-
@boc = boc
|
167
|
-
@cache_type = cache_type
|
168
|
-
end
|
169
|
-
|
86
|
+
ParamsOfBocCacheSet = Struct.new(:boc, :cache_type) do
|
170
87
|
def to_h
|
171
88
|
{
|
172
89
|
boc: @boc,
|
@@ -175,22 +92,18 @@ module TonSdk
|
|
175
92
|
end
|
176
93
|
end
|
177
94
|
|
178
|
-
|
179
|
-
attr_reader :boc_ref
|
95
|
+
ResultOfBocCacheSet = Struct.new(:boc_ref)
|
180
96
|
|
181
|
-
|
182
|
-
|
97
|
+
ParamsOfBocCacheUnpin = Struct.new(:boc, :boc_ref) do
|
98
|
+
def to_h
|
99
|
+
{
|
100
|
+
boc: @boc,
|
101
|
+
boc_ref: @boc_ref
|
102
|
+
}
|
183
103
|
end
|
184
104
|
end
|
185
105
|
|
186
|
-
|
187
|
-
attr_reader :boc, :boc_ref
|
188
|
-
|
189
|
-
def initialize(boc:, boc_ref: nil)
|
190
|
-
@boc = boc
|
191
|
-
@boc_ref = boc_ref
|
192
|
-
end
|
193
|
-
|
106
|
+
ParamsOfEncodeBoc = Struct.new(:builder, :boc_cache) do
|
194
107
|
def to_h
|
195
108
|
{
|
196
109
|
boc: @boc,
|
@@ -199,6 +112,8 @@ module TonSdk
|
|
199
112
|
end
|
200
113
|
end
|
201
114
|
|
115
|
+
ResultOfEncodeBoc = Struct.new(:boc)
|
116
|
+
|
202
117
|
|
203
118
|
|
204
119
|
#
|
@@ -340,5 +255,33 @@ module TonSdk
|
|
340
255
|
end
|
341
256
|
end
|
342
257
|
end
|
258
|
+
|
259
|
+
def self.encode_boc(ctx, params)
|
260
|
+
Interop::request_to_native_lib(ctx, "boc.encode_boc", params.to_h.to_json) do |resp|
|
261
|
+
if resp.success?
|
262
|
+
yield NativeLibResponsetResult.new(
|
263
|
+
result: ResultOfEncodeBoc.new(
|
264
|
+
resp.result["boc"]
|
265
|
+
)
|
266
|
+
)
|
267
|
+
else
|
268
|
+
yield resp
|
269
|
+
end
|
270
|
+
end
|
271
|
+
end
|
272
|
+
|
273
|
+
def self.get_blockchain_config(ctx, params)
|
274
|
+
Interop::request_to_native_lib(ctx, "boc.get_blockchain_config", params.to_h.to_json) do |resp|
|
275
|
+
if resp.success?
|
276
|
+
yield NativeLibResponsetResult.new(
|
277
|
+
result: ResultOfGetBlockchainConfig.new(
|
278
|
+
resp.result["config_boc"]
|
279
|
+
)
|
280
|
+
)
|
281
|
+
else
|
282
|
+
yield resp
|
283
|
+
end
|
284
|
+
end
|
285
|
+
end
|
343
286
|
end
|
344
287
|
end
|
@@ -44,57 +44,23 @@ module TonSdk
|
|
44
44
|
INTERNAL_ERROR = 33
|
45
45
|
end
|
46
46
|
|
47
|
-
|
48
|
-
attr_reader :version
|
47
|
+
ResultOfVersion = Struct.new(:version)
|
49
48
|
|
50
|
-
|
51
|
-
@version = a
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
class ResultOfGetApiReference
|
56
|
-
attr_reader :api
|
57
|
-
|
58
|
-
def initialize(a)
|
59
|
-
@api = a
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
class BuildInfoDependency
|
64
|
-
attr_reader :name, :git_commit
|
65
|
-
|
66
|
-
def initialize(name:, git_commit:)
|
67
|
-
@name = name
|
68
|
-
@git_commit = git_commit
|
69
|
-
end
|
49
|
+
ResultOfGetApiReference = Struct.new(:api)
|
70
50
|
|
51
|
+
BuildInfoDependency = Struct.new(:name, :git_commit, keyword_init: true) do
|
71
52
|
def self.from_json(j)
|
72
53
|
return nil if j.nil?
|
73
54
|
|
74
55
|
self.new(
|
75
|
-
|
76
|
-
|
56
|
+
j["name"],
|
57
|
+
j["git_commit"]
|
77
58
|
)
|
78
59
|
end
|
79
60
|
end
|
80
61
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
def initialize(build_number:, dependencies:)
|
85
|
-
@build_number = build_number
|
86
|
-
@dependencies = dependencies
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
class ParamsOfAppRequest
|
91
|
-
attr_reader :app_request_id, :request_data
|
92
|
-
|
93
|
-
def initialize(app_request_id:, request_data:)
|
94
|
-
@app_request_id = app_request_id
|
95
|
-
@request_data = request_data
|
96
|
-
end
|
97
|
-
end
|
62
|
+
ResultOfBuildInfo = Struct.new(:build_number, :dependencies, keyword_init: true)
|
63
|
+
ParamsOfAppRequest = Struct.new(:app_request_id, :request_data, keyword_init: true)
|
98
64
|
|
99
65
|
class AppRequestResult
|
100
66
|
TYPES = [:ok, :error]
|
@@ -128,14 +94,7 @@ module TonSdk
|
|
128
94
|
end
|
129
95
|
end
|
130
96
|
|
131
|
-
|
132
|
-
attr_reader :app_request_id, :result
|
133
|
-
|
134
|
-
def initialize(app_request_id:, result:)
|
135
|
-
@app_request_id = app_request_id
|
136
|
-
@result = result
|
137
|
-
end
|
138
|
-
|
97
|
+
ParamsOfResolveAppRequest = Struct.new(:app_request_id, :result, keyword_init: true) do
|
139
98
|
def to_h
|
140
99
|
{
|
141
100
|
app_request_id: @app_request_id,
|
@@ -22,65 +22,77 @@ module TonSdk
|
|
22
22
|
end
|
23
23
|
|
24
24
|
class NetworkConfig
|
25
|
-
|
26
|
-
|
25
|
+
DEFAULT_NETWORK_RETRIES_COUNT = 5
|
26
|
+
DEFAULT_MAX_RECONNECT_TIMEOUT = 120000
|
27
|
+
DEFAULT_RECONNECT_TIMEOUT = 1000
|
28
|
+
DEFAULT_MESSAGE_RETRIES_COUNT = 5
|
29
|
+
|
30
|
+
DEFAULT_MESSAGE_PROCESSING_TIMEOUT = 40000
|
27
31
|
DEFAULT_WAIT_TIMEOUT = 40000
|
28
32
|
DEFAULT_OUT_OF_SYNC_THRESHOLD = 15000
|
29
|
-
|
30
|
-
DEFAULT_MAX_RECONNECT_TIMEOUT = 2
|
33
|
+
DEFAULT_SENDING_ENDPOINT_COUNT = 2
|
31
34
|
|
32
35
|
attr_reader :server_address, :endpoints, :network_retries_count,
|
33
36
|
:message_retries_count, :message_processing_timeout,
|
34
37
|
:wait_for_timeout, :out_of_sync_threshold, :reconnect_timeout,
|
35
|
-
:
|
38
|
+
:max_reconnect_timeout,
|
39
|
+
:sending_endpoint_count,
|
40
|
+
:access_key
|
36
41
|
|
37
42
|
def initialize(
|
38
43
|
server_address: "",
|
39
44
|
endpoints: [],
|
45
|
+
|
40
46
|
network_retries_count: DEFAULT_NETWORK_RETRIES_COUNT,
|
41
|
-
|
42
|
-
|
47
|
+
max_reconnect_timeout: DEFAULT_MAX_RECONNECT_TIMEOUT,
|
48
|
+
reconnect_timeout: DEFAULT_RECONNECT_TIMEOUT,
|
49
|
+
message_retries_count: DEFAULT_MESSAGE_RETRIES_COUNT,
|
50
|
+
|
51
|
+
message_processing_timeout: DEFAULT_MESSAGE_PROCESSING_TIMEOUT,
|
43
52
|
wait_for_timeout: DEFAULT_WAIT_TIMEOUT,
|
44
53
|
out_of_sync_threshold: DEFAULT_OUT_OF_SYNC_THRESHOLD,
|
45
|
-
|
46
|
-
|
47
|
-
|
54
|
+
sending_endpoint_count: DEFAULT_SENDING_ENDPOINT_COUNT,
|
55
|
+
|
56
|
+
access_key: nil
|
48
57
|
)
|
58
|
+
|
49
59
|
@server_address = server_address
|
50
60
|
@endpoints = endpoints
|
61
|
+
|
51
62
|
@network_retries_count = network_retries_count
|
63
|
+
@max_reconnect_timeout = max_reconnect_timeout
|
64
|
+
@reconnect_timeout = reconnect_timeout
|
52
65
|
@message_retries_count = message_retries_count
|
66
|
+
|
53
67
|
@message_processing_timeout = message_processing_timeout
|
54
68
|
@wait_for_timeout = wait_for_timeout
|
55
69
|
@out_of_sync_threshold = out_of_sync_threshold
|
56
|
-
@
|
70
|
+
@sending_endpoint_count = sending_endpoint_count
|
71
|
+
|
57
72
|
@access_key = access_key
|
58
|
-
@max_reconnect_timeout = max_reconnect_timeout
|
59
73
|
end
|
60
74
|
|
61
75
|
def to_h
|
62
76
|
{
|
63
77
|
server_address: @server_address,
|
64
78
|
endpoints: @endpoints,
|
79
|
+
|
65
80
|
network_retries_count: @network_retries_count,
|
81
|
+
max_reconnect_timeout: @max_reconnect_timeout,
|
82
|
+
reconnect_timeout: @reconnect_timeout,
|
66
83
|
message_retries_count: @message_retries_count,
|
84
|
+
|
67
85
|
message_processing_timeout: @message_processing_timeout,
|
68
86
|
wait_for_timeout: @wait_for_timeout,
|
69
87
|
out_of_sync_threshold: @out_of_sync_threshold,
|
70
|
-
|
71
|
-
|
72
|
-
|
88
|
+
sending_endpoint_count: @sending_endpoint_count,
|
89
|
+
|
90
|
+
access_key: @access_key
|
73
91
|
}
|
74
92
|
end
|
75
93
|
end
|
76
94
|
|
77
|
-
|
78
|
-
attr_reader :fish_param
|
79
|
-
|
80
|
-
def initialize(a)
|
81
|
-
@fish_param = a
|
82
|
-
end
|
83
|
-
|
95
|
+
CryptoConfig = Struct.new(:fish_param) do
|
84
96
|
def to_h = { fish_param: @fish_param }
|
85
97
|
end
|
86
98
|
|