1
0
mirror of https://github.com/bumi/lnrpc synced 2025-03-24 03:59:42 +00:00
lnrpc/lib/lnrpc.rb
Michael Bumann 404ed3b99e Add support for v0.11 GRPC services
This also refactors the client GRPC wrapper to dynamically load the
request objects.
All GRPC generated client files now live under lib/grpc_services
2020-08-28 14:14:50 +02:00

27 lines
608 B
Ruby

require 'lnrpc/version'
# require GRPC services
Dir[File.join(File.expand_path(File.dirname(__FILE__)), 'grpc_services/**/*_services_pb.rb')].each do |file|
require file
end
require 'securerandom'
module Lnrpc
class Error < StandardError; end
autoload :Client, 'lnrpc/client'
autoload :GrpcWrapper, 'lnrpc/grpc_wrapper'
autoload :MacaroonInterceptor, 'lnrpc/macaroon_interceptor'
PREIMAGE_BYTE_LENGTH = 32
KEY_SEND_PREIMAGE_TYPE = 5482373484
def self.create_preimage
SecureRandom.random_bytes(PREIMAGE_BYTE_LENGTH)
end
def self.to_byte_array(str)
[str].pack("H*")
end
end