everscale-client-ruby 1.1.44 → 1.1.47
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 +12 -10
- data/lib/everscale-client-ruby/Binding/binding.rb +51 -56
- data/lib/everscale-client-ruby/Binding/struct.rb +0 -8
- data/lib/everscale-client-ruby/Client/Abi.rb +17 -18
- data/lib/everscale-client-ruby/Client/Boc.rb +21 -22
- data/lib/everscale-client-ruby/Client/Client.rb +12 -10
- data/lib/everscale-client-ruby/Client/Crypto.rb +53 -54
- data/lib/everscale-client-ruby/Client/Debot.rb +8 -9
- data/lib/everscale-client-ruby/Client/Net.rb +24 -25
- data/lib/everscale-client-ruby/Client/Processing.rb +5 -6
- data/lib/everscale-client-ruby/Client/Proofs.rb +5 -6
- data/lib/everscale-client-ruby/Client/Tvm.rb +5 -6
- data/lib/everscale-client-ruby/Client/Utils.rb +7 -8
- data/lib/everscale-client-ruby/version.rb +1 -1
- data/lib/everscale-client-ruby.rb +2 -2
- metadata +7 -8
- data/lib/everscale-client-ruby/Client/Context.rb +0 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ef18c6e5ec06aec7b4d2a5469980f3ba4a14d74122a72ee66f64138e08f87d8
|
4
|
+
data.tar.gz: ca752bcc10ae424fdf22fc8d26809df20cf9e030078bf828fa0c814fb61e0334
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a51eb6ea6dc7624e8583bac6c886a58085ac49cbb38d298a8f9dc24da84506acc89338c0d1178b93ddb3f9a605f2e296a57427c265a00cc4bedcbfb8cdda0861
|
7
|
+
data.tar.gz: 2add7a7abf6a257a925bc40a4670a8579e6d89580753681811ac40458eb34ea427bc9ea51faa315f4b831a3e6ffeb18b3dcf81d4f797ebdacd92356c15f7f4aa
|
@@ -234,18 +234,21 @@ 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 :
|
237
|
+
content << "#{TAB}#{TAB}attr_reader :context, :context_config\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'
|
241
241
|
content << ((modules.size - 1) == i ? ":_#{m.name}\n" : ":_#{m.name}, ")
|
242
242
|
end
|
243
243
|
content << "#{TAB}#{TAB}MODULE = self.to_s.downcase.gsub(/^(.+::|)(\\w+)$/, '\\2').freeze\n\n"
|
244
|
-
content << "#{TAB}#{TAB}def initialize(
|
245
|
-
content << "#{TAB}#{TAB}#{TAB}@
|
246
|
-
content << "#{TAB}#{TAB}#{TAB}
|
244
|
+
content << "#{TAB}#{TAB}def initialize(context_config: {})\n"
|
245
|
+
content << "#{TAB}#{TAB}#{TAB}@context_config = context_config\n"
|
246
|
+
content << "#{TAB}#{TAB}#{TAB}config = TonBinding.make_string(context_config.to_json)\n"
|
247
|
+
content << "#{TAB}#{TAB}#{TAB}context_ptr = TonBinding.tc_create_context(config)\n"
|
248
|
+
content << "#{TAB}#{TAB}#{TAB}@context = TonBinding.read_string_to_hash(context_ptr)['result']\n"
|
249
|
+
content << "#{TAB}#{TAB}end\n\n"
|
247
250
|
content << "#{TAB}#{TAB}def destroy_context\n"
|
248
|
-
content << "#{TAB}#{TAB}#{TAB}
|
251
|
+
content << "#{TAB}#{TAB}#{TAB}TonBinding.tc_destroy_context(context)\n#{TAB}#{TAB}end\n\n"
|
249
252
|
modules.each_with_index do |m, i|
|
250
253
|
next if m.name.downcase == 'client'
|
251
254
|
content << "#{TAB}#{TAB}def #{m.name}\n"
|
@@ -265,11 +268,10 @@ cd everscale-client-ruby\n
|
|
265
268
|
|
266
269
|
private def generateModule(mod)
|
267
270
|
content = "module TonClient\n\n#{TAB}class #{mod.name.capitalize}\n#{TAB}#{TAB}include CommonInstanceHelpers\n\n"
|
268
|
-
content << "#{TAB}#{TAB}attr_reader :
|
271
|
+
content << "#{TAB}#{TAB}attr_reader :context\n"
|
269
272
|
content << "#{TAB}#{TAB}MODULE = self.to_s.downcase.gsub(/^(.+::|)(\\w+)$/, '\\2').freeze\n\n"
|
270
|
-
content << "#{TAB}#{TAB}def initialize(context:
|
273
|
+
content << "#{TAB}#{TAB}def initialize(context: nil)\n"
|
271
274
|
content << "#{TAB}#{TAB}#{TAB}@context = context\n"
|
272
|
-
content << "#{TAB}#{TAB}#{TAB}@core = core\n"
|
273
275
|
content << "#{TAB}#{TAB}end\n\n"
|
274
276
|
|
275
277
|
mod.functions.each do |func|
|
@@ -287,10 +289,10 @@ cd everscale-client-ruby\n
|
|
287
289
|
content << "#{TAB}#{TAB}def #{function.name}"
|
288
290
|
if function.arguments.empty?
|
289
291
|
content << "(&block)\n"
|
290
|
-
content << "#{TAB}#{TAB}#{TAB}
|
292
|
+
content << "#{TAB}#{TAB}#{TAB}TonBinding.requestLibrary(context: context, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block)\n"
|
291
293
|
else
|
292
294
|
content << "(payload, &block)\n"
|
293
|
-
content << "#{TAB}#{TAB}#{TAB}
|
295
|
+
content << "#{TAB}#{TAB}#{TAB}TonBinding.requestLibrary(context: context, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)\n"
|
294
296
|
end
|
295
297
|
content << "#{TAB}#{TAB}end\n\n"
|
296
298
|
|
@@ -1,21 +1,24 @@
|
|
1
|
+
require 'byebug'
|
2
|
+
|
1
3
|
module TonClient
|
2
4
|
module TonBinding
|
3
|
-
@@request_id =
|
4
|
-
@@requests =
|
5
|
+
@@request_id = Concurrent::AtomicFixnum.new(1)
|
6
|
+
@@requests = Concurrent::Hash.new()
|
5
7
|
|
6
8
|
class Response
|
7
|
-
attr_reader :core
|
8
9
|
attr_accessor :result, :error, :custom_response, :finished, :request_id, :current_response
|
9
10
|
|
10
|
-
def initialize(
|
11
|
-
|
11
|
+
def initialize(request_id, string_data, response_type, finished)
|
12
|
+
update(request_id, string_data, response_type, finished)
|
12
13
|
end
|
13
14
|
|
15
|
+
private
|
14
16
|
def update(request_id, string_data, response_type, finished)
|
15
|
-
response_hash =
|
17
|
+
response_hash = TonBinding.read_string_to_hash(string_data)
|
16
18
|
self.finished = finished
|
17
19
|
self.request_id = request_id
|
18
20
|
self.current_response = response_hash
|
21
|
+
|
19
22
|
case response_type
|
20
23
|
when 0
|
21
24
|
# result
|
@@ -29,25 +32,27 @@ module TonClient
|
|
29
32
|
self.custom_responses = response_hash
|
30
33
|
end
|
31
34
|
end
|
35
|
+
|
36
|
+
self
|
32
37
|
end
|
33
38
|
end
|
34
39
|
|
35
40
|
def self.generate_request_id
|
36
|
-
@@request_id
|
37
|
-
@@request_id
|
41
|
+
@@request_id.increment()
|
42
|
+
@@request_id.value
|
38
43
|
end
|
39
44
|
|
40
45
|
def self.get_request(id)
|
41
46
|
@@requests[id]
|
42
47
|
end
|
43
48
|
|
44
|
-
def self.delete_request(id)
|
45
|
-
@@requests[id] = nil
|
46
|
-
end
|
47
|
-
|
48
49
|
def self.set_request(id, &request_block)
|
49
50
|
@@requests[id] = request_block
|
50
51
|
end
|
52
|
+
|
53
|
+
def self.delete_request(id)
|
54
|
+
@@requests[id] = nil
|
55
|
+
end
|
51
56
|
end
|
52
57
|
end
|
53
58
|
|
@@ -56,18 +61,19 @@ module TonClient
|
|
56
61
|
|
57
62
|
module TonBinding
|
58
63
|
extend FFI::Library
|
59
|
-
ffi_lib FFI::Library::LIBC
|
64
|
+
# ffi_lib FFI::Library::LIBC
|
65
|
+
# ffi_lib 'ruby'
|
60
66
|
|
61
67
|
# memory allocators
|
62
|
-
attach_function :malloc, [:size_t], :pointer
|
63
|
-
attach_function :calloc, [:size_t], :pointer
|
64
|
-
attach_function :valloc, [:size_t], :pointer
|
65
|
-
attach_function :realloc, [:pointer, :size_t], :pointer
|
66
|
-
attach_function :free, [:pointer], :void
|
68
|
+
# attach_function :malloc, [:size_t], :pointer
|
69
|
+
# attach_function :calloc, [:size_t], :pointer
|
70
|
+
# attach_function :valloc, [:size_t], :pointer
|
71
|
+
# attach_function :realloc, [:pointer, :size_t], :pointer
|
72
|
+
# attach_function :free, [:pointer], :void
|
67
73
|
|
68
|
-
# memory movers
|
69
|
-
attach_function :memcpy, [:pointer, :pointer, :size_t], :pointer
|
70
|
-
attach_function :bcopy, [:pointer, :pointer, :size_t], :void
|
74
|
+
# # memory movers
|
75
|
+
# attach_function :memcpy, [:pointer, :pointer, :size_t], :pointer
|
76
|
+
# attach_function :bcopy, [:pointer, :pointer, :size_t], :void
|
71
77
|
|
72
78
|
def self.setup_bindings
|
73
79
|
|
@@ -116,28 +122,21 @@ module TonClient
|
|
116
122
|
end
|
117
123
|
|
118
124
|
def self.make_string(string)
|
125
|
+
# p 1
|
119
126
|
result = TonBinding::TcStringDataT.new
|
120
|
-
|
121
|
-
|
127
|
+
bytes_count = string.unpack("C*").size
|
128
|
+
ptr1 = FFI::MemoryPointer.new(:char, bytes_count)
|
129
|
+
ptr1.put_bytes(0, string, 0, bytes_count)
|
130
|
+
# ptr1.autorelease = false
|
131
|
+
# p ptr1.autorelease?
|
132
|
+
result[:content] = ptr1
|
133
|
+
# result[:content] = FFI::MemoryPointer.from_string(string)
|
134
|
+
# result[:len] = string.bytesize
|
135
|
+
result[:len] = ptr1.size
|
136
|
+
# p 2
|
122
137
|
result
|
123
138
|
end
|
124
139
|
|
125
|
-
# def self.read_string(tc_string_handle)
|
126
|
-
# is_ref = tc_string_handle.class == TonClient::TonBinding::TcStringHandleT
|
127
|
-
# if is_ref
|
128
|
-
# string = tc_read_string(tc_string_handle)
|
129
|
-
# else
|
130
|
-
# string = tc_string_handle
|
131
|
-
# end
|
132
|
-
|
133
|
-
# if string[:content].address > 1
|
134
|
-
# string = string[:content].read_string(string[:len]).force_encoding('UTF-8') + ''
|
135
|
-
# tc_destroy_string(tc_string_handle) if is_ref
|
136
|
-
# return string
|
137
|
-
# end
|
138
|
-
# nil
|
139
|
-
# end
|
140
|
-
|
141
140
|
def self.read_string(tc_string_handle)
|
142
141
|
is_ref = tc_string_handle.class == FFI::Pointer
|
143
142
|
if is_ref
|
@@ -147,8 +146,11 @@ module TonClient
|
|
147
146
|
end
|
148
147
|
|
149
148
|
if string[:content].address > 1
|
150
|
-
string = string[:content].read_string(string[:len])
|
151
|
-
|
149
|
+
string = string[:content].read_string(string[:len])
|
150
|
+
if is_ref
|
151
|
+
tc_destroy_string(tc_string_handle)
|
152
|
+
# free(tc_string_handle)
|
153
|
+
end
|
152
154
|
return string
|
153
155
|
end
|
154
156
|
nil
|
@@ -173,26 +175,19 @@ module TonClient
|
|
173
175
|
return response['error'] if response['error']
|
174
176
|
end
|
175
177
|
|
176
|
-
|
178
|
+
# block = { |response| }
|
179
|
+
def self.requestLibrary(context: 1, method_name: '', payload: {}, &block)
|
177
180
|
raise 'context not found' unless context
|
178
181
|
raise 'method_name is empty' if method_name.empty?
|
179
182
|
|
180
|
-
if block
|
181
|
-
method_name_string = make_string(method_name)
|
182
|
-
payload_string = make_string(payload.to_json)
|
183
|
-
tc_request(context, method_name_string, payload_string, request_id, &block)
|
184
|
-
end
|
185
|
-
end
|
186
|
-
|
187
|
-
# block = { |response| }
|
188
|
-
def self.requestLibrary(context: 1, method_name: '', payload: {}, &block)
|
189
183
|
request_id = generate_request_id
|
184
|
+
method_name_string = make_string(method_name)
|
185
|
+
payload_string = make_string(payload.to_json)
|
190
186
|
set_request(request_id, &block)
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
get_request(request_id).call(response)
|
187
|
+
tc_request(context, method_name_string, payload_string, request_id) do |request_id, string_data, response_type, finished|
|
188
|
+
request = get_request(request_id)
|
189
|
+
if request
|
190
|
+
request.call(Response.new(request_id, string_data, response_type, finished))
|
196
191
|
delete_request(request_id) if finished
|
197
192
|
end
|
198
193
|
end
|
@@ -3,12 +3,11 @@ module TonClient
|
|
3
3
|
class Abi
|
4
4
|
include CommonInstanceHelpers
|
5
5
|
|
6
|
-
attr_reader :
|
6
|
+
attr_reader :context
|
7
7
|
MODULE = self.to_s.downcase.gsub(/^(.+::|)(\w+)$/, '\2').freeze
|
8
8
|
|
9
|
-
def initialize(context:
|
9
|
+
def initialize(context: nil)
|
10
10
|
@context = context
|
11
|
-
@core = core
|
12
11
|
end
|
13
12
|
|
14
13
|
# INPUT: ParamsOfEncodeMessageBody
|
@@ -27,7 +26,7 @@ module TonClient
|
|
27
26
|
# data_to_sign: String<Optional> - # # Optional data to sign. # # Encoded with `base64`.
|
28
27
|
# # 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`.
|
29
28
|
def encode_message_body(payload, &block)
|
30
|
-
|
29
|
+
TonBinding.requestLibrary(context: context, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
31
30
|
end
|
32
31
|
|
33
32
|
# INPUT: ParamsOfAttachSignatureToMessageBody
|
@@ -38,7 +37,7 @@ module TonClient
|
|
38
37
|
# RESPONSE: ResultOfAttachSignatureToMessageBody
|
39
38
|
# body: String -
|
40
39
|
def attach_signature_to_message_body(payload, &block)
|
41
|
-
|
40
|
+
TonBinding.requestLibrary(context: context, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
42
41
|
end
|
43
42
|
|
44
43
|
# INPUT: ParamsOfEncodeMessage
|
@@ -59,7 +58,7 @@ module TonClient
|
|
59
58
|
# address: String - # # Destination address.
|
60
59
|
# message_id: String - # # Message id.
|
61
60
|
def encode_message(payload, &block)
|
62
|
-
|
61
|
+
TonBinding.requestLibrary(context: context, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
63
62
|
end
|
64
63
|
|
65
64
|
# INPUT: ParamsOfEncodeInternalMessage
|
@@ -77,7 +76,7 @@ module TonClient
|
|
77
76
|
# address: String - # # Destination address.
|
78
77
|
# message_id: String - # # Message id.
|
79
78
|
def encode_internal_message(payload, &block)
|
80
|
-
|
79
|
+
TonBinding.requestLibrary(context: context, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
81
80
|
end
|
82
81
|
|
83
82
|
# INPUT: ParamsOfAttachSignature
|
@@ -89,7 +88,7 @@ module TonClient
|
|
89
88
|
# message: String - # # Signed message BOC
|
90
89
|
# message_id: String - # # Message ID
|
91
90
|
def attach_signature(payload, &block)
|
92
|
-
|
91
|
+
TonBinding.requestLibrary(context: context, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
93
92
|
end
|
94
93
|
|
95
94
|
# INPUT: ParamsOfDecodeMessage
|
@@ -102,7 +101,7 @@ module TonClient
|
|
102
101
|
# value: Value<Optional> - # # Parameters or result value.
|
103
102
|
# header: FunctionHeader<Optional> - # # Function header.
|
104
103
|
def decode_message(payload, &block)
|
105
|
-
|
104
|
+
TonBinding.requestLibrary(context: context, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
106
105
|
end
|
107
106
|
|
108
107
|
# INPUT: ParamsOfDecodeMessageBody
|
@@ -116,7 +115,7 @@ module TonClient
|
|
116
115
|
# value: Value<Optional> - # # Parameters or result value.
|
117
116
|
# header: FunctionHeader<Optional> - # # Function header.
|
118
117
|
def decode_message_body(payload, &block)
|
119
|
-
|
118
|
+
TonBinding.requestLibrary(context: context, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
120
119
|
end
|
121
120
|
|
122
121
|
# INPUT: ParamsOfEncodeAccount
|
@@ -129,7 +128,7 @@ module TonClient
|
|
129
128
|
# account: String - # # Account BOC encoded in `base64`.
|
130
129
|
# id: String - # # Account ID encoded in `hex`.
|
131
130
|
def encode_account(payload, &block)
|
132
|
-
|
131
|
+
TonBinding.requestLibrary(context: context, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
133
132
|
end
|
134
133
|
|
135
134
|
# INPUT: ParamsOfDecodeAccountData
|
@@ -139,7 +138,7 @@ module TonClient
|
|
139
138
|
# RESPONSE: ResultOfDecodeAccountData
|
140
139
|
# data: Value - # # Decoded data as a JSON structure.
|
141
140
|
def decode_account_data(payload, &block)
|
142
|
-
|
141
|
+
TonBinding.requestLibrary(context: context, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
143
142
|
end
|
144
143
|
|
145
144
|
# INPUT: ParamsOfUpdateInitialData
|
@@ -151,7 +150,7 @@ module TonClient
|
|
151
150
|
# RESPONSE: ResultOfUpdateInitialData
|
152
151
|
# data: String - # # Updated data BOC or BOC handle
|
153
152
|
def update_initial_data(payload, &block)
|
154
|
-
|
153
|
+
TonBinding.requestLibrary(context: context, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
155
154
|
end
|
156
155
|
|
157
156
|
# INPUT: ParamsOfEncodeInitialData
|
@@ -162,7 +161,7 @@ module TonClient
|
|
162
161
|
# RESPONSE: ResultOfEncodeInitialData
|
163
162
|
# data: String - # # Updated data BOC or BOC handle
|
164
163
|
def encode_initial_data(payload, &block)
|
165
|
-
|
164
|
+
TonBinding.requestLibrary(context: context, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
166
165
|
end
|
167
166
|
|
168
167
|
# INPUT: ParamsOfDecodeInitialData
|
@@ -173,7 +172,7 @@ module TonClient
|
|
173
172
|
# initial_data: Value<Optional> - # # List of initial values of contract's public variables. # # Initial data is decoded if `abi` input parameter is provided
|
174
173
|
# initial_pubkey: String - # # Initial account owner's public key
|
175
174
|
def decode_initial_data(payload, &block)
|
176
|
-
|
175
|
+
TonBinding.requestLibrary(context: context, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
177
176
|
end
|
178
177
|
|
179
178
|
# INPUT: ParamsOfDecodeBoc
|
@@ -183,7 +182,7 @@ module TonClient
|
|
183
182
|
# RESPONSE: ResultOfDecodeBoc
|
184
183
|
# data: Value - # # Decoded data as a JSON structure.
|
185
184
|
def decode_boc(payload, &block)
|
186
|
-
|
185
|
+
TonBinding.requestLibrary(context: context, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
187
186
|
end
|
188
187
|
|
189
188
|
# INPUT: ParamsOfAbiEncodeBoc
|
@@ -193,7 +192,7 @@ module TonClient
|
|
193
192
|
# RESPONSE: ResultOfAbiEncodeBoc
|
194
193
|
# boc: String - # # BOC encoded as base64
|
195
194
|
def encode_boc(payload, &block)
|
196
|
-
|
195
|
+
TonBinding.requestLibrary(context: context, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
197
196
|
end
|
198
197
|
|
199
198
|
# INPUT: ParamsOfCalcFunctionId
|
@@ -203,7 +202,7 @@ module TonClient
|
|
203
202
|
# RESPONSE: ResultOfCalcFunctionId
|
204
203
|
# function_id: Number - # # Contract function ID
|
205
204
|
def calc_function_id(payload, &block)
|
206
|
-
|
205
|
+
TonBinding.requestLibrary(context: context, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
207
206
|
end
|
208
207
|
|
209
208
|
end
|
@@ -3,12 +3,11 @@ module TonClient
|
|
3
3
|
class Boc
|
4
4
|
include CommonInstanceHelpers
|
5
5
|
|
6
|
-
attr_reader :
|
6
|
+
attr_reader :context
|
7
7
|
MODULE = self.to_s.downcase.gsub(/^(.+::|)(\w+)$/, '\2').freeze
|
8
8
|
|
9
|
-
def initialize(context:
|
9
|
+
def initialize(context: nil)
|
10
10
|
@context = context
|
11
|
-
@core = core
|
12
11
|
end
|
13
12
|
|
14
13
|
# INPUT: ParamsOfParse
|
@@ -16,7 +15,7 @@ module TonClient
|
|
16
15
|
# RESPONSE: ResultOfParse
|
17
16
|
# parsed: Value - # # JSON containing parsed BOC
|
18
17
|
def parse_message(payload, &block)
|
19
|
-
|
18
|
+
TonBinding.requestLibrary(context: context, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
20
19
|
end
|
21
20
|
|
22
21
|
# INPUT: ParamsOfParse
|
@@ -24,7 +23,7 @@ module TonClient
|
|
24
23
|
# RESPONSE: ResultOfParse
|
25
24
|
# parsed: Value - # # JSON containing parsed BOC
|
26
25
|
def parse_transaction(payload, &block)
|
27
|
-
|
26
|
+
TonBinding.requestLibrary(context: context, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
28
27
|
end
|
29
28
|
|
30
29
|
# INPUT: ParamsOfParse
|
@@ -32,7 +31,7 @@ module TonClient
|
|
32
31
|
# RESPONSE: ResultOfParse
|
33
32
|
# parsed: Value - # # JSON containing parsed BOC
|
34
33
|
def parse_account(payload, &block)
|
35
|
-
|
34
|
+
TonBinding.requestLibrary(context: context, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
36
35
|
end
|
37
36
|
|
38
37
|
# INPUT: ParamsOfParse
|
@@ -40,7 +39,7 @@ module TonClient
|
|
40
39
|
# RESPONSE: ResultOfParse
|
41
40
|
# parsed: Value - # # JSON containing parsed BOC
|
42
41
|
def parse_block(payload, &block)
|
43
|
-
|
42
|
+
TonBinding.requestLibrary(context: context, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
44
43
|
end
|
45
44
|
|
46
45
|
# INPUT: ParamsOfParseShardstate
|
@@ -50,7 +49,7 @@ module TonClient
|
|
50
49
|
# RESPONSE: ResultOfParse
|
51
50
|
# parsed: Value - # # JSON containing parsed BOC
|
52
51
|
def parse_shardstate(payload, &block)
|
53
|
-
|
52
|
+
TonBinding.requestLibrary(context: context, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
54
53
|
end
|
55
54
|
|
56
55
|
# INPUT: ParamsOfGetBlockchainConfig
|
@@ -58,7 +57,7 @@ module TonClient
|
|
58
57
|
# RESPONSE: ResultOfGetBlockchainConfig
|
59
58
|
# config_boc: String - # # Blockchain config BOC encoded as base64
|
60
59
|
def get_blockchain_config(payload, &block)
|
61
|
-
|
60
|
+
TonBinding.requestLibrary(context: context, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
62
61
|
end
|
63
62
|
|
64
63
|
# INPUT: ParamsOfGetBocHash
|
@@ -66,7 +65,7 @@ module TonClient
|
|
66
65
|
# RESPONSE: ResultOfGetBocHash
|
67
66
|
# hash: String - # # BOC root hash encoded with hex
|
68
67
|
def get_boc_hash(payload, &block)
|
69
|
-
|
68
|
+
TonBinding.requestLibrary(context: context, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
70
69
|
end
|
71
70
|
|
72
71
|
# INPUT: ParamsOfGetBocDepth
|
@@ -74,7 +73,7 @@ module TonClient
|
|
74
73
|
# RESPONSE: ResultOfGetBocDepth
|
75
74
|
# depth: Number - # # BOC root cell depth
|
76
75
|
def get_boc_depth(payload, &block)
|
77
|
-
|
76
|
+
TonBinding.requestLibrary(context: context, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
78
77
|
end
|
79
78
|
|
80
79
|
# INPUT: ParamsOfGetCodeFromTvc
|
@@ -82,7 +81,7 @@ module TonClient
|
|
82
81
|
# RESPONSE: ResultOfGetCodeFromTvc
|
83
82
|
# code: String - # # Contract code encoded as base64
|
84
83
|
def get_code_from_tvc(payload, &block)
|
85
|
-
|
84
|
+
TonBinding.requestLibrary(context: context, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
86
85
|
end
|
87
86
|
|
88
87
|
# INPUT: ParamsOfBocCacheGet
|
@@ -90,7 +89,7 @@ module TonClient
|
|
90
89
|
# RESPONSE: ResultOfBocCacheGet
|
91
90
|
# boc: String<Optional> - # # BOC encoded as base64.
|
92
91
|
def cache_get(payload, &block)
|
93
|
-
|
92
|
+
TonBinding.requestLibrary(context: context, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
94
93
|
end
|
95
94
|
|
96
95
|
# INPUT: ParamsOfBocCacheSet
|
@@ -99,14 +98,14 @@ module TonClient
|
|
99
98
|
# RESPONSE: ResultOfBocCacheSet
|
100
99
|
# boc_ref: String - # # Reference to the cached BOC
|
101
100
|
def cache_set(payload, &block)
|
102
|
-
|
101
|
+
TonBinding.requestLibrary(context: context, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
103
102
|
end
|
104
103
|
|
105
104
|
# INPUT: ParamsOfBocCacheUnpin
|
106
105
|
# pin: String - # # Pinned name
|
107
106
|
# boc_ref: String<Optional> - # # Reference to the cached BOC. # # If it is provided then only referenced BOC is unpinned
|
108
107
|
def cache_unpin(payload, &block)
|
109
|
-
|
108
|
+
TonBinding.requestLibrary(context: context, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
110
109
|
end
|
111
110
|
|
112
111
|
# INPUT: ParamsOfEncodeBoc
|
@@ -115,7 +114,7 @@ module TonClient
|
|
115
114
|
# RESPONSE: ResultOfEncodeBoc
|
116
115
|
# boc: String - # # Encoded cell BOC or BOC cache key.
|
117
116
|
def encode_boc(payload, &block)
|
118
|
-
|
117
|
+
TonBinding.requestLibrary(context: context, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
119
118
|
end
|
120
119
|
|
121
120
|
# INPUT: ParamsOfGetCodeSalt
|
@@ -124,7 +123,7 @@ module TonClient
|
|
124
123
|
# RESPONSE: ResultOfGetCodeSalt
|
125
124
|
# salt: String<Optional> - # # Contract code salt if present. # # BOC encoded as base64 or BOC handle
|
126
125
|
def get_code_salt(payload, &block)
|
127
|
-
|
126
|
+
TonBinding.requestLibrary(context: context, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
128
127
|
end
|
129
128
|
|
130
129
|
# INPUT: ParamsOfSetCodeSalt
|
@@ -134,7 +133,7 @@ module TonClient
|
|
134
133
|
# RESPONSE: ResultOfSetCodeSalt
|
135
134
|
# code: String - # # Contract code with salt set. # # BOC encoded as base64 or BOC handle
|
136
135
|
def set_code_salt(payload, &block)
|
137
|
-
|
136
|
+
TonBinding.requestLibrary(context: context, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
138
137
|
end
|
139
138
|
|
140
139
|
# INPUT: ParamsOfDecodeTvc
|
@@ -153,7 +152,7 @@ module TonClient
|
|
153
152
|
# split_depth: Number<Optional> - # # Is present and non-zero only in instances of large smart contracts
|
154
153
|
# compiler_version: String<Optional> - # # Compiler version, for example 'sol 0.49.0'
|
155
154
|
def decode_tvc(payload, &block)
|
156
|
-
|
155
|
+
TonBinding.requestLibrary(context: context, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
157
156
|
end
|
158
157
|
|
159
158
|
# INPUT: ParamsOfEncodeTvc
|
@@ -167,7 +166,7 @@ module TonClient
|
|
167
166
|
# RESPONSE: ResultOfEncodeTvc
|
168
167
|
# tvc: String - # # Contract TVC image BOC encoded as base64 or BOC handle of boc_cache parameter was specified
|
169
168
|
def encode_tvc(payload, &block)
|
170
|
-
|
169
|
+
TonBinding.requestLibrary(context: context, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
171
170
|
end
|
172
171
|
|
173
172
|
# INPUT: ParamsOfEncodeExternalInMessage
|
@@ -180,7 +179,7 @@ module TonClient
|
|
180
179
|
# message: String - # # Message BOC encoded with `base64`.
|
181
180
|
# message_id: String - # # Message id.
|
182
181
|
def encode_external_in_message(payload, &block)
|
183
|
-
|
182
|
+
TonBinding.requestLibrary(context: context, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
184
183
|
end
|
185
184
|
|
186
185
|
# INPUT: ParamsOfGetCompilerVersion
|
@@ -188,7 +187,7 @@ module TonClient
|
|
188
187
|
# RESPONSE: ResultOfGetCompilerVersion
|
189
188
|
# version: String<Optional> - # # Compiler version, for example 'sol 0.49.0'
|
190
189
|
def get_compiler_version(payload, &block)
|
191
|
-
|
190
|
+
TonBinding.requestLibrary(context: context, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
192
191
|
end
|
193
192
|
|
194
193
|
end
|
@@ -3,17 +3,19 @@ module TonClient
|
|
3
3
|
class Client
|
4
4
|
include CommonInstanceHelpers
|
5
5
|
|
6
|
-
attr_reader :
|
6
|
+
attr_reader :context, :context_config
|
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(
|
11
|
-
@
|
12
|
-
|
10
|
+
def initialize(context_config: {})
|
11
|
+
@context_config = context_config
|
12
|
+
config = TonBinding.make_string(context_config.to_json)
|
13
|
+
context_ptr = TonBinding.tc_create_context(config)
|
14
|
+
@context = TonBinding.read_string_to_hash(context_ptr)['result']
|
13
15
|
end
|
14
16
|
|
15
17
|
def destroy_context
|
16
|
-
|
18
|
+
TonBinding.tc_destroy_context(context)
|
17
19
|
end
|
18
20
|
|
19
21
|
def crypto
|
@@ -55,13 +57,13 @@ module TonClient
|
|
55
57
|
# RESPONSE: ResultOfGetApiReference
|
56
58
|
# api: Value -
|
57
59
|
def get_api_reference(&block)
|
58
|
-
|
60
|
+
TonBinding.requestLibrary(context: context, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block)
|
59
61
|
end
|
60
62
|
|
61
63
|
# RESPONSE: ResultOfVersion
|
62
64
|
# version: String - # # Core Library version
|
63
65
|
def version(&block)
|
64
|
-
|
66
|
+
TonBinding.requestLibrary(context: context, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block)
|
65
67
|
end
|
66
68
|
|
67
69
|
# RESPONSE: ClientConfig
|
@@ -72,21 +74,21 @@ module TonClient
|
|
72
74
|
# proofs: ProofsConfig<Optional> -
|
73
75
|
# 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
76
|
def config(&block)
|
75
|
-
|
77
|
+
TonBinding.requestLibrary(context: context, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block)
|
76
78
|
end
|
77
79
|
|
78
80
|
# RESPONSE: ResultOfBuildInfo
|
79
81
|
# build_number: Number - # # Build number assigned to this build by the CI.
|
80
82
|
# dependencies: Array - # # Fingerprint of the most important dependencies.
|
81
83
|
def build_info(&block)
|
82
|
-
|
84
|
+
TonBinding.requestLibrary(context: context, method_name: full_method_name(MODULE, __method__.to_s), payload: {}, &block)
|
83
85
|
end
|
84
86
|
|
85
87
|
# INPUT: ParamsOfResolveAppRequest
|
86
88
|
# app_request_id: Number - # # Request ID received from SDK
|
87
89
|
# result: AppRequestResult - # # Result of request processing
|
88
90
|
def resolve_app_request(payload, &block)
|
89
|
-
|
91
|
+
TonBinding.requestLibrary(context: context, method_name: full_method_name(MODULE, __method__.to_s), payload: payload, &block)
|
90
92
|
end
|
91
93
|
|
92
94
|
end
|