Skip to content

Commit

Permalink
add helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
nerzh committed May 22, 2021
1 parent 0b8a622 commit 2e14a10
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
27 changes: 27 additions & 0 deletions lib/ton-client-ruby/Helpers/CommonHelpers.rb
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion lib/ton-client-ruby/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module TonClient
VERSION = "1.0.4"
VERSION = "1.0.5"
end

0 comments on commit 2e14a10

Please sign in to comment.