2020-05-05 22:08:35 +02:00
|
|
|
require 'lnrpc/version'
|
2020-08-28 14:09:57 +02:00
|
|
|
|
|
|
|
|
# require GRPC services
|
|
|
|
|
Dir[File.join(File.expand_path(File.dirname(__FILE__)), 'grpc_services/**/*_services_pb.rb')].each do |file|
|
|
|
|
|
require file
|
|
|
|
|
end
|
|
|
|
|
|
2020-05-05 22:08:35 +02:00
|
|
|
require 'securerandom'
|
2019-02-08 06:51:42 +01:00
|
|
|
|
|
|
|
|
module Lnrpc
|
|
|
|
|
class Error < StandardError; end
|
|
|
|
|
autoload :Client, 'lnrpc/client'
|
2020-05-05 22:08:35 +02:00
|
|
|
autoload :GrpcWrapper, 'lnrpc/grpc_wrapper'
|
2019-02-12 17:15:16 +01:00
|
|
|
autoload :MacaroonInterceptor, 'lnrpc/macaroon_interceptor'
|
2019-02-12 03:12:48 +01:00
|
|
|
|
2020-05-05 22:08:35 +02:00
|
|
|
PREIMAGE_BYTE_LENGTH = 32
|
|
|
|
|
KEY_SEND_PREIMAGE_TYPE = 5482373484
|
|
|
|
|
|
|
|
|
|
def self.create_preimage
|
|
|
|
|
SecureRandom.random_bytes(PREIMAGE_BYTE_LENGTH)
|
|
|
|
|
end
|
2019-02-12 03:12:48 +01:00
|
|
|
|
2020-05-05 22:08:35 +02:00
|
|
|
def self.to_byte_array(str)
|
|
|
|
|
[str].pack("H*")
|
|
|
|
|
end
|
|
|
|
|
end
|