Module: TonClient

Defined in:
lib/everscale-client-ruby.rb,
lib/everscale-client-ruby/version.rb,
lib/everscale-client-ruby/Client/Abi.rb,
lib/everscale-client-ruby/Client/Boc.rb,
lib/everscale-client-ruby/Client/Net.rb,
lib/everscale-client-ruby/Client/Tvm.rb,
lib/everscale-client-ruby/Client/Debot.rb,
lib/everscale-client-ruby/Client/Utils.rb,
lib/everscale-client-ruby/Client/Client.rb,
lib/everscale-client-ruby/Client/Crypto.rb,
lib/everscale-client-ruby/Client/Proofs.rb,
lib/everscale-client-ruby/Binding/struct.rb,
lib/everscale-client-ruby/Binding/binding.rb,
lib/everscale-client-ruby/Binding/binding.rb,
lib/everscale-client-ruby/Client/Processing.rb,
lib/everscale-client-ruby/Helpers/CommonHelpers.rb

Defined Under Namespace

Modules: TonBinding Classes: Abi, Boc, Client, Crypto, Debot, Net, Processing, Proofs, RequestId, Requests, Tvm, Utils

Constant Summary collapse

VERSION =
"1.1.73"
@@configured =
false

Class Method Summary collapse

Class Method Details

.callLibraryMethodSync(method, *args) {|responses.map{ |resp| resp if (resp.result || resp.error) }.compact| ... } ⇒ Object

Yields:

  • (responses.map{ |resp| resp if (resp.result || resp.error) }.compact)


16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/everscale-client-ruby/Helpers/CommonHelpers.rb', line 16

def self.callLibraryMethodSync(method, *args)
  responses = []
  mutex = Monitor.new
  condition = mutex.new_cond

  method.call(*args) do |response|
    mutex.synchronize do
      responses << response
      if response.finished == true
        condition.signal
      end
    end
  end

  mutex.synchronize do
    condition.wait
  end

  yield(responses.map{ |resp| resp if (resp.result || resp.error) }.compact) if block_given?
end

.check_configurationObject



25
26
27
# File 'lib/everscale-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| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (TonClient)

    the object that the method was called on



29
30
31
# File 'lib/everscale-client-ruby.rb', line 29

def self.configure
  yield self
end

.create(config: {}) ⇒ Object



39
40
41
42
# File 'lib/everscale-client-ruby.rb', line 39

def self.create(config: {})
  check_configuration
  Client.new(context_config: config)
end

.ffi_lib(dylib_path = nil) ⇒ Object



33
34
35
36
37
# File 'lib/everscale-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



3
4
5
6
# File 'lib/everscale-client-ruby/Helpers/CommonHelpers.rb', line 3

def self.read_abi(path_to_file)
  file = File.read(path_to_file)
  JSON.parse(file)
end

.read_tvc(path_to_file) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/everscale-client-ruby/Helpers/CommonHelpers.rb', line 8

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