public interface LightningHandler
Modifier and Type | Method and Description |
---|---|
void |
close()
Method to close the LND connections and release underlying resources.
|
void |
connect(LightningHandlerContext context)
Method to open up a connection to the configured LND node.
|
Invoice |
generateInvoice(PreImageData preImageData,
ConvertedOrder paymentData)
Method to create an invoice in the underlying lightning node.
|
NodeInfo |
getNodeInfo()
Method to fetch the related lightning node's information to include in invoices.
|
boolean |
isConnected()
Method to check if handler is connected to node.
|
Invoice |
lookupInvoice(byte[] preImageHash)
Method to lookup an invoice in LND given the invoice's pre-image hash.
|
void |
registerListener(LightningEventListener listener)
Method to register a listener to recieve notification about updated invoices and settled invoices.
|
void |
unregisterListener(LightningEventListener listener)
Method to remove a listener from the list of event listeners of events related to adding or settling
invoices.
|
void connect(LightningHandlerContext context) throws java.io.IOException, InternalErrorException
context
- the last context by the payment handler, containing the indicies of the last invoices processed.java.io.IOException
- if communication problems occurred with underlying node.InternalErrorException
- if internal problems occurred opening up a connection with LND node.Invoice generateInvoice(PreImageData preImageData, ConvertedOrder paymentData) throws java.io.IOException, InternalErrorException
preImageData
- the generated pre image and hash to use in invoice.paymentData
- the payment data to generate invoice for.java.io.IOException
- if communication problems occurred with underlying node.InternalErrorException
- if problems occurred generating the invoice.void registerListener(LightningEventListener listener) throws InternalErrorException
listener
- the event listener to add to list receiving notifications.InternalErrorException
- if problems occurred registering from listeners.void unregisterListener(LightningEventListener listener) throws InternalErrorException
listener
- the listener to remove from list of listeners.InternalErrorException
- if problems occurred un-registering from listeners.Invoice lookupInvoice(byte[] preImageHash) throws java.io.IOException, InternalErrorException
preImageHash
- the pre image hash of the invoice to lookup.java.io.IOException
- if communication problems occurred with underlying node.InternalErrorException
- if internal problems occurred communication or parsing invoice with lightning node.boolean isConnected() throws java.io.IOException, InternalErrorException
java.io.IOException
- if communication problems occurred with underlying node.InternalErrorException
- if internal problems occurred checking connection status.void close() throws java.io.IOException, InternalErrorException
java.io.IOException
- if communication problems occurred with underlying node.InternalErrorException
- if internal problems occurred closing the connections with lightning node.NodeInfo getNodeInfo() throws java.io.IOException, InternalErrorException
java.io.IOException
- if communication problems occurred with underlying node.InternalErrorException
- if internal problems occurred closing the connections with lightning node.