ton_sdk_client 1.20.0 → 1.24.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -25,133 +25,103 @@ module TonSdk
25
25
  MNEMONICFROMENTROPY_FAILED = 120
26
26
  SIGNING_BOX_NOT_REGISTERED = 121
27
27
  INVALID_SIGNATURE = 122
28
- end
29
-
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
57
- def initialize(signed:, public_:)
58
- super
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
35
+ end
36
+
37
+ ParamsOfFactorize = KwStruct.new(:composite)
38
+ ResultOfFactorize = KwStruct.new(:factors)
39
+ ParamsOfModularPower = KwStruct.new(:base, :exponent, :modulus)
40
+ ResultOfModularPower = KwStruct.new(:modular_power)
41
+ ParamsOfTonCrc16 = KwStruct.new(:data)
42
+
43
+ ResultOfTonCrc16 = KwStruct.new(:crc)
44
+ ParamsOfGenerateRandomBytes = KwStruct.new(:length)
45
+ ResultOfGenerateRandomBytes = KwStruct.new(:bytes)
46
+ ParamsOfConvertPublicKeyToTonSafeFormat = KwStruct.new(:public_key)
47
+ ResultOfConvertPublicKeyToTonSafeFormat = KwStruct.new(:ton_public_key)
48
+
49
+ KeyPair = KwStruct.new(:public_, :secret) do
50
+ def to_h
51
+ {
52
+ public: public_,
53
+ secret: secret
54
+ }
59
55
  end
60
56
  end
61
-
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
66
- def initialize(decrypted:, nonce:, their_public:, secret:)
67
- super
57
+ ParamsOfSign = KwStruct.new(:unsigned, :keys) do
58
+ def to_h
59
+ {
60
+ unsigned: unsigned,
61
+ keys: keys&.to_h
62
+ }
68
63
  end
69
64
  end
70
-
71
- ResultOfNaclBox = Struct.new(:encrypted)
72
- ParamsOfNaclBoxOpen = Struct.new(:encrypted, :nonce, :their_public, :secret) do
73
- def initialize(encrypted:, nonce:, their_public:, secret:)
74
- super
65
+ ResultOfSign = KwStruct.new(:signed, :signature)
66
+ ParamsOfVerifySignature = KwStruct.new(:signed, :public_) do
67
+ def to_h
68
+ {
69
+ signed: signed,
70
+ public: public_
71
+ }
75
72
  end
76
73
  end
74
+ ResultOfVerifySignature = KwStruct.new(:unsigned)
77
75
 
78
- ResultOfNaclBoxOpen = Struct.new(:decrypted)
79
- ParamsOfNaclSecretBox = Struct.new(:decrypted, :nonce, :key) do
80
- def initialize(decrypted:, nonce:, key:)
81
- super
82
- end
83
- end
76
+ ParamsOfHash = KwStruct.new(:data)
77
+ ResultOfHash = KwStruct.new(:hash)
78
+ ParamsOfScrypt = KwStruct.new(:password, :salt, :log_n, :r, :p, :dk_len)
79
+ ResultOfScrypt = KwStruct.new(:key)
80
+ ParamsOfNaclSignKeyPairFromSecret = KwStruct.new(:secret)
84
81
 
85
- ParamsOfNaclSecretBoxOpen = Struct.new(:encrypted, :nonce, :key) do
86
- def initialize(encrypted:, nonce:, key:)
87
- super
82
+ ParamsOfNaclSign = KwStruct.new(:unsigned, :secret)
83
+ ResultOfNaclSign = KwStruct.new(:signed)
84
+ ParamsOfNaclSignOpen = KwStruct.new(:signed, :public_) do
85
+ def to_h
86
+ {
87
+ signed: signed,
88
+ public: public_
89
+ }
88
90
  end
89
91
  end
90
92
 
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)
93
+ ResultOfNaclSignOpen = KwStruct.new(:unsigned)
95
94
 
