everscale-client-ruby 1.1.44 → 1.1.49

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,65 +3,74 @@ module TonClient
3
3
  class Client
4
4
  include CommonInstanceHelpers
5
5
 
6
- attr_reader :core, :context
6
+ attr_reader :context, :context_config, :request_id, :requests
7
7
  private_accessor :_crypto, :_abi, :_boc, :_processing, :_utils, :_tvm, :_net, :_debot, :_proofs
8
8
  MODULE = self.to_s.downcase.gsub(/^(.+::|)(\w+)$/, '\2').freeze
9
9
 
10
- def initialize(context: Context.new, core: TonClient::TonBinding)
11
- @context = context
12
- @core = core
10
+ def initialize(context_config: {})
11
+ @context_config = context_config
12
+ @request_id = Concurrent::AtomicFixnum.new(1)
13
+ @requests = Concurrent::Hash.new()
14
+ config = TonBinding.make_string(context_config.to_json)
15
+ context_ptr = TonBinding.tc_create_context(config)
16
+ @context = TonBinding.read_string_to_hash(context_ptr)['result']
17
+ ObjectSpace.define_finalizer(self, self.class.finalize(@context))
13
18
  end
14
19
 
15
- def destroy_context
16
- core.tc_destroy_context(context.id)
20
+ def self.finalize(ctx)
21
+ Proc.new do
22
+ if (ctx != nil) && (ctx > 0)
23
+ TonBinding.tc_destroy_context(ctx)
24
+ end
25
+ end
17
26
  end
18
27
 
19
28
  def crypto
20
- _crypto ||= Crypto.new(context: context)
29
+ _crypto ||= Crypto.new(context: context, request_id: request_id, requests: requests)
21
30
  end
22
31
 
23
32
  def abi
24
- _abi ||= Abi.new(context: context)
33
+ _abi ||= Abi.new(context: context, request_id: request_id, requests: requests)
25
34
  end
26
35
 
27
36
  def boc
28
- _boc ||= Boc.new(context: context)
37
+ _boc ||= Boc.new(context: context, request_id: request_id, requests: requests)
29
38
  end
30
39
 
31
40
  def processing
32
- _processing ||= Processing.new(context: context)
41
+ _processing ||= Processing.new(context: context, request_id: request_id, requests: requests)
33
42
  end
34
43
 
35
44
  def utils
36
- _utils ||= Utils.new(context: context)
45
+ _utils ||= Utils.new(context: context, request_id: request_id, requests: requests)
37
46
  end
38
47
 
39
48
  def tvm
40
- _tvm ||= Tvm.new(context: context)
49
+ _tvm ||= Tvm.new(context: context, request_id: request_id, requests: requests)
41
50
  end
42
51
 
43
52
  def net
44
- _net ||= Net.new(context: context)
53
+ _net ||= Net.new(context: context, request_id: request_id, requests: requests)
45
54
  end
46
55
 
47
56
  def debot
48
- _debot ||= Debot.new(context: context)
57
+ _debot ||= Debot.new(context: context, request_id: request_id, requests: requests)
49
58
  end
50
59
 
51
60
  def proofs
52
- _proofs ||= Proofs.new(context: context)
61
+ _proofs ||= Proofs.new(context: context, request_id: request_id, requests: requests)
53
62
  end
54
63
 
55
64
  # RESPONSE: ResultOfGetApiReference
56
65
  # api: Value -
57
66
  def get_api_reference(&block)
58
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block)
67
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block)
59
68
  end
60
69
 
61
70
  # RESPONSE: ResultOfVersion
62
71
  # version: String - # # Core Library version
63
72
  def version(&block)
64
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block)
73
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block)
65
74
  end
66
75
 
67
76
  # RESPONSE: ClientConfig
@@ -72,21 +81,21 @@ module TonClient
72
81
  # proofs: ProofsConfig<Optional> -
73
82
  # local_storage_path: String<Optional> - # # For file based storage is a folder name where SDK will store its data. For browser based is a browser async storage key prefix. Default (recommended) value is "~/.tonclient" for native environments and ".tonclient" for web-browser.
74
83
  def config(&block)
75
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block)
84
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block)
76
85
  end
77
86
 
78
87
  # RESPONSE: ResultOfBuildInfo
79
88
  # build_number: Number - # # Build number assigned to this build by the CI.
80
89
  # dependencies: Array - # # Fingerprint of the most important dependencies.
