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.
@@ -5,64 +5,31 @@ module TonSdk
5
5
  # types
6
6
  #
7
7
 
8
- ParamsOfParse = Struct.new(:boc) do
9
- def to_h = { boc: @boc }
10
- end
11
-
8
+ ParamsOfParse = Struct.new(:boc)
12
9
  ResultOfParse = Struct.new(:parsed)
13
-
14
- ParamsOfParseShardstate = Struct.new(:boc, :id, :workchain_id) do
15
- def to_h
16
- {
17
- boc: @boc,
18
- id: @id_,
19
- workchain_id: @workchain_id
20
- }
21
- end
22
- end
23
-
24
- ParamsOfGetBlockchainConfig = Struct.new(:block_boc) do
25
- def to_h = { block_boc: @block_boc }
26
- end
27
-
10
+ ParamsOfParseShardstate = Struct.new(:boc, :id_, :workchain_id, keyword_init: true)
11
+ ParamsOfGetBlockchainConfig = Struct.new(:block_boc)
28
12
  ResultOfGetBlockchainConfig = Struct.new(:config_boc)
29
13
 
30
- ParamsOfGetBocHash = Struct.new(:boc) do
31
- def to_h
32
- {
33
- boc: @boc
34
- }
35
- end
36
- end
37
-
14
+ ParamsOfGetBocHash = Struct.new(:boc)
38
15
  ResultOfGetBocHash = Struct.new(:hash)
39
-
40
- ParamsOfGetCodeFromTvc = Struct.new(:hash) do
41
- def to_h = { tvc: @tvc }
42
- end
43
-
16
+ ParamsOfGetCodeFromTvc = Struct.new(:hash)
44
17
  ResultOfGetCodeFromTvc = Struct.new(:code)
45
-
46
- ParamsOfBocCacheGet = Struct.new(:boc_ref) do
47
- def to_h = { boc_ref: @boc_ref }
48
- end
18
+ ParamsOfBocCacheGet = Struct.new(:boc_ref)
49
19
 
50
20
  ResultOfBocCacheGet = Struct.new(:boc)
51
21
 
52
22
  class BocCacheType
53
- TYPES = [
54
- :pinned,
55
- :unpinned
56
- ]
23
+ private_class_method :new
57
24
 
58
25
  attr_reader :type_, :pin
59
26
 
60
- def new_with_type_pinned(pin)
27
+ def self.new_with_type_pinned(pin)
61
28
  @type_ = :pinned
62
29
  @pin = pin
63
30
  end
64
31
 
65
- def new_with_type_unpinned
32
+ def self.new_with_type_unpinned
66
33
  @type_ = :unpinned
67
34
  end
68
35
 
@@ -93,25 +60,8 @@ module TonSdk
93
60
  end
94
61
 
95
62
  ResultOfBocCacheSet = Struct.new(:boc_ref)
96
-
97
- ParamsOfBocCacheUnpin = Struct.new(:boc, :boc_ref) do
98
- def to_h
99
- {
100
- boc: @boc,
101
- boc_ref: @boc_ref
102
- }
103
- end
104
- end
105
-
106
- ParamsOfEncodeBoc = Struct.new(:builder, :boc_cache) do
107
- def to_h
108
- {
109
- boc: @boc,
110
- boc_ref: @boc_ref
111
- }
112
- end
113
- end
114
-
63
+ ParamsOfBocCacheUnpin = Struct.new(:boc, :boc_ref)
64
+ ParamsOfEncodeBoc = Struct.new(:builder, :boc_cache)
115
65
  ResultOfEncodeBoc = Struct.new(:boc)
116
66
 
117
67
 
@@ -121,7 +71,7 @@ module TonSdk
121
71
  #
122
72
 
123
73
  def self.parse_message(ctx, params)
124
- Interop::request_to_native_lib(ctx, "boc.parse_message", params.to_h.to_json) do |resp|
74
+ Interop::request_to_native_lib(ctx, "boc.parse_message", params) do |resp|
125
75
  if resp.success?
126
76
  yield NativeLibResponsetResult.new(
127
77
  result: ResultOfParse.new(resp.result["parsed"])
@@ -133,7 +83,7 @@ module TonSdk
133
83
  end
134
84
 
135
85
  def self.parse_transaction(ctx, params)
136
- Interop::request_to_native_lib(ctx, "boc.parse_transaction", params.to_h.to_json) do |resp|
86
+ Interop::request_to_native_lib(ctx, "boc.parse_transaction", params) do |resp|
137
87
  if resp.success?
138
88
  yield NativeLibResponsetResult.new(
139
89
  result: ResultOfParse.new(resp.result["parsed"])
@@ -145,7 +95,7 @@ module TonSdk
145
95
  end
146
96
 
147
97
  def self.parse_account(ctx, params)
148
- Interop::request_to_native_lib(ctx, "boc.parse_account", params.to_h.to_json) do |resp|
98
+ Interop::request_to_native_lib(ctx, "boc.parse_account", params) do |resp|
149
99
  if resp.success?
150
100
  yield NativeLibResponsetResult.new(
151
101
  result: ResultOfParse.new(resp.result["parsed"])
@@ -157,7 +107,7 @@ module TonSdk
157
107
  end
158
108
 
159
109
  def self.parse_block(ctx, params)
160
- Interop::request_to_native_lib(ctx, "boc.parse_block", params.to_h.to_json) do |resp|
110
+ Interop::request_to_native_lib(ctx, "boc.parse_block", params) do |resp|
161
111
  if resp.success?
162
112
  yield NativeLibResponsetResult.new(
163
113
  result: ResultOfParse.new(resp.result["parsed"])
@@ -169,7 +119,7 @@ module TonSdk
169
119
  end
170
120
 
171
121
  def self.parse_shardstate(ctx, params)
172
- Interop::request_to_native_lib(ctx, "boc.parse_shardstate", params.to_h.to_json) do |resp|
122
+ Interop::request_to_native_lib(ctx, "boc.parse_shardstate", params) do |resp|
173
123
  if resp.success?
174
124
  yield NativeLibResponsetResult.new(
175
125
  result: ResultOfParse.new(resp.result["parsed"])
@@ -181,7 +131,7 @@ module TonSdk
181
131
  end
182
132
 
183
133
  def self.get_blockchain_config(ctx, params)
184
- Interop::request_to_native_lib(ctx, "boc.get_blockchain_config", params.to_h.to_json) do |resp|
134
+ Interop::request_to_native_lib(ctx, "boc.get_blockchain_config", params) do |resp|
185
135
  if resp.success?
186
136
  yield NativeLibResponsetResult.new(
187
137
  result: ResultOfGetBlockchainConfig.new(resp.result["config_boc"])
@@ -193,7 +143,7 @@ module TonSdk
193
143
  end
194
144
 
195
145
  def self.get_boc_hash(ctx, params)
196
- Interop::request_to_native_lib(ctx, "boc.get_boc_hash", params.to_h.to_json) do |resp|
146
+ Interop::request_to_native_lib(ctx, "boc.get_boc_hash", params) do |resp|
197
147
  if resp.success?
198
148
  yield NativeLibResponsetResult.new(
199
149
  result: ResultOfGetBocHash.new(resp.result["hash"])
@@ -205,7 +155,7 @@ module TonSdk
205
155
  end
206
156
 
207
157
  def self.get_code_from_tvc(ctx, params)
208
- Interop::request_to_native_lib(ctx, "boc.get_code_from_tvc", params.to_h.to_json) do |resp|
158
+ Interop::request_to_native_lib(ctx, "boc.get_code_from_tvc", params) do |resp|
209
159
  if resp.success?
210
160
  yield NativeLibResponsetResult.new(
211
161
  result: ResultOfGetCodeFromTvc.new(resp.result["code"])
@@ -217,7 +167,7 @@ module TonSdk
217
167
  end
218
168
 
219
169
  def self.cache_get(ctx, params)
220
- Interop::request_to_native_lib(ctx, "boc.cache_get", params.to_h.to_json) do |resp|
170
+ Interop::request_to_native_lib(ctx, "boc.cache_get", params) do |resp|
221
171
  if resp.success?
222
172
  yield NativeLibResponsetResult.new(
223
173
  result: ResultOfBocCacheGet.new(
@@ -231,7 +181,7 @@ module TonSdk
231
181
  end
232
182
 
233
183
  def self.cache_set(ctx, params)
234
- Interop::request_to_native_lib(ctx, "boc.cache_set", params.to_h.to_json) do |resp|
184
+ Interop::request_to_native_lib(ctx, "boc.cache_set", params) do |resp|
235
185
  if resp.success?
236
186
  yield NativeLibResponsetResult.new(
237
187
  result: ResultOfBocCacheSet.new(
@@ -245,7 +195,7 @@ module TonSdk
245
195
  end
246
196
 
247
197
  def self.cache_unpin(ctx, params)
248
- Interop::request_to_native_lib(ctx, "boc.cache_unpin", params.to_h.to_json) do |resp|
198
+ Interop::request_to_native_lib(ctx, "boc.cache_unpin", params) do |resp|
249
199
  if resp.success?
250
200
  yield NativeLibResponsetResult.new(
251
201
  result: nil
@@ -257,7 +207,7 @@ module TonSdk
257
207
  end
258
208
 
259
209
  def self.encode_boc(ctx, params)
260
- Interop::request_to_native_lib(ctx, "boc.encode_boc", params.to_h.to_json) do |resp|
210
+ Interop::request_to_native_lib(ctx, "boc.encode_boc", params) do |resp|
261
211
  if resp.success?
262
212
  yield NativeLibResponsetResult.new(
263
213
  result: ResultOfEncodeBoc.new(
@@ -271,7 +221,7 @@ module TonSdk
271
221
  end
272
222
 
273
223
  def self.get_blockchain_config(ctx, params)
274
- Interop::request_to_native_lib(ctx, "boc.get_blockchain_config", params.to_h.to_json) do |resp|
224
+ Interop::request_to_native_lib(ctx, "boc.get_blockchain_config", params) do |resp|
275
225
  if resp.success?
276
226
  yield NativeLibResponsetResult.new(
277
227
  result: ResultOfGetBlockchainConfig.new(
@@ -45,7 +45,6 @@ module TonSdk
45
45
  end
46
46
 
47
47
  ResultOfVersion = Struct.new(:version)
48
-
49
48
  ResultOfGetApiReference = Struct.new(:api)
50
49
 
51
50
  BuildInfoDependency = Struct.new(:name, :git_commit, keyword_init: true) do
@@ -153,7 +152,7 @@ module TonSdk
153
152
  end
154
153
 
155
154
  def self.resolve_app_request(ctx, params)
156
- Interop::request_to_native_lib(ctx, "client.resolve_app_request", params.to_h.to_json) do |resp|
155
+ Interop::request_to_native_lib(ctx, "client.resolve_app_request", params) do |resp|
157
156
  if resp.success?
158
157
  yield NativeLibResponsetResult.new(
159
158
  result: ""
@@ -1,4 +1,5 @@
1
1
  require 'json'
2
+
2
3
  require_relative './interop.rb'
3
4
  require_relative './types.rb'
4
5
  require_relative './helper.rb'
@@ -14,6 +15,7 @@ require_relative './tvm.rb'
14
15
  require_relative './processing.rb'
15
16
  require_relative './debot.rb'
16
17
 
18
+
17
19
  module TonSdk
18
20
  class ClientContext
19
21
  attr_reader :context
@@ -1,120 +1,67 @@
1
1
  module TonSdk
2
- class ClientConfig
3
- attr_reader :network, :crypto, :abi
4
-
5
- def initialize(network: nil, crypto: nil, abi: nil)
6
- if network.nil? && crypto.nil? && abi.nil?
7
- raise ArgumentError.new("all 3 arguments may not be nil")
8
- end
9
-
10
- @network = network
11
- @crypto = crypto
12
- @abi = abi
13
- end
14
-
15
- def to_h
16
- {
17
- network: @network.nil? ? nil : @network.to_h,
18
- crypto: @crypto.nil? ? nil : @crypto.to_h,
19
- abi: @abi.nil? ? nil : @abi.to_h
20
- }
21
- end
22
- end
23
-
24
- class NetworkConfig
25
- DEFAULT_NETWORK_RETRIES_COUNT = 5
26
- DEFAULT_MAX_RECONNECT_TIMEOUT = 120000
27
- DEFAULT_RECONNECT_TIMEOUT = 1000
28
- DEFAULT_MESSAGE_RETRIES_COUNT = 5
29
-
30
- DEFAULT_MESSAGE_PROCESSING_TIMEOUT = 40000
31
- DEFAULT_WAIT_TIMEOUT = 40000
32
- DEFAULT_OUT_OF_SYNC_THRESHOLD = 15000
33
- DEFAULT_SENDING_ENDPOINT_COUNT = 2
34
-
35
- attr_reader :server_address, :endpoints, :network_retries_count,
36
- :message_retries_count, :message_processing_timeout,
37
- :wait_for_timeout, :out_of_sync_threshold, :reconnect_timeout,
38
- :max_reconnect_timeout,
39
- :sending_endpoint_count,
40
- :access_key
41
-
2
+ CryptoConfig = Struct.new(:mnemonic_dictionary, :mnemonic_word_count, :hdkey_derivation_path, keyword_init: true)
3
+ BocConfig = Struct.new(:cache_max_size)
4
+ NetworkConfig = Struct.new(
5
+ :server_address,
6
+ :endpoints,
7
+ :network_retries_count,
8
+ :message_retries_count,
9
+ :message_processing_timeout,
10
+ :wait_for_timeout,
11
+ :out_of_sync_threshold,
12
+ :reconnect_timeout,
13
+ :max_reconnect_timeout,
14
+ :sending_endpoint_count,
15
+ :latency_detection_interval,
16
+ :max_latency,
17
+ :access_key,
18
+ keyword_init: true
19
+ ) do
42
20
  def initialize(
43
21
  server_address: "",
44
22
  endpoints: [],
45
-
46
- network_retries_count: DEFAULT_NETWORK_RETRIES_COUNT,
47
- max_reconnect_timeout: DEFAULT_MAX_RECONNECT_TIMEOUT,
48
- reconnect_timeout: DEFAULT_RECONNECT_TIMEOUT,
49
- message_retries_count: DEFAULT_MESSAGE_RETRIES_COUNT,
50
-
51
- message_processing_timeout: DEFAULT_MESSAGE_PROCESSING_TIMEOUT,
52
- wait_for_timeout: DEFAULT_WAIT_TIMEOUT,
53
- out_of_sync_threshold: DEFAULT_OUT_OF_SYNC_THRESHOLD,
54
- sending_endpoint_count: DEFAULT_SENDING_ENDPOINT_COUNT,
55
-
23
+ network_retries_count: 5,
24
+ max_reconnect_timeout: 120000,
25
+ reconnect_timeout: 1000,
26
+ message_retries_count: 5,
27
+ message_processing_timeout: 40000,
28
+ wait_for_timeout: 40000,
29
+ out_of_sync_threshold: 15000,
30
+ sending_endpoint_count: 2,
31
+ latency_detection_interval: 60000,
32
+ max_latency: 60000,
56
33
  access_key: nil
57
34
  )
58
-
59
- @server_address = server_address
60
- @endpoints = endpoints
61
-
62
- @network_retries_count = network_retries_count
63
- @max_reconnect_timeout = max_reconnect_timeout
64
- @reconnect_timeout = reconnect_timeout
65
- @message_retries_count = message_retries_count
66
-
67
- @message_processing_timeout = message_processing_timeout
68
- @wait_for_timeout = wait_for_timeout
69
- @out_of_sync_threshold = out_of_sync_threshold
70
- @sending_endpoint_count = sending_endpoint_count
71
-
72
- @access_key = access_key
35
+ super
73
36
  end
74
-
75
- def to_h
76
- {
77
- server_address: @server_address,
78
- endpoints: @endpoints,
79
-
80
- network_retries_count: @network_retries_count,
81
- max_reconnect_timeout: @max_reconnect_timeout,
82
- reconnect_timeout: @reconnect_timeout,
83
- message_retries_count: @message_retries_count,
84
-
85
- message_processing_timeout: @message_processing_timeout,
86
- wait_for_timeout: @wait_for_timeout,
87
- out_of_sync_threshold: @out_of_sync_threshold,
88
- sending_endpoint_count: @sending_endpoint_count,
89
-
90
- access_key: @access_key
91
- }
92
- end
93
- end
94
-
95
- CryptoConfig = Struct.new(:fish_param) do
96
- def to_h = { fish_param: @fish_param }
97
37
  end
98
38
 
99
- class AbiConfig
100
- DEFAULT_EXPIRATION_TIMEOUT = 40000
101
- DEFAULT_TIMEOUT_GROW_FACTOR = 1.5
102
-
103
- attr_reader :message_expiration_timeout, :message_expiration_timeout_grow_factor
104
-
39
+ AbiConfig = Struct.new(
40
+ :workchain,
41
+ :message_expiration_timeout,
42
+ :message_expiration_timeout_grow_factor,
43
+ keyword_init: true
44
+ ) do
105
45
  def initialize(
106
- message_expiration_timeout: DEFAULT_EXPIRATION_TIMEOUT,
107
- message_expiration_timeout_grow_factor: DEFAULT_TIMEOUT_GROW_FACTOR
46
+ workchain: nil,
47
+ message_expiration_timeout: 40000,
48
+ message_expiration_timeout_grow_factor: 1.5
108
49
  )
109
- @message_expiration_timeout = message_expiration_timeout
110
- @message_expiration_timeout_grow_factor = message_expiration_timeout_grow_factor
50
+ super
111
51
  end
52
+ end
112
53
 
54
+ ClientConfig = Struct.new(:network, :crypto, :abi, :boc, keyword_init: true) do
113
55
  def to_h
56
+ res = super.to_h
57
+
114
58
  {
115
- message_expiration_timeout: @message_expiration_timeout,
116
- message_expiration_timeout_grow_factor: @message_expiration_timeout_grow_factor
59
+ network: res[:network]&.to_h,
60
+ crypto: res[:crypto]&.to_h,
61
+ abi: res[:abi]&.to_h,
62
+ boc: res[:boc]&.to_h
117
63
  }
118
64
  end
119
65
  end
66
+
120
67
  end
@@ -27,255 +27,70 @@ module TonSdk
27
27
  INVALID_SIGNATURE = 122
28
28
  end
29
29
 
30
- ParamsOfFactorize = Struct.new(:composite) do
31
- def to_h = { composite: @composite }
32
- end
33
-
30
+ ParamsOfFactorize = Struct.new(:composite)
34
31
  ResultOfFactorize = Struct.new(:factors)
35
-
36
- ParamsOfModularPower = Struct.new(:base, :exponent, :modulus) do
37
- def to_h
38
- {
39
- base: @base,
40
- exponent: @exponent,
41
- modulus: @modulus
42
- }
43
- end
44
- end
45
-
32
+ ParamsOfModularPower = Struct.new(:base, :exponent, :modulus, keyword_init: true)
46
33
  ResultOfModularPower = Struct.new(:modular_power)
47
-
48
- ParamsOfTonCrc16 = Struct.new(:data) do
49
- def to_h = { data: @data }
50
- end
34
+ ParamsOfTonCrc16 = Struct.new(:data)
51
35
 
52
36
  ResultOfTonCrc16 = Struct.new(:crc)
53
-
54
- ParamsOfGenerateRandomBytes = Struct.new(:length) do
55
- def to_h = { length: @length }
56
- end
57
-
37
+ ParamsOfGenerateRandomBytes = Struct.new(:length)
58
38
  ResultOfGenerateRandomBytes = Struct.new(:bytes)
59
-
60
- ParamsOfConvertPublicKeyToTonSafeFormat = Struct.new(:public_key) do
61
- def to_h = { public_key: @public_key }
62
- end
63
-
39
+ ParamsOfConvertPublicKeyToTonSafeFormat = Struct.new(:public_key)
64
40
  ResultOfConvertPublicKeyToTonSafeFormat = Struct.new(:ton_public_key)
65
41
 
66
- KeyPair = Struct.new(:public_, :secret) do
67
- def to_h
68
- {
69
- public: @public_,
70
- secret: @secret
71
- }
72
- end
73
- end
74
-
75
- ParamsOfSign = Struct.new(:unsigned, :keys) do
76
- def to_h
77
- {
78
- unsigned: @unsigned,
79
- keys: @keys.to_h
80
- }
81
- end
82
- end
83
-
42
+ KeyPair = Struct.new(:public_, :secret)
43
+ ParamsOfSign = Struct.new(:unsigned, :keys)
84
44
  ResultOfSign = Struct.new(:signed, :signature)
85
-
86
- ParamsOfVerifySignature = Struct.new(:signed, :public_) do
87
- def to_h
88
- {
89
- signed: @signed,
90
- public: @public_
91
- }
92
- end
93
- end
94
-
45
+ ParamsOfVerifySignature = Struct.new(:signed, :public_)
95
46
  ResultOfVerifySignature = Struct.new(:unsigned)
96
47
 
97
- ParamsOfHash = Struct.new(:data) do
98
- def to_h = { data: @data }
99
- end
100
-
48
+ ParamsOfHash = Struct.new(:data)
101
49
  ResultOfHash = Struct.new(:hash)
102
-
103
- ParamsOfScrypt = Struct.new(:password, :salt, :log_n, :r, :p_, :dk_len) do
104
- def to_h
105
- {
106
- password: @password,
107
- salt: @salt,
108
- log_n: @log_n,
109
- r: @r,
110
- p: @p_,
111
- dk_len: @dk_len
112
- }
113
- end
114
- end
115
-
50
+ ParamsOfScrypt = Struct.new(:password, :salt, :log_n, :r, :p_, :dk_len, keyword_init: true)
116
51
  ResultOfScrypt = Struct.new(:key)
52
+ ParamsOfNaclSignKeyPairFromSecret = Struct.new(:secret)
117
53
 
118
- ParamsOfNaclSignKeyPairFromSecret = Struct.new(:secret) do
119
- def to_h = { secret: @secret }
120
- end
121
-
122
- ParamsOfNaclSign = Struct.new(:unsigned, :secret) do
123
- def to_h
124
- {
125
- unsigned: @unsigned,
126
- secret: @secret
127
- }
128
- end
129
- end
130
-
54
+ ParamsOfNaclSign = Struct.new(:unsigned, :secret)
131
55
  ResultOfNaclSign = Struct.new(:signed)
132
-
133
- class ParamsOfNaclSignOpen
134
- attr_reader :signed, :public_
135
-
56
+ ParamsOfNaclSignOpen = Struct.new(:signed, :public_) do
136
57
  def initialize(signed:, public_:)
137
- @signed = signed
138
- @public_ = public_
139
- end
140
-
141
- def to_h
142
- {
143
- signed: @signed,
144
- public: @public_
145
- }
58
+ super
146
59
  end
147
60
  end
148
61
 
149
62
  ResultOfNaclSignOpen = Struct.new(:unsigned)
150
-
151
63
  ResultOfNaclSignDetached = Struct.new(:signature)
152
-
153
- class ParamsOfNaclBoxKeyPairFromSecret
154
- attr_reader :secret
155
-
156
- def initialize(a)
157
- @secret = a
158
- end
159
-
160
- def to_h
161
- {
162
- secret: @secret
163
- }
164
- end
165
- end
166
-
167
- class ParamsOfNaclBox
168
- attr_reader :decrypted, :nonce, :their_public, :secret
169
-
64
+ ParamsOfNaclBoxKeyPairFromSecret = Struct.new(:secret)
65
+ ParamsOfNaclBox = Struct.new(:decrypted, :nonce, :their_public, :secret) do
170
66
  def initialize(decrypted:, nonce:, their_public:, secret:)
171
- @decrypted = decrypted
172
- @nonce = nonce
173
- @their_public = their_public
174
- @secret = secret
175
- end
176
-
177
- def to_h
178
- {
179
- decrypted: @decrypted,
180
- nonce: @nonce,
181
- their_public: @their_public,
182
- secret: @secret
183
- }
67
+ super
184
68
  end
185
69
  end
186
70
 
187
71
  ResultOfNaclBox = Struct.new(:encrypted)
188
-
189
- class ParamsOfNaclBoxOpen
190
- attr_reader :encrypted, :nonce, :their_public, :secret
191
-
72
+ ParamsOfNaclBoxOpen = Struct.new(:encrypted, :nonce, :their_public, :secret) do
192
73
  def initialize(encrypted:, nonce:, their_public:, secret:)
193
- @encrypted = encrypted
194
- @nonce = nonce
195
- @their_public = their_public
196
- @secret = secret
197
- end
198
-
199
- def to_h
200
- {
201
- encrypted: @encrypted,
202
- nonce: @nonce,
203
- their_public: @their_public,
204
- secret: @secret
205
- }
74
+ super
206
75
  end
207
76
  end
208
77
 
209
78
  ResultOfNaclBoxOpen = Struct.new(:decrypted)
210
-
211
- class ParamsOfNaclSecretBox
212
- attr_reader :decrypted, :nonce, :key
213
-
79
+ ParamsOfNaclSecretBox = Struct.new(:decrypted, :nonce, :key) do
214
80
  def initialize(decrypted:, nonce:, key:)
215
- @decrypted = decrypted
216
- @nonce = nonce
217
- @key = key
218
- end
219
-
220
- def to_h
221
- {
222
- decrypted: @decrypted,
223
- nonce: @nonce,
224
- key: @key
225
- }
81
+ super
226
82
  end
227
83
  end
228
84
 
229
- class ParamsOfNaclSecretBoxOpen
230
- attr_reader :encrypted, :nonce, :key
231
-
85
+ ParamsOfNaclSecretBoxOpen = Struct.new(:encrypted, :nonce, :key) do
232
86
  def initialize(encrypted:, nonce:, key:)
233
- @encrypted = encrypted
234
- @nonce = nonce
235
- @key = key
236
- end
237
-
238
- def to_h
239
- {
240
- encrypted: @encrypted,
241
- nonce: @nonce,
242
- key: @key
243
- }
244
- end
245
- end
246
-
247
- class ParamsOfMnemonicWords
248
- attr_reader :dictionary
249
-
250
- def initialize(a: nil)
251
- @dictionary = a
252
- end
253
-
254
- def to_h
255
- {
256
- dictionary: @dictionary
257
- }
87
+ super
258
88
  end
259
89
  end
260
90
 
91
+ ParamsOfMnemonicWords = Struct.new(:dictionary)
261
92
  ResultOfMnemonicWords = Struct.new(:words)
262
-
263
- class ParamsOfMnemonicFromRandom
264
- attr_reader :dictionary, :word_count
265
-
266
- def initialize(dictionary: nil, word_count: nil)
267
- @dictionary = dictionary
268
- @word_count = word_count
269
- end
270
-
271
- def to_h
272
- {
273
- dictionary: @dictionary,
274
- word_count: @word_count
275
- }
276
- end
277
- end
278
-
93
+ ParamsOfMnemonicFromRandom = Struct.new(:dictionary, :word_count, keyword_init: true)
279
94
  ResultOfMnemonicFromRandom = Struct.new(:phrase)
280
95
 
281
96
  class ParamsOfMnemonicFromEntropy
@@ -356,13 +171,7 @@ module TonSdk
356
171
  end
357
172
  end
358
173
 
359
- class ResultOfHDKeyXPrvFromMnemonic
360
- attr_reader :xprv
361
-
362
- def initialize(a)
363
- @xprv = a
364
- end
365
- end
174
+ ResultOfHDKeyXPrvFromMnemonic = Struct.new(:xprv)
366
175
 
367
176
  class ParamsOfHDKeyDeriveFromXPrv
368
177
  attr_reader :xprv, :child_index, :hardened
@@ -382,162 +191,37 @@ module TonSdk
382
191
  end
383
192
  end
384
193
 
385
- class ResultOfHDKeyDeriveFromXPrv
386
- attr_reader :xprv
387
-
388
- def initialize(a)
389
- @xprv = a
390
- end
391
-
392
- def to_h
393
- {
394
- xprv: @xprv,
395
- path: @path
396
- }
397
- end
398
- end
399
-
400
- class ParamsOfHDKeySecretFromXPrv
401
- attr_reader :xprv
402
-
403
- def initialize(a)
404
- @xprv = a
405
- end
406
-
407
- def to_h
408
- {
409
- xprv: @xprv
410
- }
411
- end
412
- end
413
-
414
- class ResultOfHDKeySecretFromXPrv
415
- attr_reader :secret
416
-
417
- def initialize(a)
418
- @secret = a
419
- end
420
- end
421
-
422
- class ParamsOfHDKeyPublicFromXPrv
423
- attr_reader :xprv
424
-
425
- def initialize(a)
426
- @xprv = a
427
- end
428
-
429
- def to_h
430
- {
431
- xprv: @xprv
432
- }
433
- end
434
- end
435
-
436
- class ResultOfHDKeyPublicFromXPrv
437
- attr_reader :public_
438
-
439
- def initialize(a)
440
- @public_ = a
441
- end
442
- end
443
-
444
- class ParamsOfHDKeyDeriveFromXPrvPath
445
- attr_reader :xprv, :path
194
+ ResultOfHDKeyDeriveFromXPrv = Struct.new(:xprv)
195
+ ParamsOfHDKeySecretFromXPrv = Struct.new(:xprv)
196
+ ResultOfHDKeySecretFromXPrv = Struct.new(:secret)
197
+ ParamsOfHDKeyPublicFromXPrv = Struct.new(:xprv)
198
+ ResultOfHDKeyPublicFromXPrv = Struct.new(:public_)
446
199
 
200
+ ParamsOfHDKeyDeriveFromXPrvPath = Struct.new(:xprv, :path) do
447
201
  def initialize(xprv:, path:)
448
- @xprv = xprv
449
- @path = path
450
- end
451
-
452
- def to_h
453
- {
454
- xprv: @xprv,
455
- path: @path
456
- }
202
+ super
457
203
  end
458
204
  end
459
205
 
460
- class ResultOfHDKeyDeriveFromXPrvPath
461
- attr_reader :xprv
462
-
463
- def initialize(a)
464
- @xprv = a
465
- end
466
- end
467
-
468
- class ParamsOfChaCha20
469
- attr_reader :data, :key, :nonce
206
+ ResultOfHDKeyDeriveFromXPrvPath = Struct.new(:xprv)
470
207
 
208
+ ParamsOfChaCha20 = Struct.new(:data, :key, :nonce) do
471
209
  def initialize(data:, key:, nonce:)
472
- @data = data
473
- @key = key
474
- @nonce = nonce
475
- end
476
-
477
- def to_h
478
- {
479
- data: @data,
480
- key: @key,
481
- nonce: @nonce
482
- }
483
- end
484
- end
485
-
486
- class ResultOfChaCha20
487
- attr_reader :data
488
-
489
- def initialize(a)
490
- @data = a
210
+ super
491
211
  end
492
212
  end
493
213
 
494
- class ParamsOfSigningBoxSign
495
- attr_reader :signing_box, :unsigned
214
+ ResultOfChaCha20 = Struct.new(:data)
496
215
 
216
+ ParamsOfSigningBoxSign = Struct.new(:signing_box, :unsigned) do
497
217
  def initialize(signing_box:, unsigned:)
498
- @signing_box = signing_box
499
- @unsigned = unsigned
500
- end
501
-
502
- def to_h
503
- {
504
- signing_box: @signing_box,
505
- unsigned: @unsigned
506
- }
218
+ super
507
219
  end
508
220
  end
509
221
 
510
- class ResultOfSigningBoxSign
511
- attr_reader :signature
512
-
513
- def initialize(a)
514
- @signature = a
515
- end
516
- end
517
-
518
- class RegisteredSigningBox
519
- attr_reader :handle
520
-
521
- def initialize(a)
522
- @handle = a
523
- end
524
-
525
- def to_h
526
- {
527
- handle: @handle
528
- }
529
- end
530
- end
531
-
532
- class ResultOfSigningBoxGetPublicKey
533
- attr_reader :pubkey
534
-
535
- def initialize(a)
536
- @pubkey = a
537
- end
538
-
539
- def to_h = { pubkey: @pubkey }
540
- end
222
+ ResultOfSigningBoxSign = Struct.new(:signature)
223
+ RegisteredSigningBox = Struct.new(:handle)
224
+ ResultOfSigningBoxGetPublicKey = Struct.new(:pubkey)
541
225
 
542
226
  class ParamsOfNaclSignDetachedVerify
543
227
  attr_reader :unsigned, :signature, :public
@@ -555,15 +239,7 @@ module TonSdk
555
239
  end
556
240
  end
557
241
 
558
- class ResultOfNaclSignDetachedVerify
559
- attr_reader :succeeded
560
-
561
- def initialize(a)
562
- @succeeded = a
563
- end
564
-
565
- def to_h = { succeeded: @succeeded }
566
- end
242
+ ResultOfNaclSignDetachedVerify = Struct.new(:succeeded)
567
243
 
568
244
  class ParamsOfAppSigningBox
569
245
  TYPES = [
@@ -595,8 +271,7 @@ module TonSdk
595
271
  #
596
272
 
597
273
  def self.factorize(ctx, params)
598
- pr_json = params.to_h.to_json
599
- Interop::request_to_native_lib(ctx, "crypto.factorize", pr_json) do |resp|
274
+ Interop::request_to_native_lib(ctx, "crypto.factorize", params) do |resp|
600
275
  if resp.success?
601
276
  yield NativeLibResponsetResult.new(
602
277
  result: ResultOfFactorize.new(resp.result["factors"])
@@ -608,8 +283,7 @@ module TonSdk
608
283
  end
609
284
 
610
285
  def self.modular_power(ctx, params)
611
- pr_json = params.to_h.to_json
612
- Interop::request_to_native_lib(ctx, "crypto.modular_power", pr_json) do |resp|
286
+ Interop::request_to_native_lib(ctx, "crypto.modular_power", params) do |resp|
613
287
  if resp.success?
614
288
  yield NativeLibResponsetResult.new(
615
289
  result: ResultOfModularPower.new(resp.result["modular_power"])
@@ -621,8 +295,7 @@ module TonSdk
621
295
  end
622
296
 
623
297
  def self.ton_crc16(ctx, params)
624
- pr_json = params.to_h.to_json
625
- Interop::request_to_native_lib(ctx, "crypto.ton_crc16", pr_json) do |resp|
298
+ Interop::request_to_native_lib(ctx, "crypto.ton_crc16", params) do |resp|
626
299
  if resp.success?
627
300
  yield NativeLibResponsetResult.new(
628
301
  result: ResultOfTonCrc16.new(resp.result["crc"])
@@ -634,8 +307,7 @@ module TonSdk
634
307
  end
635
308
 
636
309
  def self.generate_random_bytes(ctx, params)
637
- pr_json = params.to_h.to_json
638
- Interop::request_to_native_lib(ctx, "crypto.generate_random_bytes", pr_json) do |resp|
310
+ Interop::request_to_native_lib(ctx, "crypto.generate_random_bytes", params) do |resp|
639
311
  if resp.success?
640
312
  yield NativeLibResponsetResult.new(
641
313
  result: ResultOfGenerateRandomBytes.new(resp.result["bytes"])
@@ -647,8 +319,7 @@ module TonSdk
647
319
  end
648
320
 
649
321
  def self.convert_public_key_to_ton_safe_format(ctx, params)
650
- pr_json = params.to_h.to_json
651
- Interop::request_to_native_lib(ctx, "crypto.convert_public_key_to_ton_safe_format", pr_json) do |resp|
322
+ Interop::request_to_native_lib(ctx, "crypto.convert_public_key_to_ton_safe_format", params) do |resp|
652
323
  if resp.success?
653
324
  yield NativeLibResponsetResult.new(
654
325
  result: ResultOfConvertPublicKeyToTonSafeFormat.new(resp.result["ton_public_key"])
@@ -675,8 +346,7 @@ module TonSdk
675
346
  end
676
347
 
677
348
  def self.sign(ctx, params)
678
- pr_json = params.to_h.to_json
679
- Interop::request_to_native_lib(ctx, "crypto.sign", pr_json) do |resp|
349
+ Interop::request_to_native_lib(ctx, "crypto.sign", params) do |resp|
680
350
  if resp.success?
681
351
  yield NativeLibResponsetResult.new(
682
352
  result: ResultOfSign.new(
@@ -691,8 +361,7 @@ module TonSdk
691
361
  end
692
362
 
693
363
  def self.verify_signature(ctx, params)
694
- pr_json = params.to_h.to_json
695
- Interop::request_to_native_lib(ctx, "crypto.verify_signature", pr_json) do |resp|
364
+ Interop::request_to_native_lib(ctx, "crypto.verify_signature", params) do |resp|
696
365
  if resp.success?
697
366
  yield NativeLibResponsetResult.new(
698
367
  result: ResultOfVerifySignature.new(resp.result["unsigned"])
@@ -704,8 +373,7 @@ module TonSdk
704
373
  end
705
374
 
706
375
  def self.sha256(ctx, params)
707
- pr_json = params.to_h.to_json
708
- Interop::request_to_native_lib(ctx, "crypto.sha256", pr_json) do |resp|
376
+ Interop::request_to_native_lib(ctx, "crypto.sha256", params) do |resp|
709
377
  if resp.success?
710
378
  yield NativeLibResponsetResult.new(
711
379
  result: ResultOfHash.new(resp.result["hash"])
@@ -717,8 +385,7 @@ module TonSdk
717
385
  end
718
386
 
719
387
  def self.sha512(ctx, params)
720
- pr_json = params.to_h.to_json
721
- Interop::request_to_native_lib(ctx, "crypto.sha512", pr_json) do |resp|
388
+ Interop::request_to_native_lib(ctx, "crypto.sha512", params) do |resp|
722
389
  if resp.success?
723
390
  yield NativeLibResponsetResult.new(
724
391
  result: ResultOfHash.new(resp.result["hash"])
@@ -730,8 +397,7 @@ module TonSdk
730
397
  end
731
398
 
732
399
  def self.scrypt(ctx, params)
733
- pr_json = params.to_h.to_json
734
- Interop::request_to_native_lib(ctx, "crypto.scrypt", pr_json) do |resp|
400
+ Interop::request_to_native_lib(ctx, "crypto.scrypt", params) do |resp|
735
401
  if resp.success?
736
402
  yield NativeLibResponsetResult.new(
737
403
  result: ResultOfScrypt.new(resp.result["key"])
@@ -743,8 +409,7 @@ module TonSdk
743
409
  end
744
410
 
745
411
  def self.nacl_sign_keypair_from_secret_key(ctx, params)
746
- pr_json = params.to_h.to_json
747
- Interop::request_to_native_lib(ctx, "crypto.nacl_sign_keypair_from_secret_key", pr_json) do |resp|
412
+ Interop::request_to_native_lib(ctx, "crypto.nacl_sign_keypair_from_secret_key", params) do |resp|
748
413
  if resp.success?
749
414
  yield NativeLibResponsetResult.new(
750
415
  result: KeyPair.new(public_: resp.result["public"], secret: resp.result["secret"])
@@ -756,8 +421,7 @@ module TonSdk
756
421
  end
757
422
 
758
423
  def self.nacl_sign(ctx, params)
759
- pr_json = params.to_h.to_json
760
- Interop::request_to_native_lib(ctx, "crypto.nacl_sign", pr_json) do |resp|
424
+ Interop::request_to_native_lib(ctx, "crypto.nacl_sign", params) do |resp|
761
425
  if resp.success?
762
426
  yield NativeLibResponsetResult.new(
763
427
  result: ResultOfNaclSign.new(resp.result["signed"])
@@ -769,8 +433,7 @@ module TonSdk
769
433
  end
770
434
 
771
435
  def self.nacl_sign_open(ctx, params)
772
- pr_json = params.to_h.to_json
773
- Interop::request_to_native_lib(ctx, "crypto.nacl_sign_open", pr_json) do |resp|
436
+ Interop::request_to_native_lib(ctx, "crypto.nacl_sign_open", params) do |resp|
774
437
  if resp.success?
775
438
  yield NativeLibResponsetResult.new(
776
439
  result: ResultOfNaclSignOpen.new(resp.result["unsigned"])
@@ -782,8 +445,7 @@ module TonSdk
782
445
  end
783
446
 
784
447
  def self.nacl_sign_detached(ctx, params)
785
- pr_json = params.to_h.to_json
786
- Interop::request_to_native_lib(ctx, "crypto.nacl_sign_detached", pr_json) do |resp|
448
+ Interop::request_to_native_lib(ctx, "crypto.nacl_sign_detached", params) do |resp|
787
449
  if resp.success?
788
450
  yield NativeLibResponsetResult.new(
789
451
  result: ResultOfNaclSignDetached.new(resp.result["signature"])
@@ -794,8 +456,20 @@ module TonSdk
794
456
  end
795
457
  end
796
458
 
459
+ def self.nacl_sign_detached_verify(ctx, params)
460
+ Interop::request_to_native_lib(ctx, "crypto.nacl_sign_detached_verify", params) do |resp|
461
+ if resp.success?
462
+ yield NativeLibResponsetResult.new(
463
+ result: ResultOfNaclSignDetachedVerify.new(resp.result["succeeded"])
464
+ )
465
+ else
466
+ yield resp
467
+ end
468
+ end
469
+ end
470
+
797
471
  def self.nacl_box_keypair(ctx)
798
- Interop::request_to_native_lib(ctx, "crypto.nacl_box_keypair", "") do |resp|
472
+ Interop::request_to_native_lib(ctx, "crypto.nacl_box_keypair") do |resp|
799
473
  if resp.success?
800
474
  yield NativeLibResponsetResult.new(
801
475
  result: KeyPair.new(public_: resp.result["public"], secret: resp.result["secret"])
@@ -807,8 +481,7 @@ module TonSdk
807
481
  end
808
482
 
809
483
  def self.nacl_box_keypair_from_secret_key(ctx, params)
810
- pr_json = params.to_h.to_json
811
- Interop::request_to_native_lib(ctx, "crypto.nacl_box_keypair_from_secret_key", pr_json) do |resp|
484
+ Interop::request_to_native_lib(ctx, "crypto.nacl_box_keypair_from_secret_key", params) do |resp|
812
485
  if resp.success?
813
486
  yield NativeLibResponsetResult.new(
814
487
  result: KeyPair.new(public_: resp.result["public"], secret: resp.result["secret"])
@@ -820,8 +493,7 @@ module TonSdk
820
493
  end
821
494
 
822
495
  def self.nacl_box(ctx, params)
823
- pr_json = params.to_h.to_json
824
- Interop::request_to_native_lib(ctx, "crypto.nacl_box", pr_json) do |resp|
496
+ Interop::request_to_native_lib(ctx, "crypto.nacl_box", params) do |resp|
825
497
  if resp.success?
826
498
  yield NativeLibResponsetResult.new(
827
499
  result: ResultOfNaclBox.new(resp.result["encrypted"])
@@ -833,8 +505,7 @@ module TonSdk
833
505
  end
834
506
 
835
507
  def self.nacl_box_open(ctx, params)
836
- pr_json = params.to_h.to_json
837
- Interop::request_to_native_lib(ctx, "crypto.nacl_box_open", pr_json) do |resp|
508
+ Interop::request_to_native_lib(ctx, "crypto.nacl_box_open", params) do |resp|
838
509
  if resp.success?
839
510
  yield NativeLibResponsetResult.new(
840
511
  result: ResultOfNaclBoxOpen.new(resp.result["decrypted"])
@@ -846,8 +517,7 @@ module TonSdk
846
517
  end
847
518
 
848
519
  def self.nacl_secret_box(ctx, params)
849
- pr_json = params.to_h.to_json
850
- Interop::request_to_native_lib(ctx, "crypto.nacl_secret_box", pr_json) do |resp|
520
+ Interop::request_to_native_lib(ctx, "crypto.nacl_secret_box", params) do |resp|
851
521
  if resp.success?
852
522
  yield NativeLibResponsetResult.new(
853
523
  result: ResultOfNaclBox.new(resp.result["encrypted"])
@@ -859,8 +529,7 @@ module TonSdk
859
529
  end
860
530
 
861
531
  def self.nacl_secret_box_open(ctx, params)
862
- pr_json = params.to_h.to_json
863
- Interop::request_to_native_lib(ctx, "crypto.nacl_secret_box_open", pr_json) do |resp|
532
+ Interop::request_to_native_lib(ctx, "crypto.nacl_secret_box_open", params) do |resp|
864
533
  if resp.success?
865
534
  yield NativeLibResponsetResult.new(
866
535
  result: ResultOfNaclBoxOpen.new(resp.result["decrypted"])
@@ -872,8 +541,7 @@ module TonSdk
872
541
  end
873
542
 
874
543
  def self.mnemonic_words(ctx, params)
875
- pr_json = params.to_h.to_json
876
- Interop::request_to_native_lib(ctx, "crypto.mnemonic_words", pr_json) do |resp|
544
+ Interop::request_to_native_lib(ctx, "crypto.mnemonic_words", params) do |resp|
877
545
  if resp.success?
878
546
  yield NativeLibResponsetResult.new(
879
547
  result: ResultOfMnemonicWords.new(resp.result["words"])
@@ -885,8 +553,7 @@ module TonSdk
885
553
  end
886
554
 
887
555
  def self.mnemonic_from_random(ctx, params)
888
- pr_json = params.to_h.to_json
889
- Interop::request_to_native_lib(ctx, "crypto.mnemonic_from_random", pr_json) do |resp|
556
+ Interop::request_to_native_lib(ctx, "crypto.mnemonic_from_random", params) do |resp|
890
557
  if resp.success?
891
558
  yield NativeLibResponsetResult.new(
892
559
  result: ResultOfMnemonicFromRandom.new(resp.result["phrase"])
@@ -898,8 +565,7 @@ module TonSdk
898
565
  end
899
566
 
900
567
  def self.mnemonic_from_entropy(ctx, params)
901
- pr_json = params.to_h.to_json
902
- Interop::request_to_native_lib(ctx, "crypto.mnemonic_from_entropy", pr_json) do |resp|
568
+ Interop::request_to_native_lib(ctx, "crypto.mnemonic_from_entropy", params) do |resp|
903
569
  if resp.success?
904
570
  yield NativeLibResponsetResult.new(
905
571
  result: ResultOfMnemonicFromEntropy.new(resp.result["phrase"])
@@ -911,8 +577,7 @@ module TonSdk
911
577
  end
912
578
 
913
579
  def self.mnemonic_verify(ctx, params)
914
- pr_json = params.to_h.to_json
915
- Interop::request_to_native_lib(ctx, "crypto.mnemonic_verify", pr_json) do |resp|
580
+ Interop::request_to_native_lib(ctx, "crypto.mnemonic_verify", params) do |resp|
916
581
  if resp.success?
917
582
  yield NativeLibResponsetResult.new(
918
583
  result: ResultOfMnemonicVerify.new(resp.result["valid"])
@@ -924,8 +589,7 @@ module TonSdk
924
589
  end
925
590
 
926
591
  def self.mnemonic_derive_sign_keys(ctx, params)
927
- pr_json = params.to_h.to_json
928
- Interop::request_to_native_lib(ctx, "crypto.mnemonic_derive_sign_keys", pr_json) do |resp|
592
+ Interop::request_to_native_lib(ctx, "crypto.mnemonic_derive_sign_keys", params) do |resp|
929
593
  if resp.success?
930
594
  yield NativeLibResponsetResult.new(
931
595
  result: KeyPair.new(public_: resp.result["public"], secret: resp.result["secret"])
@@ -937,8 +601,7 @@ module TonSdk
937
601
  end
938
602
 
939
603
  def self.hdkey_xprv_from_mnemonic(ctx, params)
940
- pr_json = params.to_h.to_json
941
- Interop::request_to_native_lib(ctx, "crypto.hdkey_xprv_from_mnemonic", pr_json) do |resp|
604
+ Interop::request_to_native_lib(ctx, "crypto.hdkey_xprv_from_mnemonic", params) do |resp|
942
605
  if resp.success?
943
606
  yield NativeLibResponsetResult.new(
944
607
  result: ResultOfHDKeyXPrvFromMnemonic.new(resp.result["xprv"])
@@ -950,8 +613,7 @@ module TonSdk
950
613
  end
951
614
 
952
615
  def self.hdkey_derive_from_xprv(ctx, params)
953
- pr_json = params.to_h.to_json
954
- Interop::request_to_native_lib(ctx, "crypto.hdkey_derive_from_xprv", pr_json) do |resp|
616
+ Interop::request_to_native_lib(ctx, "crypto.hdkey_derive_from_xprv", params) do |resp|
955
617
  if resp.success?
956
618
  yield NativeLibResponsetResult.new(
957
619
  result: ResultOfHDKeyDeriveFromXPrv.new(resp.result["xprv"])
@@ -963,8 +625,7 @@ module TonSdk
963
625
  end
964
626
 
965
627
  def self.hdkey_derive_from_xprv_path(ctx, params)
966
- pr_json = params.to_h.to_json
967
- Interop::request_to_native_lib(ctx, "crypto.hdkey_derive_from_xprv_path", pr_json) do |resp|
628
+ Interop::request_to_native_lib(ctx, "crypto.hdkey_derive_from_xprv_path", params) do |resp|
968
629
  if resp.success?
969
630
  yield NativeLibResponsetResult.new(
970
631
  result: ResultOfHDKeyDeriveFromXPrvPath.new(resp.result["xprv"])
@@ -976,8 +637,7 @@ module TonSdk
976
637
  end
977
638
 
978
639
  def self.hdkey_secret_from_xprv(ctx, params)
979
- pr_json = params.to_h.to_json
980
- Interop::request_to_native_lib(ctx, "crypto.hdkey_secret_from_xprv", pr_json) do |resp|
640
+ Interop::request_to_native_lib(ctx, "crypto.hdkey_secret_from_xprv", params) do |resp|
981
641
  if resp.success?
982
642
  yield NativeLibResponsetResult.new(
983
643
  result: ResultOfHDKeySecretFromXPrv.new(resp.result["secret"])
@@ -989,8 +649,7 @@ module TonSdk
989
649
  end
990
650
 
991
651
  def self.hdkey_public_from_xprv(ctx, params)
992
- pr_json = params.to_h.to_json
993
- Interop::request_to_native_lib(ctx, "crypto.hdkey_public_from_xprv", pr_json) do |resp|
652
+ Interop::request_to_native_lib(ctx, "crypto.hdkey_public_from_xprv", params) do |resp|
994
653
  if resp.success?
995
654
  yield NativeLibResponsetResult.new(
996
655
  result: ResultOfHDKeyPublicFromXPrv.new(resp.result["public"])
@@ -1002,8 +661,7 @@ module TonSdk
1002
661
  end
1003
662
 
1004
663
  def self.chacha20(ctx, params)
1005
- pr_json = params.to_h.to_json
1006
- Interop::request_to_native_lib(ctx, "crypto.chacha20", pr_json) do |resp|
664
+ Interop::request_to_native_lib(ctx, "crypto.chacha20", params) do |resp|
1007
665
  if resp.success?
1008
666
  yield NativeLibResponsetResult.new(
1009
667
  result: ResultOfChaCha20.new(resp.result["data"])
@@ -1054,7 +712,7 @@ module TonSdk
1054
712
  end
1055
713
 
1056
714
  def self.get_signing_box(ctx, params)
1057
- Interop::request_to_native_lib(ctx, "crypto.get_signing_box", params.to_h.to_json) do |resp|
715
+ Interop::request_to_native_lib(ctx, "crypto.get_signing_box", params) do |resp|
1058
716
  if resp.success?
1059
717
  yield NativeLibResponsetResult.new(
1060
718
  result: RegisteredSigningBox.new(resp.result["handle"])
@@ -1069,7 +727,6 @@ module TonSdk
1069
727
  Interop::request_to_native_lib(
1070
728
  ctx,
1071
729
  "crypto.signing_box_get_public_key",
1072
- params.to_h.to_json,
1073
730
  is_single_thread_only: is_single_thread_only
1074
731
  ) do |resp|
1075
732
  if resp.success?
@@ -1083,7 +740,7 @@ module TonSdk
1083
740
  end
1084
741
 
1085
742
  def self.signing_box_sign(ctx, params)
1086
- Interop::request_to_native_lib(ctx, "crypto.signing_box_sign", params.to_h.to_json) do |resp|
743
+ Interop::request_to_native_lib(ctx, "crypto.signing_box_sign", params) do |resp|
1087
744
  if resp.success?
1088
745
  yield NativeLibResponsetResult.new(
1089
746
  result: ResultOfSigningBoxSign.new(resp.result["signature"])
@@ -1095,22 +752,10 @@ module TonSdk
1095
752
  end
1096
753
 
1097
754
  def self.remove_signing_box(ctx, params)
1098
- Interop::request_to_native_lib(ctx, "crypto.remove_signing_box", params.to_h.to_json) do |resp|
1099
- if resp.success?
1100
- yield NativeLibResponsetResult.new(
1101
- result: ResultOfSigningBoxSign.new(resp.result["signature"])
1102
- )
1103
- else
1104
- yield resp
1105
- end
1106
- end
1107
- end
1108
-
1109
- def self.nacl_sign_detached_verify(ctx, params)
1110
- Interop::request_to_native_lib(ctx, "crypto.nacl_sign_detached_verify", params.to_h.to_json) do |resp|
755
+ Interop::request_to_native_lib(ctx, "crypto.remove_signing_box", params) do |resp|
1111
756
  if resp.success?
1112
757
  yield NativeLibResponsetResult.new(
1113
- result: ResultOfNaclSignDetachedVerify.new(resp.result["succeeded"])
758
+ result: nil
1114
759
  )
1115
760
  else
1116
761
  yield resp