96
- class ParamsOfMnemonicFromEntropy
97
- attr_reader :entropy, :dictionary, :word_count
95
+ ParamsOfNaclSignDetached = KwStruct.new(:unsigned, :secret)
98
96
 
99
- def initialize(entropy:, dictionary: nil, word_count: nil)
100
- @entropy = entropy
101
- @dictionary = dictionary
102
- @word_count = word_count
103
- end
97
+ ResultOfNaclSignDetached = KwStruct.new(:signature)
104
98
 
105
- def to_h
106
- {
107
- entropy: @entropy,
108
- dictionary: @dictionary,
109
- word_count: @word_count
110
- }
111
- end
112
- end
99
+ ParamsOfNaclBoxKeyPairFromSecret = KwStruct.new(:secret)
113
100
 
114
- ResultOfMnemonicFromEntropy = Struct.new(:phrase)
101
+ ParamsOfNaclBox = KwStruct.new(:decrypted, :nonce, :their_public, :secret)
115
102
 
116
- class ParamsOfMnemonicVerify
117
- attr_reader :phrase, :dictionary, :word_count
103
+ ResultOfNaclBox = KwStruct.new(:encrypted)
104
+ ParamsOfNaclBoxOpen = KwStruct.new(:encrypted, :nonce, :their_public, :secret)
118
105
 
119
- def initialize(phrase:, dictionary: nil, word_count: nil)
120
- @phrase = phrase
121
- @dictionary = dictionary
122
- @word_count = word_count
123
- end
106
+ ResultOfNaclBoxOpen = KwStruct.new(:decrypted)
107
+ ParamsOfNaclSecretBox = KwStruct.new(:decrypted, :nonce, :key)
124
108
 
125
- def to_h
126
- {
127
- phrase: @phrase,
128
- dictionary: @dictionary,
129
- word_count: @word_count
130
- }
131
- end
132
- end
109
+ ParamsOfNaclSecretBoxOpen = KwStruct.new(:encrypted, :nonce, :key)
133
110
 
134
- ResultOfMnemonicVerify = Struct.new(:valid)
111
+ ParamsOfMnemonicWords = KwStruct.new(:dictionary)
112
+ ResultOfMnemonicWords = KwStruct.new(:words)
113
+ ParamsOfMnemonicFromRandom = KwStruct.new(:dictionary, :word_count)
114
+ ResultOfMnemonicFromRandom = KwStruct.new(:phrase)
135
115
 
136
- class ParamsOfMnemonicDeriveSignKeys
137
- attr_reader :phrase, :path, :dictionary, :word_count
116
+ ParamsOfMnemonicFromEntropy = KwStruct.new(:entropy, :dictionary, :word_count)
138
117
 
139
- def initialize(phrase:, path: nil, dictionary: nil, word_count: nil)
140
- @phrase = phrase
141
- @path = path
142
- @dictionary = dictionary
143
- @word_count = word_count
144
- end
118
+ ResultOfMnemonicFromEntropy = KwStruct.new(:phrase)
145
119
 
146
- def to_h
147
- {
148
- phrase: @phrase,
149
- path: @path,
150
- dictionary: @dictionary,
151
- word_count: @word_count
152
- }
153
- end
154
- end
120
+ ParamsOfMnemonicVerify = KwStruct.new(:phrase, :dictionary, :word_count)
121
+
122
+ ResultOfMnemonicVerify = KwStruct.new(:valid)
123
+
124
+ ParamsOfMnemonicDeriveSignKeys = KwStruct.new(:phrase, :path, :dictionary, :word_count)
155
125
 
156
126
  class ParamsOfHDKeyXPrvFromMnemonic
157
127
  attr_reader :phrase, :dictionary, :word_count
@@ -171,7 +141,7 @@ module TonSdk
171
141
  end
172
142
  end
173
143
 
174
- ResultOfHDKeyXPrvFromMnemonic = Struct.new(:xprv)
144
+ ResultOfHDKeyXPrvFromMnemonic = KwStruct.new(:xprv)
175
145
 