81
90
  def build_info(&block)
82
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block)
91
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block)
83
92
  end
84
93
 
85
94
  # INPUT: ParamsOfResolveAppRequest
86
95
  # app_request_id: Number - # # Request ID received from SDK
87
96
  # result: AppRequestResult - # # Result of request processing
88
97
  def resolve_app_request(payload, &block)
89
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
98
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
90
99
  end
91
100
 
92
101
  end
@@ -3,12 +3,13 @@ module TonClient
3
3
  class Crypto
4
4
  include CommonInstanceHelpers
5
5
 
6
- attr_reader :core, :context
6
+ attr_reader :context, :request_id, :requests
7
7
  MODULE = self.to_s.downcase.gsub(/^(.+::|)(\w+)$/, '\2').freeze
8
8
 
9
- def initialize(context: Context.new, core: TonClient::TonBinding)
9
+ def initialize(context: nil, request_id: nil, requests: nil)
10
10
  @context = context
11
- @core = core
11
+ @request_id = request_id
12
+ @requests = requests
12
13
  end
13
14
 
14
15
  # INPUT: ParamsOfFactorize
@@ -16,7 +17,7 @@ module TonClient
16
17
  # RESPONSE: ResultOfFactorize
17
18
  # factors: Array - # # Two factors of composite or empty if composite can't be factorized.
18
19
  def factorize(payload, &block)
19
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
20
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
20
21
  end
21
22
 
22
23
  # INPUT: ParamsOfModularPower
@@ -26,7 +27,7 @@ module TonClient
26
27
  # RESPONSE: ResultOfModularPower
27
28
  # modular_power: String - # # Result of modular exponentiation
28
29
  def modular_power(payload, &block)
29
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
30
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
30
31
  end
31
32
 
32
33
  # INPUT: ParamsOfTonCrc16
@@ -34,7 +35,7 @@ module TonClient
34
35
  # RESPONSE: ResultOfTonCrc16
35
36
  # crc: Number - # # Calculated CRC for input data.
36
37
  def ton_crc16(payload, &block)
37
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
38
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
38
39
  end
39
40
 
40
41
  # INPUT: ParamsOfGenerateRandomBytes
@@ -42,7 +43,7 @@ module TonClient
42
43
  # RESPONSE: ResultOfGenerateRandomBytes
43
44
  # bytes: String - # # Generated bytes encoded in `base64`.
44
45
  def generate_random_bytes(payload, &block)
45
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
46
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
46
47
  end
47
48
 
48
49
  # INPUT: ParamsOfConvertPublicKeyToTonSafeFormat
@@ -50,14 +51,14 @@ module TonClient
50
51
  # RESPONSE: ResultOfConvertPublicKeyToTonSafeFormat
51
52
  # ton_public_key: String - # # Public key represented in TON safe format.
52
53
  def convert_public_key_to_ton_safe_format(payload, &block)
53
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
54
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
54
55
  end
55
56
 
56
57
  # RESPONSE: KeyPair
57
58
  # public: String - # # Public key - 64 symbols hex string
58
59
  # secret: String - # # Private key - u64 symbols hex string
59
60
  def generate_random_sign_keys(&block)
60
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block)
61
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block)
61
62
  end
62
63
 
63
64
  # INPUT: ParamsOfSign
@@ -67,7 +68,7 @@ module TonClient
67
68
  # signed: String - # # Signed data combined with signature encoded in `base64`.
68
69
  # signature: String - # # Signature encoded in `hex`.
69
70
  def sign(payload, &block)
70
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
71
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
71
72
  end
72
73
 
73
74
  # INPUT: ParamsOfVerifySignature
@@ -76,7 +77,7 @@ module TonClient
76
77
  # RESPONSE: ResultOfVerifySignature
77
78
  # unsigned: String - # # Unsigned data encoded in `base64`.
78
79
  def verify_signature(payload, &block)
79
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
80
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
80
81
  end
81
82
 
82
83
  # INPUT: ParamsOfHash
@@ -84,7 +85,7 @@ module TonClient
84
85
  # RESPONSE: ResultOfHash
85
86
  # hash: String - # # Hash of input `data`. # # Encoded with 'hex'.
86
87
  def sha256(payload, &block)
87
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
88
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
88
89
  end
89
90
 
90
91
  # INPUT: ParamsOfHash
