1
0
mirror of https://github.com/bumi/lnrpc synced 2025-08-05 15:36:52 +00:00
lnrpc/lib/lnrpc.rb
Michael Bumann 9b1499616d Add PaymentResponse wrapper
This is an experimental wrapper around the send_payment shortcut calls.
The goal is to provide a simple interface to check if the payment was
successful.
2020-08-29 19:40:45 +02:00

28 lines
662 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 :PaymentResponse, 'lnrpc/payment_response'
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