ton_sdk_client 1.12.0 → 1.17.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 +22 -1
- data/README.md +1 -1
- data/lib/ton_sdk_client/abi.rb +114 -294
- data/lib/ton_sdk_client/boc.rb +32 -212
- 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 +49 -90
- data/lib/ton_sdk_client/crypto.rb +156 -581
- data/lib/ton_sdk_client/debot.rb +118 -55
- data/lib/ton_sdk_client/interop.rb +2 -2
- data/lib/ton_sdk_client/net.rb +154 -169
- data/lib/ton_sdk_client/processing.rb +7 -36
- 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
@@ -23,15 +23,15 @@ module TonSdk
|
|
23
23
|
OPERATION_REJECTED = 812
|
24
24
|
end
|
25
25
|
|
26
|
-
DebotAction = Struct.new(:description, :name, :action_type, :to, :attributes, :misc) do
|
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
@@ -18,7 +18,7 @@ module TonSdk
|
|
18
18
|
WEBSOCKET_DISCONNECTED = 610
|
19
19
|
NOT_SUPPORTED = 611
|
20
20
|
NO_ENDPOINTS_PROVIDED = 612
|
21
|
-
GRAPHQL_WEBSOCKET_INIT_ERROR = 613
|
21
|
+
GRAPHQL_WEBSOCKET_INIT_ERROR = 613
|
22
22
|
NETWORK_MODULE_RESUMED = 614
|
23
23
|
end
|
24
24
|
|
@@ -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,150 +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
|
-
}
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
class ResultOfQueryCollection
|
72
|
-
attr_reader :result
|
73
|
-
|
74
|
-
def initialize(a)
|
75
|
-
@result = a
|
56
|
+
h[:order] = ord_h_s
|
57
|
+
h
|
76
58
|
end
|
77
59
|
end
|
78
60
|
|
79
|
-
|
80
|
-
|
81
|
-
|
61
|
+
ResultOfQueryCollection = Struct.new(:result)
|
62
|
+
ResultOfWaitForCollection = Struct.new(:result)
|
63
|
+
ResultOfQuery = Struct.new(:result)
|
64
|
+
ResultOfBatchQuery = Struct.new(:results)
|
65
|
+
ParamsOfWaitForCollection = Struct.new(:collection, :filter, :result, :timeout, keyword_init: true) do
|
82
66
|
def initialize(collection:, filter: nil, result:, timeout: nil)
|
83
|
-
|
84
|
-
@filter = filter
|
85
|
-
@result = result
|
86
|
-
@timeout = timeout
|
87
|
-
end
|
88
|
-
|
89
|
-
def to_h
|
90
|
-
{
|
91
|
-
collection: @collection,
|
92
|
-
filter: @filter,
|
93
|
-
result: @result,
|
94
|
-
timeout: @timeout
|
95
|
-
}
|
67
|
+
super
|
96
68
|
end
|
97
69
|
end
|
98
70
|
|
99
|
-
|
100
|
-
attr_reader :result
|
101
|
-
|
102
|
-
def initialize(a)
|
103
|
-
@result = a
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
class ParamsOfSubscribeCollection
|
108
|
-
attr_reader :collection, :filter, :result
|
109
|
-
|
71
|
+
ParamsOfSubscribeCollection = Struct.new(:collection, :filter, :result, keyword_init: true) do
|
110
72
|
def initialize(collection:, filter: nil, result:)
|
111
|
-
|
112
|
-
@filter = filter
|
113
|
-
@result = result
|
114
|
-
end
|
115
|
-
|
116
|
-
def to_h
|
117
|
-
{
|
118
|
-
collection: @collection,
|
119
|
-
filter: @filter,
|
120
|
-
result: @result
|
121
|
-
}
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
|
-
class ResultOfSubscribeCollection
|
126
|
-
attr_reader :handle
|
127
|
-
|
128
|
-
def initialize(a)
|
129
|
-
@handle = a
|
73
|
+
super
|
130
74
|
end
|
131
|
-
|
132
|
-
def to_h = { handle: @handle }
|
133
75
|
end
|
134
76
|
|
135
|
-
|
136
|
-
|
137
|
-
|
77
|
+
ResultOfSubscribeCollection = Struct.new(:handle)
|
78
|
+
ParamsOfQuery = Struct.new(:query, :variables, keyword_init: true) do
|
138
79
|
def initialize(query:, variables: nil)
|
139
|
-
|
140
|
-
@variables = variables
|
141
|
-
end
|
142
|
-
|
143
|
-
def to_h
|
144
|
-
{
|
145
|
-
query: @query,
|
146
|
-
variables: @variables
|
147
|
-
}
|
80
|
+
super
|
148
81
|
end
|
149
82
|
end
|
150
83
|
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
def initialize(a)
|
155
|
-
@result = a
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
|
-
class ParamsOfFindLastShardBlock
|
160
|
-
attr_reader :address
|
161
|
-
|
162
|
-
def initialize(a)
|
163
|
-
@address = a
|
164
|
-
end
|
165
|
-
|
166
|
-
def to_h = { address: @address }
|
167
|
-
end
|
168
|
-
|
169
|
-
class ResultOfFindLastShardBlock
|
170
|
-
attr_reader :block_id
|
171
|
-
|
172
|
-
def initialize(a)
|
173
|
-
@block_id = a
|
174
|
-
end
|
175
|
-
end
|
176
|
-
|
177
|
-
class EndpointsSet
|
178
|
-
attr_reader :endpoints
|
179
|
-
|
180
|
-
def initialize(a)
|
181
|
-
@endpoints = a
|
182
|
-
end
|
183
|
-
|
184
|
-
def to_h = { endpoints: @endpoints }
|
185
|
-
end
|
84
|
+
ParamsOfFindLastShardBlock = Struct.new(:address)
|
85
|
+
ResultOfFindLastShardBlock = Struct.new(:block_id)
|
86
|
+
EndpointsSet = Struct.new(:endpoints)
|
186
87
|
|
187
88
|
class ParamsOfQueryOperation
|
89
|
+
private_class_method :new
|
90
|
+
|
188
91
|
attr_reader :type_, :params
|
189
92
|
|
190
|
-
def new_with_type_query_collection(params)
|
93
|
+
def self.new_with_type_query_collection(params)
|
191
94
|
@type_ = :query_collection
|
192
95
|
@params = params
|
193
96
|
end
|
194
97
|
|
195
|
-
def new_with_type_wait_for_collection(params)
|
98
|
+
def self.new_with_type_wait_for_collection(params)
|
196
99
|
@type_ = :wait_for_collection
|
197
100
|
@params = params
|
198
101
|
end
|
199
102
|
|
200
|
-
def new_with_type_aggregate_collection(params)
|
103
|
+
def self.new_with_type_aggregate_collection(params)
|
201
104
|
@type_ = :aggregate_collection
|
202
105
|
@params = params
|
203
106
|
end
|
204
107
|
|
108
|
+
def self.new_with_type_query_counterparties(params)
|
109
|
+
@type_ = :query_counterparties
|
110
|
+
@params = params
|
111
|
+
end
|
112
|
+
|
205
113
|
def to_h
|
206
114
|
tp = {
|
207
115
|
type: Helper.sym_to_capitalized_case_str(@type_)
|
@@ -212,41 +120,23 @@ module TonSdk
|
|
212
120
|
end
|
213
121
|
end
|
214
122
|
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
end
|
221
|
-
|
222
|
-
def to_h = { operations: @operations.compact.map(&:to_h) }
|
223
|
-
end
|
224
|
-
|
225
|
-
class ResultOfBatchQuery
|
226
|
-
attr_reader :results
|
227
|
-
|
228
|
-
def initialize(a)
|
229
|
-
@results = a
|
123
|
+
ParamsOfBatchQuery = Struct.new(:operations) do
|
124
|
+
def to_h
|
125
|
+
{
|
126
|
+
operations: self.operations.compact.map(&:to_h)
|
127
|
+
}
|
230
128
|
end
|
231
|
-
|
232
|
-
def to_h = { results: @results }
|
233
129
|
end
|
234
130
|
|
235
|
-
|
236
|
-
attr_reader :collection, :filter, :fields
|
237
|
-
|
131
|
+
ParamsOfAggregateCollection = Struct.new(:collection, :filter, :fields) do
|
238
132
|
def initialize(collection:, filter: nil, fields: [])
|
239
|
-
|
240
|
-
@filter = filter
|
241
|
-
@fields = fields
|
133
|
+
super
|
242
134
|
end
|
243
135
|
|
244
136
|
def to_h
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
fields: @fields.map(&:to_h)
|
249
|
-
}
|
137
|
+
h = super
|
138
|
+
h[:fields] = self.fields.map(&:to_h)
|
139
|
+
h
|
250
140
|
end
|
251
141
|
end
|
252
142
|
|
@@ -277,16 +167,69 @@ module TonSdk
|
|
277
167
|
end
|
278
168
|
end
|
279
169
|
|
280
|
-
|
281
|
-
attr_reader :values
|
170
|
+
ResultOfAggregateCollection = Struct.new(:values)
|
282
171
|
|
283
|
-
|
284
|
-
|
172
|
+
ParamsOfQueryCounterparties = Struct.new(:account, :result, :first, :after, keyword_init: true) do
|
173
|
+
def initialize(account:, result:, first: nil, after: nil)
|
174
|
+
super
|
285
175
|
end
|
176
|
+
end
|
286
177
|
|
287
|
-
|
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
|
288
193
|
end
|
289
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
|
224
|
+
|
225
|
+
def to_h
|
226
|
+
h = super
|
227
|
+
h[:abi_registry] = self.abi_registry&.map(&:to_h)
|
228
|
+
h
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
232
|
+
ResultOfQueryTransactionTree = Struct.new(:messages, :transactions, keyword_init: true)
|
290
233
|
|
291
234
|
|
292
235
|
#
|
@@ -297,7 +240,7 @@ module TonSdk
|
|
297
240
|
Interop::request_to_native_lib(
|
298
241
|
ctx,
|
299
242
|
"net.query_collection",
|
300
|
-
params
|
243
|
+
params,
|
301
244
|
is_single_thread_only: false
|
302
245
|
) do |resp|
|
303
246
|
if resp.success?
|
@@ -314,7 +257,7 @@ module TonSdk
|
|
314
257
|
Interop::request_to_native_lib(
|
315
258
|
ctx,
|
316
259
|
"net.wait_for_collection",
|
317
|
-
params
|
260
|
+
params,
|
318
261
|
is_single_thread_only: false
|
319
262
|
) do |resp|
|
320
263
|
if resp.success?
|
@@ -328,7 +271,7 @@ module TonSdk
|
|
328
271
|
end
|
329
272
|
|
330
273
|
def self.unsubscribe(ctx, params)
|
331
|
-
Interop::request_to_native_lib(ctx, "net.unsubscribe", params
|
274
|
+
Interop::request_to_native_lib(ctx, "net.unsubscribe", params) do |resp|
|
332
275
|
if resp.success?
|
333
276
|
yield NativeLibResponsetResult.new(
|
334
277
|
result: ""
|
@@ -343,7 +286,7 @@ module TonSdk
|
|
343
286
|
Interop::request_to_native_lib(
|
344
287
|
ctx,
|
345
288
|
"net.subscribe_collection",
|
346
|
-
params
|
289
|
+
params,
|
347
290
|
client_callback: client_callback,
|
348
291
|
is_single_thread_only: false
|
349
292
|
) do |resp|
|
@@ -358,7 +301,7 @@ module TonSdk
|
|
358
301
|
end
|
359
302
|
|
360
303
|
def self.query(ctx, params)
|
361
|
-
Interop::request_to_native_lib(ctx, "net.query", params
|
304
|
+
Interop::request_to_native_lib(ctx, "net.query", params) do |resp|
|
362
305
|
if resp.success?
|
363
306
|
yield NativeLibResponsetResult.new(
|
364
307
|
result: ResultOfQuery.new(resp.result["result"])
|
@@ -370,7 +313,7 @@ module TonSdk
|
|
370
313
|
end
|
371
314
|
|
372
315
|
def self.suspend(ctx)
|
373
|
-
Interop::request_to_native_lib(ctx, "net.suspend"
|
316
|
+
Interop::request_to_native_lib(ctx, "net.suspend") do |resp|
|
374
317
|
if resp.success?
|
375
318
|
yield NativeLibResponsetResult.new(result: "")
|
376
319
|
else
|
@@ -380,7 +323,7 @@ module TonSdk
|
|
380
323
|
end
|
381
324
|
|
382
325
|
def self.resume(ctx)
|
383
|
-
Interop::request_to_native_lib(ctx, "net.resume"
|
326
|
+
Interop::request_to_native_lib(ctx, "net.resume") do |resp|
|
384
327
|
if resp.success?
|
385
328
|
yield NativeLibResponsetResult.new(result: "")
|
386
329
|
else
|
@@ -390,7 +333,7 @@ module TonSdk
|
|
390
333
|
end
|
391
334
|
|
392
335
|
def self.find_last_shard_block(ctx, params)
|
393
|
-
Interop::request_to_native_lib(ctx, "net.find_last_shard_block", params
|
336
|
+
Interop::request_to_native_lib(ctx, "net.find_last_shard_block", params) do |resp|
|
394
337
|
if resp.success?
|
395
338
|
yield NativeLibResponsetResult.new(
|
396
339
|
result: ResultOfFindLastShardBlock.new(resp.result["block_id"])
|
@@ -402,7 +345,7 @@ module TonSdk
|
|
402
345
|
end
|
403
346
|
|
404
347
|
def self.fetch_endpoints(ctx)
|
405
|
-
Interop::request_to_native_lib(ctx, "net.fetch_endpoints"
|
348
|
+
Interop::request_to_native_lib(ctx, "net.fetch_endpoints") do |resp|
|
406
349
|
if resp.success?
|
407
350
|
yield NativeLibResponsetResult.new(
|
408
351
|
result: EndpointsSet.new(resp.result["endpoints"])
|
@@ -414,7 +357,7 @@ module TonSdk
|
|
414
357
|
end
|
415
358
|
|
416
359
|
def self.set_endpoints(ctx, params)
|
417
|
-
Interop::request_to_native_lib(ctx, "net.set_endpoints", params
|
360
|
+
Interop::request_to_native_lib(ctx, "net.set_endpoints", params) do |resp|
|
418
361
|
if resp.success?
|
419
362
|
yield NativeLibResponsetResult.new(
|
420
363
|
result: nil
|
@@ -427,7 +370,7 @@ module TonSdk
|
|
427
370
|
end
|
428
371
|
|
429
372
|
def self.batch_query(ctx, params)
|
430
|
-
Interop::request_to_native_lib(ctx, "net.batch_query", params
|
373
|
+
Interop::request_to_native_lib(ctx, "net.batch_query", params) do |resp|
|
431
374
|
if resp.success?
|
432
375
|
yield NativeLibResponsetResult.new(
|
433
376
|
result: ResultOfBatchQuery.new(resp.result["results"])
|
@@ -439,7 +382,7 @@ module TonSdk
|
|
439
382
|
end
|
440
383
|
|
441
384
|
def self.aggregate_collection(ctx, params)
|
442
|
-
Interop::request_to_native_lib(ctx, "net.aggregate_collection", params
|
385
|
+
Interop::request_to_native_lib(ctx, "net.aggregate_collection", params) do |resp|
|
443
386
|
if resp.success?
|
444
387
|
yield NativeLibResponsetResult.new(
|
445
388
|
result: ResultOfAggregateCollection.new(resp.result["values"])
|
@@ -449,4 +392,46 @@ module TonSdk
|
|
449
392
|
end
|
450
393
|
end
|
451
394
|
end
|
395
|
+
|
396
|
+
def self.get_endpoints(ctx, params)
|
397
|
+
Interop::request_to_native_lib(ctx, "net.get_endpoints", params) do |resp|
|
398
|
+
if resp.success?
|
399
|
+
yield NativeLibResponsetResult.new(
|
400
|
+
result: ResultOfGetEndpoints.new(
|
401
|
+
query: resp.result["query"],
|
402
|
+
endpoints: resp.result["endpoints"],
|
403
|
+
)
|
404
|
+
)
|
405
|
+
else
|
406
|
+
yield resp
|
407
|
+
end
|
408
|
+
end
|
409
|
+
end
|
410
|
+
|
411
|
+
def self.query_counterparties(ctx, params)
|
412
|
+
Interop::request_to_native_lib(ctx, "net.query_counterparties", params) do |resp|
|
413
|
+
if resp.success?
|
414
|
+
yield NativeLibResponsetResult.new(
|
415
|
+
result: ResultOfQueryCollection.new(resp.result["result"])
|
416
|
+
)
|
417
|
+
else
|
418
|
+
yield resp
|
419
|
+
end
|
420
|
+
end
|
421
|
+
end
|
422
|
+
|
423
|
+
def self.query_transaction_tree(ctx, params)
|
424
|
+
Interop::request_to_native_lib(ctx, "net.query_transaction_tree", params) do |resp|
|
425
|
+
if resp.success?
|
426
|
+
yield NativeLibResponsetResult.new(
|
427
|
+
result: ResultOfQueryTransactionTree.new(
|
428
|
+
messages: resp.result["messages"],
|
429
|
+
transactions: resp.result["transactions"],
|
430
|
+
)
|
431
|
+
)
|
432
|
+
else
|
433
|
+
yield resp
|
434
|
+
end
|
435
|
+
end
|
436
|
+
end
|
452
437
|
end
|