@@ -92,7 +93,7 @@ module TonClient
92
93
  # RESPONSE: ResultOfHash
93
94
  # hash: String - # # Hash of input `data`. # # Encoded with 'hex'.
94
95
  def sha512(payload, &block)
95
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
96
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
96
97
  end
97
98
 
98
99
  # INPUT: ParamsOfScrypt
@@ -105,7 +106,7 @@ module TonClient
105
106
  # RESPONSE: ResultOfScrypt
106
107
  # key: String - # # Derived key. # # Encoded with `hex`.
107
108
  def scrypt(payload, &block)
108
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
109
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
109
110
  end
110
111
 
111
112
  # INPUT: ParamsOfNaclSignKeyPairFromSecret
@@ -114,7 +115,7 @@ module TonClient
114
115
  # public: String - # # Public key - 64 symbols hex string
115
116
  # secret: String - # # Private key - u64 symbols hex string
116
117
  def nacl_sign_keypair_from_secret_key(payload, &block)
117
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
118
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
118
119
  end
119
120
 
120
121
  # INPUT: ParamsOfNaclSign
@@ -123,7 +124,7 @@ module TonClient
123
124
  # RESPONSE: ResultOfNaclSign
124
125
  # signed: String - # # Signed data, encoded in `base64`.
125
126
  def nacl_sign(payload, &block)
126
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
127
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
127
128
  end
128
129
 
129
130
  # INPUT: ParamsOfNaclSignOpen
@@ -132,7 +133,7 @@ module TonClient
132
133
  # RESPONSE: ResultOfNaclSignOpen
133
134
  # unsigned: String - # # Unsigned data, encoded in `base64`.
134
135
  def nacl_sign_open(payload, &block)
135
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
136
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
136
137
  end
137
138
 
138
139
  # INPUT: ParamsOfNaclSign
@@ -141,7 +142,7 @@ module TonClient
141
142
  # RESPONSE: ResultOfNaclSignDetached
142
143
  # signature: String - # # Signature encoded in `hex`.
143
144
  def nacl_sign_detached(payload, &block)
144
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
145
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
145
146
  end
146
147
 
147
148
  # INPUT: ParamsOfNaclSignDetachedVerify
@@ -151,14 +152,14 @@ module TonClient
151
152
  # RESPONSE: ResultOfNaclSignDetachedVerify
152
153
  # succeeded: Boolean - # # `true` if verification succeeded or `false` if it failed
153
154
  def nacl_sign_detached_verify(payload, &block)
154
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
155
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
155
156
  end
156
157
 
157
158
  # RESPONSE: KeyPair
158
159
  # public: String - # # Public key - 64 symbols hex string
159
160
  # secret: String - # # Private key - u64 symbols hex string
160
161
  def nacl_box_keypair(&block)
161
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block)
162
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block)
162
163
  end
163
164
 
164
165
  # INPUT: ParamsOfNaclBoxKeyPairFromSecret
@@ -167,7 +168,7 @@ module TonClient
167
168
  # public: String - # # Public key - 64 symbols hex string
168
169
  # secret: String - # # Private key - u64 symbols hex string
169
170
  def nacl_box_keypair_from_secret_key(payload, &block)
170
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
171
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
171
172
  end
172
173
 
173
174
  # INPUT: ParamsOfNaclBox
@@ -178,7 +179,7 @@ module TonClient
178
179
  # RESPONSE: ResultOfNaclBox
179
180
  # encrypted: String - # # Encrypted data encoded in `base64`.
180
181
  def nacl_box(payload, &block)
181
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
182
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
182
183
  end
183
184
 
184
185
  # INPUT: ParamsOfNaclBoxOpen
@@ -189,7 +190,7 @@ module TonClient
189
190
  # RESPONSE: ResultOfNaclBoxOpen
190
191
  # decrypted: String - # # Decrypted data encoded in `base64`.
191
192
  def nacl_box_open(payload, &block)
192
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
193
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
193
194
  end
194
195
 
195
196
  # INPUT: ParamsOfNaclSecretBox
@@ -199,7 +200,7 @@ module TonClient
199
200
  # RESPONSE: ResultOfNaclBox
200
201
  # encrypted: String - # # Encrypted data encoded in `base64`.
201
202
  def nacl_secret_box(payload, &block)
202
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
203
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
203
204
  end
204
205
 
205
206
  # INPUT: ParamsOfNaclSecretBoxOpen
@@ -209,7 +210,7 @@ module TonClient
209
210
  # RESPONSE: ResultOfNaclBoxOpen
210
211
  # decrypted: String - # # Decrypted data encoded in `base64`.
211
212
  def nacl_secret_box_open(payload, &block)
212
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
213
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
213
214
  end
214
215
 
215
216
  # INPUT: ParamsOfMnemonicWords
@@ -217,7 +218,7 @@ module TonClient
217
218
  # RESPONSE: ResultOfMnemonicWords
218
219
  # words: String - # # The list of mnemonic words
219
220
  def mnemonic_words(payload, &block)
220
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
221
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
221
222
  end
222
223
 
223
224
  # INPUT: ParamsOfMnemonicFromRandom
@@ -226,7 +227,7 @@ module TonClient
226
227
  # RESPONSE: ResultOfMnemonicFromRandom
227
228
  # phrase: String - # # String of mnemonic words
228
229
  def mnemonic_from_random(payload, &block)
229
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
230
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
230
231
  end
231
232
 
232
233
  # INPUT: ParamsOfMnemonicFromEntropy
@@ -236,7 +237,7 @@ module TonClient
236
237
  # RESPONSE: ResultOfMnemonicFromEntropy
237
238
  # phrase: String - # # Phrase
238
239
  def mnemonic_from_entropy(payload, &block)
239
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
240
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
240
241
  end
241
242
 
242
243
  # INPUT: ParamsOfMnemonicVerify
@@ -246,7 +247,7 @@ module TonClient
246
247
  # RESPONSE: ResultOfMnemonicVerify
247
248
  # valid: Boolean - # # Flag indicating if the mnemonic is valid or not
248
249
  def mnemonic_verify(payload, &block)
249
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
250
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
250
251
  end
251
252
 
252
253
  # INPUT: ParamsOfMnemonicDeriveSignKeys
@@ -258,7 +259,7 @@ module TonClient
258
259
  # public: String - # # Public key - 64 symbols hex string
259
260
  # secret: String - # # Private key - u64 symbols hex string
260
261
  def mnemonic_derive_sign_keys(payload, &block)
261
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
262
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
262
263
  end
263
264
 
264
265
  # INPUT: ParamsOfHDKeyXPrvFromMnemonic
@@ -268,7 +269,7 @@ module TonClient
268
269
  # RESPONSE: ResultOfHDKeyXPrvFromMnemonic
269
270
  # xprv: String - # # Serialized extended master private key
270
271
  def hdkey_xprv_from_mnemonic(payload, &block)
271
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
272
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
272
273
  end
273
274
 
274
275
  # INPUT: ParamsOfHDKeyDeriveFromXPrv
@@ -278,7 +279,7 @@ module TonClient
278
279
  # RESPONSE: ResultOfHDKeyDeriveFromXPrv
279
280
  # xprv: String - # # Serialized extended private key
280
281
  def hdkey_derive_from_xprv(payload, &block)
281
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
282
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
282
283
  end
283
284
 
284
285
  # INPUT: ParamsOfHDKeyDeriveFromXPrvPath
@@ -287,7 +288,7 @@ module TonClient
287
288
  # RESPONSE: ResultOfHDKeyDeriveFromXPrvPath
288
289
  # xprv: String - # # Derived serialized extended private key
289
290
  def hdkey_derive_from_xprv_path(payload, &block)
290
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
291
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
291
292
  end
292
293
 
293
294
  # INPUT: ParamsOfHDKeySecretFromXPrv
@@ -295,7 +296,7 @@ module TonClient
295
296
  # RESPONSE: ResultOfHDKeySecretFromXPrv
296
297
  # secret: String - # # Private key - 64 symbols hex string
297
298
  def hdkey_secret_from_xprv(payload, &block)
298
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
299
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
299
300
  end
300
301
 
301
302
  # INPUT: ParamsOfHDKeyPublicFromXPrv
@@ -303,7 +304,7 @@ module TonClient
303
304
  # RESPONSE: ResultOfHDKeyPublicFromXPrv
304
305
  # public: String - # # Public key - 64 symbols hex string
305
306
  def hdkey_public_from_xprv(payload, &block)
306
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
307
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
307
308
  end
308
309
 
309
310
  # INPUT: ParamsOfChaCha20
@@ -313,7 +314,7 @@ module TonClient
313
314
  # RESPONSE: ResultOfChaCha20
