Module: TonClient
- Defined in:
- lib/ton-client-ruby.rb,
lib/ton-client-ruby/version.rb,
lib/ton-client-ruby/Client/Abi.rb,
lib/ton-client-ruby/Client/Boc.rb,
lib/ton-client-ruby/Client/Net.rb,
lib/ton-client-ruby/Client/Tvm.rb,
lib/ton-client-ruby/Client/Debot.rb,
lib/ton-client-ruby/Client/Utils.rb,
lib/ton-client-ruby/Client/Client.rb,
lib/ton-client-ruby/Client/Crypto.rb,
lib/ton-client-ruby/Binding/struct.rb,
lib/ton-client-ruby/Client/Context.rb,
lib/ton-client-ruby/Binding/binding.rb,
lib/ton-client-ruby/Binding/binding.rb,
lib/ton-client-ruby/Client/Processing.rb,
lib/ton-client-ruby/Helpers/CommonHelpers.rb
Defined Under Namespace
Modules: TonBinding
Classes: Abi, Boc, Client, Context, Crypto, Debot, Net, Processing, Tvm, Utils
Constant Summary
collapse
- VERSION =
"1.1.2"
- @@configured =
false
Class Method Summary
collapse
Class Method Details
.callLibraryMethodSync(method, *args) {|responses| ... } ⇒ Object
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/ton-client-ruby/Helpers/CommonHelpers.rb', line 17
def self.callLibraryMethodSync(method, *args)
responses = []
queue = Queue.new
method.call(*args) do |response|
responses << response
queue.push 1 if response.finished == true
end
queue.pop
yield(responses) if block_given?
end
|
.check_configuration ⇒ Object
25
26
27
|
# File 'lib/ton-client-ruby.rb', line 25
def self.check_configuration
raise "Not configured! Please configure TonClient: call ffi_lib(dylib_path)" unless !!@@configured
end
|
29
30
31
|
# File 'lib/ton-client-ruby.rb', line 29
def self.configure
yield self
end
|
.create(config: {}) ⇒ Object
39
40
41
42
|
# File 'lib/ton-client-ruby.rb', line 39
def self.create(config: {})
check_configuration
Client.new(context: Context.new(config: config))
end
|
.ffi_lib(dylib_path = nil) ⇒ Object
33
34
35
36
37
|
# File 'lib/ton-client-ruby.rb', line 33
def self.ffi_lib(dylib_path = nil)
TonBinding.ffi_lib(dylib_path)
TonBinding.setup_bindings()
@@configured = true
end
|
.read_abi(path_to_file) ⇒ Object
4
5
6
7
|
# File 'lib/ton-client-ruby/Helpers/CommonHelpers.rb', line 4
def self.read_abi(path_to_file)
file = File.read(path_to_file)
JSON.parse(file)
end
|
.read_tvc(path_to_file) ⇒ Object
9
10
11
12
13
14
15
|
# File 'lib/ton-client-ruby/Helpers/CommonHelpers.rb', line 9
def self.read_tvc(path_to_file)
data = File.open(path_to_file).read
encoded = Base64.encode64(data)
encoded.gsub(/\n/, '')
end
|