ton_sdk_client 1.17.0 → 1.21.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: 611b507cb9f4b904651663ac9d6de9c35730c1fdb246174c591b1c9e18b2e2c1
4
- data.tar.gz: f86b4cbd48751a2853263ee20ffc642cd9af9afcd67c7a64aa6a8c3d240f48b5
3
+ metadata.gz: 6256a1ec816fa6bb0473e20cd8b6d96ff2748c73073e23a1a68da801d57459fe
4
+ data.tar.gz: 03a2a5a3dc2c0553fa183b8affc1ffa304030967493fa12f4f4efe5d5b7e7752
5
5
  SHA512:
6
- metadata.gz: b8f11f0c94deff6280c93206990b747712798f668b2d1edd15540245335780dc07f8e7093d7c905744774d051671c816533a4547ee501b47721fc6af6af3487c
7
- data.tar.gz: 43b87245c92344484bac45ff9c095e2ee5d93b0869bc16cc7668d33794a6bbb8c9092adf6d3ff571220782fc8cf92a22d31620476b175ba376876c833f5ae094
6
+ metadata.gz: f996f811660b6cdfb4ee248c72662729a3cdf681a3552718a73d902c3497176662bb12b2ebd2e547b9d6f6db9c08e38c76ecbe025e386c8425e519597726ea7d
7
+ data.tar.gz: 9f065d85fe4bd9125a07b0f9ee5a324c9a463d34b1442bc9de722bd452a5dd79055a0b2899d9068998aa691f84dd18327addd1bd353b8c1154abbd9544cc4d14
data/CHANGELOG.md CHANGED
@@ -1,93 +1,37 @@
1
1
  # Changelog
2
2
 
3
- 1.17.x
4
- -----
5
- * the changes are according the ones of TON SDK
6
-
3
+ all the changes are always according to the ones of the main TON SDK library; and on top on that, there may be additional ones
7
4
 
8
- 1.16.x
5
+ 1.20.x
9
6
  -----
10
- * TON SDK version: 1.16.0
11
- * the changes are according the ones of TON SDK
7
+ * NetworkConfig and AbiContract have been changed (not mentioned explicitly in Changelog of TON SDK )
8
+
12
9
 
13
10
  1.15.x
14
11
  -----
15
- * TON SDK version: 1.15.0
16
12
  * internal refactoring
17
- * the changes are according the ones of TON SDK
13
+
18
14
 
19
15
  1.13.x
20
16
  -----
21
- * TON SDK version: 1.13.0
22
17
  * internal refactoring
23
- * the changes are according the ones of TON SDK
18
+
24
19
 
25
20
  1.12.x
26
21
  -----
27
- * TON SDK version: 1.12.0
28
22
  * internal refactoring
29
- * the changes are according the ones of TON SDK
30
-
31
- 1.11.x
32
- -----
33
- * TON SDK version: 1.11.0
34
- * the changes are according the ones of TON SDK
35
-
36
-
37
- 1.10.x
38
- -----
39
- * TON SDK version: 1.10.0
40
- * the changes are according the ones of TON SDK
41
23
 
42
24
 
43
25
  1.9.x
44
26
  -----
45
- * TON SDK version: 1.9.0
46
27
  * remove TonSdk::NATIVE_LIB_VERSION, rename TonSdk::SDK_VERSION to TonSdk::NATIVE_SDK_VERSION
47
- * the changes are according the ones of TON SDK
48
-
49
28
 
50
- 1.7.x
51
- -----
52
- * TON SDK version: 1.7.0
53
- * the changes are according the ones of TON SDK
54
-
55
- 1.3.x
56
- -----
57
- * TON SDK version: 1.6.0
58
- * the changes are according the ones of TON SDK
59
29
 
60
30
  1.2.x
61
31
  -----
62
- * TON SDK version: 1.5.2
63
32
  * min Ruby version: 3.0
64
33
 
65
34
 
66
- 1.1.x
67
- -----
68
- * new `Client` `.resolve_app_request()`
69
- * new `Net` `.query()`, `.suspend()`, `.resume()`
70
- * new `Debot`
71
- * new `Boc` `.get_boc_hash()`
72
- * new `Crypto` `.register_signing_box()`, `.get_signing_box()`, `.signing_box_get_public_key()`,
73
- `.signing_box_sign()`, `remove_signing_box()`
74
- * new paramentes in `NetworkConfig`; particularly
75
-
76
- ```
77
- server_address: "example.com"
78
- ```
79
-
80
- becomes
81
-
82
- ```
83
- endpoints: ["example.com"]
84
- ```
85
-
86
- check out the main repository for the details
87
-
88
- * new data types/classes in several modules
89
-
90
-
91
35
  1.0.0