314
315
  # data: String - # # Encrypted/decrypted data. # # Encoded with `base64`.
315
316
  def chacha20(payload, &block)
316
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
317
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
317
318
  end
318
319
 
319
320
  # INPUT: ParamsOfCreateCryptoBox
@@ -322,13 +323,13 @@ module TonClient
322
323
  # RESPONSE: RegisteredCryptoBox
323
324
  # handle: CryptoBoxHandle -
324
325
  def create_crypto_box(payload, &block)
325
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
326
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
326
327
  end
327
328
 
328
329
  # INPUT: RegisteredCryptoBox
329
330
  # handle: CryptoBoxHandle -
330
331
  def remove_crypto_box(payload, &block)
331
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
332
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
332
333
  end
333
334
 
334
335
  # INPUT: RegisteredCryptoBox
@@ -336,7 +337,7 @@ module TonClient
336
337
  # RESPONSE: ResultOfGetCryptoBoxInfo
337
338
  # encrypted_secret: String - # # Secret (seed phrase) encrypted with salt and password.
338
339
  def get_crypto_box_info(payload, &block)
339
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
340
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
340
341
  end
341
342
 
342
343
  # INPUT: RegisteredCryptoBox
@@ -346,7 +347,7 @@ module TonClient
346
347
  # dictionary: MnemonicDictionary -
347
348
  # wordcount: Number -
348
349
  def get_crypto_box_seed_phrase(payload, &block)
349
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
350
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
350
351
  end
351
352
 
352
353
  # INPUT: ParamsOfGetSigningBoxFromCryptoBox
@@ -356,7 +357,7 @@ module TonClient
356
357
  # RESPONSE: RegisteredSigningBox
357
358
  # handle: SigningBoxHandle - # # Handle of the signing box.
358
359
  def get_signing_box_from_crypto_box(payload, &block)
359
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
360
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
360
361
  end
361
362
 
362
363
  # INPUT: ParamsOfGetEncryptionBoxFromCryptoBox
@@ -367,19 +368,19 @@ module TonClient
367
368
  # RESPONSE: RegisteredEncryptionBox
368
369
  # handle: EncryptionBoxHandle - # # Handle of the encryption box.
369
370
  def get_encryption_box_from_crypto_box(payload, &block)
370
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
371
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
371
372
  end
372
373
 
373
374
  # INPUT: RegisteredCryptoBox
374
375
  # handle: CryptoBoxHandle -
375
376
  def clear_crypto_box_secret_cache(payload, &block)
376
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
377
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
377
378
  end
378
379
 
379
380
  # RESPONSE: RegisteredSigningBox
380
381
  # handle: SigningBoxHandle - # # Handle of the signing box.
381
382
  def register_signing_box(&block)
382
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block)
383
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block)
383
384
  end
384
385
 
385
386
  # INPUT: KeyPair
@@ -388,7 +389,7 @@ module TonClient
388
389
  # RESPONSE: RegisteredSigningBox
389
390
  # handle: SigningBoxHandle - # # Handle of the signing box.
390
391
  def get_signing_box(payload, &block)
391
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
392
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
392
393
  end
393
394
 
394
395
  # INPUT: RegisteredSigningBox
@@ -396,7 +397,7 @@ module TonClient
396
397
  # RESPONSE: ResultOfSigningBoxGetPublicKey
397
398
  # pubkey: String - # # Public key of signing box. # # Encoded with hex
398
399
  def signing_box_get_public_key(payload, &block)
399
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
400
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
400
401
  end
401
402
 
402
403
  # INPUT: ParamsOfSigningBoxSign
@@ -405,25 +406,25 @@ module TonClient
405
406
  # RESPONSE: ResultOfSigningBoxSign
406
407
  # signature: String - # # Data signature. # # Encoded with `hex`.
407
408
  def signing_box_sign(payload, &block)
408
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
409
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
409
410
  end
410
411
 
411
412
  # INPUT: RegisteredSigningBox
412
413
  # handle: SigningBoxHandle - # # Handle of the signing box.
413
414
  def remove_signing_box(payload, &block)
414
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
415
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
415
416
  end
416
417
 
417
418
  # RESPONSE: RegisteredEncryptionBox
418
419
  # handle: EncryptionBoxHandle - # # Handle of the encryption box.
419
420
  def register_encryption_box(&block)
420
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block)
421
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block)
421
422
  end
