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.
@@ -134,7 +134,7 @@ module TonSdk
134
134
  function_name,
135
135
  function_params_json = nil,
136
136
  client_callback: nil,
137
- is_single_thread_only: trfue
137
+ is_single_thread_only: true
138
138
  )
139
139
  function_name_tc_str = TcStringData.from_string(function_name)
140
140
  function_params_json_str = function_params_json || ""
@@ -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
 
@@ -68,12 +68,14 @@ module TonSdk
68
68
  end
69
69
  end
70
70
 
71
- class ResultOfQueryCollection
72
- attr_reader :result
71
+ ResultOfQueryCollection = Struct.new(:result)
73
72
 
74
- def initialize(a)
75
- @result = a
76
- end
73
+ ResultOfWaitForCollection = Struct.new(:result)
74
+
75
+ ResultOfQuery = Struct.new(:result)
76
+
77
+ ResultOfBatchQuery = Struct.new(:results) do
78
+ def to_h = { results: @results }
77
79
  end
78
80
 
79
81
  class ParamsOfWaitForCollection
@@ -96,14 +98,6 @@ module TonSdk
96
98
  end
97
99
  end
98
100
 
99
- class ResultOfWaitForCollection
100
- attr_reader :result
101
-
102
- def initialize(a)
103
- @result = a
104
- end
105
- end
106
-
107
101
  class ParamsOfSubscribeCollection
108
102
  attr_reader :collection, :filter, :result
109
103
 
@@ -122,22 +116,13 @@ module TonSdk
122
116
  end
123
117
  end
124
118
 
125
- class ResultOfSubscribeCollection
126
- attr_reader :handle
127
-
128
- def initialize(a)
129
- @handle = a
130
- end
131
-
119
+ ResultOfSubscribeCollection = Struct.new(:handle) do
132
120
  def to_h = { handle: @handle }
133
121
  end
134
122
 
135
- class ParamsOfQuery
136
- attr_reader :query, :variables
137
-
123
+ ParamsOfQuery = Struct.new(:query, :variables) do
138
124
  def initialize(query:, variables: nil)
139
- @query = query
140
- @variables = variables
125
+ super
141
126
  end
142
127
 
143
128
  def to_h
@@ -148,39 +133,13 @@ module TonSdk
148
133
  end
149
134
  end
150
135
 
151
- class ResultOfQuery
152
- attr_reader :result
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
-
136
+ ParamsOfFindLastShardBlock = Struct.new(:address) do
166
137
  def to_h = { address: @address }
167
138
  end
168
139
 
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
140
+ ResultOfFindLastShardBlock = Struct.new(:block_id)
183
141
 
142
+ EndpointsSet = Struct.new(:endpoints) do
184
143
  def to_h = { endpoints: @endpoints }
185
144
  end
186
145
 
@@ -212,24 +171,12 @@ module TonSdk
212
171
  end
213
172
  end
214
173
 
215
- class ParamsOfBatchQuery
216
- attr_reader :operations
217
-
218
- def initialize(a)
219
- @operations = a
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
174
+ ParamsOfBatchQuery = Struct.new(:operations) do
175
+ def to_h
176
+ {
177
+ operations: @operations.compact.map(&:to_h)
178
+ }
230
179
  end
231
-
232
- def to_h = { results: @results }
233
180
  end
234
181
 
235
182
  class ParamsOfAggregateCollection
@@ -277,18 +224,26 @@ module TonSdk
277
224
  end
278
225
  end
279
226
 
280
- class ResultOfAggregateCollection
281
- attr_reader :values
227
+ ResultOfAggregateCollection = Struct.new(:values) do
228
+ def to_h = { values: @values }
229
+ end
282
230
 
283
- def initialize(a)
284
- @values = a
231
+ ParamsOfQueryCounterparties = Struct.new(:account, :result, :first, :after, keyword_init: true) do
232
+ def initialize(account:, result:, first: nil, after: nil)
233
+ super
285
234
  end
