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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3d1c48c5f27ebe774498f9a6a471e384aa658c48d51a834bf09a9d62407b5b9a
4
- data.tar.gz: cb6369381b1aaf376a19dddea4b3d2e3a6b32b681dde8e0ce7a9fa3358bbb630
3
+ metadata.gz: 9f2ac355af8715a6b9902625f87e3056ab2f0b1e587f254e215536f61884260c
4
+ data.tar.gz: fd17e79331f37041c964540eab79bbf2865ee71e2eb4229b09c86ea81096f076
5
5
  SHA512:
6
- metadata.gz: 2e2c8829e03117c75787b63f414a4e04dbf0466d27b4f25c7767b429942a2732db56e6ced5b91a2c7ee50e863a36843b356631a2164494dfb8c1f855f2ec2069
7
- data.tar.gz: 495f0ac60ff7a8ea641afdf1169bc6accc5748fb7c01240f9246f5e47633bf24f222100ca5eff2a4c31df683b4b411076d3d095fc843c5cc2c7bbdccf03e796a
6
+ metadata.gz: 79499cc78e89af5b1aaee344abc5b22b0fad2c5edfc44b0126dfca3055953813ca54d85307cc2d8f17f18b9fd4baebb89e801d8593fea1fd80006ee092b2d175
7
+ data.tar.gz: 6c4af233eaec857f5e6bc03a140fdd3beb812c69e8cbd4a5334bc1e3a69fca4eaf6650367f609202c2def14996dcae27ed96a3aaa583debec1d72c8402adfeee
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ 1.15.x
4
+ -----
5
+ * TON SDK version: 1.15.0
6
+ * internal refactoring
7
+ * the changes are according the ones of TON SDK
8
+
3
9
  1.13.x
4
10
  -----
