Module: Lightning
- Defined in:
- lib/lnd_ruby_sdk.rb,
lib/lightning/node.rb,
lib/lightning/stub.rb,
lib/lightning/version.rb,
lib/lightning/invoices.rb
Overview
Namespace for classes and modules that handle communication with your LND node
Constant Summary collapse
- VERSION =
Current SDK version number.
'0.1.0'.freeze
Class Attribute Summary collapse
-
.config ⇒ Object
Returns the value of attribute config.
Class Method Summary collapse
-
.addinvoice(**args) ⇒ Lnrpc::AddInvoiceResponse
Add a new invoice, expressing intent for a future payment.
-
.decodepayreq(pay_req) ⇒ Lnrpc::PayReq
DecodePayReq takes an encoded payment request string and attempts to decode it, returning a full description of the conditions encoded within the payment request.
-
.getinfo ⇒ 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.
-
.listinvoices(**args) ⇒ Lnrpc::ListInvoiceResponse
This command enables the retrieval of all invoices currently stored within the database.
Class Attribute Details
.config ⇒ Object
Returns the value of attribute config
15 16 17 |
# File 'lib/lnd_ruby_sdk.rb', line 15 def config @config end |
Class Method Details
.addinvoice(**args) ⇒ Lnrpc::AddInvoiceResponse
Add a new invoice, expressing intent for a future payment. Invoices without an amount can be created by not supplying any parameters or providing an amount of 0. These invoices allow the payee to specify the amount of satoshis they wish to send.
25 26 27 28 29 30 31 32 33 |
# File 'lib/lightning/invoices.rb', line 25 def addinvoice(**args) amt = args[:amt] expiry = args[:expiry] memo = args[:memo] stub.add_invoice( Lnrpc::Invoice.new(value: amt, expiry: expiry, memo: memo) ) end |
.decodepayreq(pay_req) ⇒ Lnrpc::PayReq
DecodePayReq takes an encoded payment request string and attempts to decode it, returning a full description of the conditions encoded within the payment request.
45 46 47 48 |
# File 'lib/lightning/invoices.rb', line 45 def decodepayreq(pay_req) opts = { pay_req: pay_req } stub.decode_pay_req(Lnrpc::PayReqString.new(opts)) end |
.getinfo ⇒ 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.
12 13 14 |
# File 'lib/lightning/node.rb', line 12 def getinfo stub.get_info(Lnrpc::GetInfoRequest.new) end |
.listinvoices(**args) ⇒ Lnrpc::ListInvoiceResponse
This command enables the retrieval of all invoices currently stored within the database. It has full support for paginationed 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. The reversed flag is set by default in order to paginate backwards. If you wish to paginate forwards, you must explicitly set the flag to false. If none of the parameters are specified, then the last 100 invoices will be returned. For example: if you have 200 invoices, “listinvoices” will return the last 100 created. If you wish to retrieve the previous 100, the first_offset_index of the response can be used as the index_offset of the next listinvoices request.
82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/lightning/invoices.rb', line 82 def listinvoices(**args) num_max_invoices = args[:num_max_invoices] index_offset = args[:index_offset] pending_only = args[:pending_only] reversed = args[:reversed] stub.list_invoices( Lnrpc::ListInvoiceRequest.new( num_max_invoices: num_max_invoices, index_offset: index_offset, pending_only: pending_only, reversed: reversed ) ) end |