92
36
  -----
93
- * The first version has been released.
37
+ * the first version has been released.
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.17.0-green)](https://github.com/tonlabs/TON-SDK/tree/1.17.0)
4
+ [![TON SDK version](https://img.shields.io/badge/TON%20SDK%20version-1.21.0-green)](https://github.com/tonlabs/TON-SDK/tree/1.21.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
 
@@ -9,7 +9,7 @@ Note that there're 2 types of versions:
9
9
  * `TonSdk::VERSION` - the version of the gem
10
10
  * `TonSdk::NATIVE_SDK_VERSION` - the version of the original SDK
11
11
 
12
- and they don't necessarily have to match each other.
12
+ and they may not always match each other.
13
13
 
14
14
 
15
15
 
@@ -549,43 +549,36 @@ module TonSdk
549
549
  end
550
550
 
551
551
  class AbiContract
552
- attr_reader :abi_version, :header, :functions, :events, :data
552
+ attr_reader :abi_version, :version, :header, :functions, :events, :data, :fields
553
553
 
554
- def initialize(abi_version: nil, header: [], functions: [], events: [], data: [])
554
+ def initialize(
555
+ abi_version: nil,
556
+ version: nil,
557
+ header: [],
558
+ functions: [],
559
+ events: [],
560
+ data: [],
561
+ fields: []
562
+ )
555
563
  @abi_version = abi_version
556
-
557
- # in case if an argument has been passed as nil,
558
- # a default value should be used instead
559
-
560
- @header = header || []
561
- @functions = functions || []
562
- @events = events || []
563
- @data = data || []
564
+ @version = version
565
+ @header = header
566
+ @functions = functions
567
+ @events = events
568
+ @data = data
569
+ @fields = fields
564
570
  end
565
571
 
566
572
  def to_h
567
- @header.compact! if !@header.nil?
568
-
569
- fn_h_s = if !@functions.nil?
570
- @functions.compact.map(&:to_h)
571
- end
572
-
573
- ev_h_s = if !@events.nil?
574
- @events.compact.map(&:to_h)
575
- end
576
-
577
- dt_h_s = if !@data.nil?
578
- @data.compact.map(&:to_h)
579
- end
580
-
581
573
  {
582
574
  abi_version: @abi_version,
583
575
  :"ABI version" => @abi_version, #TODO
584
-
576
+ version: @version,
585
577
  header: @header,
586
- functions: fn_h_s,
587
- events: ev_h_s,
588
- data: dt_h_s,
578
+ functions: @functions&.map(&:to_h),
579
+ events: @events&.map(&:to_h),
580
+ data: @data&.map(&:to_h),
581
+ fields: @fields&.map(&:to_h)
589
582
  }
590
583
  end
591
584
 
@@ -610,12 +603,20 @@ module TonSdk
610
603
  j["data"].compact.map {|x| AbiData.from_json(x) }
611
604
  end
612
605
 
606
+ fl_s = if j["fields"].nil?
607
+ []
608
+ else
609
+ j["fields"].compact.map {|x| AbiParam.from_json(x) }
610
+ end
611
+
613
612
  self.new(
614
613
  abi_version: j["ABI version"],
614
+ version: j["version"],
615
615
  header: j["header"],
616
616
  functions: fn_s,
617
617
  events: ev_s,
618
- data: dt_s
618
+ data: dt_s,
619
+ fields: fl_s
619
620
  )
620
621
  end
621
622
  end
@@ -656,6 +657,9 @@ module TonSdk
656
657
  end
657
658
  end
658
659
 
660
+ ParamsOfDecodeAccountData = Struct.new(:abi, :data, keyword_init: true)
661
+ ResultOfDecodeData = Struct.new(:data)
662
+
659
663
 
660
664
  #
661
665
  # functions
@@ -772,5 +776,22 @@ module TonSdk
772
776
  end
773
777
  end
774
778
  end
779
+
780
+ def self.decode_account_data(ctx, params)
781
+ Interop::request_to_native_lib(ctx, "abi.decode_account_data", params) do |resp|
782
+ if resp.success?
783
+ yield NativeLibResponsetResult.new(
784
+ result: ResultOfDecodeData.new(
785
+ resp.result["data"]
786
+ )
787
+ )
788
+ else
789
+ yield resp
790
+ end
791
+ end
792
+ end
793
+
794
+
795
+
775
796
  end
776
797
  end
@@ -42,6 +42,7 @@ module TonSdk
42
42
  UNEXPECTED_CALLBACK_RESPONSE = 31
43
43
  CANNOT_PARSE_NUMBER = 32
44
44
  INTERNAL_ERROR = 33
45
+ INVALID_HANDLE = 34
45
46
  end
46
47
 
47
48
  ResultOfVersion = Struct.new(:version)
@@ -5,15 +5,16 @@ module TonSdk
5
5
  :server_address,
6
6
  :endpoints,
7
7
  :network_retries_count,
8
+ :max_reconnect_timeout,
9
+ :reconnect_timeout,
8
10
  :message_retries_count,
9
11
  :message_processing_timeout,
10
12
  :wait_for_timeout,
11
13
  :out_of_sync_threshold,
12
- :reconnect_timeout,
13
- :max_reconnect_timeout,
14
14
  :sending_endpoint_count,
15
15
  :latency_detection_interval,
16
16
  :max_latency,
17
+ :query_timeout,
17
18
  :access_key,
18
19
  keyword_init: true
19
20
  ) do
@@ -30,6 +31,7 @@ module TonSdk
30
31
  sending_endpoint_count: 2,
31
32
  latency_detection_interval: 60000,
32
33
  max_latency: 60000,
34
+ query_timeout: 60000,
33
35
  access_key: nil
34
36
  )
35
37
  super
@@ -25,6 +25,13 @@ module TonSdk
25
25
  MNEMONICFROMENTROPY_FAILED = 120
26
26
  SIGNING_BOX_NOT_REGISTERED = 121
27
27
  INVALID_SIGNATURE = 122
28
+ ENCRYPTION_BOX_NOT_REGISTERED = 123
29
+ INVALID_IV_SIZE = 124
30
+ UNSUPPORTED_CIPHER_MODE = 125
31
+ CANNOT_CREATE_CIPHER = 126
32
+ ENCRYPT_DATA_ERROR = 127
33
+ DECRYPT_DATA_ERROR = 128
34
+ IV_REQUIRED = 129
28
35
  end
29
36
 
30
37
  ParamsOfFactorize = Struct.new(:composite)
@@ -269,6 +276,19 @@ module TonSdk
269
276
  ParamsOfEncryptionBoxGetInfo = Struct.new(:encryption_box)
270
277
  ResultOfEncryptionBoxGetInfo = Struct.new(:info)
271
278
  RegisteredEncryptionBox = Struct.new(:handle)
279
+ ParamsOfCreateEncryptionBox = Struct.new(:algorithm)
280
+
281
+ class EncryptionAlgorithm
282
+ private_class_method :new
283
+
284
+ attr_reader :type_, :aes_params
285
+
286
+ def self.new_with_type_aes(aes_params:)
287
+ @type_ = :aes
288
+ @aes_params = aes_params
289
+ end
290
+ end
291
+
272
292
 
273
293
 
274
294
  #
@@ -819,5 +839,17 @@ module TonSdk
819
839
  end
820
840
  end
821
841
  end
842
+
843
+ def self.create_encryption_box(ctx, params)
844
+ Interop::request_to_native_lib(ctx, "crypto.create_encryption_box", params) do |resp|
845
+ if resp.success?
846
+ yield NativeLibResponsetResult.new(
847
+ result: RegisteredEncryptionBox.new(resp.result["handle"])
848
+ )
849
+ else
850
+ yield resp
851
+ end
852
+ end
853
+ end
822
854
  end
823
855
  end
@@ -228,9 +228,28 @@ module TonSdk
228
228
  h
229
229
  end
230
230
  end
231
-
232
231
  ResultOfQueryTransactionTree = Struct.new(:messages, :transactions, keyword_init: true)
233
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
250
+ end
251
+ end
252
+
234
253
 
235
254
  #
236
255
  # functions
@@ -367,71 +386,148 @@ module TonSdk
367
386
  end
368
387
  end
369
388
  end
370
- end
371
389
 
372
- def self.batch_query(ctx, params)
373
- Interop::request_to_native_lib(ctx, "net.batch_query", params) do |resp|
374
- if resp.success?
375
- yield NativeLibResponsetResult.new(
376
- result: ResultOfBatchQuery.new(resp.result["results"])
377
- )
378
- else
379
- yield resp
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
380
399
  end
381
400
  end
382
- end
383
401
 
384
- def self.aggregate_collection(ctx, params)
385
- Interop::request_to_native_lib(ctx, "net.aggregate_collection", params) do |resp|
386
- if resp.success?
387
- yield NativeLibResponsetResult.new(
388
- result: ResultOfAggregateCollection.new(resp.result["values"])
389
- )
390
- else
391
- yield resp
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
392
411
  end
393
412
  end
394
- end
395
413
 
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"],
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
+ )
403
422
  )
