Module: LightningSDK
- Defined in:
- lib/lightning/node.rb,
lib/lightning/stub.rb,
lib/lightning/invoice.rb,
lib/lightning/version.rb
Constant Summary collapse
- VERSION =
'0.1.0'.freeze
Class Method Summary collapse
-
.add(**args) ⇒ Lnrpc::AddInvoiceResponse
Attempts to add a new invoice to the invoice database and returns a payment request.
-
.info ⇒ Lnrpc::GetInfoResponse
Returns general information concerning the lightning node including it's identity pubkey, alias, the chains it is connected to, and information concerning the number of open+pending channels.
-
.list(**args) ⇒ Lnrpc::ListInvoiceResponse
Returns a list of all the invoices currently stored within the database.
Class Method Details
.add(**args) ⇒ Lnrpc::AddInvoiceResponse
Attempts to add a new invoice to the invoice database and returns a payment request.
22 23 24 25 26 27 28 29 30 |
# File 'lib/lightning/invoice.rb', line 22 def add(**args) value = args[:value] expiry = args[:expiry] memo = args[:memo] return_res stub.add_invoice( Lnrpc::Invoice.new(value: value, expiry: expiry, memo: memo) ) end |
.info ⇒ Lnrpc::GetInfoResponse
Returns general information concerning the lightning node including it's identity pubkey, alias, the chains it is connected to, and information concerning the number of open+pending channels.
11 12 13 |
# File 'lib/lightning/node.rb', line 11 def info return_res stub.get_info(Lnrpc::GetInfoRequest.new) end |
.list(**args) ⇒ Lnrpc::ListInvoiceResponse
Returns a list of all the invoices currently stored within the database. Any active debug invoices are ignored. It has full support for paginated responses, allowing users to query for specific invoices through their add_index. This can be done by using either the first_index_offset or last_index_offset fields included in the response as the index_offset of the next request. By default, the first 100 invoices created will be returned. Backwards pagination is also supported through the Reversed flag.
45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/lightning/invoice.rb', line 45 def list(**args) num_max_invoices = args[:num_max_invoices] index_offset = args[:index_offset] pending_only = args[:pending_only] reversed = args[:reversed] return_res stub.list_invoices( Lnrpc::ListInvoiceRequest.new( num_max_invoices: num_max_invoices, index_offset: index_offset, pending_only: pending_only, reversed: reversed ) ) end |