ton_sdk_client 1.18.0 → 1.21.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +2 -2
- data/lib/ton_sdk_client/abi.rb +50 -29
- data/lib/ton_sdk_client/config.rb +4 -2
- data/lib/ton_sdk_client/crypto.rb +32 -0
- data/lib/ton_sdk_client/utils.rb +19 -4
- data/lib/ton_sdk_client/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68951575793a97c1bd43193216359e97cff46220c011f849d08ce2b8b8adc269
|
4
|
+
data.tar.gz: 22be1357cf2604bfaa02fa09818c173f8766383b0cc76086c815946a0cf5deb9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3cb0f85cd65c4baee5cd8949cc915393c561b1a2054d2f3b059c77d25ccb501c87283038deaa949b7a07fdad50c99ebe57c897e09fcd144061b613d14459c833
|
7
|
+
data.tar.gz: edbd614c0895b29e1acd55d6d53e303958cb86528d80bcfc420b7b99fe2892241cc5263191912d4a68822b26bae92c913404e6d829c85819e87198016b1c956f
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
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
|
4
4
|
|
5
|
+
1.20.x
|
6
|
+
-----
|
7
|
+
* NetworkConfig and AbiContract have been changed (not mentioned explicitly in Changelog of TON SDK )
|
8
|
+
|
5
9
|
|
6
10
|
1.15.x
|
7
11
|
-----
|
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.
|
4
|
+
[![TON SDK version](https://img.shields.io/badge/TON%20SDK%20version-1.21.5-green)](https://github.com/tonlabs/TON-SDK/tree/1.21.5)
|
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
|
12
|
+
and they may not always match each other.
|
13
13
|
|
14
14
|
|
15
15
|
|
data/lib/ton_sdk_client/abi.rb
CHANGED
@@ -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(
|
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
|
-
|
558
|
-
|
559
|
-
|
560
|
-
@
|
561
|
-
@
|
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:
|
587
|
-
events:
|
588
|
-
data:
|
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
|
@@ -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
|
data/lib/ton_sdk_client/utils.rb
CHANGED
@@ -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:
|
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:
|
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:
|
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:
|
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
|
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.
|
4
|
+
version: 1.21.5
|
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-
|
11
|
+
date: 2021-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|