ton_sdk_client 1.12.0 → 1.17.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 +22 -1
- 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 +1 -2
- 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 +156 -581
- data/lib/ton_sdk_client/debot.rb +118 -55
- 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 +12 -32
- data/lib/ton_sdk_client/version.rb +2 -2
- metadata +2 -2
@@ -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,371 +27,71 @@ module TonSdk
|
|
27
27
|
INVALID_SIGNATURE = 122
|
28
28
|
end
|
29
29
|
|
30
|
-
|
31
|
-
attr_reader :composite
|
32
|
-
|
33
|
-
def initialize(a)
|
34
|
-
@composite = a
|
35
|
-
end
|
36
|
-
|
37
|
-
def to_h = { composite: @composite }
|
38
|
-
end
|
39
|
-
|
30
|
+
ParamsOfFactorize = Struct.new(:composite)
|
40
31
|
ResultOfFactorize = Struct.new(:factors)
|
41
|
-
|
42
|
-
class ParamsOfModularPower
|
43
|
-
attr_reader :base, :exponent, :modulus
|
44
|
-
|
45
|
-
def initialize(base:, exponent:, modulus:)
|
46
|
-
@base = base
|
47
|
-
@exponent = exponent
|
48
|
-
@modulus = modulus
|
49
|
-
end
|
50
|
-
|
51
|
-
def to_h
|
52
|
-
{
|
53
|
-
base: @base,
|
54
|
-
exponent: @exponent,
|
55
|
-
modulus: @modulus
|
56
|
-
}
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
32
|
+
ParamsOfModularPower = Struct.new(:base, :exponent, :modulus, keyword_init: true)
|
60
33
|
ResultOfModularPower = Struct.new(:modular_power)
|
61
|
-
|
62
|
-
ParamsOfTonCrc16 = Struct.new(:data) do
|
63
|
-
def to_h = { data: @data }
|
64
|
-
end
|
34
|
+
ParamsOfTonCrc16 = Struct.new(:data)
|
65
35
|
|
66
36
|
ResultOfTonCrc16 = Struct.new(:crc)
|
67
|
-
|
68
|
-
ParamsOfGenerateRandomBytes = Struct.new(:length) do
|
69
|
-
def to_h = { length: @length }
|
70
|
-
end
|
71
|
-
|
37
|
+
ParamsOfGenerateRandomBytes = Struct.new(:length)
|
72
38
|
ResultOfGenerateRandomBytes = Struct.new(:bytes)
|
73
|
-
|
74
|
-
ParamsOfConvertPublicKeyToTonSafeFormat = Struct.new(:public_key) do
|
75
|
-
def to_h = { public_key: @public_key }
|
76
|
-
end
|
77
|
-
|
39
|
+
ParamsOfConvertPublicKeyToTonSafeFormat = Struct.new(:public_key)
|
78
40
|
ResultOfConvertPublicKeyToTonSafeFormat = Struct.new(:ton_public_key)
|
79
41
|
|
80
|
-
KeyPair = Struct.new(:public_, :secret)
|
81
|
-
|
82
|
-
{
|
83
|
-
public: @public_,
|
84
|
-
secret: @secret
|
85
|
-
}
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
ParamsOfSign = Struct.new(:unsigned, :keys) do
|
90
|
-
def to_h
|
91
|
-
{
|
92
|
-
unsigned: @unsigned,
|
93
|
-
keys: @keys.to_h
|
94
|
-
}
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
42
|
+
KeyPair = Struct.new(:public_, :secret)
|
43
|
+
ParamsOfSign = Struct.new(:unsigned, :keys)
|
98
44
|
ResultOfSign = Struct.new(:signed, :signature)
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
public: @public_
|
112
|
-
}
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
class ResultOfVerifySignature
|
117
|
-
attr_reader :unsigned
|
118
|
-
|
119
|
-
def initialize(a)
|
120
|
-
@unsigned = a
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
class ParamsOfHash
|
125
|
-
attr_reader :data
|
126
|
-
|
127
|
-
def initialize(a)
|
128
|
-
@data = a
|
129
|
-
end
|
130
|
-
|
131
|
-
def to_h
|
132
|
-
{
|
133
|
-
data: @data
|
134
|
-
}
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|
138
|
-
class ResultOfHash
|
139
|
-
attr_reader :hash
|
140
|
-
|
141
|
-
def initialize(a)
|
142
|
-
@hash = a
|
143
|
-
end
|
144
|
-
end
|
145
|
-
|
146
|
-
class ParamsOfScrypt
|
147
|
-
attr_reader :password, :salt, :log_n, :r, :p_, :dk_len
|
148
|
-
|
149
|
-
def initialize(password:, salt:, log_n:, r:, p_:, dk_len:)
|
150
|
-
@password = password
|
151
|
-
@salt = salt
|
152
|
-
@log_n = log_n
|
153
|
-
@r = r
|
154
|
-
@p_ = p_
|
155
|
-
@dk_len = dk_len
|
156
|
-
end
|
157
|
-
|
158
|
-
def to_h
|
159
|
-
{
|
160
|
-
password: @password,
|
161
|
-
salt: @salt,
|
162
|
-
log_n: @log_n,
|
163
|
-
r: @r,
|
164
|
-
p: @p_,
|
165
|
-
dk_len: @dk_len
|
166
|
-
}
|
167
|
-
end
|
168
|
-
end
|
169
|
-
|
170
|
-
class ResultOfScrypt
|
171
|
-
attr_reader :key
|
172
|
-
|
173
|
-
def initialize(a)
|
174
|
-
@key = a
|
175
|
-
end
|
176
|
-
end
|
177
|
-
|
178
|
-
class ParamsOfNaclSignKeyPairFromSecret
|
179
|
-
attr_reader :secret
|
180
|
-
|
181
|
-
def initialize(a)
|
182
|
-
@secret = a
|
183
|
-
end
|
184
|
-
|
185
|
-
def to_h = { secret: @secret }
|
186
|
-
end
|
187
|
-
|
188
|
-
class ParamsOfNaclSign
|
189
|
-
attr_reader :unsigned, :secret
|
190
|
-
|
191
|
-
def initialize(unsigned:, secret:)
|
192
|
-
@unsigned = unsigned
|
193
|
-
@secret = secret
|
194
|
-
end
|
195
|
-
|
196
|
-
def to_h
|
197
|
-
{
|
198
|
-
unsigned: @unsigned,
|
199
|
-
secret: @secret
|
200
|
-
}
|
201
|
-
end
|
202
|
-
end
|
203
|
-
|
204
|
-
class ResultOfNaclSign
|
205
|
-
attr_reader :signed
|
206
|
-
|
207
|
-
def initialize(a)
|
208
|
-
@signed = a
|
209
|
-
end
|
210
|
-
end
|
211
|
-
|
212
|
-
class ParamsOfNaclSignOpen
|
213
|
-
attr_reader :signed, :public_
|
214
|
-
|
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
|
215
57
|
def initialize(signed:, public_:)
|
216
|
-
|
217
|
-
@public_ = public_
|
218
|
-
end
|
219
|
-
|
220
|
-
def to_h
|
221
|
-
{
|
222
|
-
signed: @signed,
|
223
|
-
public: @public_
|
224
|
-
}
|
225
|
-
end
|
226
|
-
end
|
227
|
-
|
228
|
-
class ResultOfNaclSignOpen
|
229
|
-
attr_reader :unsigned
|
230
|
-
|
231
|
-
def initialize(a)
|
232
|
-
@unsigned = a
|
233
|
-
end
|
234
|
-
end
|
235
|
-
|
236
|
-
class ResultOfNaclSignDetached
|
237
|
-
attr_reader :signature
|
238
|
-
|
239
|
-
def initialize(a)
|
240
|
-
@signature = a
|
58
|
+
super
|
241
59
|
end
|
242
60
|
end
|
243
61
|
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
@secret = a
|
249
|
-
end
|
250
|
-
|
251
|
-
def to_h
|
252
|
-
{
|
253
|
-
secret: @secret
|
254
|
-
}
|
255
|
-
end
|
256
|
-
end
|
257
|
-
|
258
|
-
class ParamsOfNaclBox
|
259
|
-
attr_reader :decrypted, :nonce, :their_public, :secret
|
260
|
-
|
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
|
261
66
|
def initialize(decrypted:, nonce:, their_public:, secret:)
|
262
|
-
|
263
|
-
@nonce = nonce
|
264
|
-
@their_public = their_public
|
265
|
-
@secret = secret
|
266
|
-
end
|
267
|
-
|
268
|
-
def to_h
|
269
|
-
{
|
270
|
-
decrypted: @decrypted,
|
271
|
-
nonce: @nonce,
|
272
|
-
their_public: @their_public,
|
273
|
-
secret: @secret
|
274
|
-
}
|
67
|
+
super
|
275
68
|
end
|
276
69
|
end
|
277
70
|
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
def initialize(a)
|
282
|
-
@encrypted = a
|
283
|
-
end
|
284
|
-
end
|
285
|
-
|
286
|
-
class ParamsOfNaclBoxOpen
|
287
|
-
attr_reader :encrypted, :nonce, :their_public, :secret
|
288
|
-
|
71
|
+
ResultOfNaclBox = Struct.new(:encrypted)
|
72
|
+
ParamsOfNaclBoxOpen = Struct.new(:encrypted, :nonce, :their_public, :secret) do
|
289
73
|
def initialize(encrypted:, nonce:, their_public:, secret:)
|
290
|
-
|
291
|
-
@nonce = nonce
|
292
|
-
@their_public = their_public
|
293
|
-
@secret = secret
|
294
|
-
end
|
295
|
-
|
296
|
-
def to_h
|
297
|
-
{
|
298
|
-
encrypted: @encrypted,
|
299
|
-
nonce: @nonce,
|
300
|
-
their_public: @their_public,
|
301
|
-
secret: @secret
|
302
|
-
}
|
303
|
-
end
|
304
|
-
end
|
305
|
-
|
306
|
-
class ResultOfNaclBoxOpen
|
307
|
-
attr_reader :decrypted
|
308
|
-
|
309
|
-
def initialize(a)
|
310
|
-
@decrypted = a
|
74
|
+
super
|
311
75
|
end
|
312
76
|
end
|
313
77
|
|
314
|
-
|
315
|
-
|
316
|
-
|
78
|
+
ResultOfNaclBoxOpen = Struct.new(:decrypted)
|
79
|
+
ParamsOfNaclSecretBox = Struct.new(:decrypted, :nonce, :key) do
|
317
80
|
def initialize(decrypted:, nonce:, key:)
|
318
|
-
|
319
|
-
@nonce = nonce
|
320
|
-
@key = key
|
321
|
-
end
|
322
|
-
|
323
|
-
def to_h
|
324
|
-
{
|
325
|
-
decrypted: @decrypted,
|
326
|
-
nonce: @nonce,
|
327
|
-
key: @key
|
328
|
-
}
|
81
|
+
super
|
329
82
|
end
|
330
83
|
end
|
331
84
|
|
332
|
-
|
333
|
-
attr_reader :encrypted, :nonce, :key
|
334
|
-
|
85
|
+
ParamsOfNaclSecretBoxOpen = Struct.new(:encrypted, :nonce, :key) do
|
335
86
|
def initialize(encrypted:, nonce:, key:)
|
336
|
-
|
337
|
-
@nonce = nonce
|
338
|
-
@key = key
|
339
|
-
end
|
340
|
-
|
341
|
-
def to_h
|
342
|
-
{
|
343
|
-
encrypted: @encrypted,
|
344
|
-
nonce: @nonce,
|
345
|
-
key: @key
|
346
|
-
}
|
87
|
+
super
|
347
88
|
end
|
348
89
|
end
|
349
90
|
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
@dictionary = a
|
355
|
-
end
|
356
|
-
|
357
|
-
def to_h
|
358
|
-
{
|
359
|
-
dictionary: @dictionary
|
360
|
-
}
|
361
|
-
end
|
362
|
-
end
|
363
|
-
|
364
|
-
class ResultOfMnemonicWords
|
365
|
-
attr_reader :words
|
366
|
-
|
367
|
-
def initialize(a)
|
368
|
-
@words = a
|
369
|
-
end
|
370
|
-
end
|
371
|
-
|
372
|
-
class ParamsOfMnemonicFromRandom
|
373
|
-
attr_reader :dictionary, :word_count
|
374
|
-
|
375
|
-
def initialize(dictionary: nil, word_count: nil)
|
376
|
-
@dictionary = dictionary
|
377
|
-
@word_count = word_count
|
378
|
-
end
|
379
|
-
|
380
|
-
def to_h
|
381
|
-
{
|
382
|
-
dictionary: @dictionary,
|
383
|
-
word_count: @word_count
|
384
|
-
}
|
385
|
-
end
|
386
|
-
end
|
387
|
-
|
388
|
-
class ResultOfMnemonicFromRandom
|
389
|
-
attr_reader :phrase
|
390
|
-
|
391
|
-
def initialize(a)
|
392
|
-
@phrase = a
|
393
|
-
end
|
394
|
-
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)
|
395
95
|
|
396
96
|
class ParamsOfMnemonicFromEntropy
|
397
97
|
attr_reader :entropy, :dictionary, :word_count
|
@@ -411,13 +111,7 @@ module TonSdk
|
|
411
111
|
end
|
412
112
|
end
|
413
113
|
|
414
|
-
|
415
|
-
attr_reader :phrase
|
416
|
-
|
417
|
-
def initialize(a)
|
418
|
-
@phrase = a
|
419
|
-
end
|
420
|
-
end
|
114
|
+
ResultOfMnemonicFromEntropy = Struct.new(:phrase)
|
421
115
|
|
422
116
|
class ParamsOfMnemonicVerify
|
423
117
|
attr_reader :phrase, :dictionary, :word_count
|
@@ -437,13 +131,7 @@ module TonSdk
|
|
437
131
|
end
|
438
132
|
end
|
439
133
|
|
440
|
-
|
441
|
-
attr_reader :valid
|
442
|
-
|
443
|
-
def initialize(a)
|
444
|
-
@valid = a
|
445
|
-
end
|
446
|
-
end
|
134
|
+
ResultOfMnemonicVerify = Struct.new(:valid)
|
447
135
|
|
448
136
|
class ParamsOfMnemonicDeriveSignKeys
|
449
137
|
attr_reader :phrase, :path, :dictionary, :word_count
|
@@ -483,13 +171,7 @@ module TonSdk
|
|
483
171
|
end
|
484
172
|
end
|
485
173
|
|
486
|
-
|
487
|
-
attr_reader :xprv
|
488
|
-
|
489
|
-
def initialize(a)
|
490
|
-
@xprv = a
|
491
|
-
end
|
492
|
-
end
|
174
|
+
ResultOfHDKeyXPrvFromMnemonic = Struct.new(:xprv)
|
493
175
|
|
494
176
|
class ParamsOfHDKeyDeriveFromXPrv
|
495
177
|
attr_reader :xprv, :child_index, :hardened
|
@@ -509,162 +191,37 @@ module TonSdk
|
|
509
191
|
end
|
510
192
|
end
|
511
193
|
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
end
|
518
|
-
|
519
|
-
def to_h
|
520
|
-
{
|
521
|
-
xprv: @xprv,
|
522
|
-
path: @path
|
523
|
-
}
|
524
|
-
end
|
525
|
-
end
|
526
|
-
|
527
|
-
class ParamsOfHDKeySecretFromXPrv
|
528
|
-
attr_reader :xprv
|
529
|
-
|
530
|
-
def initialize(a)
|
531
|
-
@xprv = a
|
532
|
-
end
|
533
|
-
|
534
|
-
def to_h
|
535
|
-
{
|
536
|
-
xprv: @xprv
|
537
|
-
}
|
538
|
-
end
|
539
|
-
end
|
540
|
-
|
541
|
-
class ResultOfHDKeySecretFromXPrv
|
542
|
-
attr_reader :secret
|
543
|
-
|
544
|
-
def initialize(a)
|
545
|
-
@secret = a
|
546
|
-
end
|
547
|
-
end
|
548
|
-
|
549
|
-
class ParamsOfHDKeyPublicFromXPrv
|
550
|
-
attr_reader :xprv
|
551
|
-
|
552
|
-
def initialize(a)
|
553
|
-
@xprv = a
|
554
|
-
end
|
555
|
-
|
556
|
-
def to_h
|
557
|
-
{
|
558
|
-
xprv: @xprv
|
559
|
-
}
|
560
|
-
end
|
561
|
-
end
|
562
|
-
|
563
|
-
class ResultOfHDKeyPublicFromXPrv
|
564
|
-
attr_reader :public_
|
565
|
-
|
566
|
-
def initialize(a)
|
567
|
-
@public_ = a
|
568
|
-
end
|
569
|
-
end
|
570
|
-
|
571
|
-
class ParamsOfHDKeyDeriveFromXPrvPath
|
572
|
-
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_)
|
573
199
|
|
200
|
+
ParamsOfHDKeyDeriveFromXPrvPath = Struct.new(:xprv, :path) do
|
574
201
|
def initialize(xprv:, path:)
|
575
|
-
|
576
|
-
@path = path
|
577
|
-
end
|
578
|
-
|
579
|
-
def to_h
|
580
|
-
{
|
581
|
-
xprv: @xprv,
|
582
|
-
path: @path
|
583
|
-
}
|
202
|
+
super
|
584
203
|
end
|
585
204
|
end
|
586
205
|
|
587
|
-
|
588
|
-
attr_reader :xprv
|
589
|
-
|
590
|
-
def initialize(a)
|
591
|
-
@xprv = a
|
592
|
-
end
|
593
|
-
end
|
594
|
-
|
595
|
-
class ParamsOfChaCha20
|
596
|
-
attr_reader :data, :key, :nonce
|
206
|
+
ResultOfHDKeyDeriveFromXPrvPath = Struct.new(:xprv)
|
597
207
|
|
208
|
+
ParamsOfChaCha20 = Struct.new(:data, :key, :nonce) do
|
598
209
|
def initialize(data:, key:, nonce:)
|
599
|
-
|
600
|
-
@key = key
|
601
|
-
@nonce = nonce
|
602
|
-
end
|
603
|
-
|
604
|
-
def to_h
|
605
|
-
{
|
606
|
-
data: @data,
|
607
|
-
key: @key,
|
608
|
-
nonce: @nonce
|
609
|
-
}
|
210
|
+
super
|
610
211
|
end
|
611
212
|
end
|
612
213
|
|
613
|
-
|
614
|
-
attr_reader :data
|
615
|
-
|
616
|
-
def initialize(a)
|
617
|
-
@data = a
|
618
|
-
end
|
619
|
-
end
|
620
|
-
|
621
|
-
class ParamsOfSigningBoxSign
|
622
|
-
attr_reader :signing_box, :unsigned
|
214
|
+
ResultOfChaCha20 = Struct.new(:data)
|
623
215
|
|
216
|
+
ParamsOfSigningBoxSign = Struct.new(:signing_box, :unsigned) do
|
624
217
|
def initialize(signing_box:, unsigned:)
|
625
|
-
|
626
|
-
@unsigned = unsigned
|
627
|
-
end
|
628
|
-
|
629
|
-
def to_h
|
630
|
-
{
|
631
|
-
signing_box: @signing_box,
|
632
|
-
unsigned: @unsigned
|
633
|
-
}
|
218
|
+
super
|
634
219
|
end
|
635
220
|
end
|
636
221
|
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
def initialize(a)
|
641
|
-
@signature = a
|
642
|
-
end
|
643
|
-
end
|
644
|
-
|
645
|
-
class RegisteredSigningBox
|
646
|
-
attr_reader :handle
|
647
|
-
|
648
|
-
def initialize(a)
|
649
|
-
@handle = a
|
650
|
-
end
|
651
|
-
|
652
|
-
def to_h
|
653
|
-
{
|
654
|
-
handle: @handle
|
655
|
-
}
|
656
|
-
end
|
657
|
-
end
|
658
|
-
|
659
|
-
class ResultOfSigningBoxGetPublicKey
|
660
|
-
attr_reader :pubkey
|
661
|
-
|
662
|
-
def initialize(a)
|
663
|
-
@pubkey = a
|
664
|
-
end
|
665
|
-
|
666
|
-
def to_h = { pubkey: @pubkey }
|
667
|
-
end
|
222
|
+
ResultOfSigningBoxSign = Struct.new(:signature)
|
223
|
+
RegisteredSigningBox = Struct.new(:handle)
|
224
|
+
ResultOfSigningBoxGetPublicKey = Struct.new(:pubkey)
|
668
225
|
|
669
226
|
class ParamsOfNaclSignDetachedVerify
|
670
227
|
attr_reader :unsigned, :signature, :public
|
@@ -682,15 +239,7 @@ module TonSdk
|
|
682
239
|
end
|
683
240
|
end
|
684
241
|
|
685
|
-
|
686
|
-
attr_reader :succeeded
|
687
|
-
|
688
|
-
def initialize(a)
|
689
|
-
@succeeded = a
|
690
|
-
end
|
691
|
-
|
692
|
-
def to_h = { succeeded: @succeeded }
|
693
|
-
end
|
242
|
+
ResultOfNaclSignDetachedVerify = Struct.new(:succeeded)
|
694
243
|
|
695
244
|
class ParamsOfAppSigningBox
|
696
245
|
TYPES = [
|
@@ -716,14 +265,18 @@ module TonSdk
|
|
716
265
|
end
|
717
266
|
end
|
718
267
|
|
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)
|
272
|
+
|
719
273
|
|
720
274
|
#
|
721
275
|
# functions
|
722
276
|
#
|
723
277
|
|
724
278
|
def self.factorize(ctx, params)
|
725
|
-
|
726
|
-
Interop::request_to_native_lib(ctx, "crypto.factorize", pr_json) do |resp|
|
279
|
+
Interop::request_to_native_lib(ctx, "crypto.factorize", params) do |resp|
|
727
280
|
if resp.success?
|
728
281
|
yield NativeLibResponsetResult.new(
|
729
282
|
result: ResultOfFactorize.new(resp.result["factors"])
|
@@ -735,8 +288,7 @@ module TonSdk
|
|
735
288
|
end
|
736
289
|
|
737
290
|
def self.modular_power(ctx, params)
|
738
|
-
|
739
|
-
Interop::request_to_native_lib(ctx, "crypto.modular_power", pr_json) do |resp|
|
291
|
+
Interop::request_to_native_lib(ctx, "crypto.modular_power", params) do |resp|
|
740
292
|
if resp.success?
|
741
293
|
yield NativeLibResponsetResult.new(
|
742
294
|
result: ResultOfModularPower.new(resp.result["modular_power"])
|
@@ -748,8 +300,7 @@ module TonSdk
|
|
748
300
|
end
|
749
301
|
|
750
302
|
def self.ton_crc16(ctx, params)
|
751
|
-
|
752
|
-
Interop::request_to_native_lib(ctx, "crypto.ton_crc16", pr_json) do |resp|
|
303
|
+
Interop::request_to_native_lib(ctx, "crypto.ton_crc16", params) do |resp|
|
753
304
|
if resp.success?
|
754
305
|
yield NativeLibResponsetResult.new(
|
755
306
|
result: ResultOfTonCrc16.new(resp.result["crc"])
|
@@ -761,8 +312,7 @@ module TonSdk
|
|
761
312
|
end
|
762
313
|
|
763
314
|
def self.generate_random_bytes(ctx, params)
|
764
|
-
|
765
|
-
Interop::request_to_native_lib(ctx, "crypto.generate_random_bytes", pr_json) do |resp|
|
315
|
+
Interop::request_to_native_lib(ctx, "crypto.generate_random_bytes", params) do |resp|
|
766
316
|
if resp.success?
|
767
317
|
yield NativeLibResponsetResult.new(
|
768
318
|
result: ResultOfGenerateRandomBytes.new(resp.result["bytes"])
|
@@ -774,8 +324,7 @@ module TonSdk
|
|
774
324
|
end
|
775
325
|
|
776
326
|
def self.convert_public_key_to_ton_safe_format(ctx, params)
|
777
|
-
|
778
|
-
Interop::request_to_native_lib(ctx, "crypto.convert_public_key_to_ton_safe_format", pr_json) do |resp|
|
327
|
+
Interop::request_to_native_lib(ctx, "crypto.convert_public_key_to_ton_safe_format", params) do |resp|
|
779
328
|
if resp.success?
|
780
329
|
yield NativeLibResponsetResult.new(
|
781
330
|
result: ResultOfConvertPublicKeyToTonSafeFormat.new(resp.result["ton_public_key"])
|
@@ -802,8 +351,7 @@ module TonSdk
|
|
802
351
|
end
|
803
352
|
|
804
353
|
def self.sign(ctx, params)
|
805
|
-
|
806
|
-
Interop::request_to_native_lib(ctx, "crypto.sign", pr_json) do |resp|
|
354
|
+
Interop::request_to_native_lib(ctx, "crypto.sign", params) do |resp|
|
807
355
|
if resp.success?
|
808
356
|
yield NativeLibResponsetResult.new(
|
809
357
|
result: ResultOfSign.new(
|
@@ -818,8 +366,7 @@ module TonSdk
|
|
818
366
|
end
|
819
367
|
|
820
368
|
def self.verify_signature(ctx, params)
|
821
|
-
|
822
|
-
Interop::request_to_native_lib(ctx, "crypto.verify_signature", pr_json) do |resp|
|
369
|
+
Interop::request_to_native_lib(ctx, "crypto.verify_signature", params) do |resp|
|
823
370
|
if resp.success?
|
824
371
|
yield NativeLibResponsetResult.new(
|
825
372
|
result: ResultOfVerifySignature.new(resp.result["unsigned"])
|
@@ -831,8 +378,7 @@ module TonSdk
|
|
831
378
|
end
|
832
379
|
|
833
380
|
def self.sha256(ctx, params)
|
834
|
-
|
835
|
-
Interop::request_to_native_lib(ctx, "crypto.sha256", pr_json) do |resp|
|
381
|
+
Interop::request_to_native_lib(ctx, "crypto.sha256", params) do |resp|
|
836
382
|
if resp.success?
|
837
383
|
yield NativeLibResponsetResult.new(
|
838
384
|
result: ResultOfHash.new(resp.result["hash"])
|
@@ -844,8 +390,7 @@ module TonSdk
|
|
844
390
|
end
|
845
391
|
|
846
392
|
def self.sha512(ctx, params)
|
847
|
-
|
848
|
-
Interop::request_to_native_lib(ctx, "crypto.sha512", pr_json) do |resp|
|
393
|
+
Interop::request_to_native_lib(ctx, "crypto.sha512", params) do |resp|
|
849
394
|
if resp.success?
|
850
395
|
yield NativeLibResponsetResult.new(
|
851
396
|
result: ResultOfHash.new(resp.result["hash"])
|
@@ -857,8 +402,7 @@ module TonSdk
|
|
857
402
|
end
|
858
403
|
|
859
404
|
def self.scrypt(ctx, params)
|
860
|
-
|
861
|
-
Interop::request_to_native_lib(ctx, "crypto.scrypt", pr_json) do |resp|
|
405
|
+
Interop::request_to_native_lib(ctx, "crypto.scrypt", params) do |resp|
|
862
406
|
if resp.success?
|
863
407
|
yield NativeLibResponsetResult.new(
|
864
408
|
result: ResultOfScrypt.new(resp.result["key"])
|
@@ -870,8 +414,7 @@ module TonSdk
|
|
870
414
|
end
|
871
415
|
|
872
416
|
def self.nacl_sign_keypair_from_secret_key(ctx, params)
|
873
|
-
|
874
|
-
Interop::request_to_native_lib(ctx, "crypto.nacl_sign_keypair_from_secret_key", pr_json) do |resp|
|
417
|
+
Interop::request_to_native_lib(ctx, "crypto.nacl_sign_keypair_from_secret_key", params) do |resp|
|
875
418
|
if resp.success?
|
876
419
|
yield NativeLibResponsetResult.new(
|
877
420
|
result: KeyPair.new(public_: resp.result["public"], secret: resp.result["secret"])
|
@@ -883,8 +426,7 @@ module TonSdk
|
|
883
426
|
end
|
884
427
|
|
885
428
|
def self.nacl_sign(ctx, params)
|
886
|
-
|
887
|
-
Interop::request_to_native_lib(ctx, "crypto.nacl_sign", pr_json) do |resp|
|
429
|
+
Interop::request_to_native_lib(ctx, "crypto.nacl_sign", params) do |resp|
|
888
430
|
if resp.success?
|
889
431
|
yield NativeLibResponsetResult.new(
|
890
432
|
result: ResultOfNaclSign.new(resp.result["signed"])
|
@@ -896,8 +438,7 @@ module TonSdk
|
|
896
438
|
end
|
897
439
|
|
898
440
|
def self.nacl_sign_open(ctx, params)
|
899
|
-
|
900
|
-
Interop::request_to_native_lib(ctx, "crypto.nacl_sign_open", pr_json) do |resp|
|
441
|
+
Interop::request_to_native_lib(ctx, "crypto.nacl_sign_open", params) do |resp|
|
901
442
|
if resp.success?
|
902
443
|
yield NativeLibResponsetResult.new(
|
903
444
|
result: ResultOfNaclSignOpen.new(resp.result["unsigned"])
|
@@ -909,8 +450,7 @@ module TonSdk
|
|
909
450
|
end
|
910
451
|
|
911
452
|
def self.nacl_sign_detached(ctx, params)
|
912
|
-
|
913
|
-
Interop::request_to_native_lib(ctx, "crypto.nacl_sign_detached", pr_json) do |resp|
|
453
|
+
Interop::request_to_native_lib(ctx, "crypto.nacl_sign_detached", params) do |resp|
|
914
454
|
if resp.success?
|
915
455
|
yield NativeLibResponsetResult.new(
|
916
456
|
result: ResultOfNaclSignDetached.new(resp.result["signature"])
|
@@ -921,8 +461,20 @@ module TonSdk
|
|
921
461
|
end
|
922
462
|
end
|
923
463
|
|
464
|
+
def self.nacl_sign_detached_verify(ctx, params)
|
465
|
+
Interop::request_to_native_lib(ctx, "crypto.nacl_sign_detached_verify", params) do |resp|
|
466
|
+
if resp.success?
|
467
|
+
yield NativeLibResponsetResult.new(
|
468
|
+
result: ResultOfNaclSignDetachedVerify.new(resp.result["succeeded"])
|
469
|
+
)
|
470
|
+
else
|
471
|
+
yield resp
|
472
|
+
end
|
473
|
+
end
|
474
|
+
end
|
475
|
+
|
924
476
|
def self.nacl_box_keypair(ctx)
|
925
|
-
Interop::request_to_native_lib(ctx, "crypto.nacl_box_keypair"
|
477
|
+
Interop::request_to_native_lib(ctx, "crypto.nacl_box_keypair") do |resp|
|
926
478
|
if resp.success?
|
927
479
|
yield NativeLibResponsetResult.new(
|
928
480
|
result: KeyPair.new(public_: resp.result["public"], secret: resp.result["secret"])
|
@@ -934,8 +486,7 @@ module TonSdk
|
|
934
486
|
end
|
935
487
|
|
936
488
|
def self.nacl_box_keypair_from_secret_key(ctx, params)
|
937
|
-
|
938
|
-
Interop::request_to_native_lib(ctx, "crypto.nacl_box_keypair_from_secret_key", pr_json) do |resp|
|
489
|
+
Interop::request_to_native_lib(ctx, "crypto.nacl_box_keypair_from_secret_key", params) do |resp|
|
939
490
|
if resp.success?
|
940
491
|
yield NativeLibResponsetResult.new(
|
941
492
|
result: KeyPair.new(public_: resp.result["public"], secret: resp.result["secret"])
|
@@ -947,8 +498,7 @@ module TonSdk
|
|
947
498
|
end
|
948
499
|
|
949
500
|
def self.nacl_box(ctx, params)
|
950
|
-
|
951
|
-
Interop::request_to_native_lib(ctx, "crypto.nacl_box", pr_json) do |resp|
|
501
|
+
Interop::request_to_native_lib(ctx, "crypto.nacl_box", params) do |resp|
|
952
502
|
if resp.success?
|
953
503
|
yield NativeLibResponsetResult.new(
|
954
504
|
result: ResultOfNaclBox.new(resp.result["encrypted"])
|
@@ -960,8 +510,7 @@ module TonSdk
|
|
960
510
|
end
|
961
511
|
|
962
512
|
def self.nacl_box_open(ctx, params)
|
963
|
-
|
964
|
-
Interop::request_to_native_lib(ctx, "crypto.nacl_box_open", pr_json) do |resp|
|
513
|
+
Interop::request_to_native_lib(ctx, "crypto.nacl_box_open", params) do |resp|
|
965
514
|
if resp.success?
|
966
515
|
yield NativeLibResponsetResult.new(
|
967
516
|
result: ResultOfNaclBoxOpen.new(resp.result["decrypted"])
|
@@ -973,8 +522,7 @@ module TonSdk
|
|
973
522
|
end
|
974
523
|
|
975
524
|
def self.nacl_secret_box(ctx, params)
|
976
|
-
|
977
|
-
Interop::request_to_native_lib(ctx, "crypto.nacl_secret_box", pr_json) do |resp|
|
525
|
+
Interop::request_to_native_lib(ctx, "crypto.nacl_secret_box", params) do |resp|
|
978
526
|
if resp.success?
|
979
527
|
yield NativeLibResponsetResult.new(
|
980
528
|
result: ResultOfNaclBox.new(resp.result["encrypted"])
|
@@ -986,8 +534,7 @@ module TonSdk
|
|
986
534
|
end
|
987
535
|
|
988
536
|
def self.nacl_secret_box_open(ctx, params)
|
989
|
-
|
990
|
-
Interop::request_to_native_lib(ctx, "crypto.nacl_secret_box_open", pr_json) do |resp|
|
537
|
+
Interop::request_to_native_lib(ctx, "crypto.nacl_secret_box_open", params) do |resp|
|
991
538
|
if resp.success?
|
992
539
|
yield NativeLibResponsetResult.new(
|
993
540
|
result: ResultOfNaclBoxOpen.new(resp.result["decrypted"])
|
@@ -999,8 +546,7 @@ module TonSdk
|
|
999
546
|
end
|
1000
547
|
|
1001
548
|
def self.mnemonic_words(ctx, params)
|
1002
|
-
|
1003
|
-
Interop::request_to_native_lib(ctx, "crypto.mnemonic_words", pr_json) do |resp|
|
549
|
+
Interop::request_to_native_lib(ctx, "crypto.mnemonic_words", params) do |resp|
|
1004
550
|
if resp.success?
|
1005
551
|
yield NativeLibResponsetResult.new(
|
1006
552
|
result: ResultOfMnemonicWords.new(resp.result["words"])
|
@@ -1012,8 +558,7 @@ module TonSdk
|
|
1012
558
|
end
|
1013
559
|
|
1014
560
|
def self.mnemonic_from_random(ctx, params)
|
1015
|
-
|
1016
|
-
Interop::request_to_native_lib(ctx, "crypto.mnemonic_from_random", pr_json) do |resp|
|
561
|
+
Interop::request_to_native_lib(ctx, "crypto.mnemonic_from_random", params) do |resp|
|
1017
562
|
if resp.success?
|
1018
563
|
yield NativeLibResponsetResult.new(
|
1019
564
|
result: ResultOfMnemonicFromRandom.new(resp.result["phrase"])
|
@@ -1025,8 +570,7 @@ module TonSdk
|
|
1025
570
|
end
|
1026
571
|
|
1027
572
|
def self.mnemonic_from_entropy(ctx, params)
|
1028
|
-
|
1029
|
-
Interop::request_to_native_lib(ctx, "crypto.mnemonic_from_entropy", pr_json) do |resp|
|
573
|
+
Interop::request_to_native_lib(ctx, "crypto.mnemonic_from_entropy", params) do |resp|
|
1030
574
|
if resp.success?
|
1031
575
|
yield NativeLibResponsetResult.new(
|
1032
576
|
result: ResultOfMnemonicFromEntropy.new(resp.result["phrase"])
|
@@ -1038,8 +582,7 @@ module TonSdk
|
|
1038
582
|
end
|
1039
583
|
|
1040
584
|
def self.mnemonic_verify(ctx, params)
|
1041
|
-
|
1042
|
-
Interop::request_to_native_lib(ctx, "crypto.mnemonic_verify", pr_json) do |resp|
|
585
|
+
Interop::request_to_native_lib(ctx, "crypto.mnemonic_verify", params) do |resp|
|
1043
586
|
if resp.success?
|
1044
587
|
yield NativeLibResponsetResult.new(
|
1045
588
|
result: ResultOfMnemonicVerify.new(resp.result["valid"])
|
@@ -1051,8 +594,7 @@ module TonSdk
|
|
1051
594
|
end
|
1052
595
|
|
1053
596
|
def self.mnemonic_derive_sign_keys(ctx, params)
|
1054
|
-
|
1055
|
-
Interop::request_to_native_lib(ctx, "crypto.mnemonic_derive_sign_keys", pr_json) do |resp|
|
597
|
+
Interop::request_to_native_lib(ctx, "crypto.mnemonic_derive_sign_keys", params) do |resp|
|
1056
598
|
if resp.success?
|
1057
599
|
yield NativeLibResponsetResult.new(
|
1058
600
|
result: KeyPair.new(public_: resp.result["public"], secret: resp.result["secret"])
|
@@ -1064,8 +606,7 @@ module TonSdk
|
|
1064
606
|
end
|
1065
607
|
|
1066
608
|
def self.hdkey_xprv_from_mnemonic(ctx, params)
|
1067
|
-
|
1068
|
-
Interop::request_to_native_lib(ctx, "crypto.hdkey_xprv_from_mnemonic", pr_json) do |resp|
|
609
|
+
Interop::request_to_native_lib(ctx, "crypto.hdkey_xprv_from_mnemonic", params) do |resp|
|
1069
610
|
if resp.success?
|
1070
611
|
yield NativeLibResponsetResult.new(
|
1071
612
|
result: ResultOfHDKeyXPrvFromMnemonic.new(resp.result["xprv"])
|
@@ -1077,8 +618,7 @@ module TonSdk
|
|
1077
618
|
end
|
1078
619
|
|
1079
620
|
def self.hdkey_derive_from_xprv(ctx, params)
|
1080
|
-
|
1081
|
-
Interop::request_to_native_lib(ctx, "crypto.hdkey_derive_from_xprv", pr_json) do |resp|
|
621
|
+
Interop::request_to_native_lib(ctx, "crypto.hdkey_derive_from_xprv", params) do |resp|
|
1082
622
|
if resp.success?
|
1083
623
|
yield NativeLibResponsetResult.new(
|
1084
624
|
result: ResultOfHDKeyDeriveFromXPrv.new(resp.result["xprv"])
|
@@ -1090,8 +630,7 @@ module TonSdk
|
|
1090
630
|
end
|
1091
631
|
|
1092
632
|
def self.hdkey_derive_from_xprv_path(ctx, params)
|
1093
|
-
|
1094
|
-
Interop::request_to_native_lib(ctx, "crypto.hdkey_derive_from_xprv_path", pr_json) do |resp|
|
633
|
+
Interop::request_to_native_lib(ctx, "crypto.hdkey_derive_from_xprv_path", params) do |resp|
|
1095
634
|
if resp.success?
|
1096
635
|
yield NativeLibResponsetResult.new(
|
1097
636
|
result: ResultOfHDKeyDeriveFromXPrvPath.new(resp.result["xprv"])
|
@@ -1103,8 +642,7 @@ module TonSdk
|
|
1103
642
|
end
|
1104
643
|
|
1105
644
|
def self.hdkey_secret_from_xprv(ctx, params)
|
1106
|
-
|
1107
|
-
Interop::request_to_native_lib(ctx, "crypto.hdkey_secret_from_xprv", pr_json) do |resp|
|
645
|
+
Interop::request_to_native_lib(ctx, "crypto.hdkey_secret_from_xprv", params) do |resp|
|
1108
646
|
if resp.success?
|
1109
647
|
yield NativeLibResponsetResult.new(
|
1110
648
|
result: ResultOfHDKeySecretFromXPrv.new(resp.result["secret"])
|
@@ -1116,8 +654,7 @@ module TonSdk
|
|
1116
654
|
end
|
1117
655
|
|
1118
656
|
def self.hdkey_public_from_xprv(ctx, params)
|
1119
|
-
|
1120
|
-
Interop::request_to_native_lib(ctx, "crypto.hdkey_public_from_xprv", pr_json) do |resp|
|
657
|
+
Interop::request_to_native_lib(ctx, "crypto.hdkey_public_from_xprv", params) do |resp|
|
1121
658
|
if resp.success?
|
1122
659
|
yield NativeLibResponsetResult.new(
|
1123
660
|
result: ResultOfHDKeyPublicFromXPrv.new(resp.result["public"])
|
@@ -1129,8 +666,7 @@ module TonSdk
|
|
1129
666
|
end
|
1130
667
|
|
1131
668
|
def self.chacha20(ctx, params)
|
1132
|
-
|
1133
|
-
Interop::request_to_native_lib(ctx, "crypto.chacha20", pr_json) do |resp|
|
669
|
+
Interop::request_to_native_lib(ctx, "crypto.chacha20", params) do |resp|
|
1134
670
|
if resp.success?
|
1135
671
|
yield NativeLibResponsetResult.new(
|
1136
672
|
result: ResultOfChaCha20.new(resp.result["data"])
|
@@ -1181,7 +717,7 @@ module TonSdk
|
|
1181
717
|
end
|
1182
718
|
|
1183
719
|
def self.get_signing_box(ctx, params)
|
1184
|
-
Interop::request_to_native_lib(ctx, "crypto.get_signing_box", params
|
720
|
+
Interop::request_to_native_lib(ctx, "crypto.get_signing_box", params) do |resp|
|
1185
721
|
if resp.success?
|
1186
722
|
yield NativeLibResponsetResult.new(
|
1187
723
|
result: RegisteredSigningBox.new(resp.result["handle"])
|
@@ -1196,7 +732,6 @@ module TonSdk
|
|
1196
732
|
Interop::request_to_native_lib(
|
1197
733
|
ctx,
|
1198
734
|
"crypto.signing_box_get_public_key",
|
1199
|
-
params.to_h.to_json,
|
1200
735
|
is_single_thread_only: is_single_thread_only
|
1201
736
|
) do |resp|
|
1202
737
|
if resp.success?
|
@@ -1210,7 +745,7 @@ module TonSdk
|
|
1210
745
|
end
|
1211
746
|
|
1212
747
|
def self.signing_box_sign(ctx, params)
|
1213
|
-
Interop::request_to_native_lib(ctx, "crypto.signing_box_sign", params
|
748
|
+
Interop::request_to_native_lib(ctx, "crypto.signing_box_sign", params) do |resp|
|
1214
749
|
if resp.success?
|
1215
750
|
yield NativeLibResponsetResult.new(
|
1216
751
|
result: ResultOfSigningBoxSign.new(resp.result["signature"])
|
@@ -1222,10 +757,10 @@ module TonSdk
|
|
1222
757
|
end
|
1223
758
|
|
1224
759
|
def self.remove_signing_box(ctx, params)
|
1225
|
-
Interop::request_to_native_lib(ctx, "crypto.remove_signing_box", params
|
760
|
+
Interop::request_to_native_lib(ctx, "crypto.remove_signing_box", params) do |resp|
|
1226
761
|
if resp.success?
|
1227
762
|
yield NativeLibResponsetResult.new(
|
1228
|
-
result:
|
763
|
+
result: nil
|
1229
764
|
)
|
1230
765
|
else
|
1231
766
|
yield resp
|
@@ -1233,11 +768,51 @@ module TonSdk
|
|
1233
768
|
end
|
1234
769
|
end
|
1235
770
|
|
1236
|
-
def self.
|
1237
|
-
|
771
|
+
def self.register_encryption_box(ctx, app_obj:)
|
772
|
+
client_callback = Proc.new do |type_, x|
|
773
|
+
app_res = app_obj.request(x["request_data"])
|
774
|
+
app_req_result = case app_res
|
775
|
+
in [:success, result]
|
776
|
+
TonSdk::Client::AppRequestResult.new(
|
777
|
+
type_: :ok,
|
778
|
+
result: result
|
779
|
+
)
|
780
|
+
in [:error, text]
|
781
|
+
TonSdk::Client::AppRequestResult.new(
|
782
|
+
type_: :error,
|
783
|
+
text: text
|
784
|
+
)
|
785
|
+
end
|
786
|
+
|
787
|
+
params = TonSdk::Client::ParamsOfResolveAppRequest.new(
|
788
|
+
app_request_id: x["app_request_id"],
|
789
|
+
result: app_req_result
|
790
|
+
)
|
791
|
+
TonSdk::Client.resolve_app_request(ctx, params)
|
792
|
+
end
|
793
|
+
|
794
|
+
Interop::request_to_native_lib(
|
795
|
+
ctx,
|
796
|
+
"crypto.register_encryption_box",
|
797
|
+
nil,
|
798
|
+
client_callback: client_callback,
|
799
|
+
is_single_thread_only: false
|
800
|
+
) do |resp|
|
1238
801
|
if resp.success?
|
1239
802
|
yield NativeLibResponsetResult.new(
|
1240
|
-
result:
|
803
|
+
result: RegisteredEncryptionBox.new(resp.result["handle"])
|
804
|
+
)
|
805
|
+
else
|
806
|
+
yield resp
|
807
|
+
end
|
808
|
+
end
|
809
|
+
end
|
810
|
+
|
811
|
+
def self.encryption_box_get_info(ctx, params)
|
812
|
+
Interop::request_to_native_lib(ctx, "crypto.encryption_box_get_info", params) do |resp|
|
813
|
+
if resp.success?
|
814
|
+
yield NativeLibResponsetResult.new(
|
815
|
+
result: ResultOfEncryptionBoxGetInfo.new(resp.result["info"])
|
1241
816
|
)
|
1242
817
|
else
|
1243
818
|
yield resp
|