ton_sdk_client 1.13.0 → 1.15.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 +6 -0
- data/README.md +1 -1
- data/lib/ton_sdk_client/abi.rb +114 -294
- data/lib/ton_sdk_client/boc.rb +24 -74
- data/lib/ton_sdk_client/client.rb +1 -2
- data/lib/ton_sdk_client/client_context.rb +2 -0
- data/lib/ton_sdk_client/config.rb +48 -101
- data/lib/ton_sdk_client/crypto.rb +90 -445
- data/lib/ton_sdk_client/debot.rb +117 -54
- data/lib/ton_sdk_client/interop.rb +2 -2
- data/lib/ton_sdk_client/net.rb +57 -113
- data/lib/ton_sdk_client/processing.rb +6 -22
- data/lib/ton_sdk_client/tvm.rb +58 -94
- data/lib/ton_sdk_client/utils.rb +12 -32
- data/lib/ton_sdk_client/version.rb +2 -2
- metadata +2 -2
@@ -23,13 +23,7 @@ module TonSdk
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
ResultOfSendMessage = Struct.new(:shard_block_id)
|
27
|
-
def to_h
|
28
|
-
{
|
29
|
-
shard_block_id: @shard_block_id
|
30
|
-
}
|
31
|
-
end
|
32
|
-
end
|
26
|
+
ResultOfSendMessage = Struct.new(:shard_block_id)
|
33
27
|
|
34
28
|
class ParamsOfWaitForTransaction
|
35
29
|
attr_reader :abi, :message, :shard_block_id, :send_events
|
@@ -135,19 +129,9 @@ module TonSdk
|
|
135
129
|
end
|
136
130
|
end
|
137
131
|
|
138
|
-
|
139
|
-
attr_reader :out_messages, :output
|
140
|
-
|
132
|
+
DecodedOutput = Struct.new(:out_messages, :output) do
|
141
133
|
def initialize(out_messages:, output: nil)
|
142
|
-
|
143
|
-
@output = output
|
144
|
-
end
|
145
|
-
|
146
|
-
def to_h
|
147
|
-
{
|
148
|
-
out_messages: @out_messages,
|
149
|
-
output: @output
|
150
|
-
}
|
134
|
+
super
|
151
135
|
end
|
152
136
|
end
|
153
137
|
|
@@ -173,7 +157,7 @@ module TonSdk
|
|
173
157
|
Interop::request_to_native_lib(
|
174
158
|
ctx,
|
175
159
|
"processing.send_message",
|
176
|
-
params
|
160
|
+
params,
|
177
161
|
client_callback: client_callback,
|
178
162
|
is_single_thread_only: false
|
179
163
|
) do |resp|
|
@@ -195,7 +179,7 @@ module TonSdk
|
|
195
179
|
Interop::request_to_native_lib(
|
196
180
|
ctx,
|
197
181
|
"processing.wait_for_transaction",
|
198
|
-
params
|
182
|
+
params,
|
199
183
|
client_callback: client_callback,
|
200
184
|
is_single_thread_only: false
|
201
185
|
) do |resp|
|
@@ -222,7 +206,7 @@ module TonSdk
|
|
222
206
|
Interop::request_to_native_lib(
|
223
207
|
ctx,
|
224
208
|
"processing.process_message",
|
225
|
-
params
|
209
|
+
params,
|
226
210
|
client_callback: client_callback,
|
227
211
|
is_single_thread_only: false
|
228
212
|
) do |resp|
|
data/lib/ton_sdk_client/tvm.rb
CHANGED
@@ -22,30 +22,27 @@ module TonSdk
|
|
22
22
|
CONTRACT_EXECUTION_ERROR = 414
|
23
23
|
end
|
24
24
|
|
25
|
-
|
26
|
-
attr_reader :blockchain_config, :block_time, :block_lt, :transaction_lt
|
27
|
-
|
25
|
+
ExecutionOptions = Struct.new(:blockchain_config, :block_time, :block_lt, :transaction_lt, keyword_init: true) do
|
28
26
|
def initialize(blockchain_config: nil, block_time: nil, block_lt: nil, transaction_lt: nil)
|
29
|
-
|
30
|
-
@block_time = block_time
|
31
|
-
@block_lt = block_lt
|
32
|
-
@transaction_lt = transaction_lt
|
27
|
+
super
|
33
28
|
end
|
34
29
|
end
|
35
30
|
|
36
31
|
class AccountForExecutor
|
32
|
+
private_class_method :new
|
33
|
+
|
37
34
|
TYPES = [:none, :uninit, :account]
|
38
35
|
attr_reader :type_, :boc, :unlimited_balance
|
39
36
|
|
40
|
-
def new_with_type_none
|
37
|
+
def self.new_with_type_none
|
41
38
|
@type_ = :none
|
42
39
|
end
|
43
40
|
|
44
|
-
def new_with_type_uninit
|
41
|
+
def self.new_with_type_uninit
|
45
42
|
@type_ = :uninit
|
46
43
|
end
|
47
44
|
|
48
|
-
def new_with_type_account(boc:, unlimited_balance: nil)
|
45
|
+
def self.new_with_type_account(boc:, unlimited_balance: nil)
|
49
46
|
@type_ = :account
|
50
47
|
@boc = boc
|
51
48
|
@unlimited_balance = unlimited_balance
|
@@ -67,10 +64,16 @@ module TonSdk
|
|
67
64
|
end
|
68
65
|
end
|
69
66
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
67
|
+
ParamsOfRunExecutor = Struct.new(
|
68
|
+
:message,
|
69
|
+
:account,
|
70
|
+
:execution_options,
|
71
|
+
:abi,
|
72
|
+
:skip_transaction_check,
|
73
|
+
:boc_cache,
|
74
|
+
:return_updated_account,
|
75
|
+
keyword_init: true
|
76
|
+
) do
|
74
77
|
def initialize(
|
75
78
|
message:,
|
76
79
|
account:,
|
@@ -80,41 +83,22 @@ module TonSdk
|
|
80
83
|
boc_cache: nil,
|
81
84
|
return_updated_account: nil
|
82
85
|
)
|
83
|
-
|
84
|
-
@account = account
|
85
|
-
@execution_options = execution_options
|
86
|
-
@abi = abi
|
87
|
-
@skip_transaction_check = skip_transaction_check
|
88
|
-
@boc_cache = boc_cache
|
89
|
-
@return_updated_account = return_updated_account
|
86
|
+
super
|
90
87
|
end
|
91
88
|
|
92
89
|
def to_h
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
account: @account.to_h,
|
100
|
-
execution_options: exe_opt_val,
|
101
|
-
abi: abi_val,
|
102
|
-
skip_transaction_check: @skip_transaction_check,
|
103
|
-
boc_cache: boc_cache_val,
|
104
|
-
return_updated_account: @return_updated_account
|
105
|
-
}
|
90
|
+
h = super
|
91
|
+
h[:account] = self.account.to_h
|
92
|
+
h[:execution_options] = self.execution_options&.to_h
|
93
|
+
h[:abi] = self.abi&.to_h
|
94
|
+
h[:boc_cache] = self.boc_cache&.to_h
|
95
|
+
h
|
106
96
|
end
|
107
97
|
end
|
108
98
|
|
109
|
-
|
110
|
-
attr_reader :transaction, :out_messages, :decoded, :account, :fees
|
111
|
-
|
99
|
+
ResultOfRunExecutor = Struct.new(:transaction, :out_messages, :decoded, :account, :fees, keyword_init: true) do
|
112
100
|
def initialize(transaction:, out_messages:, decoded: nil, account:, fees:)
|
113
|
-
|
114
|
-
@out_messages = out_messages
|
115
|
-
@decoded = decoded
|
116
|
-
@account = account
|
117
|
-
@fees = fees
|
101
|
+
super
|
118
102
|
end
|
119
103
|
end
|
120
104
|
|
@@ -132,28 +116,20 @@ module TonSdk
|
|
132
116
|
end
|
133
117
|
|
134
118
|
def to_h
|
135
|
-
abi_val = @abi.nil? ? nil : @abi.to_h
|
136
|
-
exe_opt_val = @execution_options.nil? ? nil : @execution_options.to_h
|
137
|
-
boc_cache_val = @boc_cache.nil? ? nil : @boc_cache.to_h
|
138
|
-
|
139
119
|
{
|
140
120
|
message: @message,
|
141
121
|
account: @account,
|
142
|
-
execution_options:
|
143
|
-
abi:
|
144
|
-
boc_cache:
|
122
|
+
execution_options: @execution_options&.to_h,
|
123
|
+
abi: @abi&.to_h,
|
124
|
+
boc_cache: @boc_cache&.to_h,
|
145
125
|
return_updated_account: @return_updated_account
|
146
126
|
}
|
147
127
|
end
|
148
128
|
end
|
149
129
|
|
150
|
-
|
151
|
-
attr_reader :out_messages, :decoded, :account
|
152
|
-
|
130
|
+
ResultOfRunTvm = Struct.new(:out_messages, :decoded, :account, keyword_init: true) do
|
153
131
|
def initialize(out_messages:, decoded: nil, account:)
|
154
|
-
|
155
|
-
@decoded = decoded
|
156
|
-
@account = account
|
132
|
+
super
|
157
133
|
end
|
158
134
|
end
|
159
135
|
|
@@ -169,59 +145,49 @@ module TonSdk
|
|
169
145
|
end
|
170
146
|
|
171
147
|
def to_h
|
172
|
-
exe_opt_val = @execution_options.nil? ? nil : @execution_options.to_h
|
173
|
-
|
174
148
|
{
|
175
149
|
account: @account,
|
176
150
|
function_name: @function_name,
|
177
151
|
input: @input,
|
178
|
-
execution_options:
|
152
|
+
execution_options: @execution_options&.to_h,
|
179
153
|
tuple_list_as_array: @tuple_list_as_array
|
180
154
|
}
|
181
155
|
end
|
182
156
|
end
|
183
157
|
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
158
|
+
ResultOfRunGet = Struct.new(:output)
|
159
|
+
|
160
|
+
TransactionFees = Struct.new(
|
161
|
+
:in_msg_fwd_fee,
|
162
|
+
:storage_fee,
|
163
|
+
:gas_fee,
|
164
|
+
:out_msgs_fwd_fee,
|
165
|
+
:total_account_fees,
|
166
|
+
:total_output,
|
167
|
+
keyword_init: true
|
168
|
+
) do
|
169
|
+
def initialize(
|
170
|
+
in_msg_fwd_fee:,
|
171
|
+
storage_fee:,
|
172
|
+
gas_fee:,
|
173
|
+
out_msgs_fwd_fee:,
|
174
|
+
total_account_fees:,
|
175
|
+
total_output:
|
176
|
+
)
|
177
|
+
super
|
189
178
|
end
|
190
179
|
end
|
191
180
|
|
192
|
-
class TransactionFees
|
193
|
-
attr_reader :in_msg_fwd_fee, :storage_fee, :gas_fee, :out_msgs_fwd_fee,
|
194
|
-
:total_account_fees
|
195
181
|
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
@in_msg_fwd_fee = in_msg_fwd_fee
|
200
|
-
@storage_fee = storage_fee
|
201
|
-
@gas_fee = gas_fee
|
202
|
-
@out_msgs_fwd_fee = out_msgs_fwd_fee
|
203
|
-
@total_account_fees = total_account_fees
|
204
|
-
@total_output = total_output
|
205
|
-
end
|
206
|
-
|
207
|
-
def to_h
|
208
|
-
{
|
209
|
-
in_msg_fwd_fee: @in_msg_fwd_fee,
|
210
|
-
storage_fee: @storage_fee,
|
211
|
-
gas_fee: @gas_fee,
|
212
|
-
out_msgs_fwd_fee: @out_msgs_fwd_fee,
|
213
|
-
total_account_fees: @total_account_fees,
|
214
|
-
total_output: @total_output
|
215
|
-
}
|
216
|
-
end
|
217
|
-
end
|
182
|
+
#
|
183
|
+
# functions
|
184
|
+
#
|
218
185
|
|
219
186
|
def self.run_executor(ctx, params)
|
220
|
-
pr_json = params.to_h.to_json
|
221
187
|
Interop::request_to_native_lib(
|
222
188
|
ctx,
|
223
189
|
"tvm.run_executor",
|
224
|
-
|
190
|
+
params,
|
225
191
|
is_single_thread_only: false
|
226
192
|
) do |resp|
|
227
193
|
if resp.success?
|
@@ -241,11 +207,10 @@ module TonSdk
|
|
241
207
|
end
|
242
208
|
|
243
209
|
def self.run_tvm(ctx, params)
|
244
|
-
pr_json = params.to_h.to_json
|
245
210
|
Interop::request_to_native_lib(
|
246
211
|
ctx,
|
247
212
|
"tvm.run_tvm",
|
248
|
-
|
213
|
+
params,
|
249
214
|
is_single_thread_only: false
|
250
215
|
) do |resp|
|
251
216
|
if resp.success?
|
@@ -263,11 +228,10 @@ module TonSdk
|
|
263
228
|
end
|
264
229
|
|
265
230
|
def self.run_get(ctx, params)
|
266
|
-
pr_json = params.to_h.to_json
|
267
231
|
Interop::request_to_native_lib(
|
268
232
|
ctx,
|
269
233
|
"tvm.run_get",
|
270
|
-
|
234
|
+
params,
|
271
235
|
is_single_thread_only: false
|
272
236
|
) do |resp|
|
273
237
|
if resp.success?
|
data/lib/ton_sdk_client/utils.rb
CHANGED
@@ -32,7 +32,7 @@ module TonSdk
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
ParamsOfConvertAddress = Struct.new(:address, :output_format) do
|
35
|
+
ParamsOfConvertAddress = Struct.new(:address, :output_format, keyword_init: true) do
|
36
36
|
def to_h
|
37
37
|
{
|
38
38
|
address: @address,
|
@@ -42,33 +42,13 @@ module TonSdk
|
|
42
42
|
end
|
43
43
|
|
44
44
|
ResultOfConvertAddress = Struct.new(:address)
|
45
|
-
|
46
|
-
ParamsOfCalcStorageFee = Struct.new(:account, :period) do
|
47
|
-
def to_h
|
48
|
-
{
|
49
|
-
account: @account,
|
50
|
-
period: @period
|
51
|
-
}
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
45
|
+
ParamsOfCalcStorageFee = Struct.new(:account, :period, keyword_init: true)
|
55
46
|
ResultOfCalcStorageFee = Struct.new(:fee)
|
56
47
|
|
57
|
-
ParamsOfCompressZstd = Struct.new(:uncompressed, :level)
|
58
|
-
def to_h
|
59
|
-
{
|
60
|
-
uncompressed: @uncompressed,
|
61
|
-
level: @level
|
62
|
-
}
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
48
|
+
ParamsOfCompressZstd = Struct.new(:uncompressed, :level, keyword_init: true)
|
66
49
|
ResultOfCompressZstd = Struct.new(:compressed)
|
67
50
|
|
68
|
-
ParamsOfDecompressZstd = Struct.new(:compressed)
|
69
|
-
def to_h = { compressed: @compressed }
|
70
|
-
end
|
71
|
-
|
51
|
+
ParamsOfDecompressZstd = Struct.new(:compressed)
|
72
52
|
ResultOfDecompressZstd = Struct.new(:decompressed)
|
73
53
|
|
74
54
|
|
@@ -76,8 +56,8 @@ module TonSdk
|
|
76
56
|
# functions
|
77
57
|
#
|
78
58
|
|
79
|
-
def self.convert_address(ctx,
|
80
|
-
Interop::request_to_native_lib(ctx, "utils.convert_address",
|
59
|
+
def self.convert_address(ctx, params)
|
60
|
+
Interop::request_to_native_lib(ctx, "utils.convert_address", params) do |resp|
|
81
61
|
if resp.success?
|
82
62
|
yield NativeLibResponsetResult.new(
|
83
63
|
result: Utils::ResultOfConvertAddress.new(resp.result["address"])
|
@@ -88,8 +68,8 @@ module TonSdk
|
|
88
68
|
end
|
89
69
|
end
|
90
70
|
|
91
|
-
def self.calc_storage_fee(ctx,
|
92
|
-
Interop::request_to_native_lib(ctx, "utils.calc_storage_fee",
|
71
|
+
def self.calc_storage_fee(ctx, params)
|
72
|
+
Interop::request_to_native_lib(ctx, "utils.calc_storage_fee", params) do |resp|
|
93
73
|
if resp.success?
|
94
74
|
yield NativeLibResponsetResult.new(
|
95
75
|
result: Utils::ResultOfCalcStorageFee.new(resp.result["fee"])
|
@@ -100,8 +80,8 @@ module TonSdk
|
|
100
80
|
end
|
101
81
|
end
|
102
82
|
|
103
|
-
def self.compress_zstd(ctx,
|
104
|
-
Interop::request_to_native_lib(ctx, "utils.compress_zstd",
|
83
|
+
def self.compress_zstd(ctx, params)
|
84
|
+
Interop::request_to_native_lib(ctx, "utils.compress_zstd", params) do |resp|
|
105
85
|
if resp.success?
|
106
86
|
yield NativeLibResponsetResult.new(
|
107
87
|
result: Utils::ResultOfCompressZstd.new(resp.result["compressed"])
|
@@ -112,8 +92,8 @@ module TonSdk
|
|
112
92
|
end
|
113
93
|
end
|
114
94
|
|
115
|
-
def self.decompress_zstd(ctx,
|
116
|
-
Interop::request_to_native_lib(ctx, "utils.decompress_zstd",
|
95
|
+
def self.decompress_zstd(ctx, params)
|
96
|
+
Interop::request_to_native_lib(ctx, "utils.decompress_zstd", params) do |resp|
|
117
97
|
if resp.success?
|
118
98
|
yield NativeLibResponsetResult.new(
|
119
99
|
result: Utils::ParamsOfDecompressZstd.new(resp.result["decompressed"])
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ton_sdk_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.15.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Maslakov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-05-
|
11
|
+
date: 2021-05-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|