diff --git a/lib/ton-client-ruby/Helpers/CommonHelpers.rb b/lib/ton-client-ruby/Helpers/CommonHelpers.rb index cd93639..ee43380 100644 --- a/lib/ton-client-ruby/Helpers/CommonHelpers.rb +++ b/lib/ton-client-ruby/Helpers/CommonHelpers.rb @@ -1,4 +1,31 @@ +module TonClient + + def self.read_abi(path_to_file) + file = File.read(path_to_file) + JSON.parse(file) + end + + 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 + + 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 +end + module CommonClassHelpers def class_attr_accessor(*names) diff --git a/lib/ton-client-ruby/version.rb b/lib/ton-client-ruby/version.rb index 5d70842..ff5a793 100644 --- a/lib/ton-client-ruby/version.rb +++ b/lib/ton-client-ruby/version.rb @@ -1,3 +1,3 @@ module TonClient - VERSION = "1.0.4" + VERSION = "1.0.5" end