176
146
  class ParamsOfHDKeyDeriveFromXPrv
177
147
  attr_reader :xprv, :child_index, :hardened
@@ -191,55 +161,37 @@ module TonSdk
191
161
  end
192
162
  end
193
163
 
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_)
164
+ ResultOfHDKeyDeriveFromXPrv = KwStruct.new(:xprv)
165
+ ParamsOfHDKeySecretFromXPrv = KwStruct.new(:xprv)
166
+ ResultOfHDKeySecretFromXPrv = KwStruct.new(:secret)
167
+ ParamsOfHDKeyPublicFromXPrv = KwStruct.new(:xprv)
168
+ ResultOfHDKeyPublicFromXPrv = KwStruct.new(:public_)
199
169
 
200
- ParamsOfHDKeyDeriveFromXPrvPath = Struct.new(:xprv, :path) do
201
- def initialize(xprv:, path:)
202
- super
203
- end
204
- end
170
+ ParamsOfHDKeyDeriveFromXPrvPath = KwStruct.new(:xprv, :path)
205
171
 
206
- ResultOfHDKeyDeriveFromXPrvPath = Struct.new(:xprv)
172
+ ResultOfHDKeyDeriveFromXPrvPath = KwStruct.new(:xprv)
207
173
 
208
- ParamsOfChaCha20 = Struct.new(:data, :key, :nonce) do
209
- def initialize(data:, key:, nonce:)
210
- super
211
- end
212
- end
213
-
214
- ResultOfChaCha20 = Struct.new(:data)
215
-
216
- ParamsOfSigningBoxSign = Struct.new(:signing_box, :unsigned) do
217
- def initialize(signing_box:, unsigned:)
218
- super
219
- end
220
- end
174
+ ParamsOfChaCha20 = KwStruct.new(:data, :key, :nonce)
221
175
 
222
- ResultOfSigningBoxSign = Struct.new(:signature)
223
- RegisteredSigningBox = Struct.new(:handle)
224
- ResultOfSigningBoxGetPublicKey = Struct.new(:pubkey)
176
+ ResultOfChaCha20 = KwStruct.new(:data)
225
177
 
226
- class ParamsOfNaclSignDetachedVerify
227
- attr_reader :unsigned, :signature, :public
178
+ ParamsOfSigningBoxSign = KwStruct.new(:signing_box, :unsigned)
228
179
 
229
- def initialize(unsigned:, signature:, public_:)
230
- @unsigned, @signature, @public_ = unsigned, signature, public_
231
- end
180
+ ResultOfSigningBoxSign = KwStruct.new(:signature)
181
+ RegisteredSigningBox = KwStruct.new(:handle)
182
+ ResultOfSigningBoxGetPublicKey = KwStruct.new(:pubkey)
232
183
 
184
+ ParamsOfNaclSignDetachedVerify = KwStruct.new(:unsigned, :signature, :public_) do
233
185
  def to_h
234
186
  {
235
- unsigned: @unsigned,
236
- signature: @signature,
237
- public: @public_
187
+ unsigned: unsigned,
188
+ signature: signature,
189
+ public: public_
238
190
  }
239
191
  end
240
192
  end
241
193
 
242
- ResultOfNaclSignDetachedVerify = Struct.new(:succeeded)
194
+ ResultOfNaclSignDetachedVerify = KwStruct.new(:succeeded)
243
195
 
244
196
  class ParamsOfAppSigningBox
