public class LNDHelper
extends java.lang.Object
Constructor and Description |
---|
LNDHelper(org.lightningj.lnd.wrapper.message.GetInfoResponse infoResponse)
Constructor of LND helper methods parsing info from LND node.
|
LNDHelper(java.lang.String supportedCurrency)
Default constructor when supportedCurrency comes from configuration
|
Modifier and Type | Method and Description |
---|---|
protected void |
checkCryptoAmount(CryptoAmount amount)
Method that the specified crypto amount is supported by LND.
|
Invoice |
convert(NodeInfo nodeInfo,
org.lightningj.lnd.wrapper.message.Invoice lndInvoice)
Help method to convert a LND Invoice to a Invoice value object.
|
org.lightningj.lnd.wrapper.message.Invoice |
genLNDInvoice(PreImageData preImageData,
ConvertedOrder paymentData)
Method to generate an LND Invoice from a PreImageData and ConvertedOrder
|
NodeInfo |
parseNodeInfo(org.lightningj.lnd.wrapper.message.GetInfoResponse infoResponse)
Method to parse a GetInfoResponse into a NodeInfo value object.
|
public LNDHelper(org.lightningj.lnd.wrapper.message.GetInfoResponse infoResponse) throws InternalErrorException
infoResponse
- the GetInfoResponse from the LND node.InternalErrorException
- if no supported currency was given.public LNDHelper(java.lang.String supportedCurrency)
supportedCurrency
- the configured currency code.public Invoice convert(NodeInfo nodeInfo, org.lightningj.lnd.wrapper.message.Invoice lndInvoice)
nodeInfo
- the related node info from LND node.lndInvoice
- the LND invoice to convert.public org.lightningj.lnd.wrapper.message.Invoice genLNDInvoice(PreImageData preImageData, ConvertedOrder paymentData) throws InternalErrorException
preImageData
- the preImageData value object to the invoice preimage and hash from.paymentData
- the payment data to generate invoice value and expire date from.InternalErrorException
- if specified crypto amount is unsupported by LND implementation.protected void checkCryptoAmount(CryptoAmount amount) throws InternalErrorException
amount
- the crypto amount to used in LND invoiceInternalErrorException
- if crypto amount contained invalid values.public NodeInfo parseNodeInfo(org.lightningj.lnd.wrapper.message.GetInfoResponse infoResponse) throws InternalErrorException
infoResponse
- the GetInfoResponse from LND node.InternalErrorException
- if problem occurred parsing the LND node data.