2020-05-05 20:08:35 +00:00
|
|
|
require 'lnrpc/version'
|
2020-08-28 12:09:57 +00: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 20:08:35 +00:00
|
|
|
require 'securerandom'
|
2019-02-08 05:51:42 +00:00
|
|
|
|
|
|
|
module Lnrpc
|
|
|
|
class Error < StandardError; end
|
|
|
|
autoload :Client, 'lnrpc/client'
|
2020-05-05 20:08:35 +00:00
|
|
|
autoload :GrpcWrapper, 'lnrpc/grpc_wrapper'
|
2019-02-12 16:15:16 +00:00
|
|
|
autoload :MacaroonInterceptor, 'lnrpc/macaroon_interceptor'
|
2019-02-12 02:12:48 +00:00
|
|
|
|
2020-05-05 20:08:35 +00:00
|
|
|
PREIMAGE_BYTE_LENGTH = 32
|
|
|
|
KEY_SEND_PREIMAGE_TYPE = 5482373484
|
|
|
|
|
|
|
|
def self.create_preimage
|
|
|
|
SecureRandom.random_bytes(PREIMAGE_BYTE_LENGTH)
|
|
|
|
end
|
2019-02-12 02:12:48 +00:00
|
|
|
|
2020-05-05 20:08:35 +00:00
|
|
|
def self.to_byte_array(str)
|
|
|
|
[str].pack("H*")
|
|
|
|
end
|
|
|
|
end
|