286
235
 
287
- def to_h = { values: @values }
236
+ def to_h
237
+ {
238
+ account: @account,
239
+ result: @result,
240
+ first: @first,
241
+ after: @after
242
+ }
243
+ end
288
244
  end
289
245
 
290
246
 
291
-
292
247
  #
293
248
  # functions
294
249
  #
@@ -449,4 +404,16 @@ module TonSdk
449
404
  end
450
405
  end
451
406
  end
407
+
408
+ def self.query_counterparties(ctx, params)
409
+ Interop::request_to_native_lib(ctx, "net.query_counterparties", params.to_h.to_json) do |resp|
410
+ if resp.success?
411
+ yield NativeLibResponsetResult.new(
412
+ result: ResultOfQueryCollection.new(resp.result["result"])
413
+ )
414
+ else
415
+ yield resp
416
+ end
417
+ end
418
+ end
452
419
  end
@@ -23,13 +23,7 @@ module TonSdk
23
23
  end
24
24
  end
25
25
 
26
- class ResultOfSendMessage
27
- attr_reader :shard_block_id
28
-
29
- def initialize(a)
30
- @shard_block_id = a
31
- end
32
-
26
+ ResultOfSendMessage = Struct.new(:shard_block_id) do
33
27
  def to_h
34
28
  {
35
29
  shard_block_id: @shard_block_id
@@ -157,14 +151,7 @@ module TonSdk
157
151
  end
158
152
  end
159
153
 
160
- class ParamsOfProcessMessage
161
- attr_reader :message_encode_params, :send_events
162
-
163
- def initialize(message_encode_params:, send_events:)
164
- @message_encode_params = message_encode_params
165
- @send_events = send_events
166
- end
167
-
154
+ ParamsOfProcessMessage = Struct.new(:message_encode_params, :send_events) do
168
155
  def to_h
169
156
  {
170
157
  message_encode_params: @message_encode_params.to_h,
@@ -5,6 +5,23 @@ module TonSdk
5
5
  # types
6
6
  #
7
7
 
8
+ module ErrorCode
9
+ CANNOT_READ_TRANSACTION = 401
10
+ CANNOT_READ_BLOCKCHAIN_CONFIG = 402
11
+ TRANSACTION_ABORTED = 403
12
+ INTERNAL_ERROR = 404
13
+ ACTION_PHASE_FAILED = 405
14
+ ACCOUNT_CODE_MISSING = 406
15
+ LOW_BALANCE = 407
16
+ ACCOUNT_FROZEN_OR_DELETED = 408
17
+ ACCOUNT_MISSING = 409
18
+ UNKNOWN_EXECUTION_ERROR = 410
19
+ INVALID_INPUT_STACK = 411
20
+ INVALID_ACCOUNT_BOC = 412
21
+ INVALID_MESSAGE_TYPE = 413
22
+ CONTRACT_EXECUTION_ERROR = 414
23
+ end
24
+
8
25
  class ExecutionOptions
9
26
  attr_reader :blockchain_config, :block_time, :block_lt, :transaction_lt
10
27
 
@@ -141,13 +158,14 @@ module TonSdk
141
158
  end
142
159
 
143
160
  class ParamsOfRunGet
144
- attr_reader :account, :function_name, :input, :execution_options
161
+ attr_reader :account, :function_name, :input, :execution_options, :tuple_list_as_array
145
162
 
146
- def initialize(account:, function_name:, input: nil, execution_options: nil)
163
+ def initialize(account:, function_name:, input: nil, execution_options: nil, tuple_list_as_array: nil)
147
164
  @account = account
148
165
  @function_name = function_name
149
166
  @input = input
150
167
  @execution_options = execution_options
168
+ @tuple_list_as_array = tuple_list_as_array
151
169
  end
152
170
 
153
171
  def to_h
@@ -157,7 +175,8 @@ module TonSdk
157
175
  account: @account,
158
176
  function_name: @function_name,
159
177
  input: @input,
160
- execution_options: exe_opt_val
178
+ execution_options: exe_opt_val,
179
+ tuple_list_as_array: @tuple_list_as_array
161
180
  }
162
181
  end
163
182
  end
@@ -32,14 +32,7 @@ module TonSdk
32
32
  end
33
33
  end
34
34
 
35
- class ParamsOfConvertAddress
36
- attr_reader :address, :output_format
37
-
38
- def initialize(address:, output_format:)
39
- @address = address
40
- @output_format = output_format
41
- end
42
-
35
+ ParamsOfConvertAddress = Struct.new(:address, :output_format) do
43
36
  def to_h
44
37
  {
45
38
  address: @address,
@@ -48,14 +41,36 @@ module TonSdk
48
41
  end
49
42
  end
50
43
 
51
- class ResultOfConvertAddress
52
- attr_reader :address
44
+ ResultOfConvertAddress = Struct.new(:address)
53
45
 
54
- def initialize(a)
55
- @address = a
46
+ ParamsOfCalcStorageFee = Struct.new(:account, :period) do
47
+ def to_h
48
+ {
49
+ account: @account,
50
+ period: @period
51
+ }
52
+ end
53
+ end
54
+
55
+ ResultOfCalcStorageFee = Struct.new(:fee)
56
+
57
+ ParamsOfCompressZstd = Struct.new(:uncompressed, :level) do
58
+ def to_h
59
+ {
60
+ uncompressed: @uncompressed,
61
+ level: @level
62
+ }
56
63
  end
57
64
  end
58
65
 
66
+ ResultOfCompressZstd = Struct.new(:compressed)
67
+
68
+ ParamsOfDecompressZstd = Struct.new(:compressed) do
69
+ def to_h = { compressed: @compressed }
70
+ end
71
+
72
+ ResultOfDecompressZstd = Struct.new(:decompressed)
73
+
59
74
 
60
75
  #
61
76
  # functions
@@ -72,5 +87,41 @@ module TonSdk
72
87
  end
73
88
  end
74
89
  end
90
+
91
+ def self.calc_storage_fee(ctx, prm)
92
+ Interop::request_to_native_lib(ctx, "utils.calc_storage_fee", prm.to_h.to_json) do |resp|
93
+ if resp.success?
94
+ yield NativeLibResponsetResult.new(
95
+ result: Utils::ResultOfCalcStorageFee.new(resp.result["fee"])
96
+ )
97
+ else
98
+ yield resp
99
+ end
100
+ end
101
+ end
102
+
103
+ def self.compress_zstd(ctx, prm)
104
+ Interop::request_to_native_lib(ctx, "utils.compress_zstd", prm.to_h.to_json) do |resp|
105
+ if resp.success?
106
+ yield NativeLibResponsetResult.new(
107
+ result: Utils::ResultOfCompressZstd.new(resp.result["compressed"])
108
+ )
109
+ else
110
+ yield resp
111
+ end
112
+ end
113
+ end
114
+
115
+ def self.decompress_zstd(ctx, prm)
116
+ Interop::request_to_native_lib(ctx, "utils.decompress_zstd", prm.to_h.to_json) do |resp|
117
+ if resp.success?
118
+ yield NativeLibResponsetResult.new(
119
+ result: Utils::ParamsOfDecompressZstd.new(resp.result["decompressed"])
120
+ )
121
+ else
122
+ yield resp
123
+ end
124
+ end
125
+ end
75
126
  end
76
127
  end
@@ -1,5 +1,4 @@
1
1
  module TonSdk
2
- VERSION = "1.7.1"
3
- NATIVE_LIB_VERSION = "1.7.0"
4
- SDK_VERSION = "1.7.0"
2
+ VERSION = "1.13.0"
3
+ NATIVE_SDK_VERSION = "1.13.0"
5
4
  end
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.7.1
4
+ version: 1.13.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-03-25 00:00:00.000000000 Z
11
+ date: 2021-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi