ton_sdk_client 1.10.0 → 1.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +29 -0
- data/README.md +1 -1
- data/lib/ton_sdk_client/abi.rb +114 -294
- data/lib/ton_sdk_client/boc.rb +32 -212
- data/lib/ton_sdk_client/client.rb +9 -51
- data/lib/ton_sdk_client/client_context.rb +2 -0
- data/lib/ton_sdk_client/config.rb +49 -90
- data/lib/ton_sdk_client/crypto.rb +116 -675
- data/lib/ton_sdk_client/debot.rb +142 -247
- data/lib/ton_sdk_client/interop.rb +2 -2
- data/lib/ton_sdk_client/net.rb +154 -169
- data/lib/ton_sdk_client/processing.rb +7 -36
- data/lib/ton_sdk_client/tvm.rb +58 -94
- data/lib/ton_sdk_client/utils.rb +47 -16
- data/lib/ton_sdk_client/version.rb +2 -2
- metadata +2 -2
@@ -1,108 +1,67 @@
|
|
1
1
|
module TonSdk
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
}
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
class NetworkConfig
|
25
|
-
DEFAULT_RETRIES_COUNT = 5
|
26
|
-
DEFAULT_PROCESSING_TIMEOUT = 40000
|
27
|
-
DEFAULT_WAIT_TIMEOUT = 40000
|
28
|
-
DEFAULT_OUT_OF_SYNC_THRESHOLD = 15000
|
29
|
-
DEFAULT_NETWORK_RETRIES_COUNT = 5
|
30
|
-
DEFAULT_MAX_RECONNECT_TIMEOUT = 2
|
31
|
-
|
32
|
-
attr_reader :server_address, :endpoints, :network_retries_count,
|
33
|
-
:message_retries_count, :message_processing_timeout,
|
34
|
-
:wait_for_timeout, :out_of_sync_threshold, :reconnect_timeout,
|
35
|
-
:access_key, :max_reconnect_timeout
|
36
|
-
|
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
|
37
20
|
def initialize(
|
38
21
|
server_address: "",
|
39
22
|
endpoints: [],
|
40
|
-
network_retries_count:
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
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,
|
33
|
+
access_key: nil
|
48
34
|
)
|
49
|
-
|
50
|
-
@endpoints = endpoints
|
51
|
-
@network_retries_count = network_retries_count
|
52
|
-
@message_retries_count = message_retries_count
|
53
|
-
@message_processing_timeout = message_processing_timeout
|
54
|
-
@wait_for_timeout = wait_for_timeout
|
55
|
-
@out_of_sync_threshold = out_of_sync_threshold
|
56
|
-
@reconnect_timeout = reconnect_timeout
|
57
|
-
@access_key = access_key
|
58
|
-
@max_reconnect_timeout = max_reconnect_timeout
|
59
|
-
end
|
60
|
-
|
61
|
-
def to_h
|
62
|
-
{
|
63
|
-
server_address: @server_address,
|
64
|
-
endpoints: @endpoints,
|
65
|
-
network_retries_count: @network_retries_count,
|
66
|
-
message_retries_count: @message_retries_count,
|
67
|
-
message_processing_timeout: @message_processing_timeout,
|
68
|
-
wait_for_timeout: @wait_for_timeout,
|
69
|
-
out_of_sync_threshold: @out_of_sync_threshold,
|
70
|
-
reconnect_timeout: @reconnect_timeout,
|
71
|
-
access_key: @access_key,
|
72
|
-
max_reconnect_timeout: @max_reconnect_timeout
|
73
|
-
}
|
35
|
+
super
|
74
36
|
end
|
75
37
|
end
|
76
38
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
def to_h = { fish_param: @fish_param }
|
85
|
-
end
|
86
|
-
|
87
|
-
class AbiConfig
|
88
|
-
DEFAULT_EXPIRATION_TIMEOUT = 40000
|
89
|
-
DEFAULT_TIMEOUT_GROW_FACTOR = 1.5
|
90
|
-
|
91
|
-
attr_reader :message_expiration_timeout, :message_expiration_timeout_grow_factor
|
92
|
-
|
39
|
+
AbiConfig = Struct.new(
|
40
|
+
:workchain,
|
41
|
+
:message_expiration_timeout,
|
42
|
+
:message_expiration_timeout_grow_factor,
|
43
|
+
keyword_init: true
|
44
|
+
) do
|
93
45
|
def initialize(
|
94
|
-
|
95
|
-
|
46
|
+
workchain: nil,
|
47
|
+
message_expiration_timeout: 40000,
|
48
|
+
message_expiration_timeout_grow_factor: 1.5
|
96
49
|
)
|
97
|
-
|
98
|
-
@message_expiration_timeout_grow_factor = message_expiration_timeout_grow_factor
|
50
|
+
super
|
99
51
|
end
|
52
|
+
end
|
100
53
|
|
54
|
+
ClientConfig = Struct.new(:network, :crypto, :abi, :boc, keyword_init: true) do
|
101
55
|
def to_h
|
56
|
+
res = super.to_h
|
57
|
+
|
102
58
|
{
|
103
|
-
|
104
|
-
|
59
|
+
network: res[:network]&.to_h,
|
60
|
+
crypto: res[:crypto]&.to_h,
|
61
|
+
abi: res[:abi]&.to_h,
|
62
|
+
boc: res[:boc]&.to_h
|
105
63
|
}
|
106
64
|
end
|
107
65
|
end
|
66
|
+
|
108
67
|
end
|
@@ -10,11 +10,11 @@ module TonSdk
|
|
10
10
|
INVALID_KEY = 102
|
11
11
|
INVALID_FACTORIZE_CHALLENGE = 106
|
12
12
|
INVALID_BIGINT = 107
|
13
|
-
SCRYPT_FAILED = 108
|
13
|
+
SCRYPT_FAILED = 108
|
14
14
|
INVALID_KEYSIZE = 109
|
15
|
-
NACL_SECRET_BOX_FAILED = 110
|
16
|
-
NACL_BOX_FAILED = 111
|
17
|
-
NACL_SIGN_FAILED = 112
|
15
|
+
NACL_SECRET_BOX_FAILED = 110
|
16
|
+
NACL_BOX_FAILED = 111
|
17
|
+
NACL_SIGN_FAILED = 112
|
18
18
|
BIP39_INVALID_ENTROPY = 113
|
19
19
|
BIP39_INVALID_PHRASE = 114
|
20
20
|
BIP32_INVALID_KEY = 115
|
@@ -27,448 +27,71 @@ module TonSdk
|
|
27
27
|
INVALID_SIGNATURE = 122
|
28
28
|
end
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
def to_h
|
58
|
-
{
|
59
|
-
base: @base,
|
60
|
-
exponent: @exponent,
|
61
|
-
modulus: @modulus
|
62
|
-
}
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
class ResultOfModularPower
|
67
|
-
attr_reader :modular_power
|
68
|
-
|
69
|
-
def initialize(a)
|
70
|
-
@modular_power = a
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
class ParamsOfTonCrc16
|
75
|
-
attr_reader :data
|
76
|
-
|
77
|
-
def initialize(a)
|
78
|
-
@data = a
|
79
|
-
end
|
80
|
-
|
81
|
-
def to_h = { data: @data }
|
82
|
-
end
|
83
|
-
|
84
|
-
class ResultOfTonCrc16
|
85
|
-
attr_reader :crc
|
86
|
-
|
87
|
-
def initialize(a)
|
88
|
-
@crc = a
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
class ParamsOfGenerateRandomBytes
|
93
|
-
attr_reader :length
|
94
|
-
|
95
|
-
def initialize(a)
|
96
|
-
@length = a
|
97
|
-
end
|
98
|
-
|
99
|
-
def to_h
|
100
|
-
{
|
101
|
-
length: @length
|
102
|
-
}
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
class ResultOfGenerateRandomBytes
|
107
|
-
attr_reader :bytes
|
108
|
-
|
109
|
-
def initialize(a)
|
110
|
-
@bytes = a
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
class ParamsOfConvertPublicKeyToTonSafeFormat
|
115
|
-
attr_reader :public_key
|
116
|
-
|
117
|
-
def initialize(a)
|
118
|
-
@public_key = a
|
119
|
-
end
|
120
|
-
|
121
|
-
def to_h
|
122
|
-
{
|
123
|
-
public_key: @public_key
|
124
|
-
}
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
class ResultOfConvertPublicKeyToTonSafeFormat
|
129
|
-
attr_reader :ton_public_key
|
130
|
-
|
131
|
-
def initialize(a)
|
132
|
-
@ton_public_key = a
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|
136
|
-
class KeyPair
|
137
|
-
attr_reader :public_, :secret
|
138
|
-
|
139
|
-
def initialize(public_: , secret:)
|
140
|
-
@public_ = public_
|
141
|
-
@secret = secret
|
142
|
-
end
|
143
|
-
|
144
|
-
def to_h
|
145
|
-
{
|
146
|
-
public: @public_,
|
147
|
-
secret: @secret
|
148
|
-
}
|
149
|
-
end
|
150
|
-
end
|
151
|
-
|
152
|
-
class ParamsOfSign
|
153
|
-
attr_reader :unsigned, :keys
|
154
|
-
|
155
|
-
def initialize(unsigned:, keys:)
|
156
|
-
@unsigned = unsigned
|
157
|
-
@keys = keys
|
158
|
-
end
|
159
|
-
|
160
|
-
def to_h
|
161
|
-
{
|
162
|
-
unsigned: @unsigned,
|
163
|
-
keys: @keys.to_h
|
164
|
-
}
|
165
|
-
end
|
166
|
-
end
|
167
|
-
|
168
|
-
class ResultOfSign
|
169
|
-
attr_reader :signed, :signature
|
170
|
-
|
171
|
-
def initialize(signed:, signature:)
|
172
|
-
@signed = signed
|
173
|
-
@signature = signature
|
174
|
-
end
|
175
|
-
end
|
176
|
-
|
177
|
-
class ParamsOfVerifySignature
|
178
|
-
attr_reader :signed, :public_
|
179
|
-
|
180
|
-
def initialize(signed:, public_:)
|
181
|
-
@signed = signed
|
182
|
-
@public_ = public_
|
183
|
-
end
|
184
|
-
|
185
|
-
def to_h
|
186
|
-
{
|
187
|
-
signed: @signed,
|
188
|
-
public: @public_
|
189
|
-
}
|
190
|
-
end
|
191
|
-
end
|
192
|
-
|
193
|
-
class ResultOfVerifySignature
|
194
|
-
attr_reader :unsigned
|
195
|
-
|
196
|
-
def initialize(a)
|
197
|
-
@unsigned = a
|
198
|
-
end
|
199
|
-
end
|
200
|
-
|
201
|
-
class ParamsOfHash
|
202
|
-
attr_reader :data
|
203
|
-
|
204
|
-
def initialize(a)
|
205
|
-
@data = a
|
206
|
-
end
|
207
|
-
|
208
|
-
def to_h
|
209
|
-
{
|
210
|
-
data: @data
|
211
|
-
}
|
212
|
-
end
|
213
|
-
end
|
214
|
-
|
215
|
-
class ResultOfHash
|
216
|
-
attr_reader :hash
|
217
|
-
|
218
|
-
def initialize(a)
|
219
|
-
@hash = a
|
220
|
-
end
|
221
|
-
end
|
222
|
-
|
223
|
-
class ParamsOfScrypt
|
224
|
-
attr_reader :password, :salt, :log_n, :r, :p_, :dk_len
|
225
|
-
|
226
|
-
def initialize(password:, salt:, log_n:, r:, p_:, dk_len:)
|
227
|
-
@password = password
|
228
|
-
@salt = salt
|
229
|
-
@log_n = log_n
|
230
|
-
@r = r
|
231
|
-
@p_ = p_
|
232
|
-
@dk_len = dk_len
|
233
|
-
end
|
234
|
-
|
235
|
-
def to_h
|
236
|
-
{
|
237
|
-
password: @password,
|
238
|
-
salt: @salt,
|
239
|
-
log_n: @log_n,
|
240
|
-
r: @r,
|
241
|
-
p: @p_,
|
242
|
-
dk_len: @dk_len
|
243
|
-
}
|
244
|
-
end
|
245
|
-
end
|
246
|
-
|
247
|
-
class ResultOfScrypt
|
248
|
-
attr_reader :key
|
249
|
-
|
250
|
-
def initialize(a)
|
251
|
-
@key = a
|
252
|
-
end
|
253
|
-
end
|
254
|
-
|
255
|
-
class ParamsOfNaclSignKeyPairFromSecret
|
256
|
-
attr_reader :secret
|
257
|
-
|
258
|
-
def initialize(a)
|
259
|
-
@secret = a
|
260
|
-
end
|
261
|
-
|
262
|
-
def to_h = { secret: @secret }
|
263
|
-
end
|
264
|
-
|
265
|
-
class ParamsOfNaclSign
|
266
|
-
attr_reader :unsigned, :secret
|
267
|
-
|
268
|
-
def initialize(unsigned:, secret:)
|
269
|
-
@unsigned = unsigned
|
270
|
-
@secret = secret
|
271
|
-
end
|
272
|
-
|
273
|
-
def to_h
|
274
|
-
{
|
275
|
-
unsigned: @unsigned,
|
276
|
-
secret: @secret
|
277
|
-
}
|
278
|
-
end
|
279
|
-
end
|
280
|
-
|
281
|
-
class ResultOfNaclSign
|
282
|
-
attr_reader :signed
|
283
|
-
|
284
|
-
def initialize(a)
|
285
|
-
@signed = a
|
286
|
-
end
|
287
|
-
end
|
288
|
-
|
289
|
-
class ParamsOfNaclSignOpen
|
290
|
-
attr_reader :signed, :public_
|
291
|
-
|
30
|
+
ParamsOfFactorize = Struct.new(:composite)
|
31
|
+
ResultOfFactorize = Struct.new(:factors)
|
32
|
+
ParamsOfModularPower = Struct.new(:base, :exponent, :modulus, keyword_init: true)
|
33
|
+
ResultOfModularPower = Struct.new(:modular_power)
|
34
|
+
ParamsOfTonCrc16 = Struct.new(:data)
|
35
|
+
|
36
|
+
ResultOfTonCrc16 = Struct.new(:crc)
|
37
|
+
ParamsOfGenerateRandomBytes = Struct.new(:length)
|
38
|
+
ResultOfGenerateRandomBytes = Struct.new(:bytes)
|
39
|
+
ParamsOfConvertPublicKeyToTonSafeFormat = Struct.new(:public_key)
|
40
|
+
ResultOfConvertPublicKeyToTonSafeFormat = Struct.new(:ton_public_key)
|
41
|
+
|
42
|
+
KeyPair = Struct.new(:public_, :secret)
|
43
|
+
ParamsOfSign = Struct.new(:unsigned, :keys)
|
44
|
+
ResultOfSign = Struct.new(:signed, :signature)
|
45
|
+
ParamsOfVerifySignature = Struct.new(:signed, :public_)
|
46
|
+
ResultOfVerifySignature = Struct.new(:unsigned)
|
47
|
+
|
48
|
+
ParamsOfHash = Struct.new(:data)
|
49
|
+
ResultOfHash = Struct.new(:hash)
|
50
|
+
ParamsOfScrypt = Struct.new(:password, :salt, :log_n, :r, :p_, :dk_len, keyword_init: true)
|
51
|
+
ResultOfScrypt = Struct.new(:key)
|
52
|
+
ParamsOfNaclSignKeyPairFromSecret = Struct.new(:secret)
|
53
|
+
|
54
|
+
ParamsOfNaclSign = Struct.new(:unsigned, :secret)
|
55
|
+
ResultOfNaclSign = Struct.new(:signed)
|
56
|
+
ParamsOfNaclSignOpen = Struct.new(:signed, :public_) do
|
292
57
|
def initialize(signed:, public_:)
|
293
|
-
|
294
|
-
@public_ = public_
|
295
|
-
end
|
296
|
-
|
297
|
-
def to_h
|
298
|
-
{
|
299
|
-
signed: @signed,
|
300
|
-
public: @public_
|
301
|
-
}
|
58
|
+
super
|
302
59
|
end
|
303
60
|
end
|
304
61
|
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
@unsigned = a
|
310
|
-
end
|
311
|
-
end
|
312
|
-
|
313
|
-
class ResultOfNaclSignDetached
|
314
|
-
attr_reader :signature
|
315
|
-
|
316
|
-
def initialize(a)
|
317
|
-
@signature = a
|
318
|
-
end
|
319
|
-
end
|
320
|
-
|
321
|
-
class ParamsOfNaclBoxKeyPairFromSecret
|
322
|
-
attr_reader :secret
|
323
|
-
|
324
|
-
def initialize(a)
|
325
|
-
@secret = a
|
326
|
-
end
|
327
|
-
|
328
|
-
def to_h
|
329
|
-
{
|
330
|
-
secret: @secret
|
331
|
-
}
|
332
|
-
end
|
333
|
-
end
|
334
|
-
|
335
|
-
class ParamsOfNaclBox
|
336
|
-
attr_reader :decrypted, :nonce, :their_public, :secret
|
337
|
-
|
62
|
+
ResultOfNaclSignOpen = Struct.new(:unsigned)
|
63
|
+
ResultOfNaclSignDetached = Struct.new(:signature)
|
64
|
+
ParamsOfNaclBoxKeyPairFromSecret = Struct.new(:secret)
|
65
|
+
ParamsOfNaclBox = Struct.new(:decrypted, :nonce, :their_public, :secret) do
|
338
66
|
def initialize(decrypted:, nonce:, their_public:, secret:)
|
339
|
-
|
340
|
-
@nonce = nonce
|
341
|
-
@their_public = their_public
|
342
|
-
@secret = secret
|
343
|
-
end
|
344
|
-
|
345
|
-
def to_h
|
346
|
-
{
|
347
|
-
decrypted: @decrypted,
|
348
|
-
nonce: @nonce,
|
349
|
-
their_public: @their_public,
|
350
|
-
secret: @secret
|
351
|
-
}
|
67
|
+
super
|
352
68
|
end
|
353
69
|
end
|
354
70
|
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
def initialize(a)
|
359
|
-
@encrypted = a
|
360
|
-
end
|
361
|
-
end
|
362
|
-
|
363
|
-
class ParamsOfNaclBoxOpen
|
364
|
-
attr_reader :encrypted, :nonce, :their_public, :secret
|
365
|
-
|
71
|
+
ResultOfNaclBox = Struct.new(:encrypted)
|
72
|
+
ParamsOfNaclBoxOpen = Struct.new(:encrypted, :nonce, :their_public, :secret) do
|
366
73
|
def initialize(encrypted:, nonce:, their_public:, secret:)
|
367
|
-
|
368
|
-
@nonce = nonce
|
369
|
-
@their_public = their_public
|
370
|
-
@secret = secret
|
371
|
-
end
|
372
|
-
|
373
|
-
def to_h
|
374
|
-
{
|
375
|
-
encrypted: @encrypted,
|
376
|
-
nonce: @nonce,
|
377
|
-
their_public: @their_public,
|
378
|
-
secret: @secret
|
379
|
-
}
|
380
|
-
end
|
381
|
-
end
|
382
|
-
|
383
|
-
class ResultOfNaclBoxOpen
|
384
|
-
attr_reader :decrypted
|
385
|
-
|
386
|
-
def initialize(a)
|
387
|
-
@decrypted = a
|
74
|
+
super
|
388
75
|
end
|
389
76
|
end
|
390
77
|
|
391
|
-
|
392
|
-
|
393
|
-
|
78
|
+
ResultOfNaclBoxOpen = Struct.new(:decrypted)
|
79
|
+
ParamsOfNaclSecretBox = Struct.new(:decrypted, :nonce, :key) do
|
394
80
|
def initialize(decrypted:, nonce:, key:)
|
395
|
-
|
396
|
-
@nonce = nonce
|
397
|
-
@key = key
|
398
|
-
end
|
399
|
-
|
400
|
-
def to_h
|
401
|
-
{
|
402
|
-
decrypted: @decrypted,
|
403
|
-
nonce: @nonce,
|
404
|
-
key: @key
|
405
|
-
}
|
81
|
+
super
|
406
82
|
end
|
407
83
|
end
|
408
84
|
|
409
|
-
|
410
|
-
attr_reader :encrypted, :nonce, :key
|
411
|
-
|
85
|
+
ParamsOfNaclSecretBoxOpen = Struct.new(:encrypted, :nonce, :key) do
|
412
86
|
def initialize(encrypted:, nonce:, key:)
|
413
|
-
|
414
|
-
@nonce = nonce
|
415
|
-
@key = key
|
416
|
-
end
|
417
|
-
|
418
|
-
def to_h
|
419
|
-
{
|
420
|
-
encrypted: @encrypted,
|
421
|
-
nonce: @nonce,
|
422
|
-
key: @key
|
423
|
-
}
|
424
|
-
end
|
425
|
-
end
|
426
|
-
|
427
|
-
class ParamsOfMnemonicWords
|
428
|
-
attr_reader :dictionary
|
429
|
-
|
430
|
-
def initialize(a: nil)
|
431
|
-
@dictionary = a
|
432
|
-
end
|
433
|
-
|
434
|
-
def to_h
|
435
|
-
{
|
436
|
-
dictionary: @dictionary
|
437
|
-
}
|
438
|
-
end
|
439
|
-
end
|
440
|
-
|
441
|
-
class ResultOfMnemonicWords
|
442
|
-
attr_reader :words
|
443
|
-
|
444
|
-
def initialize(a)
|
445
|
-
@words = a
|
446
|
-
end
|
447
|
-
end
|
448
|
-
|
449
|
-
class ParamsOfMnemonicFromRandom
|
450
|
-
attr_reader :dictionary, :word_count
|
451
|
-
|
452
|
-
def initialize(dictionary: nil, word_count: nil)
|
453
|
-
@dictionary = dictionary
|
454
|
-
@word_count = word_count
|
455
|
-
end
|
456
|
-
|
457
|
-
def to_h
|
458
|
-
{
|
459
|
-
dictionary: @dictionary,
|
460
|
-
word_count: @word_count
|
461
|
-
}
|
87
|
+
super
|
462
88
|
end
|
463
89
|
end
|
464
90
|
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
@phrase = a
|
470
|
-
end
|
471
|
-
end
|
91
|
+
ParamsOfMnemonicWords = Struct.new(:dictionary)
|
92
|
+
ResultOfMnemonicWords = Struct.new(:words)
|
93
|
+
ParamsOfMnemonicFromRandom = Struct.new(:dictionary, :word_count, keyword_init: true)
|
94
|
+
ResultOfMnemonicFromRandom = Struct.new(:phrase)
|
472
95
|
|
473
96
|
class ParamsOfMnemonicFromEntropy
|
474
97
|
attr_reader :entropy, :dictionary, :word_count
|
@@ -488,13 +111,7 @@ module TonSdk
|
|
488
111
|
end
|
489
112
|
end
|
490
113
|
|
491
|
-
|
492
|
-
attr_reader :phrase
|
493
|
-
|
494
|
-
def initialize(a)
|
495
|
-
@phrase = a
|
496
|
-
end
|
497
|
-
end
|
114
|
+
ResultOfMnemonicFromEntropy = Struct.new(:phrase)
|
498
115
|
|
499
116
|
class ParamsOfMnemonicVerify
|
500
117
|
attr_reader :phrase, :dictionary, :word_count
|
@@ -514,13 +131,7 @@ module TonSdk
|
|
514
131
|
end
|
515
132
|
end
|
516
133
|
|
517
|
-
|
518
|
-
attr_reader :valid
|
519
|
-
|
520
|
-
def initialize(a)
|
521
|
-
@valid = a
|
522
|
-
end
|
523
|
-
end
|
134
|
+
ResultOfMnemonicVerify = Struct.new(:valid)
|
524
135
|
|
525
136
|
class ParamsOfMnemonicDeriveSignKeys
|
526
137
|
attr_reader :phrase, :path, :dictionary, :word_count
|
@@ -560,13 +171,7 @@ module TonSdk
|
|
560
171
|
end
|
561
172
|
end
|
562
173
|
|
563
|
-
|
564
|
-
attr_reader :xprv
|
565
|
-
|
566
|
-
def initialize(a)
|
567
|
-
@xprv = a
|
568
|
-
end
|
569
|
-
end
|
174
|
+
ResultOfHDKeyXPrvFromMnemonic = Struct.new(:xprv)
|
570
175
|
|
571
176
|
class ParamsOfHDKeyDeriveFromXPrv
|
572
177
|
attr_reader :xprv, :child_index, :hardened
|
@@ -586,162 +191,37 @@ module TonSdk
|
|
586
191
|
end
|
587
192
|
end
|
588
193
|
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
end
|
595
|
-
|
596
|
-
def to_h
|
597
|
-
{
|
598
|
-
xprv: @xprv,
|
599
|
-
path: @path
|
600
|
-
}
|
601
|
-
end
|
602
|
-
end
|
603
|
-
|
604
|
-
class ParamsOfHDKeySecretFromXPrv
|
605
|
-
attr_reader :xprv
|
606
|
-
|
607
|
-
def initialize(a)
|
608
|
-
@xprv = a
|
609
|
-
end
|
610
|
-
|
611
|
-
def to_h
|
612
|
-
{
|
613
|
-
xprv: @xprv
|
614
|
-
}
|
615
|
-
end
|
616
|
-
end
|
617
|
-
|
618
|
-
class ResultOfHDKeySecretFromXPrv
|
619
|
-
attr_reader :secret
|
620
|
-
|
621
|
-
def initialize(a)
|
622
|
-
@secret = a
|
623
|
-
end
|
624
|
-
end
|
625
|
-
|
626
|
-
class ParamsOfHDKeyPublicFromXPrv
|
627
|
-
attr_reader :xprv
|
628
|
-
|
629
|
-
def initialize(a)
|
630
|
-
@xprv = a
|
631
|
-
end
|
632
|
-
|
633
|
-
def to_h
|
634
|
-
{
|
635
|
-
xprv: @xprv
|
636
|
-
}
|
637
|
-
end
|
638
|
-
end
|
639
|
-
|
640
|
-
class ResultOfHDKeyPublicFromXPrv
|
641
|
-
attr_reader :public_
|
642
|
-
|
643
|
-
def initialize(a)
|
644
|
-
@public_ = a
|
645
|
-
end
|
646
|
-
end
|
647
|
-
|
648
|
-
class ParamsOfHDKeyDeriveFromXPrvPath
|
649
|
-
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_)
|
650
199
|
|
200
|
+
ParamsOfHDKeyDeriveFromXPrvPath = Struct.new(:xprv, :path) do
|
651
201
|
def initialize(xprv:, path:)
|
652
|
-
|
653
|
-
@path = path
|
654
|
-
end
|
655
|
-
|
656
|
-
def to_h
|
657
|
-
{
|
658
|
-
xprv: @xprv,
|
659
|
-
path: @path
|
660
|
-
}
|
202
|
+
super
|
661
203
|
end
|
662
204
|
end
|
663
205
|
|
664
|
-
|
665
|
-
attr_reader :xprv
|
666
|
-
|
667
|
-
def initialize(a)
|
668
|
-
@xprv = a
|
669
|
-
end
|
670
|
-
end
|
671
|
-
|
672
|
-
class ParamsOfChaCha20
|
673
|
-
attr_reader :data, :key, :nonce
|
206
|
+
ResultOfHDKeyDeriveFromXPrvPath = Struct.new(:xprv)
|
674
207
|
|
208
|
+
ParamsOfChaCha20 = Struct.new(:data, :key, :nonce) do
|
675
209
|
def initialize(data:, key:, nonce:)
|
676
|
-
|
677
|
-
@key = key
|
678
|
-
@nonce = nonce
|
679
|
-
end
|
680
|
-
|
681
|
-
def to_h
|
682
|
-
{
|
683
|
-
data: @data,
|
684
|
-
key: @key,
|
685
|
-
nonce: @nonce
|
686
|
-
}
|
210
|
+
super
|
687
211
|
end
|
688
212
|
end
|
689
213
|
|
690
|
-
|
691
|
-
attr_reader :data
|
692
|
-
|
693
|
-
def initialize(a)
|
694
|
-
@data = a
|
695
|
-
end
|
696
|
-
end
|
697
|
-
|
698
|
-
class ParamsOfSigningBoxSign
|
699
|
-
attr_reader :signing_box, :unsigned
|
214
|
+
ResultOfChaCha20 = Struct.new(:data)
|
700
215
|
|
216
|
+
ParamsOfSigningBoxSign = Struct.new(:signing_box, :unsigned) do
|
701
217
|
def initialize(signing_box:, unsigned:)
|
702
|
-
|
703
|
-
@unsigned = unsigned
|
704
|
-
end
|
705
|
-
|
706
|
-
def to_h
|
707
|
-
{
|
708
|
-
signing_box: @signing_box,
|
709
|
-
unsigned: @unsigned
|
710
|
-
}
|
711
|
-
end
|
712
|
-
end
|
713
|
-
|
714
|
-
class ResultOfSigningBoxSign
|
715
|
-
attr_reader :signature
|
716
|
-
|
717
|
-
def initialize(a)
|
718
|
-
@signature = a
|
719
|
-
end
|
720
|
-
end
|
721
|
-
|
722
|
-
class RegisteredSigningBox
|
723
|
-
attr_reader :handle
|
724
|
-
|
725
|
-
def initialize(a)
|
726
|
-
@handle = a
|
727
|
-
end
|
728
|
-
|
729
|
-
def to_h
|
730
|
-
{
|
731
|
-
handle: @handle
|
732
|
-
}
|
218
|
+
super
|
733
219
|
end
|
734
220
|
end
|
735
221
|
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
def initialize(a)
|
740
|
-
@pubkey = a
|
741
|
-
end
|
742
|
-
|
743
|
-
def to_h = { pubkey: @pubkey }
|
744
|
-
end
|
222
|
+
ResultOfSigningBoxSign = Struct.new(:signature)
|
223
|
+
RegisteredSigningBox = Struct.new(:handle)
|
224
|
+
ResultOfSigningBoxGetPublicKey = Struct.new(:pubkey)
|
745
225
|
|
746
226
|
class ParamsOfNaclSignDetachedVerify
|
747
227
|
attr_reader :unsigned, :signature, :public
|
@@ -759,15 +239,7 @@ module TonSdk
|
|
759
239
|
end
|
760
240
|
end
|
761
241
|
|
762
|
-
|
763
|
-
attr_reader :succeeded
|
764
|
-
|
765
|
-
def initialize(a)
|
766
|
-
@succeeded = a
|
767
|
-
end
|
768
|
-
|
769
|
-
def to_h = { succeeded: @succeeded }
|
770
|
-
end
|
242
|
+
ResultOfNaclSignDetachedVerify = Struct.new(:succeeded)
|
771
243
|
|
772
244
|
class ParamsOfAppSigningBox
|
773
245
|
TYPES = [
|
@@ -799,8 +271,7 @@ module TonSdk
|
|
799
271
|
#
|
800
272
|
|
801
273
|
def self.factorize(ctx, params)
|
802
|
-
|
803
|
-
Interop::request_to_native_lib(ctx, "crypto.factorize", pr_json) do |resp|
|
274
|
+
Interop::request_to_native_lib(ctx, "crypto.factorize", params) do |resp|
|
804
275
|
if resp.success?
|
805
276
|
yield NativeLibResponsetResult.new(
|
806
277
|
result: ResultOfFactorize.new(resp.result["factors"])
|
@@ -812,8 +283,7 @@ module TonSdk
|
|
812
283
|
end
|
813
284
|
|
814
285
|
def self.modular_power(ctx, params)
|
815
|
-
|
816
|
-
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|
|
817
287
|
if resp.success?
|
818
288
|
yield NativeLibResponsetResult.new(
|
819
289
|
result: ResultOfModularPower.new(resp.result["modular_power"])
|
@@ -825,8 +295,7 @@ module TonSdk
|
|
825
295
|
end
|
826
296
|
|
827
297
|
def self.ton_crc16(ctx, params)
|
828
|
-
|
829
|
-
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|
|
830
299
|
if resp.success?
|
831
300
|
yield NativeLibResponsetResult.new(
|
832
301
|
result: ResultOfTonCrc16.new(resp.result["crc"])
|
@@ -838,8 +307,7 @@ module TonSdk
|
|
838
307
|
end
|
839
308
|
|
840
309
|
def self.generate_random_bytes(ctx, params)
|
841
|
-
|
842
|
-
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|
|
843
311
|
if resp.success?
|
844
312
|
yield NativeLibResponsetResult.new(
|
845
313
|
result: ResultOfGenerateRandomBytes.new(resp.result["bytes"])
|
@@ -851,8 +319,7 @@ module TonSdk
|
|
851
319
|
end
|
852
320
|
|
853
321
|
def self.convert_public_key_to_ton_safe_format(ctx, params)
|
854
|
-
|
855
|
-
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|
|
856
323
|
if resp.success?
|
857
324
|
yield NativeLibResponsetResult.new(
|
858
325
|
result: ResultOfConvertPublicKeyToTonSafeFormat.new(resp.result["ton_public_key"])
|
@@ -879,8 +346,7 @@ module TonSdk
|
|
879
346
|
end
|
880
347
|
|
881
348
|
def self.sign(ctx, params)
|
882
|
-
|
883
|
-
Interop::request_to_native_lib(ctx, "crypto.sign", pr_json) do |resp|
|
349
|
+
Interop::request_to_native_lib(ctx, "crypto.sign", params) do |resp|
|
884
350
|
if resp.success?
|
885
351
|
yield NativeLibResponsetResult.new(
|
886
352
|
result: ResultOfSign.new(
|
@@ -895,8 +361,7 @@ module TonSdk
|
|
895
361
|
end
|
896
362
|
|
897
363
|
def self.verify_signature(ctx, params)
|
898
|
-
|
899
|
-
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|
|
900
365
|
if resp.success?
|
901
366
|
yield NativeLibResponsetResult.new(
|
902
367
|
result: ResultOfVerifySignature.new(resp.result["unsigned"])
|
@@ -908,8 +373,7 @@ module TonSdk
|
|
908
373
|
end
|
909
374
|
|
910
375
|
def self.sha256(ctx, params)
|
911
|
-
|
912
|
-
Interop::request_to_native_lib(ctx, "crypto.sha256", pr_json) do |resp|
|
376
|
+
Interop::request_to_native_lib(ctx, "crypto.sha256", params) do |resp|
|
913
377
|
if resp.success?
|
914
378
|
yield NativeLibResponsetResult.new(
|
915
379
|
result: ResultOfHash.new(resp.result["hash"])
|
@@ -921,8 +385,7 @@ module TonSdk
|
|
921
385
|
end
|
922
386
|
|
923
387
|
def self.sha512(ctx, params)
|
924
|
-
|
925
|
-
Interop::request_to_native_lib(ctx, "crypto.sha512", pr_json) do |resp|
|
388
|
+
Interop::request_to_native_lib(ctx, "crypto.sha512", params) do |resp|
|
926
389
|
if resp.success?
|
927
390
|
yield NativeLibResponsetResult.new(
|
928
391
|
result: ResultOfHash.new(resp.result["hash"])
|
@@ -934,8 +397,7 @@ module TonSdk
|
|
934
397
|
end
|
935
398
|
|
936
399
|
def self.scrypt(ctx, params)
|
937
|
-
|
938
|
-
Interop::request_to_native_lib(ctx, "crypto.scrypt", pr_json) do |resp|
|
400
|
+
Interop::request_to_native_lib(ctx, "crypto.scrypt", params) do |resp|
|
939
401
|
if resp.success?
|
940
402
|
yield NativeLibResponsetResult.new(
|
941
403
|
result: ResultOfScrypt.new(resp.result["key"])
|
@@ -947,8 +409,7 @@ module TonSdk
|
|
947
409
|
end
|
948
410
|
|
949
411
|
def self.nacl_sign_keypair_from_secret_key(ctx, params)
|
950
|
-
|
951
|
-
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|
|
952
413
|
if resp.success?
|
953
414
|
yield NativeLibResponsetResult.new(
|
954
415
|
result: KeyPair.new(public_: resp.result["public"], secret: resp.result["secret"])
|
@@ -960,8 +421,7 @@ module TonSdk
|
|
960
421
|
end
|
961
422
|
|
962
423
|
def self.nacl_sign(ctx, params)
|
963
|
-
|
964
|
-
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|
|
965
425
|
if resp.success?
|
966
426
|
yield NativeLibResponsetResult.new(
|
967
427
|
result: ResultOfNaclSign.new(resp.result["signed"])
|
@@ -973,8 +433,7 @@ module TonSdk
|
|
973
433
|
end
|
974
434
|
|
975
435
|
def self.nacl_sign_open(ctx, params)
|
976
|
-
|
977
|
-
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|
|
978
437
|
if resp.success?
|
979
438
|
yield NativeLibResponsetResult.new(
|
980
439
|
result: ResultOfNaclSignOpen.new(resp.result["unsigned"])
|
@@ -986,8 +445,7 @@ module TonSdk
|
|
986
445
|
end
|
987
446
|
|
988
447
|
def self.nacl_sign_detached(ctx, params)
|
989
|
-
|
990
|
-
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|
|
991
449
|
if resp.success?
|
992
450
|
yield NativeLibResponsetResult.new(
|
993
451
|
result: ResultOfNaclSignDetached.new(resp.result["signature"])
|
@@ -998,8 +456,20 @@ module TonSdk
|
|
998
456
|
end
|
999
457
|
end
|
1000
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
|
+
|
1001
471
|
def self.nacl_box_keypair(ctx)
|
1002
|
-
Interop::request_to_native_lib(ctx, "crypto.nacl_box_keypair"
|
472
|
+
Interop::request_to_native_lib(ctx, "crypto.nacl_box_keypair") do |resp|
|
1003
473
|
if resp.success?
|
1004
474
|
yield NativeLibResponsetResult.new(
|
1005
475
|
result: KeyPair.new(public_: resp.result["public"], secret: resp.result["secret"])
|
@@ -1011,8 +481,7 @@ module TonSdk
|
|
1011
481
|
end
|
1012
482
|
|
1013
483
|
def self.nacl_box_keypair_from_secret_key(ctx, params)
|
1014
|
-
|
1015
|
-
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|
|
1016
485
|
if resp.success?
|
1017
486
|
yield NativeLibResponsetResult.new(
|
1018
487
|
result: KeyPair.new(public_: resp.result["public"], secret: resp.result["secret"])
|
@@ -1024,8 +493,7 @@ module TonSdk
|
|
1024
493
|
end
|
1025
494
|
|
1026
495
|
def self.nacl_box(ctx, params)
|
1027
|
-
|
1028
|
-
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|
|
1029
497
|
if resp.success?
|
1030
498
|
yield NativeLibResponsetResult.new(
|
1031
499
|
result: ResultOfNaclBox.new(resp.result["encrypted"])
|
@@ -1037,8 +505,7 @@ module TonSdk
|
|
1037
505
|
end
|
1038
506
|
|
1039
507
|
def self.nacl_box_open(ctx, params)
|
1040
|
-
|
1041
|
-
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|
|
1042
509
|
if resp.success?
|
1043
510
|
yield NativeLibResponsetResult.new(
|
1044
511
|
result: ResultOfNaclBoxOpen.new(resp.result["decrypted"])
|
@@ -1050,8 +517,7 @@ module TonSdk
|
|
1050
517
|
end
|
1051
518
|
|
1052
519
|
def self.nacl_secret_box(ctx, params)
|
1053
|
-
|
1054
|
-
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|
|
1055
521
|
if resp.success?
|
1056
522
|
yield NativeLibResponsetResult.new(
|
1057
523
|
result: ResultOfNaclBox.new(resp.result["encrypted"])
|
@@ -1063,8 +529,7 @@ module TonSdk
|
|
1063
529
|
end
|
1064
530
|
|
1065
531
|
def self.nacl_secret_box_open(ctx, params)
|
1066
|
-
|
1067
|
-
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|
|
1068
533
|
if resp.success?
|
1069
534
|
yield NativeLibResponsetResult.new(
|
1070
535
|
result: ResultOfNaclBoxOpen.new(resp.result["decrypted"])
|
@@ -1076,8 +541,7 @@ module TonSdk
|
|
1076
541
|
end
|
1077
542
|
|
1078
543
|
def self.mnemonic_words(ctx, params)
|
1079
|
-
|
1080
|
-
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|
|
1081
545
|
if resp.success?
|
1082
546
|
yield NativeLibResponsetResult.new(
|
1083
547
|
result: ResultOfMnemonicWords.new(resp.result["words"])
|
@@ -1089,8 +553,7 @@ module TonSdk
|
|
1089
553
|
end
|
1090
554
|
|
1091
555
|
def self.mnemonic_from_random(ctx, params)
|
1092
|
-
|
1093
|
-
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|
|
1094
557
|
if resp.success?
|
1095
558
|
yield NativeLibResponsetResult.new(
|
1096
559
|
result: ResultOfMnemonicFromRandom.new(resp.result["phrase"])
|
@@ -1102,8 +565,7 @@ module TonSdk
|
|
1102
565
|
end
|
1103
566
|
|
1104
567
|
def self.mnemonic_from_entropy(ctx, params)
|
1105
|
-
|
1106
|
-
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|
|
1107
569
|
if resp.success?
|
1108
570
|
yield NativeLibResponsetResult.new(
|
1109
571
|
result: ResultOfMnemonicFromEntropy.new(resp.result["phrase"])
|
@@ -1115,8 +577,7 @@ module TonSdk
|
|
1115
577
|
end
|
1116
578
|
|
1117
579
|
def self.mnemonic_verify(ctx, params)
|
1118
|
-
|
1119
|
-
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|
|
1120
581
|
if resp.success?
|
1121
582
|
yield NativeLibResponsetResult.new(
|
1122
583
|
result: ResultOfMnemonicVerify.new(resp.result["valid"])
|
@@ -1128,8 +589,7 @@ module TonSdk
|
|
1128
589
|
end
|
1129
590
|
|
1130
591
|
def self.mnemonic_derive_sign_keys(ctx, params)
|
1131
|
-
|
1132
|
-
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|
|
1133
593
|
if resp.success?
|
1134
594
|
yield NativeLibResponsetResult.new(
|
1135
595
|
result: KeyPair.new(public_: resp.result["public"], secret: resp.result["secret"])
|
@@ -1141,8 +601,7 @@ module TonSdk
|
|
1141
601
|
end
|
1142
602
|
|
1143
603
|
def self.hdkey_xprv_from_mnemonic(ctx, params)
|
1144
|
-
|
1145
|
-
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|
|
1146
605
|
if resp.success?
|
1147
606
|
yield NativeLibResponsetResult.new(
|
1148
607
|
result: ResultOfHDKeyXPrvFromMnemonic.new(resp.result["xprv"])
|
@@ -1154,8 +613,7 @@ module TonSdk
|
|
1154
613
|
end
|
1155
614
|
|
1156
615
|
def self.hdkey_derive_from_xprv(ctx, params)
|
1157
|
-
|
1158
|
-
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|
|
1159
617
|
if resp.success?
|
1160
618
|
yield NativeLibResponsetResult.new(
|
1161
619
|
result: ResultOfHDKeyDeriveFromXPrv.new(resp.result["xprv"])
|
@@ -1167,8 +625,7 @@ module TonSdk
|
|
1167
625
|
end
|
1168
626
|
|
1169
627
|
def self.hdkey_derive_from_xprv_path(ctx, params)
|
1170
|
-
|
1171
|
-
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|
|
1172
629
|
if resp.success?
|
1173
630
|
yield NativeLibResponsetResult.new(
|
1174
631
|
result: ResultOfHDKeyDeriveFromXPrvPath.new(resp.result["xprv"])
|
@@ -1180,8 +637,7 @@ module TonSdk
|
|
1180
637
|
end
|
1181
638
|
|
1182
639
|
def self.hdkey_secret_from_xprv(ctx, params)
|
1183
|
-
|
1184
|
-
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|
|
1185
641
|
if resp.success?
|
1186
642
|
yield NativeLibResponsetResult.new(
|
1187
643
|
result: ResultOfHDKeySecretFromXPrv.new(resp.result["secret"])
|
@@ -1193,8 +649,7 @@ module TonSdk
|
|
1193
649
|
end
|
1194
650
|
|
1195
651
|
def self.hdkey_public_from_xprv(ctx, params)
|
1196
|
-
|
1197
|
-
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|
|
1198
653
|
if resp.success?
|
1199
654
|
yield NativeLibResponsetResult.new(
|
1200
655
|
result: ResultOfHDKeyPublicFromXPrv.new(resp.result["public"])
|
@@ -1206,8 +661,7 @@ module TonSdk
|
|
1206
661
|
end
|
1207
662
|
|
1208
663
|
def self.chacha20(ctx, params)
|
1209
|
-
|
1210
|
-
Interop::request_to_native_lib(ctx, "crypto.chacha20", pr_json) do |resp|
|
664
|
+
Interop::request_to_native_lib(ctx, "crypto.chacha20", params) do |resp|
|
1211
665
|
if resp.success?
|
1212
666
|
yield NativeLibResponsetResult.new(
|
1213
667
|
result: ResultOfChaCha20.new(resp.result["data"])
|
@@ -1258,7 +712,7 @@ module TonSdk
|
|
1258
712
|
end
|
1259
713
|
|
1260
714
|
def self.get_signing_box(ctx, params)
|
1261
|
-
Interop::request_to_native_lib(ctx, "crypto.get_signing_box", params
|
715
|
+
Interop::request_to_native_lib(ctx, "crypto.get_signing_box", params) do |resp|
|
1262
716
|
if resp.success?
|
1263
717
|
yield NativeLibResponsetResult.new(
|
1264
718
|
result: RegisteredSigningBox.new(resp.result["handle"])
|
@@ -1273,7 +727,6 @@ module TonSdk
|
|
1273
727
|
Interop::request_to_native_lib(
|
1274
728
|
ctx,
|
1275
729
|
"crypto.signing_box_get_public_key",
|
1276
|
-
params.to_h.to_json,
|
1277
730
|
is_single_thread_only: is_single_thread_only
|
1278
731
|
) do |resp|
|
1279
732
|
if resp.success?
|
@@ -1287,7 +740,7 @@ module TonSdk
|
|
1287
740
|
end
|
1288
741
|
|
1289
742
|
def self.signing_box_sign(ctx, params)
|
1290
|
-
Interop::request_to_native_lib(ctx, "crypto.signing_box_sign", params
|
743
|
+
Interop::request_to_native_lib(ctx, "crypto.signing_box_sign", params) do |resp|
|
1291
744
|
if resp.success?
|
1292
745
|
yield NativeLibResponsetResult.new(
|
1293
746
|
result: ResultOfSigningBoxSign.new(resp.result["signature"])
|
@@ -1299,22 +752,10 @@ module TonSdk
|
|
1299
752
|
end
|
1300
753
|
|
1301
754
|
def self.remove_signing_box(ctx, params)
|
1302
|
-
Interop::request_to_native_lib(ctx, "crypto.remove_signing_box", params
|
755
|
+
Interop::request_to_native_lib(ctx, "crypto.remove_signing_box", params) do |resp|
|
1303
756
|
if resp.success?
|
1304
757
|
yield NativeLibResponsetResult.new(
|
1305
|
-
result:
|
1306
|
-
)
|
1307
|
-
else
|
1308
|
-
yield resp
|
1309
|
-
end
|
1310
|
-
end
|
1311
|
-
end
|
1312
|
-
|
1313
|
-
def self.nacl_sign_detached_verify(ctx, params)
|
1314
|
-
Interop::request_to_native_lib(ctx, "crypto.nacl_sign_detached_verify", params.to_h.to_json) do |resp|
|
1315
|
-
if resp.success?
|
1316
|
-
yield NativeLibResponsetResult.new(
|
1317
|
-
result: ResultOfNaclSignDetachedVerify.new(resp.result["succeeded"])
|
758
|
+
result: nil
|
1318
759
|
)
|
1319
760
|
else
|
1320
761
|
yield resp
|