ton-client-ruby 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/ton-client-ruby +38 -0
- data/lib/ton-client-ruby.rb +3 -0
- data/lib/ton-client-ruby/Binding/binding.rb +3 -6
- data/lib/ton-client-ruby/Client/Abi.rb +88 -6
- data/lib/ton-client-ruby/Client/Boc.rb +53 -6
- data/lib/ton-client-ruby/Client/Client.rb +41 -25
- data/lib/ton-client-ruby/Client/Context.rb +7 -2
- data/lib/ton-client-ruby/Client/Crypto.rb +200 -30
- data/lib/ton-client-ruby/Client/Debot.rb +22 -6
- data/lib/ton-client-ruby/Client/Net.rb +62 -12
- data/lib/ton-client-ruby/Client/Processing.rb +31 -6
- data/lib/ton-client-ruby/Client/Tvm.rb +36 -6
- data/lib/ton-client-ruby/Client/Utils.rb +21 -6
- data/lib/ton-client-ruby/Helpers/CommonHelpers.rb +8 -0
- data/lib/ton-client-ruby/version.rb +1 -1
- metadata +7 -5
@@ -1,189 +1,359 @@
|
|
1
1
|
module TonClient
|
2
|
-
|
3
|
-
class Crypto
|
4
2
|
|
3
|
+
class Crypto
|
5
4
|
include CommonInstanceHelpers
|
6
|
-
MODULE = self.to_s.downcase.gsub(/^(.+::|)(\w+)$/, '\2').freeze
|
7
5
|
|
8
|
-
attr_reader :
|
6
|
+
attr_reader :core, :context
|
7
|
+
MODULE = self.to_s.downcase.gsub(/^(.+::|)(\w+)$/, '\2').freeze
|
9
8
|
|
10
9
|
def initialize(context: Context.new, core: TonClient::TonBinding)
|
11
10
|
@context = context
|
12
11
|
@core = core
|
13
12
|
end
|
14
13
|
|
14
|
+
# INPUT: ParamsOfFactorize
|
15
|
+
# composite: String - # # Hexadecimal representation of u64 composite number.
|
16
|
+
# RESPONSE: ResultOfFactorize
|
17
|
+
# factors: Array - # # Two factors of composite or empty if composite can't be factorized.
|
15
18
|
def factorize(payload, &block)
|
16
19
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
17
20
|
end
|
18
21
|
|
22
|
+
# INPUT: ParamsOfModularPower
|
23
|
+
# base: String - # # `base` argument of calculation.
|
24
|
+
# exponent: String - # # `exponent` argument of calculation.
|
25
|
+
# modulus: String - # # `modulus` argument of calculation.
|
26
|
+
# RESPONSE: ResultOfModularPower
|
27
|
+
# modular_power: String - # # Result of modular exponentiation
|
19
28
|
def modular_power(payload, &block)
|
20
29
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
21
30
|
end
|
22
31
|
|
32
|
+
# INPUT: ParamsOfTonCrc16
|
33
|
+
# data: String - # # Input data for CRC calculation. # # Encoded with `base64`.
|
34
|
+
# RESPONSE: ResultOfTonCrc16
|
35
|
+
# crc: Number - # # Calculated CRC for input data.
|
23
36
|
def ton_crc16(payload, &block)
|
24
37
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
25
38
|
end
|
26
39
|
|
40
|
+
# INPUT: ParamsOfGenerateRandomBytes
|
41
|
+
# length: Number - # # Size of random byte array.
|
42
|
+
# RESPONSE: ResultOfGenerateRandomBytes
|
43
|
+
# bytes: String - # # Generated bytes encoded in `base64`.
|
27
44
|
def generate_random_bytes(payload, &block)
|
28
45
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
29
46
|
end
|
30
47
|
|
48
|
+
# INPUT: ParamsOfConvertPublicKeyToTonSafeFormat
|
49
|
+
# public_key: String - # # Public key - 64 symbols hex string
|
50
|
+
# RESPONSE: ResultOfConvertPublicKeyToTonSafeFormat
|
51
|
+
# ton_public_key: String - # # Public key represented in TON safe format.
|
31
52
|
def convert_public_key_to_ton_safe_format(payload, &block)
|
32
53
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
33
54
|
end
|
34
55
|
|
56
|
+
# RESPONSE: KeyPair
|
57
|
+
# public: String - # # Public key - 64 symbols hex string
|
58
|
+
# secret: String - # # Private key - u64 symbols hex string
|
35
59
|
def generate_random_sign_keys(&block)
|
36
|
-
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), &block)
|
60
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block)
|
37
61
|
end
|
38
62
|
|
63
|
+
# INPUT: ParamsOfSign
|
64
|
+
# unsigned: String - # # Data that must be signed encoded in `base64`.
|
65
|
+
# keys: KeyPair - # # Sign keys.
|
66
|
+
# RESPONSE: ResultOfSign
|
67
|
+
# signed: String - # # Signed data combined with signature encoded in `base64`.
|
68
|
+
# signature: String - # # Signature encoded in `hex`.
|
39
69
|
def sign(payload, &block)
|
40
70
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
41
71
|
end
|
42
72
|
|
73
|
+
# INPUT: ParamsOfVerifySignature
|
74
|
+
# signed: String - # # Signed data that must be verified encoded in `base64`.
|
75
|
+
# public: String - # # Signer's public key - 64 symbols hex string
|
76
|
+
# RESPONSE: ResultOfVerifySignature
|
77
|
+
# unsigned: String - # # Unsigned data encoded in `base64`.
|
43
78
|
def verify_signature(payload, &block)
|
44
79
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
45
80
|
end
|
46
81
|
|
82
|
+
# INPUT: ParamsOfHash
|
83
|
+
# data: String - # # Input data for hash calculation. # # Encoded with `base64`.
|
84
|
+
# RESPONSE: ResultOfHash
|
85
|
+
# hash: String - # # Hash of input `data`. # # Encoded with 'hex'.
|
47
86
|
def sha256(payload, &block)
|
48
87
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
49
88
|
end
|
50
89
|
|
90
|
+
# INPUT: ParamsOfHash
|
91
|
+
# data: String - # # Input data for hash calculation. # # Encoded with `base64`.
|
92
|
+
# RESPONSE: ResultOfHash
|
93
|
+
# hash: String - # # Hash of input `data`. # # Encoded with 'hex'.
|
51
94
|
def sha512(payload, &block)
|
52
|
-
payload[:data] = encode_to_base64(payload[:data])
|
53
95
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
54
96
|
end
|
55
97
|
|
98
|
+
# INPUT: ParamsOfScrypt
|
99
|
+
# password: String - # # The password bytes to be hashed. Must be encoded with `base64`.
|
100
|
+
# salt: String - # # Salt bytes that modify the hash to protect against Rainbow table attacks. Must be encoded with `base64`.
|
101
|
+
# log_n: Number - # # CPU/memory cost parameter
|
102
|
+
# r: Number - # # The block size parameter, which fine-tunes sequential memory read size and performance.
|
103
|
+
# p: Number - # # Parallelization parameter.
|
104
|
+
# dk_len: Number - # # Intended output length in octets of the derived key.
|
105
|
+
# RESPONSE: ResultOfScrypt
|
106
|
+
# key: String - # # Derived key. # # Encoded with `hex`.
|
56
107
|
def scrypt(payload, &block)
|
57
108
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
58
109
|
end
|
59
110
|
|
111
|
+
# INPUT: ParamsOfNaclSignKeyPairFromSecret
|
112
|
+
# secret: String - # # Secret key - unprefixed 0-padded to 64 symbols hex string
|
113
|
+
# RESPONSE: KeyPair
|
114
|
+
# public: String - # # Public key - 64 symbols hex string
|
115
|
+
# secret: String - # # Private key - u64 symbols hex string
|
60
116
|
def nacl_sign_keypair_from_secret_key(payload, &block)
|
61
117
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
62
118
|
end
|
63
119
|
|
120
|
+
# INPUT: ParamsOfNaclSign
|
121
|
+
# unsigned: String - # # Data that must be signed encoded in `base64`.
|
122
|
+
# secret: String - # # Signer's secret key - unprefixed 0-padded to 64 symbols hex string
|
123
|
+
# RESPONSE: ResultOfNaclSign
|
124
|
+
# signed: String - # # Signed data, encoded in `base64`.
|
64
125
|
def nacl_sign(payload, &block)
|
65
126
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
66
127
|
end
|
67
128
|
|
129
|
+
# INPUT: ParamsOfNaclSignOpen
|
130
|
+
# signed: String - # # Signed data that must be unsigned. # # Encoded with `base64`.
|
131
|
+
# public: String - # # Signer's public key - unprefixed 0-padded to 64 symbols hex string
|
132
|
+
# RESPONSE: ResultOfNaclSignOpen
|
133
|
+
# unsigned: String - # # Unsigned data, encoded in `base64`.
|
68
134
|
def nacl_sign_open(payload, &block)
|
69
135
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
70
136
|
end
|
71
137
|
|
138
|
+
# INPUT: ParamsOfNaclSign
|
139
|
+
# unsigned: String - # # Data that must be signed encoded in `base64`.
|
140
|
+
# secret: String - # # Signer's secret key - unprefixed 0-padded to 64 symbols hex string
|
141
|
+
# RESPONSE: ResultOfNaclSignDetached
|
142
|
+
# signature: String - # # Signature encoded in `hex`.
|
72
143
|
def nacl_sign_detached(payload, &block)
|
73
144
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
74
145
|
end
|
75
146
|
|
147
|
+
# INPUT: ParamsOfNaclSignDetachedVerify
|
148
|
+
# unsigned: String - # # Unsigned data that must be verified. # # Encoded with `base64`.
|
149
|
+
# signature: String - # # Signature that must be verified. # # Encoded with `hex`.
|
150
|
+
# public: String - # # Signer's public key - unprefixed 0-padded to 64 symbols hex string.
|
151
|
+
# RESPONSE: ResultOfNaclSignDetachedVerify
|
152
|
+
# succeeded: Boolean - # # `true` if verification succeeded or `false` if it failed
|
76
153
|
def nacl_sign_detached_verify(payload, &block)
|
77
154
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
78
155
|
end
|
79
156
|
|
157
|
+
# RESPONSE: KeyPair
|
158
|
+
# public: String - # # Public key - 64 symbols hex string
|
159
|
+
# secret: String - # # Private key - u64 symbols hex string
|
80
160
|
def nacl_box_keypair(&block)
|
81
|
-
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), &block)
|
161
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block)
|
82
162
|
end
|
83
163
|
|
164
|
+
# INPUT: ParamsOfNaclBoxKeyPairFromSecret
|
165
|
+
# secret: String - # # Secret key - unprefixed 0-padded to 64 symbols hex string
|
166
|
+
# RESPONSE: KeyPair
|
167
|
+
# public: String - # # Public key - 64 symbols hex string
|
168
|
+
# secret: String - # # Private key - u64 symbols hex string
|
84
169
|
def nacl_box_keypair_from_secret_key(payload, &block)
|
85
170
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
86
171
|
end
|
87
172
|
|
173
|
+
# INPUT: ParamsOfNaclBox
|
174
|
+
# decrypted: String - # # Data that must be encrypted encoded in `base64`.
|
175
|
+
# nonce: String - # # Nonce, encoded in `hex`
|
176
|
+
# their_public: String - # # Receiver's public key - unprefixed 0-padded to 64 symbols hex string
|
177
|
+
# secret: String - # # Sender's private key - unprefixed 0-padded to 64 symbols hex string
|
178
|
+
# RESPONSE: ResultOfNaclBox
|
179
|
+
# encrypted: String - # # Encrypted data encoded in `base64`.
|
88
180
|
def nacl_box(payload, &block)
|
89
181
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
90
182
|
end
|
91
183
|
|
184
|
+
# INPUT: ParamsOfNaclBoxOpen
|
185
|
+
# encrypted: String - # # Data that must be decrypted. # # Encoded with `base64`.
|
186
|
+
# nonce: String -
|
187
|
+
# their_public: String - # # Sender's public key - unprefixed 0-padded to 64 symbols hex string
|
188
|
+
# secret: String - # # Receiver's private key - unprefixed 0-padded to 64 symbols hex string
|
189
|
+
# RESPONSE: ResultOfNaclBoxOpen
|
190
|
+
# decrypted: String - # # Decrypted data encoded in `base64`.
|
92
191
|
def nacl_box_open(payload, &block)
|
93
192
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
94
193
|
end
|
95
194
|
|
195
|
+
# INPUT: ParamsOfNaclSecretBox
|
196
|
+
# decrypted: String - # # Data that must be encrypted. # # Encoded with `base64`.
|
197
|
+
# nonce: String - # # Nonce in `hex`
|
198
|
+
# key: String - # # Secret key - unprefixed 0-padded to 64 symbols hex string
|
199
|
+
# RESPONSE: ResultOfNaclBox
|
200
|
+
# encrypted: String - # # Encrypted data encoded in `base64`.
|
96
201
|
def nacl_secret_box(payload, &block)
|
97
202
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
98
203
|
end
|
99
204
|
|
205
|
+
# INPUT: ParamsOfNaclSecretBoxOpen
|
206
|
+
# encrypted: String - # # Data that must be decrypted. # # Encoded with `base64`.
|
207
|
+
# nonce: String - # # Nonce in `hex`
|
208
|
+
# key: String - # # Public key - unprefixed 0-padded to 64 symbols hex string
|
209
|
+
# RESPONSE: ResultOfNaclBoxOpen
|
210
|
+
# decrypted: String - # # Decrypted data encoded in `base64`.
|
100
211
|
def nacl_secret_box_open(payload, &block)
|
101
212
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
102
213
|
end
|
103
214
|
|
104
|
-
|
105
|
-
|
215
|
+
# INPUT: ParamsOfMnemonicWords
|
216
|
+
# dictionary: MnemonicDictionary - # # Dictionary identifier
|
217
|
+
# RESPONSE: ResultOfMnemonicWords
|
218
|
+
# words: String - # # The list of mnemonic words
|
219
|
+
def mnemonic_words(payload, &block)
|
220
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
106
221
|
end
|
107
222
|
|
223
|
+
# INPUT: ParamsOfMnemonicFromRandom
|
224
|
+
# dictionary: MnemonicDictionary - # # Dictionary identifier
|
225
|
+
# word_count: Number<Optional> - # # Mnemonic word count
|
226
|
+
# RESPONSE: ResultOfMnemonicFromRandom
|
227
|
+
# phrase: String - # # String of mnemonic words
|
108
228
|
def mnemonic_from_random(payload, &block)
|
109
229
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
110
230
|
end
|
111
231
|
|
232
|
+
# INPUT: ParamsOfMnemonicFromEntropy
|
233
|
+
# entropy: String - # # Entropy bytes. # # Hex encoded.
|
234
|
+
# dictionary: MnemonicDictionary - # # Dictionary identifier
|
235
|
+
# word_count: Number<Optional> - # # Mnemonic word count
|
236
|
+
# RESPONSE: ResultOfMnemonicFromEntropy
|
237
|
+
# phrase: String - # # Phrase
|
112
238
|
def mnemonic_from_entropy(payload, &block)
|
113
239
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
114
240
|
end
|
115
241
|
|
242
|
+
# INPUT: ParamsOfMnemonicVerify
|
243
|
+
# phrase: String - # # Phrase
|
244
|
+
# dictionary: MnemonicDictionary - # # Dictionary identifier
|
245
|
+
# word_count: Number<Optional> - # # Word count
|
246
|
+
# RESPONSE: ResultOfMnemonicVerify
|
247
|
+
# valid: Boolean - # # Flag indicating if the mnemonic is valid or not
|
116
248
|
def mnemonic_verify(payload, &block)
|
117
249
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
118
250
|
end
|
119
251
|
|
252
|
+
# INPUT: ParamsOfMnemonicDeriveSignKeys
|
253
|
+
# phrase: String - # # Phrase
|
254
|
+
# path: String<Optional> - # # Derivation path, for instance "m/44'/396'/0'/0/0"
|
255
|
+
# dictionary: MnemonicDictionary - # # Dictionary identifier
|
256
|
+
# word_count: Number<Optional> - # # Word count
|
257
|
+
# RESPONSE: KeyPair
|
258
|
+
# public: String - # # Public key - 64 symbols hex string
|
259
|
+
# secret: String - # # Private key - u64 symbols hex string
|
120
260
|
def mnemonic_derive_sign_keys(payload, &block)
|
121
261
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
122
262
|
end
|
123
263
|
|
264
|
+
# INPUT: ParamsOfHDKeyXPrvFromMnemonic
|
265
|
+
# phrase: String - # # String with seed phrase
|
266
|
+
# dictionary: MnemonicDictionary - # # Dictionary identifier
|
267
|
+
# word_count: Number<Optional> - # # Mnemonic word count
|
268
|
+
# RESPONSE: ResultOfHDKeyXPrvFromMnemonic
|
269
|
+
# xprv: String - # # Serialized extended master private key
|
124
270
|
def hdkey_xprv_from_mnemonic(payload, &block)
|
125
271
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
126
272
|
end
|
127
273
|
|
274
|
+
# INPUT: ParamsOfHDKeyDeriveFromXPrv
|
275
|
+
# xprv: String - # # Serialized extended private key
|
276
|
+
# child_index: Number - # # Child index (see BIP-0032)
|
277
|
+
# hardened: Boolean - # # Indicates the derivation of hardened/not-hardened key (see BIP-0032)
|
278
|
+
# RESPONSE: ResultOfHDKeyDeriveFromXPrv
|
279
|
+
# xprv: String - # # Serialized extended private key
|
128
280
|
def hdkey_derive_from_xprv(payload, &block)
|
129
281
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
130
282
|
end
|
131
283
|
|
284
|
+
# INPUT: ParamsOfHDKeyDeriveFromXPrvPath
|
285
|
+
# xprv: String - # # Serialized extended private key
|
286
|
+
# path: String - # # Derivation path, for instance "m/44'/396'/0'/0/0"
|
287
|
+
# RESPONSE: ResultOfHDKeyDeriveFromXPrvPath
|
288
|
+
# xprv: String - # # Derived serialized extended private key
|
132
289
|
def hdkey_derive_from_xprv_path(payload, &block)
|
133
290
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
134
291
|
end
|
135
292
|
|
293
|
+
# INPUT: ParamsOfHDKeySecretFromXPrv
|
294
|
+
# xprv: String - # # Serialized extended private key
|
295
|
+
# RESPONSE: ResultOfHDKeySecretFromXPrv
|
296
|
+
# secret: String - # # Private key - 64 symbols hex string
|
136
297
|
def hdkey_secret_from_xprv(payload, &block)
|
137
298
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
138
299
|
end
|
139
300
|
|
301
|
+
# INPUT: ParamsOfHDKeyPublicFromXPrv
|
302
|
+
# xprv: String - # # Serialized extended private key
|
303
|
+
# RESPONSE: ResultOfHDKeyPublicFromXPrv
|
304
|
+
# public: String - # # Public key - 64 symbols hex string
|
140
305
|
def hdkey_public_from_xprv(payload, &block)
|
141
306
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
142
307
|
end
|
143
308
|
|
309
|
+
# INPUT: ParamsOfChaCha20
|
310
|
+
# data: String - # # Source data to be encrypted or decrypted. # # Must be encoded with `base64`.
|
311
|
+
# key: String - # # 256-bit key. # # Must be encoded with `hex`.
|
312
|
+
# nonce: String - # # 96-bit nonce. # # Must be encoded with `hex`.
|
313
|
+
# RESPONSE: ResultOfChaCha20
|
314
|
+
# data: String - # # Encrypted/decrypted data. # # Encoded with `base64`.
|
144
315
|
def chacha20(payload, &block)
|
145
316
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
146
317
|
end
|
147
318
|
|
148
|
-
|
149
|
-
|
319
|
+
# RESPONSE: RegisteredSigningBox
|
320
|
+
# handle: SigningBoxHandle - # # Handle of the signing box.
|
321
|
+
def register_signing_box(&block)
|
322
|
+
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block)
|
150
323
|
end
|
151
324
|
|
325
|
+
# INPUT: KeyPair
|
326
|
+
# public: String - # # Public key - 64 symbols hex string
|
327
|
+
# secret: String - # # Private key - u64 symbols hex string
|
328
|
+
# RESPONSE: RegisteredSigningBox
|
329
|
+
# handle: SigningBoxHandle - # # Handle of the signing box.
|
152
330
|
def get_signing_box(payload, &block)
|
153
331
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
154
332
|
end
|
155
333
|
|
334
|
+
# INPUT: RegisteredSigningBox
|
335
|
+
# handle: SigningBoxHandle - # # Handle of the signing box.
|
336
|
+
# RESPONSE: ResultOfSigningBoxGetPublicKey
|
337
|
+
# pubkey: String - # # Public key of signing box. # # Encoded with hex
|
156
338
|
def signing_box_get_public_key(payload, &block)
|
157
339
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
158
340
|
end
|
159
341
|
|
342
|
+
# INPUT: ParamsOfSigningBoxSign
|
343
|
+
# signing_box: SigningBoxHandle - # # Signing Box handle.
|
344
|
+
# unsigned: String - # # Unsigned user data. # # Must be encoded with `base64`.
|
345
|
+
# RESPONSE: ResultOfSigningBoxSign
|
346
|
+
# signature: String - # # Data signature. # # Encoded with `hex`.
|
160
347
|
def signing_box_sign(payload, &block)
|
161
348
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
162
349
|
end
|
163
350
|
|
351
|
+
# INPUT: RegisteredSigningBox
|
352
|
+
# handle: SigningBoxHandle - # # Handle of the signing box.
|
164
353
|
def remove_signing_box(payload, &block)
|
165
354
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
166
355
|
end
|
167
356
|
|
168
|
-
private
|
169
|
-
|
170
|
-
def base64?(value)
|
171
|
-
value.is_a?(String) && (Base64.encode64(Base64.decode64(value)).strip == value)
|
172
|
-
end
|
173
|
-
|
174
|
-
def encode_to_base64(message)
|
175
|
-
return message if base64?(message)
|
176
|
-
Base64.encode64(message.force_encoding('UTF-8')).strip
|
177
|
-
end
|
178
|
-
|
179
357
|
end
|
180
358
|
end
|
181
359
|
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module TonClient
|
2
|
-
|
2
|
+
|
3
3
|
class Debot
|
4
4
|
include CommonInstanceHelpers
|
5
5
|
|
@@ -11,34 +11,50 @@ module TonClient
|
|
11
11
|
@core = core
|
12
12
|
end
|
13
13
|
|
14
|
+
# INPUT: ParamsOfInit
|
15
|
+
# address: String - # # Debot smart contract address
|
16
|
+
# RESPONSE: RegisteredDebot
|
17
|
+
# debot_handle: DebotHandle - # # Debot handle which references an instance of debot engine.
|
18
|
+
# debot_abi: String - # # Debot abi as json string.
|
19
|
+
# info: DebotInfo - # # Debot metadata.
|
14
20
|
def init(payload, &block)
|
15
21
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
16
22
|
end
|
17
23
|
|
24
|
+
# INPUT: ParamsOfStart
|
25
|
+
# debot_handle: DebotHandle - # # Debot handle which references an instance of debot engine.
|
18
26
|
def start(payload, &block)
|
19
27
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
20
28
|
end
|
21
29
|
|
30
|
+
# INPUT: ParamsOfFetch
|
31
|
+
# address: String - # # Debot smart contract address.
|
32
|
+
# RESPONSE: ResultOfFetch
|
33
|
+
# info: DebotInfo - # # Debot metadata.
|
22
34
|
def fetch(payload, &block)
|
23
35
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
24
36
|
end
|
25
37
|
|
38
|
+
# INPUT: ParamsOfExecute
|
39
|
+
# debot_handle: DebotHandle - # # Debot handle which references an instance of debot engine.
|
40
|
+
# action: DebotAction - # # Debot Action that must be executed.
|
26
41
|
def execute(payload, &block)
|
27
42
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
28
43
|
end
|
29
44
|
|
45
|
+
# INPUT: ParamsOfSend
|
46
|
+
# debot_handle: DebotHandle - # # Debot handle which references an instance of debot engine.
|
47
|
+
# message: String - # # BOC of internal message to debot encoded in base64 format.
|
30
48
|
def send(payload, &block)
|
31
49
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
32
50
|
end
|
33
51
|
|
52
|
+
# INPUT: ParamsOfRemove
|
53
|
+
# debot_handle: DebotHandle - # # Debot handle which references an instance of debot engine.
|
34
54
|
def remove(payload, &block)
|
35
55
|
core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
36
56
|
end
|
57
|
+
|
37
58
|
end
|
38
59
|
end
|
39
60
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|