245
197
  TYPES = [
@@ -265,10 +217,23 @@ module TonSdk
265
217
  end
266
218
  end
267
219
 
268
- EncryptionBoxInfo = Struct.new(:hdpath, :algorithm, :options, :public, keyword_init: true)
269
- ParamsOfEncryptionBoxGetInfo = Struct.new(:encryption_box)
270
- ResultOfEncryptionBoxGetInfo = Struct.new(:info)
271
- RegisteredEncryptionBox = Struct.new(:handle)
220
+ EncryptionBoxInfo = KwStruct.new(:hdpath, :algorithm, :options, :public)
221
+ ParamsOfEncryptionBoxGetInfo = KwStruct.new(:encryption_box)
222
+ ResultOfEncryptionBoxGetInfo = KwStruct.new(:info)
223
+ RegisteredEncryptionBox = KwStruct.new(:handle)
224
+ ParamsOfCreateEncryptionBox = KwStruct.new(:algorithm)
225
+
226
+ class EncryptionAlgorithm
227
+ private_class_method :new
228
+
229
+ attr_reader :type_, :aes_params
230
+
231
+ def self.new_with_type_aes(aes_params:)
232
+ @type_ = :aes
233
+ @aes_params = aes_params
234
+ end
235
+ end
236
+
272
237
 
273
238
 
274
239
  #
@@ -279,7 +244,7 @@ module TonSdk
279
244
  Interop::request_to_native_lib(ctx, "crypto.factorize", params) do |resp|
280
245
  if resp.success?
281
246
  yield NativeLibResponsetResult.new(
282
- result: ResultOfFactorize.new(resp.result["factors"])
247
+ result: ResultOfFactorize.new(factors: resp.result["factors"])
283
248
  )
284
249
  else
285
250
  yield resp
@@ -291,7 +256,7 @@ module TonSdk
291
256
  Interop::request_to_native_lib(ctx, "crypto.modular_power", params) do |resp|
292
257
  if resp.success?
293
258
  yield NativeLibResponsetResult.new(
294
- result: ResultOfModularPower.new(resp.result["modular_power"])
259
+ result: ResultOfModularPower.new(modular_power: resp.result["modular_power"])
295
260
  )
296
261
  else
297
262
  yield resp
@@ -303,7 +268,7 @@ module TonSdk
303
268
  Interop::request_to_native_lib(ctx, "crypto.ton_crc16", params) do |resp|
304
269
  if resp.success?
305
270
  yield NativeLibResponsetResult.new(
306
- result: ResultOfTonCrc16.new(resp.result["crc"])
271
+ result: ResultOfTonCrc16.new(crc: resp.result["crc"])
307
272
  )
308
273
  else
309
274
  yield resp
@@ -315,7 +280,7 @@ module TonSdk
315
280
  Interop::request_to_native_lib(ctx, "crypto.generate_random_bytes", params) do |resp|
316
281
  if resp.success?
317
282
  yield NativeLibResponsetResult.new(
318
- result: ResultOfGenerateRandomBytes.new(resp.result["bytes"])
283
+ result: ResultOfGenerateRandomBytes.new(bytes: resp.result["bytes"])
319
284
  )
320
285
  else
321
286
  yield resp
@@ -327,7 +292,7 @@ module TonSdk
327
292
  Interop::request_to_native_lib(ctx, "crypto.convert_public_key_to_ton_safe_format", params) do |resp|
328
293
  if resp.success?
329
294
  yield NativeLibResponsetResult.new(
330
- result: ResultOfConvertPublicKeyToTonSafeFormat.new(resp.result["ton_public_key"])
295
+ result: ResultOfConvertPublicKeyToTonSafeFormat.new(ton_public_key: resp.result["ton_public_key"])
331
296
  )
332
297
  else
333
298
  yield resp
@@ -369,7 +334,7 @@ module TonSdk
369
334
  Interop::request_to_native_lib(ctx, "crypto.verify_signature", params) do |resp|
370
335
  if resp.success?
371
336
  yield NativeLibResponsetResult.new(
372
- result: ResultOfVerifySignature.new(resp.result["unsigned"])
337
+ result: ResultOfVerifySignature.new(unsigned: resp.result["unsigned"])
373
338
  )
374
339
  else
375
340
  yield resp
@@ -381,7 +346,7 @@ module TonSdk
381
346
  Interop::request_to_native_lib(ctx, "crypto.sha256", params) do |resp|
382
347
  if resp.success?
383
348
  yield NativeLibResponsetResult.new(
384
- result: ResultOfHash.new(resp.result["hash"])
349
+ result: ResultOfHash.new(hash: resp.result["hash"])
385
350
  )
386
351
  else
387
352
  yield resp
@@ -393,7 +358,7 @@ module TonSdk
393
358
  Interop::request_to_native_lib(ctx, "crypto.sha512", params) do |resp|
394
359
  if resp.success?
395
360
  yield NativeLibResponsetResult.new(
396
- result: ResultOfHash.new(resp.result["hash"])
361
+ result: ResultOfHash.new(hash: resp.result["hash"])
397
362
  )
398
363
  else
399
364
  yield resp
@@ -405,7 +370,7 @@ module TonSdk
405
370
  Interop::request_to_native_lib(ctx, "crypto.scrypt", params) do |resp|
406
371
  if resp.success?
407
372
  yield NativeLibResponsetResult.new(
408
- result: ResultOfScrypt.new(resp.result["key"])
373
+ result: ResultOfScrypt.new(key: resp.result["key"])
409
374
  )
410
375
  else
411
376
  yield resp
@@ -417,7 +382,10 @@ module TonSdk
417
382
  Interop::request_to_native_lib(ctx, "crypto.nacl_sign_keypair_from_secret_key", params) do |resp|
418
383
  if resp.success?
419
384
  yield NativeLibResponsetResult.new(
420
- result: KeyPair.new(public_: resp.result["public"], secret: resp.result["secret"])
385
+ result: KeyPair.new(
386
+ public_: resp.result["public"],
387
+ secret: resp.result["secret"]
388
+ )
421
389
  )
422
390
  else
423
391
  yield resp
@@ -429,7 +397,7 @@ module TonSdk
429
397
  Interop::request_to_native_lib(ctx, "crypto.nacl_sign", params) do |resp|
430
398
  if resp.success?
431
399
  yield NativeLibResponsetResult.new(
432
- result: ResultOfNaclSign.new(resp.result["signed"])
400
+ result: ResultOfNaclSign.new(signed: resp.result["signed"])
433
401
  )
434
402
  else
435
403
  yield resp
@@ -441,7 +409,7 @@ module TonSdk
441
409
  Interop::request_to_native_lib(ctx, "crypto.nacl_sign_open", params) do |resp|
442
410
  if resp.success?
443
411
  yield NativeLibResponsetResult.new(
444
- result: ResultOfNaclSignOpen.new(resp.result["unsigned"])
412
+ result: ResultOfNaclSignOpen.new(unsigned: resp.result["unsigned"])
445
413
  )
446
414
  else
447
415
  yield resp
@@ -453,7 +421,7 @@ module TonSdk
453
421
  Interop::request_to_native_lib(ctx, "crypto.nacl_sign_detached", params) do |resp|
454
422
  if resp.success?
455
423
  yield NativeLibResponsetResult.new(
456
- result: ResultOfNaclSignDetached.new(resp.result["signature"])
424
+ result: ResultOfNaclSignDetached.new(signature: resp.result["signature"])
457
425
  )
458
426
  else
459
427
  yield resp
@@ -465,7 +433,7 @@ module TonSdk
465
433
  Interop::request_to_native_lib(ctx, "crypto.nacl_sign_detached_verify", params) do |resp|
466
434
  if resp.success?
467
435
  yield NativeLibResponsetResult.new(
468
- result: ResultOfNaclSignDetachedVerify.new(resp.result["succeeded"])
436
+ result: ResultOfNaclSignDetachedVerify.new(succeeded: resp.result["succeeded"])
469
437
  )
470
438
  else
471
439
  yield resp
@@ -477,7 +445,10 @@ module TonSdk
477
445
  Interop::request_to_native_lib(ctx, "crypto.nacl_box_keypair") do |resp|
478
446
  if resp.success?
479
447
  yield NativeLibResponsetResult.new(
480
- result: KeyPair.new(public_: resp.result["public"], secret: resp.result["secret"])
448
+ result: KeyPair.new(
449
+ public_: resp.result["public"],
450
+ secret: resp.result["secret"]
451
+ )
481
452
  )
482
453
  else
483
454
  yield resp
@@ -489,7 +460,10 @@ module TonSdk
489
460
  Interop::request_to_native_lib(ctx, "crypto.nacl_box_keypair_from_secret_key", params) do |resp|
490
461
  if resp.success?
491
462
  yield NativeLibResponsetResult.new(
492
- result: KeyPair.new(public_: resp.result["public"], secret: resp.result["secret"])
463
+ result: KeyPair.new(
464
+ public_: resp.result["public"],
465
+ secret: resp.result["secret"]
466
+ )
493
467
  )
494
468
  else
495
469
  yield resp
@@ -501,7 +475,7 @@ module TonSdk
501
475
  Interop::request_to_native_lib(ctx, "crypto.nacl_box", params) do |resp|
502
476
  if resp.success?
503
477
  yield NativeLibResponsetResult.new(
504
- result: ResultOfNaclBox.new(resp.result["encrypted"])
478
+ result: ResultOfNaclBox.new(encrypted: resp.result["encrypted"])
505
479
  )
506
480
  else
507
481
  yield resp
@@ -513,7 +487,7 @@ module TonSdk
513
487
  Interop::request_to_native_lib(ctx, "crypto.nacl_box_open", params) do |resp|
514
488
  if resp.success?
515
489
  yield NativeLibResponsetResult.new(
516
- result: ResultOfNaclBoxOpen.new(resp.result["decrypted"])
490
+ result: ResultOfNaclBoxOpen.new(decrypted: resp.result["decrypted"])
517
491
  )
518
492
  else
519
493
  yield resp
@@ -525,7 +499,7 @@ module TonSdk
525
499
  Interop::request_to_native_lib(ctx, "crypto.nacl_secret_box", params) do |resp|
526
500
  if resp.success?
527
501
  yield NativeLibResponsetResult.new(
528
- result: ResultOfNaclBox.new(resp.result["encrypted"])
502
+ result: ResultOfNaclBox.new(encrypted: resp.result["encrypted"])
529
503
  )
530
504
  else
531
505
  yield resp
@@ -537,7 +511,7 @@ module TonSdk
537
511
  Interop::request_to_native_lib(ctx, "crypto.nacl_secret_box_open", params) do |resp|
538
512
  if resp.success?
539
513
  yield NativeLibResponsetResult.new(
540
- result: ResultOfNaclBoxOpen.new(resp.result["decrypted"])
514
+ result: ResultOfNaclBoxOpen.new(decrypted: resp.result["decrypted"])
541
515
  )
542
516
  else
543
517
  yield resp
@@ -549,7 +523,7 @@ module TonSdk
549
523
  Interop::request_to_native_lib(ctx, "crypto.mnemonic_words", params) do |resp|
550
524
  if resp.success?
551
525
  yield NativeLibResponsetResult.new(
552
- result: ResultOfMnemonicWords.new(resp.result["words"])
526
+ result: ResultOfMnemonicWords.new(words: resp.result["words"])
553
527
  )
554
528
  else
555
529
  yield resp
@@ -561,7 +535,7 @@ module TonSdk
561
535
  Interop::request_to_native_lib(ctx, "crypto.mnemonic_from_random", params) do |resp|
562
536
  if resp.success?
563
537
  yield NativeLibResponsetResult.new(
564
- result: ResultOfMnemonicFromRandom.new(resp.result["phrase"])
538
+ result: ResultOfMnemonicFromRandom.new(phrase: resp.result["phrase"])
565
539
  )
566
540
  else
567
541
  yield resp
@@ -573,7 +547,7 @@ module TonSdk
573
547
  Interop::request_to_native_lib(ctx, "crypto.mnemonic_from_entropy", params) do |resp|
574
548
  if resp.success?
575
549
  yield NativeLibResponsetResult.new(
576
- result: ResultOfMnemonicFromEntropy.new(resp.result["phrase"])
550
+ result: ResultOfMnemonicFromEntropy.new(phrase: resp.result["phrase"])
577
551
  )
578
552
  else
579
553
  yield resp
@@ -585,7 +559,7 @@ module TonSdk
585
559
  Interop::request_to_native_lib(ctx, "crypto.mnemonic_verify", params) do |resp|
586
560
  if resp.success?
587
561
  yield NativeLibResponsetResult.new(
588
- result: ResultOfMnemonicVerify.new(resp.result["valid"])
562
+ result: ResultOfMnemonicVerify.new(valid: resp.result["valid"])
589
563
  )
590
564
  else
591
565
  yield resp
@@ -597,7 +571,10 @@ module TonSdk
597
571
  Interop::request_to_native_lib(ctx, "crypto.mnemonic_derive_sign_keys", params) do |resp|
598
572
  if resp.success?
599
573
  yield NativeLibResponsetResult.new(
600
- result: KeyPair.new(public_: resp.result["public"], secret: resp.result["secret"])
574
+ result: KeyPair.new(
575
+ public_: resp.result["public"],
576
+ secret: resp.result["secret"]
577
+ )
601
578
  )
602
579
  else
603
580
  yield resp
@@ -609,7 +586,7 @@ module TonSdk
609
586
  Interop::request_to_native_lib(ctx, "crypto.hdkey_xprv_from_mnemonic", params) do |resp|
610
587
  if resp.success?
611
588
  yield NativeLibResponsetResult.new(
612
- result: ResultOfHDKeyXPrvFromMnemonic.new(resp.result["xprv"])
589
+ result: ResultOfHDKeyXPrvFromMnemonic.new(xprv: resp.result["xprv"])
613
590
  )
614
591
  else
615
592
  yield resp
@@ -621,7 +598,7 @@ module TonSdk
621
598
  Interop::request_to_native_lib(ctx, "crypto.hdkey_derive_from_xprv", params) do |resp|
622
599
  if resp.success?
623
600
  yield NativeLibResponsetResult.new(
624
- result: ResultOfHDKeyDeriveFromXPrv.new(resp.result["xprv"])
601
+ result: ResultOfHDKeyDeriveFromXPrv.new(xprv: resp.result["xprv"])
625
602
  )
626
603
  else
627
604
  yield resp
@@ -633,7 +610,7 @@ module TonSdk
633
610
  Interop::request_to_native_lib(ctx, "crypto.hdkey_derive_from_xprv_path", params) do |resp|
634
611
  if resp.success?
635
612
  yield NativeLibResponsetResult.new(
636
- result: ResultOfHDKeyDeriveFromXPrvPath.new(resp.result["xprv"])
613
+ result: ResultOfHDKeyDeriveFromXPrvPath.new(xprv: resp.result["xprv"])
637
614
  )
638
615
  else
639
616
  yield resp
@@ -645,7 +622,7 @@ module TonSdk
645
622
  Interop::request_to_native_lib(ctx, "crypto.hdkey_secret_from_xprv", params) do |resp|
646
623
  if resp.success?
647
624
  yield NativeLibResponsetResult.new(
648
- result: ResultOfHDKeySecretFromXPrv.new(resp.result["secret"])
625
+ result: ResultOfHDKeySecretFromXPrv.new(secret: resp.result["secret"])
649
626
  )
650
627
  else
651
628
  yield resp
@@ -657,7 +634,7 @@ module TonSdk
657
634
  Interop::request_to_native_lib(ctx, "crypto.hdkey_public_from_xprv", params) do |resp|
658
635
  if resp.success?
659
636
  yield NativeLibResponsetResult.new(
660
- result: ResultOfHDKeyPublicFromXPrv.new(resp.result["public"])
637
+ result: ResultOfHDKeyPublicFromXPrv.new(public_: resp.result["public"])
661
638
  )
662
639
  else
663
640
  yield resp
@@ -669,7 +646,7 @@ module TonSdk
669
646
  Interop::request_to_native_lib(ctx, "crypto.chacha20", params) do |resp|
670
647
  if resp.success?
671
648
  yield NativeLibResponsetResult.new(
672
- result: ResultOfChaCha20.new(resp.result["data"])
649
+ result: ResultOfChaCha20.new(data: resp.result["data"])
673
650
  )
674
651
  else
675
652
  yield resp
@@ -708,7 +685,7 @@ module TonSdk
708
685
  ) do |resp|
