everscale-client-ruby 1.1.50 → 1.1.53
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/lib/code_generator/code_generator.rb +11 -8
- data/lib/everscale-client-ruby/Binding/binding.rb +41 -38
- data/lib/everscale-client-ruby/Client/Abi.rb +18 -17
- data/lib/everscale-client-ruby/Client/Boc.rb +22 -21
- data/lib/everscale-client-ruby/Client/Client.rb +18 -17
- data/lib/everscale-client-ruby/Client/Crypto.rb +54 -53
- data/lib/everscale-client-ruby/Client/Debot.rb +9 -8
- data/lib/everscale-client-ruby/Client/Net.rb +25 -24
- data/lib/everscale-client-ruby/Client/Processing.rb +6 -5
- data/lib/everscale-client-ruby/Client/Proofs.rb +6 -5
- data/lib/everscale-client-ruby/Client/Tvm.rb +6 -5
- data/lib/everscale-client-ruby/Client/Utils.rb +8 -7
- data/lib/everscale-client-ruby/Helpers/CommonHelpers.rb +38 -1
- data/lib/everscale-client-ruby/version.rb +1 -1
- data/lib/everscale-client-ruby.rb +1 -1
- metadata +6 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd4d1a9ed7a39d8fc2c88766a36ccdd69eb218803b9347d8b0a014ab3762a97b
|
4
|
+
data.tar.gz: b78741d14eb45b3ee51fcd538500e2c6727c17e01e36afb3807f6ba40a661d89
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3be72dead08887c9f647cedc5bb161b0c76101d8ed333429c58f144a676636b243d09ab52b32ba869a06b61a3adac10fb409a32675180f3d920f8780012f2d0
|
7
|
+
data.tar.gz: ae39578957576c391754e87938ac565f0cb50e8af3e4f6893e4ae087fd8fe39dd1d15e5ddb65ec79c539daa7dddec18dba38fdc62bd8ed63210a5e28dfc29d09
|
@@ -234,7 +234,7 @@ cd everscale-client-ruby\n
|
|
234
234
|
|
235
235
|
private def generateClientModule(mod, modules)
|
236
236
|
content = "module TonClient\n\n#{TAB}class #{mod.name.capitalize}\n#{TAB}#{TAB}include CommonInstanceHelpers\n\n"
|
237
|
-
content << "#{TAB}#{TAB}attr_reader :context, :context_config, :request_id, :requests\n"
|
237
|
+
content << "#{TAB}#{TAB}attr_reader :context, :context_config, :request_id, :requests, :monitor\n"
|
238
238
|
content << "#{TAB}#{TAB}private_accessor "
|
239
239
|
modules.each_with_index do |m, i|
|
240
240
|
next if m.name.downcase == 'client'
|
@@ -243,8 +243,9 @@ cd everscale-client-ruby\n
|
|
243
243
|
content << "#{TAB}#{TAB}MODULE = self.to_s.downcase.gsub(/^(.+::|)(\\w+)$/, '\\2').freeze\n\n"
|
244
244
|
content << "#{TAB}#{TAB}def initialize(context_config: {})\n"
|
245
245
|
content << "#{TAB}#{TAB}#{TAB}@context_config = context_config\n"
|
246
|
-
content << "#{TAB}#{TAB}#{TAB}@request_id =
|
247
|
-
content << "#{TAB}#{TAB}#{TAB}@requests =
|
246
|
+
content << "#{TAB}#{TAB}#{TAB}@request_id = RequestId.new\n"
|
247
|
+
content << "#{TAB}#{TAB}#{TAB}@requests = Requests.new\n"
|
248
|
+
content << "#{TAB}#{TAB}#{TAB}@monitor = Monitor.new\n"
|
248
249
|
content << "#{TAB}#{TAB}#{TAB}config = TonBinding.make_string(context_config.to_json)\n"
|
249
250
|
content << "#{TAB}#{TAB}#{TAB}context_ptr = TonBinding.tc_create_context(config)\n"
|
250
251
|
content << "#{TAB}#{TAB}#{TAB}@context = TonBinding.read_string_to_hash(context_ptr)['result']\n"
|
@@ -260,7 +261,7 @@ cd everscale-client-ruby\n
|
|
260
261
|
modules.each_with_index do |m, i|
|
261
262
|
next if m.name.downcase == 'client'
|
262
263
|
content << "#{TAB}#{TAB}def #{m.name}\n"
|
263
|
-
content << "#{TAB}#{TAB}#{TAB}_#{m.name} ||= #{m.name.capitalize}.new(context: context, request_id: request_id, requests: requests)\n"
|
264
|
+
content << "#{TAB}#{TAB}#{TAB}_#{m.name} ||= #{m.name.capitalize}.new(context: context, request_id: request_id, requests: requests, monitor: monitor)\n"
|
264
265
|
content << "#{TAB}#{TAB}end\n\n"
|
265
266
|
end
|
266
267
|
|
@@ -276,12 +277,13 @@ cd everscale-client-ruby\n
|
|
276
277
|
|
277
278
|
private def generateModule(mod)
|
278
279
|
content = "module TonClient\n\n#{TAB}class #{mod.name.capitalize}\n#{TAB}#{TAB}include CommonInstanceHelpers\n\n"
|
279
|
-
content << "#{TAB}#{TAB}attr_reader :context, :request_id, :requests\n"
|
280
|
+
content << "#{TAB}#{TAB}attr_reader :context, :request_id, :requests, :monitor\n"
|
280
281
|
content << "#{TAB}#{TAB}MODULE = self.to_s.downcase.gsub(/^(.+::|)(\\w+)$/, '\\2').freeze\n\n"
|
281
|
-
content << "#{TAB}#{TAB}def initialize(context: nil, request_id: nil, requests: nil)\n"
|
282
|
+
content << "#{TAB}#{TAB}def initialize(context: nil, request_id: nil, requests: nil, monitor: nil)\n"
|
282
283
|
content << "#{TAB}#{TAB}#{TAB}@context = context\n"
|
283
284
|
content << "#{TAB}#{TAB}#{TAB}@request_id = request_id\n"
|
284
285
|
content << "#{TAB}#{TAB}#{TAB}@requests = requests\n"
|
286
|
+
content << "#{TAB}#{TAB}#{TAB}@monitor = monitor\n"
|
285
287
|
content << "#{TAB}#{TAB}end\n\n"
|
286
288
|
|
287
289
|
mod.functions.each do |func|
|
@@ -299,11 +301,12 @@ cd everscale-client-ruby\n
|
|
299
301
|
content << "#{TAB}#{TAB}def #{function.name}"
|
300
302
|
if function.arguments.empty?
|
301
303
|
content << "(&block)\n"
|
302
|
-
|
304
|
+
payload = "{}"
|
303
305
|
else
|
304
306
|
content << "(payload, &block)\n"
|
305
|
-
|
307
|
+
payload = "payload"
|
306
308
|
end
|
309
|
+
content << "#{TAB}#{TAB}#{TAB}TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, monitor: monitor, method_name: full_method_name(MODULE, __method__.to_s), payload: #{payload}, &block)\n"
|
307
310
|
content << "#{TAB}#{TAB}end\n\n"
|
308
311
|
|
309
312
|
content
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'byebug'
|
2
|
-
|
3
1
|
module TonClient
|
4
2
|
module TonBinding
|
5
3
|
class Response
|
@@ -16,9 +14,10 @@ module TonClient
|
|
16
14
|
@request_id = request_id
|
17
15
|
@response_type = response_type
|
18
16
|
@error = string_data || "Client deallocated"
|
17
|
+
p "ERROR: #{@error}"
|
19
18
|
return self
|
20
19
|
end
|
21
|
-
|
20
|
+
|
22
21
|
response_hash = TonBinding.read_string_to_hash(string_data)
|
23
22
|
@finished = finished
|
24
23
|
@request_id = request_id
|
@@ -110,18 +109,9 @@ module TonClient
|
|
110
109
|
end
|
111
110
|
|
112
111
|
def self.make_string(string)
|
113
|
-
# p 1
|
114
112
|
result = TonBinding::TcStringDataT.new
|
115
|
-
|
116
|
-
|
117
|
-
ptr1.put_bytes(0, string, 0, bytes_count)
|
118
|
-
# ptr1.autorelease = false
|
119
|
-
# p ptr1.autorelease?
|
120
|
-
result[:content] = ptr1
|
121
|
-
# result[:content] = FFI::MemoryPointer.from_string(string)
|
122
|
-
# result[:len] = string.bytesize
|
123
|
-
result[:len] = ptr1.size
|
124
|
-
# p 2
|
113
|
+
result[:content] = FFI::MemoryPointer.from_string(string)
|
114
|
+
result[:len] = string.bytesize
|
125
115
|
result
|
126
116
|
end
|
127
117
|
|
@@ -133,7 +123,7 @@ module TonClient
|
|
133
123
|
string = tc_string_handle
|
134
124
|
end
|
135
125
|
|
136
|
-
if string[:
|
126
|
+
if string[:len] > 0
|
137
127
|
result = string[:content].read_string(string[:len])
|
138
128
|
if is_ref
|
139
129
|
tc_destroy_string(tc_string_handle)
|
@@ -165,30 +155,43 @@ module TonClient
|
|
165
155
|
end
|
166
156
|
|
167
157
|
# block = { |response| }
|
168
|
-
def self.requestLibrary(context: nil,
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
158
|
+
def self.requestLibrary(context: nil,
|
159
|
+
request_id: nil,
|
160
|
+
requests: nil,
|
161
|
+
monitor: nil,
|
162
|
+
method_name: '',
|
163
|
+
payload: {},
|
164
|
+
&block
|
165
|
+
)
|
166
|
+
monitor&.synchronize do
|
167
|
+
raise 'context not found' unless context
|
168
|
+
raise 'method_name is empty' if method_name.empty?
|
169
|
+
# raise "context: #{context}. request_id not is nil. Client dealloc." unless request_id
|
170
|
+
unless request_id
|
171
|
+
# p "context: #{context}. request_id is nil. Client deallocated."
|
172
|
+
block.call(Response.new(request_id, "Client deallocated", -1, true)) if block
|
173
|
+
return
|
174
|
+
end
|
175
|
+
method_name_string = make_string(method_name)
|
176
|
+
payload_string = make_string(payload.to_json)
|
177
|
+
|
178
|
+
request_id = request_id.increment
|
179
|
+
requests[request_id] = block
|
180
|
+
# p "start #{request_id}"
|
181
|
+
tc_request(context, method_name_string, payload_string, request_id) do |request_id, string_data, response_type, finished|
|
182
|
+
# p "tc_request #{request_id}"
|
183
|
+
# p "Thread.current #{Thread.current}"
|
184
|
+
begin
|
185
|
+
monitor.synchronize do
|
186
|
+
request = requests[request_id]
|
187
|
+
if request
|
188
|
+
request.call(Response.new(request_id, string_data, response_type, finished))
|
189
|
+
requests.delete(request_id) if finished
|
190
|
+
end
|
191
|
+
end
|
192
|
+
rescue => ex
|
193
|
+
block.call(Response.new(request_id, ex.message, -1, true)) if block
|
189
194
|
end
|
190
|
-
rescue => ex
|
191
|
-
block.call(Response.new(request_id, ex.message, -1, true)) if block
|
192
195
|
end
|
193
196
|
end
|
194
197
|
rescue => ex
|
@@ -3,13 +3,14 @@ module TonClient
|
|
3
3
|
class Abi
|
4
4
|
include CommonInstanceHelpers
|
5
5
|
|
6
|
-
attr_reader :context, :request_id, :requests
|
6
|
+
attr_reader :context, :request_id, :requests, :monitor
|
7
7
|
MODULE = self.to_s.downcase.gsub(/^(.+::|)(\w+)$/, '\2').freeze
|
8
8
|
|
9
|
-
def initialize(context: nil, request_id: nil, requests: nil)
|
9
|
+
def initialize(context: nil, request_id: nil, requests: nil, monitor: nil)
|
10
10
|
@context = context
|
11
11
|
@request_id = request_id
|
12
12
|
@requests = requests
|
13
|
+
@monitor = monitor
|
13
14
|
end
|
14
15
|
|
15
16
|
# INPUT: ParamsOfEncodeMessageBody
|
@@ -28,7 +29,7 @@ module TonClient
|
|
28
29
|
# data_to_sign: String<Optional> - # # Optional data to sign. # # Encoded with `base64`.
|
29
30
|
# # Presents when `message` is unsigned. Can be used for externalmessage signing. Is this case you need to sing this data andproduce signed message using `abi.attach_signature`.
|
30
31
|
def encode_message_body(payload, &block)
|
31
|
-
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
32
|
+
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, monitor: monitor, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
32
33
|
end
|
33
34
|
|
34
35
|
# INPUT: ParamsOfAttachSignatureToMessageBody
|
@@ -39,7 +40,7 @@ module TonClient
|
|
39
40
|
# RESPONSE: ResultOfAttachSignatureToMessageBody
|
40
41
|
# body: String -
|
41
42
|
def attach_signature_to_message_body(payload, &block)
|
42
|
-
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
43
|
+
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, monitor: monitor, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
43
44
|
end
|
44
45
|
|
45
46
|
# INPUT: ParamsOfEncodeMessage
|
@@ -60,7 +61,7 @@ module TonClient
|
|
60
61
|
# address: String - # # Destination address.
|
61
62
|
# message_id: String - # # Message id.
|
62
63
|
def encode_message(payload, &block)
|
63
|
-
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
64
|
+
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, monitor: monitor, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
64
65
|
end
|
65
66
|
|
66
67
|
# INPUT: ParamsOfEncodeInternalMessage
|
@@ -78,7 +79,7 @@ module TonClient
|
|
78
79
|
# address: String - # # Destination address.
|
79
80
|
# message_id: String - # # Message id.
|
80
81
|
def encode_internal_message(payload, &block)
|
81
|
-
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
82
|
+
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, monitor: monitor, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
82
83
|
end
|
83
84
|
|
84
85
|
# INPUT: ParamsOfAttachSignature
|
@@ -90,7 +91,7 @@ module TonClient
|
|
90
91
|
# message: String - # # Signed message BOC
|
91
92
|
# message_id: String - # # Message ID
|
92
93
|
def attach_signature(payload, &block)
|
93
|
-
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
94
|
+
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, monitor: monitor, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
94
95
|
end
|
95
96
|
|
96
97
|
# INPUT: ParamsOfDecodeMessage
|
@@ -103,7 +104,7 @@ module TonClient
|
|
103
104
|
# value: Value<Optional> - # # Parameters or result value.
|
104
105
|
# header: FunctionHeader<Optional> - # # Function header.
|
105
106
|
def decode_message(payload, &block)
|
106
|
-
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
107
|
+
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, monitor: monitor, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
107
108
|
end
|
108
109
|
|
109
110
|
# INPUT: ParamsOfDecodeMessageBody
|
@@ -117,7 +118,7 @@ module TonClient
|
|
117
118
|
# value: Value<Optional> - # # Parameters or result value.
|
118
119
|
# header: FunctionHeader<Optional> - # # Function header.
|
119
120
|
def decode_message_body(payload, &block)
|
120
|
-
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
121
|
+
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, monitor: monitor, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
121
122
|
end
|
122
123
|
|
123
124
|
# INPUT: ParamsOfEncodeAccount
|
@@ -130,7 +131,7 @@ module TonClient
|
|
130
131
|
# account: String - # # Account BOC encoded in `base64`.
|
131
132
|
# id: String - # # Account ID encoded in `hex`.
|
132
133
|
def encode_account(payload, &block)
|
133
|
-
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
134
|
+
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, monitor: monitor, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
134
135
|
end
|
135
136
|
|
136
137
|
# INPUT: ParamsOfDecodeAccountData
|
@@ -140,7 +141,7 @@ module TonClient
|
|
140
141
|
# RESPONSE: ResultOfDecodeAccountData
|
141
142
|
# data: Value - # # Decoded data as a JSON structure.
|
142
143
|
def decode_account_data(payload, &block)
|
143
|
-
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
144
|
+
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, monitor: monitor, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
144
145
|
end
|
145
146
|
|
146
147
|
# INPUT: ParamsOfUpdateInitialData
|
@@ -152,7 +153,7 @@ module TonClient
|
|
152
153
|
# RESPONSE: ResultOfUpdateInitialData
|
153
154
|
# data: String - # # Updated data BOC or BOC handle
|
154
155
|
def update_initial_data(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)
|
156
|
+
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, monitor: monitor, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
156
157
|
end
|
157
158
|
|
158
159
|
# INPUT: ParamsOfEncodeInitialData
|
@@ -163,7 +164,7 @@ module TonClient
|
|
163
164
|
# RESPONSE: ResultOfEncodeInitialData
|
164
165
|
# data: String - # # Updated data BOC or BOC handle
|
165
166
|
def encode_initial_data(payload, &block)
|
166
|
-
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
167
|
+
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, monitor: monitor, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
167
168
|
end
|
168
169
|
|
169
170
|
# INPUT: ParamsOfDecodeInitialData
|
@@ -174,7 +175,7 @@ module TonClient
|
|
174
175
|
# initial_data: Value<Optional> - # # List of initial values of contract's public variables. # # Initial data is decoded if `abi` input parameter is provided
|
175
176
|
# initial_pubkey: String - # # Initial account owner's public key
|
176
177
|
def decode_initial_data(payload, &block)
|
177
|
-
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
178
|
+
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, monitor: monitor, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
178
179
|
end
|
179
180
|
|
180
181
|
# INPUT: ParamsOfDecodeBoc
|
@@ -184,7 +185,7 @@ module TonClient
|
|
184
185
|
# RESPONSE: ResultOfDecodeBoc
|
185
186
|
# data: Value - # # Decoded data as a JSON structure.
|
186
187
|
def decode_boc(payload, &block)
|
187
|
-
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
188
|
+
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, monitor: monitor, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
188
189
|
end
|
189
190
|
|
190
191
|
# INPUT: ParamsOfAbiEncodeBoc
|
@@ -194,7 +195,7 @@ module TonClient
|
|
194
195
|
# RESPONSE: ResultOfAbiEncodeBoc
|
195
196
|
# boc: String - # # BOC encoded as base64
|
196
197
|
def encode_boc(payload, &block)
|
197
|
-
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
198
|
+
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, monitor: monitor, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
198
199
|
end
|
199
200
|
|
200
201
|
# INPUT: ParamsOfCalcFunctionId
|
@@ -204,7 +205,7 @@ module TonClient
|
|
204
205
|
# RESPONSE: ResultOfCalcFunctionId
|
205
206
|
# function_id: Number - # # Contract function ID
|
206
207
|
def calc_function_id(payload, &block)
|
207
|
-
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
208
|
+
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, monitor: monitor, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
208
209
|
end
|
209
210
|
|
210
211
|
end
|
@@ -3,13 +3,14 @@ module TonClient
|
|
3
3
|
class Boc
|
4
4
|
include CommonInstanceHelpers
|
5
5
|
|
6
|
-
attr_reader :context, :request_id, :requests
|
6
|
+
attr_reader :context, :request_id, :requests, :monitor
|
7
7
|
MODULE = self.to_s.downcase.gsub(/^(.+::|)(\w+)$/, '\2').freeze
|
8
8
|
|
9
|
-
def initialize(context: nil, request_id: nil, requests: nil)
|
9
|
+
def initialize(context: nil, request_id: nil, requests: nil, monitor: nil)
|
10
10
|
@context = context
|
11
11
|
@request_id = request_id
|
12
12
|
@requests = requests
|
13
|
+
@monitor = monitor
|
13
14
|
end
|
14
15
|
|
15
16
|
# INPUT: ParamsOfParse
|
@@ -17,7 +18,7 @@ module TonClient
|
|
17
18
|
# RESPONSE: ResultOfParse
|
18
19
|
# parsed: Value - # # JSON containing parsed BOC
|
19
20
|
def parse_message(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)
|
21
|
+
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, monitor: monitor, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
21
22
|
end
|
22
23
|
|
23
24
|
# INPUT: ParamsOfParse
|
@@ -25,7 +26,7 @@ module TonClient
|
|
25
26
|
# RESPONSE: ResultOfParse
|
26
27
|
# parsed: Value - # # JSON containing parsed BOC
|
27
28
|
def parse_transaction(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)
|
29
|
+
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, monitor: monitor, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
29
30
|
end
|
30
31
|
|
31
32
|
# INPUT: ParamsOfParse
|
@@ -33,7 +34,7 @@ module TonClient
|
|
33
34
|
# RESPONSE: ResultOfParse
|
34
35
|
# parsed: Value - # # JSON containing parsed BOC
|
35
36
|
def parse_account(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)
|
37
|
+
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, monitor: monitor, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
37
38
|
end
|
38
39
|
|
39
40
|
# INPUT: ParamsOfParse
|
@@ -41,7 +42,7 @@ module TonClient
|
|
41
42
|
# RESPONSE: ResultOfParse
|
42
43
|
# parsed: Value - # # JSON containing parsed BOC
|
43
44
|
def parse_block(payload, &block)
|
44
|
-
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
45
|
+
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, monitor: monitor, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
45
46
|
end
|
46
47
|
|
47
48
|
# INPUT: ParamsOfParseShardstate
|
@@ -51,7 +52,7 @@ module TonClient
|
|
51
52
|
# RESPONSE: ResultOfParse
|
52
53
|
# parsed: Value - # # JSON containing parsed BOC
|
53
54
|
def parse_shardstate(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)
|
55
|
+
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, monitor: monitor, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
55
56
|
end
|
56
57
|
|
57
58
|
# INPUT: ParamsOfGetBlockchainConfig
|
@@ -59,7 +60,7 @@ module TonClient
|
|
59
60
|
# RESPONSE: ResultOfGetBlockchainConfig
|
60
61
|
# config_boc: String - # # Blockchain config BOC encoded as base64
|
61
62
|
def get_blockchain_config(payload, &block)
|
62
|
-
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
63
|
+
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, monitor: monitor, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
63
64
|
end
|
64
65
|
|
65
66
|
# INPUT: ParamsOfGetBocHash
|
@@ -67,7 +68,7 @@ module TonClient
|
|
67
68
|
# RESPONSE: ResultOfGetBocHash
|
68
69
|
# hash: String - # # BOC root hash encoded with hex
|
69
70
|
def get_boc_hash(payload, &block)
|
70
|
-
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
71
|
+
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, monitor: monitor, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
71
72
|
end
|
72
73
|
|
73
74
|
# INPUT: ParamsOfGetBocDepth
|
@@ -75,7 +76,7 @@ module TonClient
|
|
75
76
|
# RESPONSE: ResultOfGetBocDepth
|
76
77
|
# depth: Number - # # BOC root cell depth
|
77
78
|
def get_boc_depth(payload, &block)
|
78
|
-
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
79
|
+
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, monitor: monitor, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
79
80
|
end
|
80
81
|
|
81
82
|
# INPUT: ParamsOfGetCodeFromTvc
|
@@ -83,7 +84,7 @@ module TonClient
|
|
83
84
|
# RESPONSE: ResultOfGetCodeFromTvc
|
84
85
|
# code: String - # # Contract code encoded as base64
|
85
86
|
def get_code_from_tvc(payload, &block)
|
86
|
-
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
87
|
+
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, monitor: monitor, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
87
88
|
end
|
88
89
|
|
89
90
|
# INPUT: ParamsOfBocCacheGet
|
@@ -91,7 +92,7 @@ module TonClient
|
|
91
92
|
# RESPONSE: ResultOfBocCacheGet
|
92
93
|
# boc: String<Optional> - # # BOC encoded as base64.
|
93
94
|
def cache_get(payload, &block)
|
94
|
-
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
95
|
+
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, monitor: monitor, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
95
96
|
end
|
96
97
|
|
97
98
|
# INPUT: ParamsOfBocCacheSet
|
@@ -100,14 +101,14 @@ module TonClient
|
|
100
101
|
# RESPONSE: ResultOfBocCacheSet
|
101
102
|
# boc_ref: String - # # Reference to the cached BOC
|
102
103
|
def cache_set(payload, &block)
|
103
|
-
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
104
|
+
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, monitor: monitor, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
104
105
|
end
|
105
106
|
|
106
107
|
# INPUT: ParamsOfBocCacheUnpin
|
107
108
|
# pin: String - # # Pinned name
|
108
109
|
# boc_ref: String<Optional> - # # Reference to the cached BOC. # # If it is provided then only referenced BOC is unpinned
|
109
110
|
def cache_unpin(payload, &block)
|
110
|
-
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
111
|
+
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, monitor: monitor, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
111
112
|
end
|
112
113
|
|
113
114
|
# INPUT: ParamsOfEncodeBoc
|
@@ -116,7 +117,7 @@ module TonClient
|
|
116
117
|
# RESPONSE: ResultOfEncodeBoc
|
117
118
|
# boc: String - # # Encoded cell BOC or BOC cache key.
|
118
119
|
def encode_boc(payload, &block)
|
119
|
-
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
120
|
+
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, monitor: monitor, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
120
121
|
end
|
121
122
|
|
122
123
|
# INPUT: ParamsOfGetCodeSalt
|
@@ -125,7 +126,7 @@ module TonClient
|
|
125
126
|
# RESPONSE: ResultOfGetCodeSalt
|
126
127
|
# salt: String<Optional> - # # Contract code salt if present. # # BOC encoded as base64 or BOC handle
|
127
128
|
def get_code_salt(payload, &block)
|
128
|
-
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
129
|
+
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, monitor: monitor, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
129
130
|
end
|
130
131
|
|
131
132
|
# INPUT: ParamsOfSetCodeSalt
|
@@ -135,7 +136,7 @@ module TonClient
|
|
135
136
|
# RESPONSE: ResultOfSetCodeSalt
|
136
137
|
# code: String - # # Contract code with salt set. # # BOC encoded as base64 or BOC handle
|
137
138
|
def set_code_salt(payload, &block)
|
138
|
-
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
139
|
+
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, monitor: monitor, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
139
140
|
end
|
140
141
|
|
141
142
|
# INPUT: ParamsOfDecodeTvc
|
@@ -154,7 +155,7 @@ module TonClient
|
|
154
155
|
# split_depth: Number<Optional> - # # Is present and non-zero only in instances of large smart contracts
|
155
156
|
# compiler_version: String<Optional> - # # Compiler version, for example 'sol 0.49.0'
|
156
157
|
def decode_tvc(payload, &block)
|
157
|
-
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
158
|
+
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, monitor: monitor, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
158
159
|
end
|
159
160
|
|
160
161
|
# INPUT: ParamsOfEncodeTvc
|
@@ -168,7 +169,7 @@ module TonClient
|
|
168
169
|
# RESPONSE: ResultOfEncodeTvc
|
169
170
|
# tvc: String - # # Contract TVC image BOC encoded as base64 or BOC handle of boc_cache parameter was specified
|
170
171
|
def encode_tvc(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)
|
172
|
+
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, monitor: monitor, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
172
173
|
end
|
173
174
|
|
174
175
|
# INPUT: ParamsOfEncodeExternalInMessage
|
@@ -181,7 +182,7 @@ module TonClient
|
|
181
182
|
# message: String - # # Message BOC encoded with `base64`.
|
182
183
|
# message_id: String - # # Message id.
|
183
184
|
def encode_external_in_message(payload, &block)
|
184
|
-
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
185
|
+
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, monitor: monitor, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
185
186
|
end
|
186
187
|
|
187
188
|
# INPUT: ParamsOfGetCompilerVersion
|
@@ -189,7 +190,7 @@ module TonClient
|
|
189
190
|
# RESPONSE: ResultOfGetCompilerVersion
|
190
191
|
# version: String<Optional> - # # Compiler version, for example 'sol 0.49.0'
|
191
192
|
def get_compiler_version(payload, &block)
|
192
|
-
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
193
|
+
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, monitor: monitor, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
193
194
|
end
|
194
195
|
|
195
196
|
end
|
@@ -3,14 +3,15 @@ module TonClient
|
|
3
3
|
class Client
|
4
4
|
include CommonInstanceHelpers
|
5
5
|
|
6
|
-
attr_reader :context, :context_config, :request_id, :requests
|
6
|
+
attr_reader :context, :context_config, :request_id, :requests, :monitor
|
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
10
|
def initialize(context_config: {})
|
11
11
|
@context_config = context_config
|
12
|
-
@request_id =
|
13
|
-
@requests =
|
12
|
+
@request_id = RequestId.new
|
13
|
+
@requests = Requests.new
|
14
|
+
@monitor = Monitor.new
|
14
15
|
config = TonBinding.make_string(context_config.to_json)
|
15
16
|
context_ptr = TonBinding.tc_create_context(config)
|
16
17
|
@context = TonBinding.read_string_to_hash(context_ptr)['result']
|
@@ -26,51 +27,51 @@ module TonClient
|
|
26
27
|
end
|
27
28
|
|
28
29
|
def crypto
|
29
|
-
_crypto ||= Crypto.new(context: context, request_id: request_id, requests: requests)
|
30
|
+
_crypto ||= Crypto.new(context: context, request_id: request_id, requests: requests, monitor: monitor)
|
30
31
|
end
|
31
32
|
|
32
33
|
def abi
|
33
|
-
_abi ||= Abi.new(context: context, request_id: request_id, requests: requests)
|
34
|
+
_abi ||= Abi.new(context: context, request_id: request_id, requests: requests, monitor: monitor)
|
34
35
|
end
|
35
36
|
|
36
37
|
def boc
|
37
|
-
_boc ||= Boc.new(context: context, request_id: request_id, requests: requests)
|
38
|
+
_boc ||= Boc.new(context: context, request_id: request_id, requests: requests, monitor: monitor)
|
38
39
|
end
|
39
40
|
|
40
41
|
def processing
|
41
|
-
_processing ||= Processing.new(context: context, request_id: request_id, requests: requests)
|
42
|
+
_processing ||= Processing.new(context: context, request_id: request_id, requests: requests, monitor: monitor)
|
42
43
|
end
|
43
44
|
|
44
45
|
def utils
|
45
|
-
_utils ||= Utils.new(context: context, request_id: request_id, requests: requests)
|
46
|
+
_utils ||= Utils.new(context: context, request_id: request_id, requests: requests, monitor: monitor)
|
46
47
|
end
|
47
48
|
|
48
49
|
def tvm
|
49
|
-
_tvm ||= Tvm.new(context: context, request_id: request_id, requests: requests)
|
50
|
+
_tvm ||= Tvm.new(context: context, request_id: request_id, requests: requests, monitor: monitor)
|
50
51
|
end
|
51
52
|
|
52
53
|
def net
|
53
|
-
_net ||= Net.new(context: context, request_id: request_id, requests: requests)
|
54
|
+
_net ||= Net.new(context: context, request_id: request_id, requests: requests, monitor: monitor)
|
54
55
|
end
|
55
56
|
|
56
57
|
def debot
|
57
|
-
_debot ||= Debot.new(context: context, request_id: request_id, requests: requests)
|
58
|
+
_debot ||= Debot.new(context: context, request_id: request_id, requests: requests, monitor: monitor)
|
58
59
|
end
|
59
60
|
|
60
61
|
def proofs
|
61
|
-
_proofs ||= Proofs.new(context: context, request_id: request_id, requests: requests)
|
62
|
+
_proofs ||= Proofs.new(context: context, request_id: request_id, requests: requests, monitor: monitor)
|
62
63
|
end
|
63
64
|
|
64
65
|
# RESPONSE: ResultOfGetApiReference
|
65
66
|
# api: Value -
|
66
67
|
def get_api_reference(&block)
|
67
|
-
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block)
|
68
|
+
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, monitor: monitor, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block)
|
68
69
|
end
|
69
70
|
|
70
71
|
# RESPONSE: ResultOfVersion
|
71
72
|
# version: String - # # Core Library version
|
72
73
|
def version(&block)
|
73
|
-
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block)
|
74
|
+
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, monitor: monitor, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block)
|
74
75
|
end
|
75
76
|
|
76
77
|
# RESPONSE: ClientConfig
|
@@ -81,21 +82,21 @@ module TonClient
|
|
81
82
|
# proofs: ProofsConfig<Optional> -
|
82
83
|
# 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.
|
83
84
|
def config(&block)
|
84
|
-
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block)
|
85
|
+
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, monitor: monitor, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block)
|
85
86
|
end
|
86
87
|
|
87
88
|
# RESPONSE: ResultOfBuildInfo
|
88
89
|
# build_number: Number - # # Build number assigned to this build by the CI.
|
89
90
|
# dependencies: Array - # # Fingerprint of the most important dependencies.
|
90
91
|
def build_info(&block)
|
91
|
-
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block)
|
92
|
+
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, monitor: monitor, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block)
|
92
93
|
end
|
93
94
|
|
94
95
|
# INPUT: ParamsOfResolveAppRequest
|
95
96
|
# app_request_id: Number - # # Request ID received from SDK
|
96
97
|
# result: AppRequestResult - # # Result of request processing
|
97
98
|
def resolve_app_request(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)
|
99
|
+
TonBinding.requestLibrary(context: context, request_id: request_id, requests: requests, monitor: monitor, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
99
100
|
end
|
100
101
|
|
101
102
|
end
|