module TonClient

Constants

VERSION

Public Class Methods

callLibraryMethodSync(method, *args) { |responses| ... } click to toggle source
# 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() click to toggle source
# 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
configure() { |self| ... } click to toggle source
# File lib/ton-client-ruby.rb, line 29
def self.configure
  yield self
end
create(config: {}) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# File lib/ton-client-ruby/Helpers/CommonHelpers.rb, line 9
def self.read_tvc(path_to_file)
  data = File.open(path_to_file).read
  # Encode the puppy
  encoded = Base64.encode64(data)
  # Spit it out into one continous string
  encoded.gsub(/\n/, '')
end