404
- )
405
- else
406
- yield resp
423
+ else
424
+ yield resp
425
+ end
407
426
  end
408
427
  end
409
- end
410
428
 
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
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
419
438
  end
420
439
  end
421
- end
422
440
 
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"],
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
+ )
430
449
  )
431
- )
432
- else
433
- yield resp
450
+ else
451
+ yield resp
452
+ end
434
453
  end
435
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
+
436
532
  end
437
533
  end
@@ -51,6 +51,9 @@ module TonSdk
51
51
  ParamsOfDecompressZstd = Struct.new(:compressed)
52
52
  ResultOfDecompressZstd = Struct.new(:decompressed)
53
53
 
54
+ ParamsOfGetAddressType = Struct.new(:address)
55
+ ResultOfGetAddressType = Struct.new(:address_type)
56
+
54
57
 
55
58
  #
56
59
  # functions
@@ -60,7 +63,7 @@ module TonSdk
60
63
  Interop::request_to_native_lib(ctx, "utils.convert_address", params) do |resp|
61
64
  if resp.success?
62
65
  yield NativeLibResponsetResult.new(
63
- result: Utils::ResultOfConvertAddress.new(resp.result["address"])
66
+ result: ResultOfConvertAddress.new(resp.result["address"])
64
67
  )