5
11
  * TON SDK version: 1.13.0
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # TON SDK client in Ruby and for Ruby
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/ton_sdk_client.png)](https://badge.fury.io/rb/ton_sdk_client)
4
- [![TON SDK version](https://img.shields.io/badge/TON%20SDK%20version-1.13.0-green)](https://github.com/tonlabs/TON-SDK/tree/1.13.0)
4
+ [![TON SDK version](https://img.shields.io/badge/TON%20SDK%20version-1.15.0-green)](https://github.com/tonlabs/TON-SDK/tree/1.15.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
 
@@ -39,59 +39,17 @@ module TonSdk
39
39
  end
40
40
  end
41
41
 
42
- class FunctionHeader
43
- attr_reader :expire, :time, :pubkey
44
-
45
- def initialize(expire: nil, time: nil, pubkey: nil)
46
- @expire = expire
47
- @time = time
48
- @pubkey = pubkey
49
- end
50
-
51
- def to_h
52
- {
53
- expire: @expire,
54
- time: @time,
55
- pubkey: @pubkey
56
- }
57
- end
58
- end
59
-
60
- class CallSet
61
- attr_reader :function_name, :header, :input
42
+ FunctionHeader = Struct.new(:expire, :time, :pubkey, keyword_init: true)
62
43
 
44
+ CallSet = Struct.new(:function_name, :header, :input, keyword_init: true) do
63
45
  def initialize(function_name:, header: nil, input: nil)
64
- @function_name = function_name
65
- @header = header
66
- @input = input
67
- end
68
-
69
- def to_h
70
- {
71
- function_name: @function_name,
72
- header: @header.nil? ? nil : @header.to_h,
73
- input: @input
74
- }
46
+ super
75
47
  end
76
48
  end
77
49
 
78
- class DeploySet
79
- attr_reader :tvc, :workchain_id, :initial_data, :initial_pubkey
80
-
50
+ DeploySet = Struct.new(:tvc, :workchain_id, :initial_data, :initial_pubkey, keyword_init: true) do
81
51
  def initialize(tvc:, workchain_id: nil, initial_data: nil, initial_pubkey: nil)
82
- @tvc = tvc
83
- @workchain_id = workchain_id
84
- @initial_data = initial_data
85
- @initial_pubkey = initial_pubkey
86
- end
87
-
88
- def to_h
89
- {
90
- tvc: @tvc,
91
- workchain_id: @workchain_id,
92
- initial_data: @initial_data,
93
- initial_pubkey: @initial_pubkey
94
- }
52
+ super
95
53
  end
96
54
  end
97
55
 
@@ -136,10 +94,18 @@ module TonSdk
136
94
  end
137
95
  end
138
96
 
139
- class StateInitSource
140
- TYPES = [:message, :state_init, :tvc]
141
- attr_reader :type_, :source, :code, :data, :library, :tvc, :public_key, :init_params
142
-
97
+ STATIC_INIT_SOURCE_TYPES = [:message, :state_init, :tvc]
98
+ StateInitSource = Struct.new(
99
+ :type_,
100
+ :source,
101
+ :code,
102
+ :data,
103
+ :library,
104
+ :tvc,
105
+ :public_key,
106
+ :init_params,
107
+ keyword_init: true
108
+ ) do
143
109
  def initialize(
144
110
  type_:,
145
111
  source: nil,
@@ -150,17 +116,10 @@ module TonSdk
150
116
  public_key: nil,
151
117
  init_params: nil
152
118
  )
153
- unless TYPES.include?(type_)
154
- raise ArgumentError.new("unknown type: #{type_}; known types: #{TYPES}")
119
+ unless STATIC_INIT_SOURCE_TYPES.include?(type_)
120
+ raise ArgumentError.new("unknown type: #{type_}; known types: #{STATIC_INIT_SOURCE_TYPES}")
155
121
  end
156
- @type_ = type_
157
- @source = source
158
- @code = code
159
- @data = data
160
- @library = library
161
- @tvc = tvc
162
- @public_key = public_key
163
- @init_params = init_params
122
+ super
164
123
  end
165
124
 
166
125
  def to_h
@@ -185,49 +144,47 @@ module TonSdk
185
144
  init_params: @init_params.to_h
186
145
  }
187
146
  else
188
- raise ArgumentError.new("unknown type: #{@type_}; known types: #{TYPES}")
147
+ raise ArgumentError.new("unknown type: #{@type_}; known types: #{STATIC_INIT_SOURCE_TYPES}")
189
148
  end
190
149
 
191
150
  h1.merge(h2)
192
151
  end
193
152
  end
194
153
 
195
- class StateInitParams
196
- attr_reader :abi, :value
197
-
154
+ StateInitParams = Struct.new(:abi, :value, keyword_init: true) do
198
155
  def initialize(abi:, value:)
199
- @abi = abi
200
- @value = value
201
- end
202
-
203
- def to_h
204
- {
205
- abi: abi.to_h,
206
- value: @value
207
- }
156
+ super
208
157
  end
209
158
  end
210
159
 
211
- class MessageSource
212
- TYPES = [:encoded, :encoding_params]
213
160
 
214
- attr_reader :type_, :message, :abi, :address, :deploy_set, :call_set,
215
- :signer, :processing_try_index
216
-
217
- def initialize(type_:, message: nil, abi: nil, address: nil, deploy_set: nil,
218
- call_set: nil, signer: nil, processing_try_index: 0)
219
- unless TYPES.include?(type_)
220
- raise ArgumentError.new("unknown type: #{type_}; known types: #{TYPES}")
161
+ MESSAGE_SOURCE_TYPES = [:encoded, :encoding_params]
162
+ MessageSource = Struct.new(
163
+ :type_,
164
+ :message,
165
+ :abi,
166
+ :address,
167
+ :deploy_set,
168
+ :call_set,
169
+ :signer,
170
+ :processing_try_index,
171
+ keyword_init: true
172
+ ) do
173
+ def initialize(
174
+ type_:,
175
+ message: nil,
176
+ abi: nil,
177
+ address: nil,
178
+ deploy_set: nil,
179
+ call_set: nil,
180
+ signer: nil,
181
+ processing_try_index: 0
182
+ )
183
+ unless MESSAGE_SOURCE_TYPES.include?(type_)
184
+ raise ArgumentError.new("unknown type: #{type_}; known types: #{MESSAGE_SOURCE_TYPES}")
221
185
  end
222
186
 
223
- @type_ = type_
224
- @message = message
225
- @abi = abi
226
- @address = address
227
- @deploy_set = deploy_set
228
- @call_set = call_set
229
- @signer = signer
230
- @processing_try_index = processing_try_index
187
+ super
231
188
  end
232
189
 
233
190
  def to_h
@@ -256,142 +213,68 @@ module TonSdk
256
213
  end
257
214
  end
258
215
 
259
- class ParamsOfEncodeMessageBody
260
- attr_reader :abi, :call_set, :is_internal, :signer, :processing_try_index
261
-
216
+ ParamsOfEncodeMessageBody = Struct.new(:abi, :call_set, :is_internal, :signer, :processing_try_index, keyword_init: true) do
262
217
  def initialize(abi:, call_set:, is_internal:, signer:, processing_try_index: 0)
263
- @abi = abi
264
- @call_set = call_set
265
- @is_internal = is_internal
266
- @signer = signer
267
- @processing_try_index = processing_try_index
268
- end
269
-
270
- def to_h
271
- {
272
- abi: @abi.to_h,
273
- call_set: @call_set.to_h,
274
- is_internal: @is_internal,
275
- signer: @signer.to_h,
276
- processing_try_index: @processing_try_index
277
- }
218
+ super
278
219
  end
279
220
  end
280
221
 
281
- class ResultOfEncodeMessageBody
282
- attr_reader :body, :data_to_sign
283
-
222
+ ResultOfEncodeMessageBody = Struct.new(:body, :data_to_sign, keyword_init: true) do
284
223
  def initialize(body:, data_to_sign: nil)
285
- @body = body
286
- @data_to_sign = data_to_sign
224
+ super
287
225
  end
288
226
  end
289
227
 
290
- class ParamsOfAttachSignatureToMessageBody
291
- attr_reader :abi, :public_key, :message, :signature
292
-
228
+ ParamsOfAttachSignatureToMessageBody = Struct.new(:abi, :public_key, :message, :signature, keyword_init: true) do
293
229
  def initialize(abi:, public_key:, message:, signature:)
294
- @abi = abi
295
- @public_key = public_key
296
- @message = message
297
- @signature = signature
298
- end
299
-
300
- def to_h
301
- {
302
- abi: @abi.to_h,
303
- public_key: @public_key,
304
- message: @message,
305
- signature: @signature
306
- }
307
- end
308
- end
309
-
310
- class ResultOfAttachSignatureToMessageBody
311
- attr_reader :body
312
-
313
- def initialize(a)
314
- @body = a
230
+ super
315
231
  end
316
232
  end
317
233
 
318
- class ParamsOfEncodeMessage
319
- attr_reader :abi, :address, :deploy_set, :call_set, :signer, :processing_try_index
234
+ ResultOfAttachSignatureToMessageBody = Struct.new(:body)
320
235
 
321
- def initialize(abi:, address: nil, deploy_set: nil, call_set: nil, signer:, processing_try_index: 0)
322
- @abi = abi
323
- @address = address
324
- @deploy_set = deploy_set
325
- @call_set = call_set
326
- @signer = signer
327
- @processing_try_index = processing_try_index
328
- end
329
-
330
- def to_h
331
- {
332
- abi: @abi.to_h,
333
- address: @address,
334
- deploy_set: @deploy_set.nil? ? nil: @deploy_set.to_h,
335
- call_set: @call_set.nil? ? nil: @call_set.to_h,
336
- signer: @signer.to_h,
337
- processing_try_index: @processing_try_index
338
- }
236
+ ParamsOfEncodeMessage = Struct.new(
237
+ :abi,
238
+ :address,
239
+ :deploy_set,
240
+ :call_set,
241
+ :signer,
242
+ :processing_try_index,
243
+ keyword_init: true
244
+ ) do
245
+ def initialize(
246
+ abi:,
247
+ address: nil,
248
+ deploy_set: nil,
249
+ call_set: nil,
250
+ signer:,
251
+ processing_try_index: 0
252
+ )
253
+ super
339
254
  end
340
255
  end
341
256
 
342
- class ResultOfEncodeMessage
343
- attr_reader :message, :data_to_sign, :address, :message_id
344
-
257
+ ResultOfEncodeMessage = Struct.new(:message, :data_to_sign, :address, :message_id, keyword_init: true) do
345
258
  def initialize(message:, data_to_sign: nil, address:, message_id:)
346
- @message = message
347
- @data_to_sign = data_to_sign
348
- @address = address
349
- @message_id = message_id
259
+ super
350
260
  end
351
261
  end
352
262
 
353
- class ParamsOfAttachSignature
354
- attr_reader :abi, :public_key, :message, :signature
355
-
263
+ ParamsOfAttachSignature = Struct.new(:abi, :public_key, :message, :signature, keyword_init: true) do
356
264
  def initialize(abi:, public_key:, message:, signature:)
357
- @abi = abi
358
- @public_key = public_key
359
- @message = message
360
- @signature = signature
361
- end
362
-
363
- def to_h
364
- {
365
- abi: @abi.to_h,
366
- public_key: @public_key,
367
- message: @message,
368
- signature: @signature
369
- }
265
+ super
370
266
  end
371
267
  end
372
268
 
373
- class ResultOfAttachSignature
374
- attr_reader :message, :message_id
375
-
269
+ ResultOfAttachSignature = Struct.new(:message, :message_id, keyword_init: true) do
376
270
  def initialize(message:, message_id:)
377
- @message = message
378
- @message_id = message_id
271
+ super
379
272
  end
380
273
  end
381
274
 
382
- class ParamsOfDecodeMessage
383
- attr_reader :abi, :message
384
-
275
+ ParamsOfDecodeMessage = Struct.new(:abi, :message, keyword_init: true) do
385
276
  def initialize(abi:, message:)
386
- @abi = abi
387
- @message = message
388
- end
389
-
390
- def to_h
391
- {
392
- abi: @abi.to_h,
393
- message: @message
394
- }
277
+ super
395
278
  end
396
279
  end
397
280
 
@@ -458,57 +341,21 @@ module TonSdk
458
341
  end
459
342
  end
460
343
 
461
- class ParamsOfDecodeMessageBody
462
- attr_reader :abi, :body, :is_internal
463
-
344
+ ParamsOfDecodeMessageBody = Struct.new(:abi, :body, :is_internal, keyword_init: true) do
464
345
  def initialize(abi:, body:, is_internal:)
465
- @abi = abi
466
- @body = body
467
- @is_internal = is_internal
468
- end
469
-
470
- def to_h
471
- {
472
- abi: @abi.to_h,
473
- body: @body,
474
- is_internal: @is_internal
475
- }
346
+ super
476
347
  end
477
348
  end
478
349
 
479
- class ParamsOfEncodeAccount
480
- attr_reader :state_init, :balance, :last_trans_lt, :last_paid
481
-
350
+ ParamsOfEncodeAccount = Struct.new(:state_init, :balance, :last_trans_lt, :last_paid, keyword_init: true) do
482
351
  def initialize(state_init:, balance: nil, last_trans_lt: nil, last_paid: nil)
483
- @state_init = state_init
484
- @balance = balance
485
- @last_trans_lt = last_trans_lt
486
- @last_paid = last_paid
487
- end
488
-
489
- def to_h
490
- {
491
- state_init: @state_init.to_h,
492
- balance: @balance,
493
- last_trans_lt: @last_trans_lt,
494
- last_paid: @last_paid
495
- }
352
+ super
496
353
  end
497
354
  end
498
355
 
499
- class ResultOfEncodeAccount
500
- attr_reader :account, :id_
501
-
356
+ ResultOfEncodeAccount = Struct.new(:account, :id_, keyword_init: true) do
502
357
  def initialize(account:, id_:)
503
- @account = account
504
- @id_ = id_
505
- end
506
-
507
- def to_h
508
- {
509
- account: @account,
510
- id: @id_
511
- }
358
+ super
512
359
  end
513
360
  end
514
361
 
@@ -773,9 +620,17 @@ module TonSdk
773
620
  end
774
621
  end
775
622
 
776
- class ParamsOfEncodeInternalMessage
777
- attr_reader :abi, :address, :src_address, :deploy_set, :call_set, :value, :bounce, :enable_ihr
778
-
623
+ ParamsOfEncodeInternalMessage = Struct.new(
624
+ :abi,
625
+ :address,
626
+ :src_address,
627
+ :deploy_set,
628
+ :call_set,
629
+ :value,
630
+ :bounce,
631
+ :enable_ihr,
632
+ keyword_init: true
633
+ ) do
779
634
  def initialize(
780
635
  abi: nil,
781
636
  address: nil,
@@ -786,45 +641,18 @@ module TonSdk
786
641
  bounce: nil,
787
642
  enable_ihr: nil
788
643
  )
789
- @abi = abi
790
- @address = address
791
- @src_address = src_address
792
- @deploy_set = deploy_set
793
- @call_set = call_set
794
- @value = value
795
- @bounce = bounce
796
- @enable_ihr = enable_ihr
797
- end
798
-
799
- def to_h
800
- {
801
- abi: @abi.nil? ? nil : @abi.to_h,
802
- address: @address,
803
- src_address: @src_address,
804
- deploy_set: @deploy_set.nil? ? nil : @deploy_set.to_h,
805
- call_set: @call_set.nil? ? nil : @call_set.to_h,
806
- value: @value,
807
- bounce: @bounce,
808
- enable_ihr: @enable_ihr
809
- }
644
+ super
810
645
  end
811
646
  end
812
647
 
813
- class ResultOfEncodeInternalMessage
814
- attr_reader :message, :address, :message_id
815
-
648
+ ResultOfEncodeInternalMessage = Struct.new(
649
+ :message,
650
+ :address,
651
+ :message_id,
652
+ keyword_init: true
653
+ ) do
816
654
  def initialize(message:, address:, message_id:)
817
- @message = message
818
- @address = address
819
- @message_id = message_id
820
- end
821
-
822
- def to_h
823
- {
824
- message: @message,
825
- address: @address,
826
- message_id: @message_id
827
- }
655
+ super
828
656
  end
829
657
  end
830
658
 
@@ -834,8 +662,7 @@ module TonSdk
834
662
  #
835
663
 
836
664
  def self.encode_message_body(ctx, params)
837
- pr_json = params.to_h.to_json
838
- Interop::request_to_native_lib(ctx, "abi.encode_message_body", pr_json) do |resp|
665
+ Interop::request_to_native_lib(ctx, "abi.encode_message_body", params) do |resp|
839
666
  if resp.success?
840
667
  yield NativeLibResponsetResult.new(
841
668
  result: ResultOfEncodeMessageBody.new(
@@ -849,8 +676,7 @@ module TonSdk
849
676
  end
850
677
 
851
678
  def self.attach_signature_to_message_body(ctx, params)
852
- pr_json = params.to_h.to_json
853
- Interop::request_to_native_lib(ctx, "abi.attach_signature_to_message_body", pr_json) do |resp|
679
+ Interop::request_to_native_lib(ctx, "abi.attach_signature_to_message_body", params) do |resp|
854
680
  if resp.success?
855
681
  yield NativeLibResponsetResult.new(
856
682
  result: ResultOfAttachSignatureToMessageBody.new(resp.result["body"])
@@ -862,8 +688,7 @@ module TonSdk
862
688
  end
863
689
 
864
690
  def self.encode_message(ctx, params)
865
- pr_json = params.to_h.to_json
866
- Interop::request_to_native_lib(ctx, "abi.encode_message", pr_json) do |resp|
691
+ Interop::request_to_native_lib(ctx, "abi.encode_message", params) do |resp|
867
692
  if resp.success?
868
693
  yield NativeLibResponsetResult.new(
869
694
  result: ResultOfEncodeMessage.new(
@@ -880,8 +705,7 @@ module TonSdk
880
705
  end
881
706
 
882
707
  def self.attach_signature(ctx, params)
883
- pr_json = params.to_h.to_json
884
- Interop::request_to_native_lib(ctx, "abi.attach_signature", pr_json) do |resp|
708
+ Interop::request_to_native_lib(ctx, "abi.attach_signature", params) do |resp|
885
709
  if resp.success?
886
710
  yield NativeLibResponsetResult.new(
887
711
  result: ResultOfAttachSignature.new(
@@ -895,8 +719,7 @@ module TonSdk
895
719
  end
896
720
 
897
721
  def self.decode_message(ctx, params)
898
- pr_json = params.to_h.to_json
899
- Interop::request_to_native_lib(ctx, "abi.decode_message", pr_json) do |resp|
722
+ Interop::request_to_native_lib(ctx, "abi.decode_message", params) do |resp|
900
723
  if resp.success?
901
724
  yield NativeLibResponsetResult.new(
902
725
  result: DecodedMessageBody.from_json(resp.result)
@@ -908,8 +731,7 @@ module TonSdk
908
731
  end
909
732
 
910
733
  def self.decode_message_body(ctx, params)
911
- pr_json = params.to_h.to_json
912
- Interop::request_to_native_lib(ctx, "abi.decode_message_body", pr_json) do |resp|
734
+ Interop::request_to_native_lib(ctx, "abi.decode_message_body", params) do |resp|
913
735
  if resp.success?
914
736
  yield NativeLibResponsetResult.new(
915
737
  result: DecodedMessageBody.from_json(resp.result)
@@ -921,8 +743,7 @@ module TonSdk
921
743
  end
922
744
 
923
745
  def self.encode_account(ctx, params)
924
- pr_json = params.to_h.to_json
925
- Interop::request_to_native_lib(ctx, "abi.encode_account", pr_json) do |resp|
746
+ Interop::request_to_native_lib(ctx, "abi.encode_account", params) do |resp|
926
747
  if resp.success?
927
748
  yield NativeLibResponsetResult.new(
928
749
  result: ResultOfEncodeAccount.new(
@@ -937,8 +758,7 @@ module TonSdk
937
758
  end
938
759
 
939
760
  def self.encode_internal_message(ctx, params)
940
- pr_json = params.to_h.to_json
941
- Interop::request_to_native_lib(ctx, "abi.encode_internal_message", pr_json) do |resp|
761
+ Interop::request_to_native_lib(ctx, "abi.encode_internal_message", params) do |resp|
942
762
  if resp.success?
943
763
  yield NativeLibResponsetResult.new(
944
764
  result: ResultOfEncodeInternalMessage.new(