module Lnd
Private Instance Methods
bin_to_hex(s)
click to toggle source
# File lib/lnd.rb, line 40 def bin_to_hex(s) ap s s.each_byte.map { |b| b.to_s(16) }.join end
certificate()
click to toggle source
# File lib/lnd.rb, line 14 def certificate # TODO: READ CERTIFICATE FROM ENV File.read(File.expand_path(ENV['lnd_cert'])) end
credentials()
click to toggle source
# File lib/lnd.rb, line 19 def credentials GRPC::Core::ChannelCredentials.new(certificate) end
macaroon()
click to toggle source
# File lib/lnd.rb, line 28 def macaroon macaroon_binary.each_byte.map { |b| b.to_s(16).rjust(2,'0') }.join end
macaroon_binary()
click to toggle source
# File lib/lnd.rb, line 23 def macaroon_binary # TODO: READ MACA FROM ENV File.read(File.expand_path(ENV['lnd_macaroon'])) end
protect_call(failed_value, &block)
click to toggle source
# File lib/lnd.rb, line 6 def protect_call(failed_value, &block) begin block.call rescue => e failed_value end end
stub()
click to toggle source
# File lib/lnd.rb, line 32 def stub # TODO: READ THE NODE URL FROM ENV Lnrpc::Lightning::Stub.new(ENV['lnd_host'], credentials, interceptors: [MacaroonInterceptor.new(macaroon)]) end