65
68
  else
66
69
  yield resp
@@ -72,7 +75,7 @@ module TonSdk
72
75
  Interop::request_to_native_lib(ctx, "utils.calc_storage_fee", params) do |resp|
73
76
  if resp.success?
74
77
  yield NativeLibResponsetResult.new(
75
- result: Utils::ResultOfCalcStorageFee.new(resp.result["fee"])
78
+ result: ResultOfCalcStorageFee.new(resp.result["fee"])
76
79
  )
77
80
  else
78
81
  yield resp
@@ -84,7 +87,7 @@ module TonSdk
84
87
  Interop::request_to_native_lib(ctx, "utils.compress_zstd", params) do |resp|
85
88
  if resp.success?
86
89
  yield NativeLibResponsetResult.new(
87
- result: Utils::ResultOfCompressZstd.new(resp.result["compressed"])
90
+ result: ResultOfCompressZstd.new(resp.result["compressed"])
88
91
  )
89
92
  else
90
93
  yield resp
@@ -96,7 +99,19 @@ module TonSdk
96
99
  Interop::request_to_native_lib(ctx, "utils.decompress_zstd", params) do |resp|
97
100
  if resp.success?
98
101
  yield NativeLibResponsetResult.new(
99
- result: Utils::ParamsOfDecompressZstd.new(resp.result["decompressed"])
102
+ result: ParamsOfDecompressZstd.new(resp.result["decompressed"])
103
+ )
104
+ else
105
+ yield resp
106
+ end
107
+ end
108
+ end
109
+
110
+ def self.get_address_type(ctx, params)
111
+ Interop::request_to_native_lib(ctx, "utils.get_address_type", params) do |resp|
112
+ if resp.success?
113
+ yield NativeLibResponsetResult.new(
114
+ result: ResultOfGetAddressType.new(resp.result["address_type"])
100
115
  )
101
116
  else
102
117
  yield resp
@@ -1,4 +1,4 @@
1
1
  module TonSdk
2
- VERSION = "1.17.0"
3
- NATIVE_SDK_VERSION = "1.17.0"
2
+ VERSION = "1.21.0"
3
+ NATIVE_SDK_VERSION = "1.21.0"
4
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.17.0
4
+ version: 1.21.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-06-28 00:00:00.000000000 Z
11
+ date: 2021-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi