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/Client/Proofs.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, Proofs, Tvm, Utils
Constant Summary
collapse
- VERSION =
"1.1.20"
- @@configured =
false
Class Method Summary
collapse
Class Method Details
.callLibraryMethodSync(method, *args) ⇒ 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
yield(responses) if block_given?
queue.push 1 if response.finished == true
end
queue.pop
end
|
.check_configuration ⇒ Object
26
27
28
|
# File 'lib/ton-client-ruby.rb', line 26
def self.check_configuration
raise "Not configured! Please configure TonClient: call ffi_lib(dylib_path)" unless !!@@configured
end
|
30
31
32
|
# File 'lib/ton-client-ruby.rb', line 30
def self.configure
yield self
end
|
.create(config: {}) ⇒ Object
40
41
42
43
|
# File 'lib/ton-client-ruby.rb', line 40
def self.create(config: {})
check_configuration
Client.new(context: Context.new(config: config))
end
|
.ffi_lib(dylib_path = nil) ⇒ Object
34
35
36
37
38
|
# File 'lib/ton-client-ruby.rb', line 34
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
|