ton_sdk_client 1.13.0 → 1.18.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -53
- 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 +2 -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 +138 -436
- 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 +249 -135
- 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
data/lib/ton_sdk_client/debot.rb
CHANGED
@@ -26,12 +26,12 @@ module TonSdk
|
|
26
26
|
DebotAction = Struct.new(:description, :name, :action_type, :to, :attributes, :misc, keyword_init: true) do
|
27
27
|
def to_h
|
28
28
|
{
|
29
|
-
description:
|
30
|
-
name:
|
31
|
-
action_type:
|
32
|
-
to:
|
33
|
-
attributes:
|
34
|
-
misc:
|
29
|
+
description: self.description,
|
30
|
+
name: self.name,
|
31
|
+
action_type: self.action_type,
|
32
|
+
to: self.to,
|
33
|
+
attributes: self.attributes,
|
34
|
+
misc: self.misc
|
35
35
|
}
|
36
36
|
end
|
37
37
|
|
@@ -49,15 +49,18 @@ module TonSdk
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
-
ParamsOfStart = Struct.new(:debot_handle)
|
53
|
-
def to_h = { debot_handle: @debot_handle }
|
54
|
-
end
|
52
|
+
ParamsOfStart = Struct.new(:debot_handle)
|
55
53
|
|
56
|
-
RegisteredDebot = Struct.new(:debot_handle) do
|
57
|
-
def to_h = {
|
54
|
+
RegisteredDebot = Struct.new(:debot_handle, :debot_abi, :info) do
|
55
|
+
def to_h = {
|
56
|
+
debot_handle: @debot_handle,
|
57
|
+
debot_abi: @debot_abi,
|
58
|
+
info: @info.to_h
|
59
|
+
}
|
58
60
|
end
|
59
61
|
|
60
62
|
class ParamsOfAppDebotBrowser
|
63
|
+
private_class_method :new
|
61
64
|
|
62
65
|
# todo remove?
|
63
66
|
TYPE_VALUES = [
|
@@ -68,50 +71,56 @@ module TonSdk
|
|
68
71
|
:input,
|
69
72
|
:get_signing_box,
|
70
73
|
:invoke_debot,
|
71
|
-
:send
|
74
|
+
:send,
|
75
|
+
:approve
|
72
76
|
]
|
73
77
|
|
74
|
-
attr_reader :type_, :msg, :context_id, :action, :prompt, :debot_addr, :message
|
78
|
+
attr_reader :type_, :msg, :context_id, :action, :prompt, :debot_addr, :message, :activity
|
75
79
|
|
76
|
-
def new_with_type_log(msg)
|
80
|
+
def self.new_with_type_log(msg)
|
77
81
|
@type_ = :log
|
78
82
|
@msg = msg
|
79
83
|
end
|
80
84
|
|
81
|
-
def new_with_type_switch(context_id)
|
85
|
+
def self.new_with_type_switch(context_id)
|
82
86
|
@type_ = :switch
|
83
87
|
@context_id = context_id
|
84
88
|
end
|
85
89
|
|
86
|
-
def new_with_type_switch_completed
|
90
|
+
def self.new_with_type_switch_completed
|
87
91
|
@type_ = :switch_completed
|
88
92
|
end
|
89
93
|
|
90
|
-
def new_with_type_show_action(action)
|
94
|
+
def self.new_with_type_show_action(action)
|
91
95
|
@type_ = :show_action
|
92
96
|
@action = action
|
93
97
|
end
|
94
98
|
|
95
|
-
def new_with_type_input(prompt)
|
99
|
+
def self.new_with_type_input(prompt)
|
96
100
|
@type_ = :input
|
97
101
|
@prompt = prompt
|
98
102
|
end
|
99
103
|
|
100
|
-
def new_with_type_get_signing_box
|
104
|
+
def self.new_with_type_get_signing_box
|
101
105
|
@type_ = :get_signing_box
|
102
106
|
end
|
103
107
|
|
104
|
-
def new_with_type_invoke_debot(debot_addr, action)
|
108
|
+
def self.new_with_type_invoke_debot(debot_addr, action)
|
105
109
|
@type_ = :invoke_debot
|
106
110
|
@debot_addr = debot_addr
|
107
111
|
@action = action
|
108
112
|
end
|
109
113
|
|
110
|
-
def new_with_type_send(message)
|
114
|
+
def self.new_with_type_send(message)
|
111
115
|
@type_ = :send
|
112
116
|
@message = message
|
113
117
|
end
|
114
118
|
|
119
|
+
def self.new_with_type_approve(activity)
|
120
|
+
@type_ = :approve
|
121
|
+
@activity = activity
|
122
|
+
end
|
123
|
+
|
115
124
|
def to_h
|
116
125
|
{
|
117
126
|
type: Helper.sym_to_capitalized_case_str(@type_),
|
@@ -127,14 +136,38 @@ module TonSdk
|
|
127
136
|
def self.from_json(j)
|
128
137
|
return nil if j.nil?
|
129
138
|
|
130
|
-
self.
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
139
|
+
tp = self.parse_type(j["type"])
|
140
|
+
case tp
|
141
|
+
when :log
|
142
|
+
self.new_with_type_log(j["msg"])
|
143
|
+
|
144
|
+
when :switch
|
145
|
+
self.new_with_type_switch(j["context_id"])
|
146
|
+
|
147
|
+
when :switch_completed
|
148
|
+
self.new_with_type_switch_completed
|
149
|
+
|
150
|
+
when :show_action
|
151
|
+
self.new_with_type_show_action(DebotAction.from_json(j["action"]))
|
152
|
+
|
153
|
+
when :input
|
154
|
+
self.new_with_type_input(j["prompt"])
|
155
|
+
|
156
|
+
when :get_signing_box
|
157
|
+
self.new_with_type_get_signing_box
|
158
|
+
|
159
|
+
when :invoke_debot
|
160
|
+
self.new_with_type_invoke_debot(j["debot_addr"], DebotAction.from_json(j["action"]))
|
161
|
+
|
162
|
+
when :send
|
163
|
+
self.new_with_type_send(j["message"])
|
164
|
+
|
165
|
+
when :approve
|
166
|
+
self.new_with_type_send(DebotActivity.from_json(j["activity"]))
|
167
|
+
|
168
|
+
else
|
169
|
+
raise ArgumentError.new("no handler for type: #{tp}")
|
170
|
+
end
|
138
171
|
end
|
139
172
|
|
140
173
|
private
|
@@ -150,31 +183,31 @@ module TonSdk
|
|
150
183
|
end
|
151
184
|
|
152
185
|
class ResultOfAppDebotBrowser
|
186
|
+
private_class_method :new
|
187
|
+
|
153
188
|
attr_reader :type_, :value, :signing_box, :is_approved
|
154
189
|
|
155
|
-
def new_with_type_input(a)
|
190
|
+
def self.new_with_type_input(a)
|
156
191
|
@type_ = :input
|
157
192
|
@value = a
|
158
193
|
end
|
159
194
|
|
160
|
-
def new_with_type_get_signing_box(a)
|
195
|
+
def self.new_with_type_get_signing_box(a)
|
161
196
|
@type_ = :get_signing_box
|
162
197
|
@signing_box = signing_box
|
163
198
|
end
|
164
199
|
|
165
|
-
def new_with_type_invoke_debot
|
200
|
+
def self.new_with_type_invoke_debot
|
166
201
|
@type_ = :invoke_debot
|
167
202
|
end
|
168
203
|
|
169
|
-
def new_with_type_approve(a)
|
204
|
+
def self.new_with_type_approve(a)
|
170
205
|
@type_ = :approve
|
171
206
|
@is_approved = a
|
172
207
|
end
|
173
208
|
end
|
174
209
|
|
175
|
-
ParamsOfFetch = Struct.new(:address)
|
176
|
-
def to_h = { address: @address }
|
177
|
-
end
|
210
|
+
ParamsOfFetch = Struct.new(:address)
|
178
211
|
|
179
212
|
ParamsOfExecute = Struct.new(:debot_handle, :action) do
|
180
213
|
def to_h
|
@@ -185,22 +218,13 @@ module TonSdk
|
|
185
218
|
end
|
186
219
|
end
|
187
220
|
|
188
|
-
ParamsOfSend = Struct.new(:debot_handle, :message)
|
189
|
-
def to_h
|
190
|
-
{
|
191
|
-
debot_handle: @debot_handle,
|
192
|
-
message: @message
|
193
|
-
}
|
194
|
-
end
|
195
|
-
end
|
196
|
-
|
221
|
+
ParamsOfSend = Struct.new(:debot_handle, :message)
|
197
222
|
ParamsOfInit = Struct.new(:address)
|
198
|
-
|
199
223
|
DebotInfo = Struct.new(
|
200
224
|
:name,
|
201
225
|
:version,
|
202
226
|
:publisher,
|
203
|
-
:
|
227
|
+
:caption,
|
204
228
|
:author,
|
205
229
|
:support,
|
206
230
|
:hello,
|
@@ -209,9 +233,48 @@ module TonSdk
|
|
209
233
|
:icon,
|
210
234
|
:interfaces,
|
211
235
|
keyword_init: true
|
212
|
-
)
|
236
|
+
) do
|
237
|
+
def initialize(
|
238
|
+
name: nil,
|
239
|
+
version: nil,
|
240
|
+
publisher: nil,
|
241
|
+
caption: nil,
|
242
|
+
author: nil,
|
243
|
+
support: nil,
|
244
|
+
hello: nil,
|
245
|
+
language: nil,
|
246
|
+
dabi: nil,
|
247
|
+
icon: nil,
|
248
|
+
interfaces: []
|
249
|
+
)
|
250
|
+
super
|
251
|
+
end
|
252
|
+
end
|
213
253
|
|
214
254
|
ResultOfFetch = Struct.new(:info)
|
255
|
+
Spending = Struct.new(:amount, :dst)
|
256
|
+
|
257
|
+
class DebotActivity
|
258
|
+
private_class_method :new
|
259
|
+
|
260
|
+
attr_reader :type_, :msg, :dst, :out, :fee, :setcode, :signkey, :signing_box_handle
|
261
|
+
|
262
|
+
def self.new_with_type_transaction(msg:, dst:, out:, fee:, setcode:, signkey:, signing_box_handle:)
|
263
|
+
@type_ = :transaction
|
264
|
+
@msg = msg
|
265
|
+
@dst = dst
|
266
|
+
@out = out
|
267
|
+
@fee = fee
|
268
|
+
@setcode = setcode
|
269
|
+
@signkey = signkey
|
270
|
+
@signing_box_handle = signing_box_handle
|
271
|
+
end
|
272
|
+
|
273
|
+
def self.from_json(j)
|
274
|
+
# todo
|
275
|
+
end
|
276
|
+
end
|
277
|
+
|
215
278
|
|
216
279
|
|
217
280
|
#
|
@@ -219,7 +282,7 @@ module TonSdk
|
|
219
282
|
#
|
220
283
|
|
221
284
|
def self.init(ctx, params, app_browser_obj)
|
222
|
-
Interop::request_to_native_lib(ctx, "debot.init", params
|
285
|
+
Interop::request_to_native_lib(ctx, "debot.init", params) do |resp|
|
223
286
|
if resp.success?
|
224
287
|
yield NativeLibResponsetResult.new(
|
225
288
|
result: nil
|
@@ -234,7 +297,7 @@ module TonSdk
|
|
234
297
|
Interop::request_to_native_lib(
|
235
298
|
ctx,
|
236
299
|
"debot.start",
|
237
|
-
params
|
300
|
+
params,
|
238
301
|
is_single_thread_only: false
|
239
302
|
) do |resp|
|
240
303
|
if resp.success?
|
@@ -251,7 +314,7 @@ module TonSdk
|
|
251
314
|
Interop::request_to_native_lib(
|
252
315
|
ctx,
|
253
316
|
"debot.fetch",
|
254
|
-
params
|
317
|
+
params,
|
255
318
|
is_single_thread_only: false
|
256
319
|
) do |resp|
|
257
320
|
if resp.success?
|
@@ -266,7 +329,7 @@ module TonSdk
|
|
266
329
|
end
|
267
330
|
|
268
331
|
def self.execute(ctx, params)
|
269
|
-
Interop::request_to_native_lib(ctx, "debot.execute", params
|
332
|
+
Interop::request_to_native_lib(ctx, "debot.execute", params) do |resp|
|
270
333
|
if resp.success?
|
271
334
|
yield NativeLibResponsetResult.new(
|
272
335
|
result: nil
|
@@ -278,7 +341,7 @@ module TonSdk
|
|
278
341
|
end
|
279
342
|
|
280
343
|
def self.remove(ctx, params)
|
281
|
-
Interop::request_to_native_lib(ctx, "debot.remove", params
|
344
|
+
Interop::request_to_native_lib(ctx, "debot.remove", params) do |resp|
|
282
345
|
if resp.success?
|
283
346
|
yield NativeLibResponsetResult.new(
|
284
347
|
result: nil
|
@@ -290,7 +353,7 @@ module TonSdk
|
|
290
353
|
end
|
291
354
|
|
292
355
|
def self.send(ctx, params)
|
293
|
-
Interop::request_to_native_lib(ctx, "debot.send", params
|
356
|
+
Interop::request_to_native_lib(ctx, "debot.send", params) do |resp|
|
294
357
|
if resp.success?
|
295
358
|
yield NativeLibResponsetResult.new(
|
296
359
|
result: nil
|
@@ -132,12 +132,12 @@ module TonSdk
|
|
132
132
|
def self.request_to_native_lib(
|
133
133
|
ctx,
|
134
134
|
function_name,
|
135
|
-
|
135
|
+
function_params = nil,
|
136
136
|
client_callback: nil,
|
137
137
|
is_single_thread_only: true
|
138
138
|
)
|
139
139
|
function_name_tc_str = TcStringData.from_string(function_name)
|
140
|
-
function_params_json_str =
|
140
|
+
function_params_json_str = function_params&.to_h.to_json || ""
|
141
141
|
function_params_json_tc_str = TcStringData.from_string(function_params_json_str)
|
142
142
|
|
143
143
|
@sm = Concurrent::Semaphore.new(1)
|
data/lib/ton_sdk_client/net.rb
CHANGED
@@ -37,20 +37,15 @@ module TonSdk
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
|
41
|
-
attr_reader :collection, :filter, :result, :order, :limit
|
42
|
-
|
40
|
+
ParamsOfQueryCollection = Struct.new(:collection, :filter, :result, :order, :limit, keyword_init: true) do
|
43
41
|
def initialize(collection: , filter: nil, result: , order: [], limit: nil)
|
44
|
-
|
45
|
-
@filter = filter
|
46
|
-
@result = result
|
47
|
-
@order = order
|
48
|
-
@limit = limit
|
42
|
+
super
|
49
43
|
end
|
50
44
|
|
51
45
|
def to_h
|
52
|
-
|
53
|
-
|
46
|
+
h = super
|
47
|
+
ord_h_s = if !self.order.nil?
|
48
|
+
self.order.map do |x|
|
54
49
|
{
|
55
50
|
path: x.path,
|
56
51
|
direction: x.direction.to_s.upcase
|
@@ -58,109 +53,63 @@ module TonSdk
|
|
58
53
|
end
|
59
54
|
end
|
60
55
|
|
61
|
-
|
62
|
-
|
63
|
-
filter: @filter,
|
64
|
-
result: @result,
|
65
|
-
order: ord_h_s,
|
66
|
-
limit: @limit
|
67
|
-
}
|
56
|
+
h[:order] = ord_h_s
|
57
|
+
h
|
68
58
|
end
|
69
59
|
end
|
70
60
|
|
71
61
|
ResultOfQueryCollection = Struct.new(:result)
|
72
|
-
|
73
62
|
ResultOfWaitForCollection = Struct.new(:result)
|
74
|
-
|
75
63
|
ResultOfQuery = Struct.new(:result)
|
76
|
-
|
77
|
-
|
78
|
-
def to_h = { results: @results }
|
79
|
-
end
|
80
|
-
|
81
|
-
class ParamsOfWaitForCollection
|
82
|
-
attr_reader :collection, :filter, :result, :timeout
|
83
|
-
|
64
|
+
ResultOfBatchQuery = Struct.new(:results)
|
65
|
+
ParamsOfWaitForCollection = Struct.new(:collection, :filter, :result, :timeout, keyword_init: true) do
|
84
66
|
def initialize(collection:, filter: nil, result:, timeout: nil)
|
85
|
-
|
86
|
-
@filter = filter
|
87
|
-
@result = result
|
88
|
-
@timeout = timeout
|
89
|
-
end
|
90
|
-
|
91
|
-
def to_h
|
92
|
-
{
|
93
|
-
collection: @collection,
|
94
|
-
filter: @filter,
|
95
|
-
result: @result,
|
96
|
-
timeout: @timeout
|
97
|
-
}
|
67
|
+
super
|
98
68
|
end
|
99
69
|
end
|
100
70
|
|
101
|
-
|
102
|
-
attr_reader :collection, :filter, :result
|
103
|
-
|
71
|
+
ParamsOfSubscribeCollection = Struct.new(:collection, :filter, :result, keyword_init: true) do
|
104
72
|
def initialize(collection:, filter: nil, result:)
|
105
|
-
|
106
|
-
@filter = filter
|
107
|
-
@result = result
|
108
|
-
end
|
109
|
-
|
110
|
-
def to_h
|
111
|
-
{
|
112
|
-
collection: @collection,
|
113
|
-
filter: @filter,
|
114
|
-
result: @result
|
115
|
-
}
|
73
|
+
super
|
116
74
|
end
|
117
75
|
end
|
118
76
|
|
119
|
-
ResultOfSubscribeCollection = Struct.new(:handle)
|
120
|
-
|
121
|
-
end
|
122
|
-
|
123
|
-
ParamsOfQuery = Struct.new(:query, :variables) do
|
77
|
+
ResultOfSubscribeCollection = Struct.new(:handle)
|
78
|
+
ParamsOfQuery = Struct.new(:query, :variables, keyword_init: true) do
|
124
79
|
def initialize(query:, variables: nil)
|
125
80
|
super
|
126
81
|
end
|
127
|
-
|
128
|
-
def to_h
|
129
|
-
{
|
130
|
-
query: @query,
|
131
|
-
variables: @variables
|
132
|
-
}
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|
136
|
-
ParamsOfFindLastShardBlock = Struct.new(:address) do
|
137
|
-
def to_h = { address: @address }
|
138
82
|
end
|
139
83
|
|
84
|
+
ParamsOfFindLastShardBlock = Struct.new(:address)
|
140
85
|
ResultOfFindLastShardBlock = Struct.new(:block_id)
|
141
|
-
|
142
|
-
EndpointsSet = Struct.new(:endpoints) do
|
143
|
-
def to_h = { endpoints: @endpoints }
|
144
|
-
end
|
86
|
+
EndpointsSet = Struct.new(:endpoints)
|
145
87
|
|
146
88
|
class ParamsOfQueryOperation
|
89
|
+
private_class_method :new
|
90
|
+
|
147
91
|
attr_reader :type_, :params
|
148
92
|
|
149
|
-
def new_with_type_query_collection(params)
|
93
|
+
def self.new_with_type_query_collection(params)
|
150
94
|
@type_ = :query_collection
|
151
95
|
@params = params
|
152
96
|
end
|
153
97
|
|
154
|
-
def new_with_type_wait_for_collection(params)
|
98
|
+
def self.new_with_type_wait_for_collection(params)
|
155
99
|
@type_ = :wait_for_collection
|
156
100
|
@params = params
|
157
101
|
end
|
158
102
|
|
159
|
-
def new_with_type_aggregate_collection(params)
|
103
|
+
def self.new_with_type_aggregate_collection(params)
|
160
104
|
@type_ = :aggregate_collection
|
161
105
|
@params = params
|
162
106
|
end
|
163
107
|
|
108
|
+
def self.new_with_type_query_counterparties(params)
|
109
|
+
@type_ = :query_counterparties
|
110
|
+
@params = params
|
111
|
+
end
|
112
|
+
|
164
113
|
def to_h
|
165
114
|
tp = {
|
166
115
|
type: Helper.sym_to_capitalized_case_str(@type_)
|
@@ -174,26 +123,20 @@ module TonSdk
|
|
174
123
|
ParamsOfBatchQuery = Struct.new(:operations) do
|
175
124
|
def to_h
|
176
125
|
{
|
177
|
-
operations:
|
126
|
+
operations: self.operations.compact.map(&:to_h)
|
178
127
|
}
|
179
128
|
end
|
180
129
|
end
|
181
130
|
|
182
|
-
|
183
|
-
attr_reader :collection, :filter, :fields
|
184
|
-
|
131
|
+
ParamsOfAggregateCollection = Struct.new(:collection, :filter, :fields) do
|
185
132
|
def initialize(collection:, filter: nil, fields: [])
|
186
|
-
|
187
|
-
@filter = filter
|
188
|
-
@fields = fields
|
133
|
+
super
|
189
134
|
end
|
190
135
|
|
191
136
|
def to_h
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
fields: @fields.map(&:to_h)
|
196
|
-
}
|
137
|
+
h = super
|
138
|
+
h[:fields] = self.fields.map(&:to_h)
|
139
|
+
h
|
197
140
|
end
|
198
141
|
end
|
199
142
|
|
@@ -224,22 +167,86 @@ module TonSdk
|
|
224
167
|
end
|
225
168
|
end
|
226
169
|
|
227
|
-
ResultOfAggregateCollection = Struct.new(:values)
|
228
|
-
def to_h = { values: @values }
|
229
|
-
end
|
170
|
+
ResultOfAggregateCollection = Struct.new(:values)
|
230
171
|
|
231
172
|
ParamsOfQueryCounterparties = Struct.new(:account, :result, :first, :after, keyword_init: true) do
|
232
173
|
def initialize(account:, result:, first: nil, after: nil)
|
233
174
|
super
|
234
175
|
end
|
176
|
+
end
|
177
|
+
|
178
|
+
ResultOfGetEndpoints = Struct.new(:query, :endpoints, keyword_init: true)
|
179
|
+
|
180
|
+
TransactionNode = Struct.new(
|
181
|
+
:id_,
|
182
|
+
:in_msg,
|
183
|
+
:out_msgs,
|
184
|
+
:account_addr,
|
185
|
+
:total_fees,
|
186
|
+
:aborted,
|
187
|
+
:exit_code,
|
188
|
+
keyword_init: true
|
189
|
+
) do
|
190
|
+
def initialize(id_:, in_msg:, out_msgs:, account_addr:, total_fees:, aborted:, exit_code: nil)
|
191
|
+
super
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
MessageNode = Struct.new(
|
196
|
+
:id_,
|
197
|
+
:src_transaction_id,
|
198
|
+
:dst_transaction_id,
|
199
|
+
:src,
|
200
|
+
:dst,
|
201
|
+
:value,
|
202
|
+
:bounce,
|
203
|
+
:decoded_body,
|
204
|
+
keyword_init: true
|
205
|
+
) do
|
206
|
+
def initialize(
|
207
|
+
id_:,
|
208
|
+
src_transaction_id: nil,
|
209
|
+
dst_transaction_id: nil,
|
210
|
+
src: nil,
|
211
|
+
dst: nil,
|
212
|
+
value: nil,
|
213
|
+
bounce:,
|
214
|
+
decoded_body: nil
|
215
|
+
)
|
216
|
+
super
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
ParamsOfQueryTransactionTree = Struct.new(:in_msg, :abi_registry, :timeout, keyword_init: true) do
|
221
|
+
def initialize(in_msg:, abi_registry: [], timeout: nil)
|
222
|
+
super
|
223
|
+
end
|
235
224
|
|
236
225
|
def to_h
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
226
|
+
h = super
|
227
|
+
h[:abi_registry] = self.abi_registry&.map(&:to_h)
|
228
|
+
h
|
229
|
+
end
|
230
|
+
end
|
231
|
+
ResultOfQueryTransactionTree = Struct.new(:messages, :transactions, keyword_init: true)
|
232
|
+
|
233
|
+
ParamsOfCreateBlockIterator = Struct.new(:start_time, :end_time, :shard_filter, :result, keyword_init: true)
|
234
|
+
RegisteredIterator = Struct.new(:handle)
|
235
|
+
ParamsOfResumeBlockIterator = Struct.new(:resume_state)
|
236
|
+
ParamsOfCreateTransactionIterator = Struct.new(:start_time, :end_time, :shard_filter, :accounts_filter, :result, :include_transfers, keyword_init: true)
|
237
|
+
ParamsOfResumeTransactionIterator = Struct.new(:resume_state, :accounts_filter, keyword_init: true) do
|
238
|
+
def initialize(resume_state:, accounts_filter: nil)
|
239
|
+
super
|
240
|
+
end
|
241
|
+
end
|
242
|
+
ParamsOfIteratorNext = Struct.new(:iterator, :limit, :return_resume_state, keyword_init: true) do
|
243
|
+
def initialize(iterator:, limit: nil, return_resume_state: nil)
|
244
|
+
super
|
245
|
+
end
|
246
|
+
end
|
247
|
+
ResultOfIteratorNext = Struct.new(:items, :has_more, :resume_state, keyword_init: true) do
|
248
|
+
def initialize(items: [], has_more:, resume_state: nil)
|
249
|
+
super
|
243
250
|
end
|
244
251
|
end
|
245
252
|
|
@@ -252,7 +259,7 @@ module TonSdk
|
|
252
259
|
Interop::request_to_native_lib(
|
253
260
|
ctx,
|
254
261
|
"net.query_collection",
|
255
|
-
params
|
262
|
+
params,
|
256
263
|
is_single_thread_only: false
|
257
264
|
) do |resp|
|
258
265
|
if resp.success?
|
@@ -269,7 +276,7 @@ module TonSdk
|
|
269
276
|
Interop::request_to_native_lib(
|
270
277
|
ctx,
|
271
278
|
"net.wait_for_collection",
|
272
|
-
params
|
279
|
+
params,
|
273
280
|
is_single_thread_only: false
|
274
281
|
) do |resp|
|
275
282
|
if resp.success?
|
@@ -283,7 +290,7 @@ module TonSdk
|
|
283
290
|
end
|
284
291
|
|
285
292
|
def self.unsubscribe(ctx, params)
|
286
|
-
Interop::request_to_native_lib(ctx, "net.unsubscribe", params
|
293
|
+
Interop::request_to_native_lib(ctx, "net.unsubscribe", params) do |resp|
|
287
294
|
if resp.success?
|
288
295
|
yield NativeLibResponsetResult.new(
|
289
296
|
result: ""
|
@@ -298,7 +305,7 @@ module TonSdk
|
|
298
305
|
Interop::request_to_native_lib(
|
299
306
|
ctx,
|
300
307
|
"net.subscribe_collection",
|
301
|
-
params
|
308
|
+
params,
|
302
309
|
client_callback: client_callback,
|
303
310
|
is_single_thread_only: false
|
304
311
|
) do |resp|
|
@@ -313,7 +320,7 @@ module TonSdk
|
|
313
320
|
end
|
314
321
|
|
315
322
|
def self.query(ctx, params)
|
316
|
-
Interop::request_to_native_lib(ctx, "net.query", params
|
323
|
+
Interop::request_to_native_lib(ctx, "net.query", params) do |resp|
|
317
324
|
if resp.success?
|
318
325
|
yield NativeLibResponsetResult.new(
|
319
326
|
result: ResultOfQuery.new(resp.result["result"])
|
@@ -325,7 +332,7 @@ module TonSdk
|
|
325
332
|
end
|
326
333
|
|
327
334
|
def self.suspend(ctx)
|
328
|
-
Interop::request_to_native_lib(ctx, "net.suspend"
|
335
|
+
Interop::request_to_native_lib(ctx, "net.suspend") do |resp|
|
329
336
|
if resp.success?
|
330
337
|
yield NativeLibResponsetResult.new(result: "")
|
331
338
|
else
|
@@ -335,7 +342,7 @@ module TonSdk
|
|
335
342
|
end
|
336
343
|
|
337
344
|
def self.resume(ctx)
|
338
|
-
Interop::request_to_native_lib(ctx, "net.resume"
|
345
|
+
Interop::request_to_native_lib(ctx, "net.resume") do |resp|
|
339
346
|
if resp.success?
|
340
347
|
yield NativeLibResponsetResult.new(result: "")
|
341
348
|
else
|
@@ -345,7 +352,7 @@ module TonSdk
|
|
345
352
|
end
|
346
353
|
|
347
354
|
def self.find_last_shard_block(ctx, params)
|
348
|
-
Interop::request_to_native_lib(ctx, "net.find_last_shard_block", params
|
355
|
+
Interop::request_to_native_lib(ctx, "net.find_last_shard_block", params) do |resp|
|
349
356
|
if resp.success?
|
350
357
|
yield NativeLibResponsetResult.new(
|
351
358
|
result: ResultOfFindLastShardBlock.new(resp.result["block_id"])
|
@@ -357,7 +364,7 @@ module TonSdk
|
|
357
364
|
end
|
358
365
|
|
359
366
|
def self.fetch_endpoints(ctx)
|
360
|
-
Interop::request_to_native_lib(ctx, "net.fetch_endpoints"
|
367
|
+
Interop::request_to_native_lib(ctx, "net.fetch_endpoints") do |resp|
|
361
368
|
if resp.success?
|
362
369
|
yield NativeLibResponsetResult.new(
|
363
370
|
result: EndpointsSet.new(resp.result["endpoints"])
|
@@ -369,7 +376,7 @@ module TonSdk
|
|
369
376
|
end
|
370
377
|
|
371
378
|
def self.set_endpoints(ctx, params)
|
372
|
-
Interop::request_to_native_lib(ctx, "net.set_endpoints", params
|
379
|
+
Interop::request_to_native_lib(ctx, "net.set_endpoints", params) do |resp|
|
373
380
|
if resp.success?
|
374
381
|
yield NativeLibResponsetResult.new(
|
375
382
|
result: nil
|
@@ -379,41 +386,148 @@ module TonSdk
|
|
379
386
|
end
|
380
387
|
end
|
381
388
|
end
|
382
|
-
end
|
383
389
|
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
390
|
+
def self.batch_query(ctx, params)
|
391
|
+
Interop::request_to_native_lib(ctx, "net.batch_query", params) do |resp|
|
392
|
+
if resp.success?
|
393
|
+
yield NativeLibResponsetResult.new(
|
394
|
+
result: ResultOfBatchQuery.new(resp.result["results"])
|
395
|
+
)
|
396
|
+
else
|
397
|
+
yield resp
|
398
|
+
end
|
392
399
|
end
|
393
400
|
end
|
394
|
-
end
|
395
401
|
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
402
|
+
def self.aggregate_collection(ctx, params)
|
403
|
+
Interop::request_to_native_lib(ctx, "net.aggregate_collection", params) do |resp|
|
404
|
+
if resp.success?
|
405
|
+
yield NativeLibResponsetResult.new(
|
406
|
+
result: ResultOfAggregateCollection.new(resp.result["values"])
|
407
|
+
)
|
408
|
+
else
|
409
|
+
yield resp
|
410
|
+
end
|
404
411
|
end
|
405
412
|
end
|
406
|
-
end
|
407
413
|
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
414
|
+
def self.get_endpoints(ctx, params)
|
415
|
+
Interop::request_to_native_lib(ctx, "net.get_endpoints", params) do |resp|
|
416
|
+
if resp.success?
|
417
|
+
yield NativeLibResponsetResult.new(
|
418
|
+
result: ResultOfGetEndpoints.new(
|
419
|
+
query: resp.result["query"],
|
420
|
+
endpoints: resp.result["endpoints"],
|
421
|
+
)
|
422
|
+
)
|
423
|
+
else
|
424
|
+
yield resp
|
425
|
+
end
|
416
426
|
end
|
417
427
|
end
|
428
|
+
|
429
|
+
def self.query_counterparties(ctx, params)
|
430
|
+
Interop::request_to_native_lib(ctx, "net.query_counterparties", params) do |resp|
|
431
|
+
if resp.success?
|
432
|
+
yield NativeLibResponsetResult.new(
|
433
|
+
result: ResultOfQueryCollection.new(resp.result["result"])
|
434
|
+
)
|
435
|
+
else
|
436
|
+
yield resp
|
437
|
+
end
|
438
|
+
end
|
439
|
+
end
|
440
|
+
|
441
|
+
def self.query_transaction_tree(ctx, params)
|
442
|
+
Interop::request_to_native_lib(ctx, "net.query_transaction_tree", params) do |resp|
|
443
|
+
if resp.success?
|
444
|
+
yield NativeLibResponsetResult.new(
|
445
|
+
result: ResultOfQueryTransactionTree.new(
|
446
|
+
messages: resp.result["messages"],
|
447
|
+
transactions: resp.result["transactions"],
|
448
|
+
)
|
449
|
+
)
|
450
|
+
else
|
451
|
+
yield resp
|
452
|
+
end
|
453
|
+
end
|
454
|
+
end
|
455
|
+
|
456
|
+
def self.create_block_iterator(ctx, params)
|
457
|
+
Interop::request_to_native_lib(ctx, "net.create_block_iterator", params) do |resp|
|
458
|
+
if resp.success?
|
459
|
+
yield NativeLibResponsetResult.new(
|
460
|
+
result: RegisteredIterator.new(resp.result["handle"])
|
461
|
+
)
|
462
|
+
else
|
463
|
+
yield resp
|
464
|
+
end
|
465
|
+
end
|
466
|
+
end
|
467
|
+
|
468
|
+
def self.resume_block_iterator(ctx, params)
|
469
|
+
Interop::request_to_native_lib(ctx, "net.resume_block_iterator", params) do |resp|
|
470
|
+
if resp.success?
|
471
|
+
yield NativeLibResponsetResult.new(
|
472
|
+
result: RegisteredIterator.new(resp.result["handle"])
|
473
|
+
)
|
474
|
+
else
|
475
|
+
yield resp
|
476
|
+
end
|
477
|
+
end
|
478
|
+
end
|
479
|
+
|
480
|
+
def self.create_transaction_iterator(ctx, params)
|
481
|
+
Interop::request_to_native_lib(ctx, "net.create_transaction_iterator", params) do |resp|
|
482
|
+
if resp.success?
|
483
|
+
yield NativeLibResponsetResult.new(
|
484
|
+
result: RegisteredIterator.new(resp.result["handle"])
|
485
|
+
)
|
486
|
+
else
|
487
|
+
yield resp
|
488
|
+
end
|
489
|
+
end
|
490
|
+
end
|
491
|
+
|
492
|
+
def self.resume_transaction_iterator(ctx, params)
|
493
|
+
Interop::request_to_native_lib(ctx, "net.resume_transaction_iterator", params) do |resp|
|
494
|
+
if resp.success?
|
495
|
+
yield NativeLibResponsetResult.new(
|
496
|
+
result: RegisteredIterator.new(resp.result["handle"])
|
497
|
+
)
|
498
|
+
else
|
499
|
+
yield resp
|
500
|
+
end
|
501
|
+
end
|
502
|
+
end
|
503
|
+
|
504
|
+
def self.iterator_next(ctx, params)
|
505
|
+
Interop::request_to_native_lib(ctx, "net.iterator_next", params) do |resp|
|
506
|
+
if resp.success?
|
507
|
+
yield NativeLibResponsetResult.new(
|
508
|
+
result: ResultOfIteratorNext.new(
|
509
|
+
items: resp.result["items"],
|
510
|
+
has_more: resp.result["has_more"],
|
511
|
+
resume_state: resp.result["resume_state"]
|
512
|
+
)
|
513
|
+
)
|
514
|
+
else
|
515
|
+
yield resp
|
516
|
+
end
|
517
|
+
end
|
518
|
+
end
|
519
|
+
|
520
|
+
def self.remove_iterator(ctx, params)
|
521
|
+
Interop::request_to_native_lib(ctx, "net.remove_iterator", params) do |resp|
|
522
|
+
if resp.success?
|
523
|
+
yield NativeLibResponsetResult.new(
|
524
|
+
result: nil
|
525
|
+
)
|
526
|
+
else
|
527
|
+
yield resp
|
528
|
+
end
|
529
|
+
end
|
530
|
+
end
|
531
|
+
|
418
532
|
end
|
419
533
|
end
|