709
686
  if resp.success?
710
687
  yield NativeLibResponsetResult.new(
711
- result: RegisteredSigningBox.new(resp.result["handle"])
688
+ result: RegisteredSigningBox.new(handle: resp.result["handle"])
712
689
  )
713
690
  else
714
691
  yield resp
@@ -720,7 +697,7 @@ module TonSdk
720
697
  Interop::request_to_native_lib(ctx, "crypto.get_signing_box", params) do |resp|
721
698
  if resp.success?
722
699
  yield NativeLibResponsetResult.new(
723
- result: RegisteredSigningBox.new(resp.result["handle"])
700
+ result: RegisteredSigningBox.new(handle: resp.result["handle"])
724
701
  )
725
702
  else
726
703
  yield resp
@@ -732,11 +709,12 @@ module TonSdk
732
709
  Interop::request_to_native_lib(
733
710
  ctx,
734
711
  "crypto.signing_box_get_public_key",
712
+ params,
735
713
  is_single_thread_only: is_single_thread_only
736
714
  ) do |resp|
737
715
  if resp.success?
738
716
  yield NativeLibResponsetResult.new(
739
- result: ResultOfSigningBoxGetPublicKey.new(resp.result["pubkey"])
717
+ result: ResultOfSigningBoxGetPublicKey.new(pubkey: resp.result["pubkey"])
740
718
  )
