Class: Lightning::Invoice
- Inherits:
-
Object
- Object
- Lightning::Invoice
- Defined in:
- lib/lightning/invoice.rb
Class Method Summary collapse
-
.add(**args) ⇒ Lnrpc::AddInvoiceResponse
Attempts to add a new invoice to the invoice database and returns a payment request.
-
.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.
23 24 25 26 27 28 29 30 31 |
# File 'lib/lightning/invoice.rb', line 23 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 |
.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.
46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/lightning/invoice.rb', line 46 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 |