422
423
 
423
424
  # INPUT: RegisteredEncryptionBox
424
425
  # handle: EncryptionBoxHandle - # # Handle of the encryption box.
425
426
  def remove_encryption_box(payload, &block)
426
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
427
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
427
428
  end
428
429
 
429
430
  # INPUT: ParamsOfEncryptionBoxGetInfo
@@ -431,7 +432,7 @@ module TonClient
431
432
  # RESPONSE: ResultOfEncryptionBoxGetInfo
432
433
  # info: EncryptionBoxInfo - # # Encryption box information
433
434
  def encryption_box_get_info(payload, &block)
434
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
435
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
435
436
  end
436
437
 
437
438
  # INPUT: ParamsOfEncryptionBoxEncrypt
@@ -440,7 +441,7 @@ module TonClient
440
441
  # RESPONSE: ResultOfEncryptionBoxEncrypt
441
442
  # data: String - # # Encrypted data, encoded in Base64. # # Padded to cipher block size
442
443
  def encryption_box_encrypt(payload, &block)
443
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
444
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
444
445
  end
445
446
 
446
447
  # INPUT: ParamsOfEncryptionBoxDecrypt
@@ -449,7 +450,7 @@ module TonClient
449
450
  # RESPONSE: ResultOfEncryptionBoxDecrypt
450
451
  # data: String - # # Decrypted data, encoded in Base64.
451
452
  def encryption_box_decrypt(payload, &block)
452
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
453
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
453
454
  end
454
455
 
455
456
  # INPUT: ParamsOfCreateEncryptionBox
@@ -457,7 +458,7 @@ module TonClient
457
458
  # RESPONSE: RegisteredEncryptionBox
458
459
  # handle: EncryptionBoxHandle - # # Handle of the encryption box.
459
460
  def create_encryption_box(payload, &block)
460
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
461
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
461
462
  end
462
463
 
463
464
  end
@@ -3,12 +3,13 @@ module TonClient
3
3
  class Debot
4
4
  include CommonInstanceHelpers
5
5
 
6
- attr_reader :core, :context
6
+ attr_reader :context, :request_id, :requests
7
7
  MODULE = self.to_s.downcase.gsub(/^(.+::|)(\w+)$/, '\2').freeze
8
8
 
9
- def initialize(context: Context.new, core: TonClient::TonBinding)
9
+ def initialize(context: nil, request_id: nil, requests: nil)
10
10
  @context = context
11
- @core = core
11
+ @request_id = request_id
12
+ @requests = requests
12
13
  end
13
14
 
14
15
  # INPUT: ParamsOfInit
@@ -18,13 +19,13 @@ module TonClient
18
19
  # debot_abi: String - # # Debot abi as json string.
19
20
  # info: DebotInfo - # # Debot metadata.
20
21
  def init(payload, &block)
21
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
22
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
22
23
  end
23
24
 
24
25
  # INPUT: ParamsOfStart
25
26
  # debot_handle: DebotHandle - # # Debot handle which references an instance of debot engine.
26
27
  def start(payload, &block)
27
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
28
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
28
29
  end
29
30
 
30
31
  # INPUT: ParamsOfFetch
@@ -32,27 +33,27 @@ module TonClient
32
33
  # RESPONSE: ResultOfFetch
33
34
  # info: DebotInfo - # # Debot metadata.
34
35
  def fetch(payload, &block)
35
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
36
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
36
37
  end
37
38
 
38
39
  # INPUT: ParamsOfExecute
39
40
  # debot_handle: DebotHandle - # # Debot handle which references an instance of debot engine.
40
41
  # action: DebotAction - # # Debot Action that must be executed.
41
42
  def execute(payload, &block)
42
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
43
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
43
44
  end
44
45
 
45
46
  # INPUT: ParamsOfSend
46
47
  # debot_handle: DebotHandle - # # Debot handle which references an instance of debot engine.
47
48
  # message: String - # # BOC of internal message to debot encoded in base64 format.
48
49
  def send(payload, &block)
49
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
50
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
50
51
  end
51
52
 
52
53
  # INPUT: ParamsOfRemove
53
54
  # debot_handle: DebotHandle - # # Debot handle which references an instance of debot engine.
54
55
  def remove(payload, &block)
55
- core.requestLibrary(context: context.id, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
56
+ TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
56
57
  end
57
58
 
58
59
  end