741
719
  else
742
720
  yield resp
@@ -748,7 +726,7 @@ module TonSdk
748
726
  Interop::request_to_native_lib(ctx, "crypto.signing_box_sign", params) do |resp|
749
727
  if resp.success?
750
728
  yield NativeLibResponsetResult.new(
751
- result: ResultOfSigningBoxSign.new(resp.result["signature"])
729
+ result: ResultOfSigningBoxSign.new(signature: resp.result["signature"])
752
730
  )
753
731
  else
754
732
  yield resp
@@ -800,7 +778,7 @@ module TonSdk
800
778
  ) do |resp|
801
779
  if resp.success?
802
780
  yield NativeLibResponsetResult.new(
803
- result: RegisteredEncryptionBox.new(resp.result["handle"])
781
+ result: RegisteredEncryptionBox.new(handle: resp.result["handle"])
804
782
  )
805
783
  else
806
784
  yield resp
@@ -812,7 +790,19 @@ module TonSdk
812
790
  Interop::request_to_native_lib(ctx, "crypto.encryption_box_get_info", params) do |resp|
813
791
  if resp.success?
814
792
  yield NativeLibResponsetResult.new(
815
- result: ResultOfEncryptionBoxGetInfo.new(resp.result["info"])
793
+ result: ResultOfEncryptionBoxGetInfo.new(info: resp.result["info"])
794
+ )
795
+ else
796
+ yield resp
797
+ end
798
+ end
799
+ end
800
+
801
+ def self.create_encryption_box(ctx, params)
802
+ Interop::request_to_native_lib(ctx, "crypto.create_encryption_box", params) do |resp|
803
+ if resp.success?
804
+ yield NativeLibResponsetResult.new(
805
+ result: RegisteredEncryptionBox.new(handle: resp.result["handle"])
816
806
  )
817
807
  else
818
808
  yield resp
@@ -820,4 +810,4 @@ module TonSdk
820
810
  end
821
811
  end
822
812
  end
823
- end
813
+ end