ton_sdk_client 1.21.5 → 1.26.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 +13 -0
- data/README.md +2 -2
- data/lib/ton_sdk_client/abi.rb +236 -78
- data/lib/ton_sdk_client/boc.rb +213 -63
- data/lib/ton_sdk_client/client.rb +17 -19
- data/lib/ton_sdk_client/client_context.rb +3 -1
- data/lib/ton_sdk_client/config.rb +7 -9
- data/lib/ton_sdk_client/crypto.rb +183 -225
- data/lib/ton_sdk_client/debot.rb +19 -20
- data/lib/ton_sdk_client/interop.rb +4 -4
- data/lib/ton_sdk_client/kw_struct.rb +7 -0
- data/lib/ton_sdk_client/net.rb +65 -67
- data/lib/ton_sdk_client/processing.rb +10 -10
- data/lib/ton_sdk_client/proofs.rb +61 -0
- data/lib/ton_sdk_client/tvm.rb +13 -15
- data/lib/ton_sdk_client/types.rb +3 -2
- data/lib/ton_sdk_client/utils.rb +23 -23
- data/lib/ton_sdk_client/version.rb +2 -2
- metadata +8 -6
@@ -34,131 +34,94 @@ module TonSdk
|
|
34
34
|
IV_REQUIRED = 129
|
35
35
|
end
|
36
36
|
|
37
|
-
ParamsOfFactorize =
|
38
|
-
ResultOfFactorize =
|
39
|
-
ParamsOfModularPower =
|
40
|
-
ResultOfModularPower =
|
41
|
-
ParamsOfTonCrc16 =
|
42
|
-
|
43
|
-
ResultOfTonCrc16 =
|
44
|
-
ParamsOfGenerateRandomBytes =
|
45
|
-
ResultOfGenerateRandomBytes =
|
46
|
-
ParamsOfConvertPublicKeyToTonSafeFormat =
|
47
|
-
ResultOfConvertPublicKeyToTonSafeFormat =
|
48
|
-
|
49
|
-
KeyPair =
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
ParamsOfHash = Struct.new(:data)
|
56
|
-
ResultOfHash = Struct.new(:hash)
|
57
|
-
ParamsOfScrypt = Struct.new(:password, :salt, :log_n, :r, :p_, :dk_len, keyword_init: true)
|
58
|
-
ResultOfScrypt = Struct.new(:key)
|
59
|
-
ParamsOfNaclSignKeyPairFromSecret = Struct.new(:secret)
|
60
|
-
|
61
|
-
ParamsOfNaclSign = Struct.new(:unsigned, :secret)
|
62
|
-
ResultOfNaclSign = Struct.new(:signed)
|
63
|
-
ParamsOfNaclSignOpen = Struct.new(:signed, :public_) do
|
64
|
-
def initialize(signed:, public_:)
|
65
|
-
super
|
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
|
+
}
|
66
55
|
end
|
67
56
|
end
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
super
|
57
|
+
ParamsOfSign = KwStruct.new(:unsigned, :keys) do
|
58
|
+
def to_h
|
59
|
+
{
|
60
|
+
unsigned: unsigned,
|
61
|
+
keys: keys&.to_h
|
62
|
+
}
|
75
63
|
end
|
76
64
|
end
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
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
|
+
}
|
82
72
|
end
|
83
73
|
end
|
74
|
+
ResultOfVerifySignature = KwStruct.new(:unsigned)
|
84
75
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
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)
|
91
81
|
|
92
|
-
|
93
|
-
|
94
|
-
|
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
|
+
}
|
95
90
|
end
|
96
91
|
end
|
97
92
|
|
98
|
-
|
99
|
-
ResultOfMnemonicWords = Struct.new(:words)
|
100
|
-
ParamsOfMnemonicFromRandom = Struct.new(:dictionary, :word_count, keyword_init: true)
|
101
|
-
ResultOfMnemonicFromRandom = Struct.new(:phrase)
|
93
|
+
ResultOfNaclSignOpen = KwStruct.new(:unsigned)
|
102
94
|
|
103
|
-
|
104
|
-
attr_reader :entropy, :dictionary, :word_count
|
95
|
+
ParamsOfNaclSignDetached = KwStruct.new(:unsigned, :secret)
|
105
96
|
|
106
|
-
|
107
|
-
@entropy = entropy
|
108
|
-
@dictionary = dictionary
|
109
|
-
@word_count = word_count
|
110
|
-
end
|
97
|
+
ResultOfNaclSignDetached = KwStruct.new(:signature)
|
111
98
|
|
112
|
-
|
113
|
-
{
|
114
|
-
entropy: @entropy,
|
115
|
-
dictionary: @dictionary,
|
116
|
-
word_count: @word_count
|
117
|
-
}
|
118
|
-
end
|
119
|
-
end
|
99
|
+
ParamsOfNaclBoxKeyPairFromSecret = KwStruct.new(:secret)
|
120
100
|
|
121
|
-
|
101
|
+
ParamsOfNaclBox = KwStruct.new(:decrypted, :nonce, :their_public, :secret)
|
122
102
|
|
123
|
-
|
124
|
-
|
103
|
+
ResultOfNaclBox = KwStruct.new(:encrypted)
|
104
|
+
ParamsOfNaclBoxOpen = KwStruct.new(:encrypted, :nonce, :their_public, :secret)
|
125
105
|
|
126
|
-
|
127
|
-
|
128
|
-
@dictionary = dictionary
|
129
|
-
@word_count = word_count
|
130
|
-
end
|
106
|
+
ResultOfNaclBoxOpen = KwStruct.new(:decrypted)
|
107
|
+
ParamsOfNaclSecretBox = KwStruct.new(:decrypted, :nonce, :key)
|
131
108
|
|
132
|
-
|
133
|
-
{
|
134
|
-
phrase: @phrase,
|
135
|
-
dictionary: @dictionary,
|
136
|
-
word_count: @word_count
|
137
|
-
}
|
138
|
-
end
|
139
|
-
end
|
109
|
+
ParamsOfNaclSecretBoxOpen = KwStruct.new(:encrypted, :nonce, :key)
|
140
110
|
|
141
|
-
|
111
|
+
ParamsOfMnemonicWords = KwStruct.new(:dictionary)
|
112
|
+
ResultOfMnemonicWords = KwStruct.new(:words)
|
113
|
+
ParamsOfMnemonicFromRandom = KwStruct.new(:dictionary, :word_count)
|
114
|
+
ResultOfMnemonicFromRandom = KwStruct.new(:phrase)
|
142
115
|
|
143
|
-
|
144
|
-
attr_reader :phrase, :path, :dictionary, :word_count
|
116
|
+
ParamsOfMnemonicFromEntropy = KwStruct.new(:entropy, :dictionary, :word_count)
|
145
117
|
|
146
|
-
|
147
|
-
@phrase = phrase
|
148
|
-
@path = path
|
149
|
-
@dictionary = dictionary
|
150
|
-
@word_count = word_count
|
151
|
-
end
|
118
|
+
ResultOfMnemonicFromEntropy = KwStruct.new(:phrase)
|
152
119
|
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
word_count: @word_count
|
159
|
-
}
|
160
|
-
end
|
161
|
-
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)
|
162
125
|
|
163
126
|
class ParamsOfHDKeyXPrvFromMnemonic
|
164
127
|
attr_reader :phrase, :dictionary, :word_count
|
@@ -178,7 +141,7 @@ module TonSdk
|
|
178
141
|
end
|
179
142
|
end
|
180
143
|
|
181
|
-
ResultOfHDKeyXPrvFromMnemonic =
|
144
|
+
ResultOfHDKeyXPrvFromMnemonic = KwStruct.new(:xprv)
|
182
145
|
|
183
146
|
class ParamsOfHDKeyDeriveFromXPrv
|
184
147
|
attr_reader :xprv, :child_index, :hardened
|
@@ -198,55 +161,37 @@ module TonSdk
|
|
198
161
|
end
|
199
162
|
end
|
200
163
|
|
201
|
-
ResultOfHDKeyDeriveFromXPrv =
|
202
|
-
ParamsOfHDKeySecretFromXPrv =
|
203
|
-
ResultOfHDKeySecretFromXPrv =
|
204
|
-
ParamsOfHDKeyPublicFromXPrv =
|
205
|
-
ResultOfHDKeyPublicFromXPrv =
|
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_)
|
206
169
|
|
207
|
-
ParamsOfHDKeyDeriveFromXPrvPath =
|
208
|
-
def initialize(xprv:, path:)
|
209
|
-
super
|
210
|
-
end
|
211
|
-
end
|
170
|
+
ParamsOfHDKeyDeriveFromXPrvPath = KwStruct.new(:xprv, :path)
|
212
171
|
|
213
|
-
ResultOfHDKeyDeriveFromXPrvPath =
|
172
|
+
ResultOfHDKeyDeriveFromXPrvPath = KwStruct.new(:xprv)
|
214
173
|
|
215
|
-
ParamsOfChaCha20 =
|
216
|
-
def initialize(data:, key:, nonce:)
|
217
|
-
super
|
218
|
-
end
|
219
|
-
end
|
174
|
+
ParamsOfChaCha20 = KwStruct.new(:data, :key, :nonce)
|
220
175
|
|
221
|
-
ResultOfChaCha20 =
|
176
|
+
ResultOfChaCha20 = KwStruct.new(:data)
|
222
177
|
|
223
|
-
ParamsOfSigningBoxSign =
|
224
|
-
def initialize(signing_box:, unsigned:)
|
225
|
-
super
|
226
|
-
end
|
227
|
-
end
|
228
|
-
|
229
|
-
ResultOfSigningBoxSign = Struct.new(:signature)
|
230
|
-
RegisteredSigningBox = Struct.new(:handle)
|
231
|
-
ResultOfSigningBoxGetPublicKey = Struct.new(:pubkey)
|
178
|
+
ParamsOfSigningBoxSign = KwStruct.new(:signing_box, :unsigned)
|
232
179
|
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
def initialize(unsigned:, signature:, public_:)
|
237
|
-
@unsigned, @signature, @public_ = unsigned, signature, public_
|
238
|
-
end
|
180
|
+
ResultOfSigningBoxSign = KwStruct.new(:signature)
|
181
|
+
RegisteredSigningBox = KwStruct.new(:handle)
|
182
|
+
ResultOfSigningBoxGetPublicKey = KwStruct.new(:pubkey)
|
239
183
|
|
184
|
+
ParamsOfNaclSignDetachedVerify = KwStruct.new(:unsigned, :signature, :public_) do
|
240
185
|
def to_h
|
241
186
|
{
|
242
|
-
unsigned:
|
243
|
-
signature:
|
244
|
-
public:
|
187
|
+
unsigned: unsigned,
|
188
|
+
signature: signature,
|
189
|
+
public: public_
|
245
190
|
}
|
246
191
|
end
|
247
192
|
end
|
248
193
|
|
249
|
-
ResultOfNaclSignDetachedVerify =
|
194
|
+
ResultOfNaclSignDetachedVerify = KwStruct.new(:succeeded)
|
250
195
|
|
251
196
|
class ParamsOfAppSigningBox
|
252
197
|
TYPES = [
|
@@ -272,11 +217,11 @@ module TonSdk
|
|
272
217
|
end
|
273
218
|
end
|
274
219
|
|
275
|
-
EncryptionBoxInfo =
|
276
|
-
ParamsOfEncryptionBoxGetInfo =
|
277
|
-
ResultOfEncryptionBoxGetInfo =
|
278
|
-
RegisteredEncryptionBox =
|
279
|
-
ParamsOfCreateEncryptionBox =
|
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)
|
280
225
|
|
281
226
|
class EncryptionAlgorithm
|
282
227
|
private_class_method :new
|
@@ -298,8 +243,8 @@ module TonSdk
|
|
298
243
|
def self.factorize(ctx, params)
|
299
244
|
Interop::request_to_native_lib(ctx, "crypto.factorize", params) do |resp|
|
300
245
|
if resp.success?
|
301
|
-
yield
|
302
|
-
result: ResultOfFactorize.new(resp.result["factors"])
|
246
|
+
yield NativeLibResponseResult.new(
|
247
|
+
result: ResultOfFactorize.new(factors: resp.result["factors"])
|
303
248
|
)
|
304
249
|
else
|
305
250
|
yield resp
|
@@ -310,8 +255,8 @@ module TonSdk
|
|
310
255
|
def self.modular_power(ctx, params)
|
311
256
|
Interop::request_to_native_lib(ctx, "crypto.modular_power", params) do |resp|
|
312
257
|
if resp.success?
|
313
|
-
yield
|
314
|
-
result: ResultOfModularPower.new(resp.result["modular_power"])
|
258
|
+
yield NativeLibResponseResult.new(
|
259
|
+
result: ResultOfModularPower.new(modular_power: resp.result["modular_power"])
|
315
260
|
)
|
316
261
|
else
|
317
262
|
yield resp
|
@@ -322,8 +267,8 @@ module TonSdk
|
|
322
267
|
def self.ton_crc16(ctx, params)
|
323
268
|
Interop::request_to_native_lib(ctx, "crypto.ton_crc16", params) do |resp|
|
324
269
|
if resp.success?
|
325
|
-
yield
|
326
|
-
result: ResultOfTonCrc16.new(resp.result["crc"])
|
270
|
+
yield NativeLibResponseResult.new(
|
271
|
+
result: ResultOfTonCrc16.new(crc: resp.result["crc"])
|
327
272
|
)
|
328
273
|
else
|
329
274
|
yield resp
|
@@ -334,8 +279,8 @@ module TonSdk
|
|
334
279
|
def self.generate_random_bytes(ctx, params)
|
335
280
|
Interop::request_to_native_lib(ctx, "crypto.generate_random_bytes", params) do |resp|
|
336
281
|
if resp.success?
|
337
|
-
yield
|
338
|
-
result: ResultOfGenerateRandomBytes.new(resp.result["bytes"])
|
282
|
+
yield NativeLibResponseResult.new(
|
283
|
+
result: ResultOfGenerateRandomBytes.new(bytes: resp.result["bytes"])
|
339
284
|
)
|
340
285
|
else
|
341
286
|
yield resp
|
@@ -346,8 +291,8 @@ module TonSdk
|
|
346
291
|
def self.convert_public_key_to_ton_safe_format(ctx, params)
|
347
292
|
Interop::request_to_native_lib(ctx, "crypto.convert_public_key_to_ton_safe_format", params) do |resp|
|
348
293
|
if resp.success?
|
349
|
-
yield
|
350
|
-
result: ResultOfConvertPublicKeyToTonSafeFormat.new(resp.result["ton_public_key"])
|
294
|
+
yield NativeLibResponseResult.new(
|
295
|
+
result: ResultOfConvertPublicKeyToTonSafeFormat.new(ton_public_key: resp.result["ton_public_key"])
|
351
296
|
)
|
352
297
|
else
|
353
298
|
yield resp
|
@@ -358,7 +303,7 @@ module TonSdk
|
|
358
303
|
def self.generate_random_sign_keys(ctx, is_single_thread_only: false)
|
359
304
|
Interop::request_to_native_lib(ctx, "crypto.generate_random_sign_keys", nil, is_single_thread_only: is_single_thread_only) do |resp|
|
360
305
|
if resp.success?
|
361
|
-
yield
|
306
|
+
yield NativeLibResponseResult.new(
|
362
307
|
result: KeyPair.new(
|
363
308
|
public_: resp.result["public"],
|
364
309
|
secret: resp.result["secret"]
|
@@ -373,7 +318,7 @@ module TonSdk
|
|
373
318
|
def self.sign(ctx, params)
|
374
319
|
Interop::request_to_native_lib(ctx, "crypto.sign", params) do |resp|
|
375
320
|
if resp.success?
|
376
|
-
yield
|
321
|
+
yield NativeLibResponseResult.new(
|
377
322
|
result: ResultOfSign.new(
|
378
323
|
signed: resp.result["signed"],
|
379
324
|
signature: resp.result["signature"]
|
@@ -388,8 +333,8 @@ module TonSdk
|
|
388
333
|
def self.verify_signature(ctx, params)
|
389
334
|
Interop::request_to_native_lib(ctx, "crypto.verify_signature", params) do |resp|
|
390
335
|
if resp.success?
|
391
|
-
yield
|
392
|
-
result: ResultOfVerifySignature.new(resp.result["unsigned"])
|
336
|
+
yield NativeLibResponseResult.new(
|
337
|
+
result: ResultOfVerifySignature.new(unsigned: resp.result["unsigned"])
|
393
338
|
)
|
394
339
|
else
|
395
340
|
yield resp
|
@@ -400,8 +345,8 @@ module TonSdk
|
|
400
345
|
def self.sha256(ctx, params)
|
401
346
|
Interop::request_to_native_lib(ctx, "crypto.sha256", params) do |resp|
|
402
347
|
if resp.success?
|
403
|
-
yield
|
404
|
-
result: ResultOfHash.new(resp.result["hash"])
|
348
|
+
yield NativeLibResponseResult.new(
|
349
|
+
result: ResultOfHash.new(hash: resp.result["hash"])
|
405
350
|
)
|
406
351
|
else
|
407
352
|
yield resp
|
@@ -412,8 +357,8 @@ module TonSdk
|
|
412
357
|
def self.sha512(ctx, params)
|
413
358
|
Interop::request_to_native_lib(ctx, "crypto.sha512", params) do |resp|
|
414
359
|
if resp.success?
|
415
|
-
yield
|
416
|
-
result: ResultOfHash.new(resp.result["hash"])
|
360
|
+
yield NativeLibResponseResult.new(
|
361
|
+
result: ResultOfHash.new(hash: resp.result["hash"])
|
417
362
|
)
|
418
363
|
else
|
419
364
|
yield resp
|
@@ -424,8 +369,8 @@ module TonSdk
|
|
424
369
|
def self.scrypt(ctx, params)
|
425
370
|
Interop::request_to_native_lib(ctx, "crypto.scrypt", params) do |resp|
|
426
371
|
if resp.success?
|
427
|
-
yield
|
428
|
-
result: ResultOfScrypt.new(resp.result["key"])
|
372
|
+
yield NativeLibResponseResult.new(
|
373
|
+
result: ResultOfScrypt.new(key: resp.result["key"])
|
429
374
|
)
|
430
375
|
else
|
431
376
|
yield resp
|
@@ -436,8 +381,11 @@ module TonSdk
|
|
436
381
|
def self.nacl_sign_keypair_from_secret_key(ctx, params)
|
437
382
|
Interop::request_to_native_lib(ctx, "crypto.nacl_sign_keypair_from_secret_key", params) do |resp|
|
438
383
|
if resp.success?
|
439
|
-
yield
|
440
|
-
result: KeyPair.new(
|
384
|
+
yield NativeLibResponseResult.new(
|
385
|
+
result: KeyPair.new(
|
386
|
+
public_: resp.result["public"],
|
387
|
+
secret: resp.result["secret"]
|
388
|
+
)
|
441
389
|
)
|
442
390
|
else
|
443
391
|
yield resp
|
@@ -448,8 +396,8 @@ module TonSdk
|
|
448
396
|
def self.nacl_sign(ctx, params)
|
449
397
|
Interop::request_to_native_lib(ctx, "crypto.nacl_sign", params) do |resp|
|
450
398
|
if resp.success?
|
451
|
-
yield
|
452
|
-
result: ResultOfNaclSign.new(resp.result["signed"])
|
399
|
+
yield NativeLibResponseResult.new(
|
400
|
+
result: ResultOfNaclSign.new(signed: resp.result["signed"])
|
453
401
|
)
|
454
402
|
else
|
455
403
|
yield resp
|
@@ -460,8 +408,8 @@ module TonSdk
|
|
460
408
|
def self.nacl_sign_open(ctx, params)
|
461
409
|
Interop::request_to_native_lib(ctx, "crypto.nacl_sign_open", params) do |resp|
|
462
410
|
if resp.success?
|
463
|
-
yield
|
464
|
-
result: ResultOfNaclSignOpen.new(resp.result["unsigned"])
|
411
|
+
yield NativeLibResponseResult.new(
|
412
|
+
result: ResultOfNaclSignOpen.new(unsigned: resp.result["unsigned"])
|
465
413
|
)
|
466
414
|
else
|
467
415
|
yield resp
|
@@ -472,8 +420,8 @@ module TonSdk
|
|
472
420
|
def self.nacl_sign_detached(ctx, params)
|
473
421
|
Interop::request_to_native_lib(ctx, "crypto.nacl_sign_detached", params) do |resp|
|
474
422
|
if resp.success?
|
475
|
-
yield
|
476
|
-
result: ResultOfNaclSignDetached.new(resp.result["signature"])
|
423
|
+
yield NativeLibResponseResult.new(
|
424
|
+
result: ResultOfNaclSignDetached.new(signature: resp.result["signature"])
|
477
425
|
)
|
478
426
|
else
|
479
427
|
yield resp
|
@@ -484,8 +432,8 @@ module TonSdk
|
|
484
432
|
def self.nacl_sign_detached_verify(ctx, params)
|
485
433
|
Interop::request_to_native_lib(ctx, "crypto.nacl_sign_detached_verify", params) do |resp|
|
486
434
|
if resp.success?
|
487
|
-
yield
|
488
|
-
result: ResultOfNaclSignDetachedVerify.new(resp.result["succeeded"])
|
435
|
+
yield NativeLibResponseResult.new(
|
436
|
+
result: ResultOfNaclSignDetachedVerify.new(succeeded: resp.result["succeeded"])
|
489
437
|
)
|
490
438
|
else
|
491
439
|
yield resp
|
@@ -496,8 +444,11 @@ module TonSdk
|
|
496
444
|
def self.nacl_box_keypair(ctx)
|
497
445
|
Interop::request_to_native_lib(ctx, "crypto.nacl_box_keypair") do |resp|
|
498
446
|
if resp.success?
|
499
|
-
yield
|
500
|
-
result: KeyPair.new(
|
447
|
+
yield NativeLibResponseResult.new(
|
448
|
+
result: KeyPair.new(
|
449
|
+
public_: resp.result["public"],
|
450
|
+
secret: resp.result["secret"]
|
451
|
+
)
|
501
452
|
)
|
502
453
|
else
|
503
454
|
yield resp
|
@@ -508,8 +459,11 @@ module TonSdk
|
|
508
459
|
def self.nacl_box_keypair_from_secret_key(ctx, params)
|
509
460
|
Interop::request_to_native_lib(ctx, "crypto.nacl_box_keypair_from_secret_key", params) do |resp|
|
510
461
|
if resp.success?
|
511
|
-
yield
|
512
|
-
result: KeyPair.new(
|
462
|
+
yield NativeLibResponseResult.new(
|
463
|
+
result: KeyPair.new(
|
464
|
+
public_: resp.result["public"],
|
465
|
+
secret: resp.result["secret"]
|
466
|
+
)
|
513
467
|
)
|
514
468
|
else
|
515
469
|
yield resp
|
@@ -520,8 +474,8 @@ module TonSdk
|
|
520
474
|
def self.nacl_box(ctx, params)
|
521
475
|
Interop::request_to_native_lib(ctx, "crypto.nacl_box", params) do |resp|
|
522
476
|
if resp.success?
|
523
|
-
yield
|
524
|
-
result: ResultOfNaclBox.new(resp.result["encrypted"])
|
477
|
+
yield NativeLibResponseResult.new(
|
478
|
+
result: ResultOfNaclBox.new(encrypted: resp.result["encrypted"])
|
525
479
|
)
|
526
480
|
else
|
527
481
|
yield resp
|
@@ -532,8 +486,8 @@ module TonSdk
|
|
532
486
|
def self.nacl_box_open(ctx, params)
|
533
487
|
Interop::request_to_native_lib(ctx, "crypto.nacl_box_open", params) do |resp|
|
534
488
|
if resp.success?
|
535
|
-
yield
|
536
|
-
result: ResultOfNaclBoxOpen.new(resp.result["decrypted"])
|
489
|
+
yield NativeLibResponseResult.new(
|
490
|
+
result: ResultOfNaclBoxOpen.new(decrypted: resp.result["decrypted"])
|
537
491
|
)
|
538
492
|
else
|
539
493
|
yield resp
|
@@ -544,8 +498,8 @@ module TonSdk
|
|
544
498
|
def self.nacl_secret_box(ctx, params)
|
545
499
|
Interop::request_to_native_lib(ctx, "crypto.nacl_secret_box", params) do |resp|
|
546
500
|
if resp.success?
|
547
|
-
yield
|
548
|
-
result: ResultOfNaclBox.new(resp.result["encrypted"])
|
501
|
+
yield NativeLibResponseResult.new(
|
502
|
+
result: ResultOfNaclBox.new(encrypted: resp.result["encrypted"])
|
549
503
|
)
|
550
504
|
else
|
551
505
|
yield resp
|
@@ -556,8 +510,8 @@ module TonSdk
|
|
556
510
|
def self.nacl_secret_box_open(ctx, params)
|
557
511
|
Interop::request_to_native_lib(ctx, "crypto.nacl_secret_box_open", params) do |resp|
|
558
512
|
if resp.success?
|
559
|
-
yield
|
560
|
-
result: ResultOfNaclBoxOpen.new(resp.result["decrypted"])
|
513
|
+
yield NativeLibResponseResult.new(
|
514
|
+
result: ResultOfNaclBoxOpen.new(decrypted: resp.result["decrypted"])
|
561
515
|
)
|
562
516
|
else
|
563
517
|
yield resp
|
@@ -568,8 +522,8 @@ module TonSdk
|
|
568
522
|
def self.mnemonic_words(ctx, params)
|
569
523
|
Interop::request_to_native_lib(ctx, "crypto.mnemonic_words", params) do |resp|
|
570
524
|
if resp.success?
|
571
|
-
yield
|
572
|
-
result: ResultOfMnemonicWords.new(resp.result["words"])
|
525
|
+
yield NativeLibResponseResult.new(
|
526
|
+
result: ResultOfMnemonicWords.new(words: resp.result["words"])
|
573
527
|
)
|
574
528
|
else
|
575
529
|
yield resp
|
@@ -580,8 +534,8 @@ module TonSdk
|
|
580
534
|
def self.mnemonic_from_random(ctx, params)
|
581
535
|
Interop::request_to_native_lib(ctx, "crypto.mnemonic_from_random", params) do |resp|
|
582
536
|
if resp.success?
|
583
|
-
yield
|
584
|
-
result: ResultOfMnemonicFromRandom.new(resp.result["phrase"])
|
537
|
+
yield NativeLibResponseResult.new(
|
538
|
+
result: ResultOfMnemonicFromRandom.new(phrase: resp.result["phrase"])
|
585
539
|
)
|
586
540
|
else
|
587
541
|
yield resp
|
@@ -592,8 +546,8 @@ module TonSdk
|
|
592
546
|
def self.mnemonic_from_entropy(ctx, params)
|
593
547
|
Interop::request_to_native_lib(ctx, "crypto.mnemonic_from_entropy", params) do |resp|
|
594
548
|
if resp.success?
|
595
|
-
yield
|
596
|
-
result: ResultOfMnemonicFromEntropy.new(resp.result["phrase"])
|
549
|
+
yield NativeLibResponseResult.new(
|
550
|
+
result: ResultOfMnemonicFromEntropy.new(phrase: resp.result["phrase"])
|
597
551
|
)
|
598
552
|
else
|
599
553
|
yield resp
|
@@ -604,8 +558,8 @@ module TonSdk
|
|
604
558
|
def self.mnemonic_verify(ctx, params)
|
605
559
|
Interop::request_to_native_lib(ctx, "crypto.mnemonic_verify", params) do |resp|
|
606
560
|
if resp.success?
|
607
|
-
yield
|
608
|
-
result: ResultOfMnemonicVerify.new(resp.result["valid"])
|
561
|
+
yield NativeLibResponseResult.new(
|
562
|
+
result: ResultOfMnemonicVerify.new(valid: resp.result["valid"])
|
609
563
|
)
|
610
564
|
else
|
611
565
|
yield resp
|
@@ -616,8 +570,11 @@ module TonSdk
|
|
616
570
|
def self.mnemonic_derive_sign_keys(ctx, params)
|
617
571
|
Interop::request_to_native_lib(ctx, "crypto.mnemonic_derive_sign_keys", params) do |resp|
|
618
572
|
if resp.success?
|
619
|
-
yield
|
620
|
-
result: KeyPair.new(
|
573
|
+
yield NativeLibResponseResult.new(
|
574
|
+
result: KeyPair.new(
|
575
|
+
public_: resp.result["public"],
|
576
|
+
secret: resp.result["secret"]
|
577
|
+
)
|
621
578
|
)
|
622
579
|
else
|
623
580
|
yield resp
|
@@ -628,8 +585,8 @@ module TonSdk
|
|
628
585
|
def self.hdkey_xprv_from_mnemonic(ctx, params)
|
629
586
|
Interop::request_to_native_lib(ctx, "crypto.hdkey_xprv_from_mnemonic", params) do |resp|
|
630
587
|
if resp.success?
|
631
|
-
yield
|
632
|
-
result: ResultOfHDKeyXPrvFromMnemonic.new(resp.result["xprv"])
|
588
|
+
yield NativeLibResponseResult.new(
|
589
|
+
result: ResultOfHDKeyXPrvFromMnemonic.new(xprv: resp.result["xprv"])
|
633
590
|
)
|
634
591
|
else
|
635
592
|
yield resp
|
@@ -640,8 +597,8 @@ module TonSdk
|
|
640
597
|
def self.hdkey_derive_from_xprv(ctx, params)
|
641
598
|
Interop::request_to_native_lib(ctx, "crypto.hdkey_derive_from_xprv", params) do |resp|
|
642
599
|
if resp.success?
|
643
|
-
yield
|
644
|
-
result: ResultOfHDKeyDeriveFromXPrv.new(resp.result["xprv"])
|
600
|
+
yield NativeLibResponseResult.new(
|
601
|
+
result: ResultOfHDKeyDeriveFromXPrv.new(xprv: resp.result["xprv"])
|
645
602
|
)
|
646
603
|
else
|
647
604
|
yield resp
|
@@ -652,8 +609,8 @@ module TonSdk
|
|
652
609
|
def self.hdkey_derive_from_xprv_path(ctx, params)
|
653
610
|
Interop::request_to_native_lib(ctx, "crypto.hdkey_derive_from_xprv_path", params) do |resp|
|
654
611
|
if resp.success?
|
655
|
-
yield
|
656
|
-
result: ResultOfHDKeyDeriveFromXPrvPath.new(resp.result["xprv"])
|
612
|
+
yield NativeLibResponseResult.new(
|
613
|
+
result: ResultOfHDKeyDeriveFromXPrvPath.new(xprv: resp.result["xprv"])
|
657
614
|
)
|
658
615
|
else
|
659
616
|
yield resp
|
@@ -664,8 +621,8 @@ module TonSdk
|
|
664
621
|
def self.hdkey_secret_from_xprv(ctx, params)
|
665
622
|
Interop::request_to_native_lib(ctx, "crypto.hdkey_secret_from_xprv", params) do |resp|
|
666
623
|
if resp.success?
|
667
|
-
yield
|
668
|
-
result: ResultOfHDKeySecretFromXPrv.new(resp.result["secret"])
|
624
|
+
yield NativeLibResponseResult.new(
|
625
|
+
result: ResultOfHDKeySecretFromXPrv.new(secret: resp.result["secret"])
|
669
626
|
)
|
670
627
|
else
|
671
628
|
yield resp
|
@@ -676,8 +633,8 @@ module TonSdk
|
|
676
633
|
def self.hdkey_public_from_xprv(ctx, params)
|
677
634
|
Interop::request_to_native_lib(ctx, "crypto.hdkey_public_from_xprv", params) do |resp|
|
678
635
|
if resp.success?
|
679
|
-
yield
|
680
|
-
result: ResultOfHDKeyPublicFromXPrv.new(resp.result["public"])
|
636
|
+
yield NativeLibResponseResult.new(
|
637
|
+
result: ResultOfHDKeyPublicFromXPrv.new(public_: resp.result["public"])
|
681
638
|
)
|
682
639
|
else
|
683
640
|
yield resp
|
@@ -688,8 +645,8 @@ module TonSdk
|
|
688
645
|
def self.chacha20(ctx, params)
|
689
646
|
Interop::request_to_native_lib(ctx, "crypto.chacha20", params) do |resp|
|
690
647
|
if resp.success?
|
691
|
-
yield
|
692
|
-
result: ResultOfChaCha20.new(resp.result["data"])
|
648
|
+
yield NativeLibResponseResult.new(
|
649
|
+
result: ResultOfChaCha20.new(data: resp.result["data"])
|
693
650
|
)
|
694
651
|
else
|
695
652
|
yield resp
|
@@ -727,8 +684,8 @@ module TonSdk
|
|
727
684
|
is_single_thread_only: is_single_thread_only
|
728
685
|
) do |resp|
|
729
686
|
if resp.success?
|
730
|
-
yield
|
731
|
-
result: RegisteredSigningBox.new(resp.result["handle"])
|
687
|
+
yield NativeLibResponseResult.new(
|
688
|
+
result: RegisteredSigningBox.new(handle: resp.result["handle"])
|
732
689
|
)
|
733
690
|
else
|
734
691
|
yield resp
|
@@ -739,8 +696,8 @@ module TonSdk
|
|
739
696
|
def self.get_signing_box(ctx, params)
|
740
697
|
Interop::request_to_native_lib(ctx, "crypto.get_signing_box", params) do |resp|
|
741
698
|
if resp.success?
|
742
|
-
yield
|
743
|
-
result: RegisteredSigningBox.new(resp.result["handle"])
|
699
|
+
yield NativeLibResponseResult.new(
|
700
|
+
result: RegisteredSigningBox.new(handle: resp.result["handle"])
|
744
701
|
)
|
745
702
|
else
|
746
703
|
yield resp
|
@@ -752,11 +709,12 @@ module TonSdk
|
|
752
709
|
Interop::request_to_native_lib(
|
753
710
|
ctx,
|
754
711
|
"crypto.signing_box_get_public_key",
|
712
|
+
params,
|
755
713
|
is_single_thread_only: is_single_thread_only
|
756
714
|
) do |resp|
|
757
715
|
if resp.success?
|
758
|
-
yield
|
759
|
-
result: ResultOfSigningBoxGetPublicKey.new(resp.result["pubkey"])
|
716
|
+
yield NativeLibResponseResult.new(
|
717
|
+
result: ResultOfSigningBoxGetPublicKey.new(pubkey: resp.result["pubkey"])
|
760
718
|
)
|
761
719
|
else
|
762
720
|
yield resp
|
@@ -767,8 +725,8 @@ module TonSdk
|
|
767
725
|
def self.signing_box_sign(ctx, params)
|
768
726
|
Interop::request_to_native_lib(ctx, "crypto.signing_box_sign", params) do |resp|
|
769
727
|
if resp.success?
|
770
|
-
yield
|
771
|
-
result: ResultOfSigningBoxSign.new(resp.result["signature"])
|
728
|
+
yield NativeLibResponseResult.new(
|
729
|
+
result: ResultOfSigningBoxSign.new(signature: resp.result["signature"])
|
772
730
|
)
|
773
731
|
else
|
774
732
|
yield resp
|
@@ -779,7 +737,7 @@ module TonSdk
|
|
779
737
|
def self.remove_signing_box(ctx, params)
|
780
738
|
Interop::request_to_native_lib(ctx, "crypto.remove_signing_box", params) do |resp|
|
781
739
|
if resp.success?
|
782
|
-
yield
|
740
|
+
yield NativeLibResponseResult.new(
|
783
741
|
result: nil
|
784
742
|
)
|
785
743
|
else
|
@@ -819,8 +777,8 @@ module TonSdk
|
|
819
777
|
is_single_thread_only: false
|
820
778
|
) do |resp|
|
821
779
|
if resp.success?
|
822
|
-
yield
|
823
|
-
result: RegisteredEncryptionBox.new(resp.result["handle"])
|
780
|
+
yield NativeLibResponseResult.new(
|
781
|
+
result: RegisteredEncryptionBox.new(handle: resp.result["handle"])
|
824
782
|
)
|
825
783
|
else
|
826
784
|
yield resp
|
@@ -831,8 +789,8 @@ module TonSdk
|
|
831
789
|
def self.encryption_box_get_info(ctx, params)
|
832
790
|
Interop::request_to_native_lib(ctx, "crypto.encryption_box_get_info", params) do |resp|
|
833
791
|
if resp.success?
|
834
|
-
yield
|
835
|
-
result: ResultOfEncryptionBoxGetInfo.new(resp.result["info"])
|
792
|
+
yield NativeLibResponseResult.new(
|
793
|
+
result: ResultOfEncryptionBoxGetInfo.new(info: resp.result["info"])
|
836
794
|
)
|
837
795
|
else
|
838
796
|
yield resp
|
@@ -843,8 +801,8 @@ module TonSdk
|
|
843
801
|
def self.create_encryption_box(ctx, params)
|
844
802
|
Interop::request_to_native_lib(ctx, "crypto.create_encryption_box", params) do |resp|
|
845
803
|
if resp.success?
|
846
|
-
yield
|
847
|
-
result: RegisteredEncryptionBox.new(resp.result["handle"])
|
804
|
+
yield NativeLibResponseResult.new(
|
805
|
+
result: RegisteredEncryptionBox.new(handle: resp.result["handle"])
|
848
806
|
)
|
849
807
|
else
|
850
808
|
yield resp
|
@@ -852,4 +810,4 @@ module TonSdk
|
|
852
810
|
end
|
853
811
|
end
|
854
812
|
end
|
855
|
-
end
|
813
|
+
end
|