Package org.ngengine.wallets
Interface Wallet
-
- All Known Implementing Classes:
NWCWallet
public interface Wallet
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classWallet.Methods
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidclose()Close the wallet and release any resources.default org.ngengine.platform.AsyncTask<java.lang.Long>getBalance()Get the msats balance of the wallet.org.ngengine.platform.AsyncTask<java.lang.Long>getBalance(java.time.Instant expireRequestAt)Get the msats balance of the wallet.default org.ngengine.platform.AsyncTask<WalletInfo>getInfo()Get information about the wallet.org.ngengine.platform.AsyncTask<WalletInfo>getInfo(java.time.Instant expireRequestAt)Get information about the wallet.org.ngengine.platform.AsyncTask<java.lang.Boolean>isMethodSupported(Wallet.Methods method)Check if a specific method is supported by the wallet.booleanisReady()Check if the wallet is ready to use.default org.ngengine.platform.AsyncTask<java.util.List<TransactionInfo>>listTransactions(java.time.Instant from, java.time.Instant until, java.lang.Integer limit, java.lang.Integer offset, boolean includeUnpaid, TransactionType type)List transactions in the wallet.org.ngengine.platform.AsyncTask<java.util.List<TransactionInfo>>listTransactions(java.time.Instant from, java.time.Instant until, java.lang.Integer limit, java.lang.Integer offset, boolean includeUnpaid, TransactionType type, java.time.Instant expireRequestAt)List transactions in the wallet.default org.ngengine.platform.AsyncTask<InvoiceData>lookupInvoice(java.lang.String paymentHash, java.lang.String invoice)Lookup an invoice by payment hash or invoice string.org.ngengine.platform.AsyncTask<InvoiceData>lookupInvoice(java.lang.String paymentHash, java.lang.String invoice, java.time.Instant expireRequestAt)Lookup an invoice by payment hash or invoice string.default org.ngengine.platform.AsyncTask<InvoiceData>makeInvoice(InvoiceProperties req)Create a lightning invoiceorg.ngengine.platform.AsyncTask<InvoiceData>makeInvoice(InvoiceProperties req, java.time.Instant expireRequestAt)Create a lightning invoicedefault org.ngengine.platform.AsyncTask<PayResponse>payInvoice(java.lang.String invoice, java.lang.Long amountMsats)Pay a lightning invoiceorg.ngengine.platform.AsyncTask<PayResponse>payInvoice(java.lang.String invoice, java.lang.Long amountMsats, java.time.Instant expireRequestAt)Pay a lightning invoiceorg.ngengine.platform.AsyncTask<java.lang.Boolean>waitForReady()Wait for the wallet to be ready.
-
-
-
Method Detail
-
payInvoice
default org.ngengine.platform.AsyncTask<PayResponse> payInvoice(@Nonnull java.lang.String invoice, @Nullable java.lang.Long amountMsats)
Pay a lightning invoice- Parameters:
invoice- the lightning invoice to payamountMsats- the amount in millisatoshis to pay, or null to use the invoice amount- Returns:
- an AsyncTask that resolves to a PayResponse containing the payment result
-
payInvoice
org.ngengine.platform.AsyncTask<PayResponse> payInvoice(@Nonnull java.lang.String invoice, @Nullable java.lang.Long amountMsats, @Nullable java.time.Instant expireRequestAt)
Pay a lightning invoice- Parameters:
invoice- the lightning invoice to payamountMsats- the amount in millisatoshis to pay, or null to use the invoice amountexpireRequestAt- an optional Instant to expire the request at, or null for no expiration- Returns:
- an AsyncTask that resolves to a PayResponse containing the payment result
-
makeInvoice
default org.ngengine.platform.AsyncTask<InvoiceData> makeInvoice(InvoiceProperties req)
Create a lightning invoice- Parameters:
req- the properties for the invoice to create- Returns:
- an AsyncTask that resolves to an InvoiceData containing the created invoice
-
makeInvoice
org.ngengine.platform.AsyncTask<InvoiceData> makeInvoice(InvoiceProperties req, @Nullable java.time.Instant expireRequestAt)
Create a lightning invoice- Parameters:
req- the properties for the invoice to createexpireRequestAt- an optional Instant to expire the request at, or null for no expiration- Returns:
-
lookupInvoice
default org.ngengine.platform.AsyncTask<InvoiceData> lookupInvoice(@Nullable java.lang.String paymentHash, @Nullable java.lang.String invoice)
Lookup an invoice by payment hash or invoice string. At least one of paymentHash or invoice must be provided.- Parameters:
paymentHash- the payment hash to lookup, or null if not availableinvoice- the invoice string to lookup, or null if not available- Returns:
- an AsyncTask that resolves to an InvoiceData containing the invoice details
-
lookupInvoice
org.ngengine.platform.AsyncTask<InvoiceData> lookupInvoice(@Nullable java.lang.String paymentHash, @Nullable java.lang.String invoice, @Nullable java.time.Instant expireRequestAt)
Lookup an invoice by payment hash or invoice string.- Parameters:
paymentHash- the payment hash to lookup, or null if not availableinvoice- the invoice string to lookup, or null if not availableexpireRequestAt- an optional Instant to expire the request at, or null for no expiration- Returns:
- an AsyncTask that resolves to an InvoiceData containing the invoice details
-
listTransactions
default org.ngengine.platform.AsyncTask<java.util.List<TransactionInfo>> listTransactions(@Nullable java.time.Instant from, @Nullable java.time.Instant until, @Nullable java.lang.Integer limit, @Nullable java.lang.Integer offset, boolean includeUnpaid, @Nullable TransactionType type)
List transactions in the wallet.- Parameters:
from- the start time to filter transactions from, or null for no start timeuntil- the end time to filter transactions until, or null for no end timelimit- the maximum number of transactions to return, or null for no limitoffset- the offset to start returning transactions from, or null for no offsetincludeUnpaid- whether to include unpaid transactions, or false to exclude themtype- the type of transactions to filter by, or null for all types- Returns:
- an AsyncTask that resolves to a List of TransactionInfo containing the transactions
-
listTransactions
org.ngengine.platform.AsyncTask<java.util.List<TransactionInfo>> listTransactions(@Nullable java.time.Instant from, @Nullable java.time.Instant until, @Nullable java.lang.Integer limit, @Nullable java.lang.Integer offset, boolean includeUnpaid, @Nullable TransactionType type, @Nullable java.time.Instant expireRequestAt)
List transactions in the wallet.- Parameters:
from- the start time to filter transactions from, or null for no start timeuntil- the end time to filter transactions until, or null for no end timelimit- the maximum number of transactions to return, or null for no limitoffset- the offset to start returning transactions from, or null for no offsetincludeUnpaid- whether to include unpaid transactions, or false to exclude themtype- the type of transactions to filter by, or null for all typesexpireRequestAt- an optional Instant to expire the request at, or null for no expiration- Returns:
- an AsyncTask that resolves to a List of TransactionInfo containing the transactions
-
getBalance
default org.ngengine.platform.AsyncTask<java.lang.Long> getBalance()
Get the msats balance of the wallet.- Returns:
- an AsyncTask that resolves to the balance in millisatoshis
-
getBalance
org.ngengine.platform.AsyncTask<java.lang.Long> getBalance(@Nullable java.time.Instant expireRequestAt)Get the msats balance of the wallet.- Parameters:
expireRequestAt- an optional Instant to expire the request at, or null for no expiration- Returns:
- an AsyncTask that resolves to the balance in millisatoshis
-
getInfo
default org.ngengine.platform.AsyncTask<WalletInfo> getInfo()
Get information about the wallet.- Returns:
- an AsyncTask that resolves to a WalletInfo containing the wallet details
-
getInfo
org.ngengine.platform.AsyncTask<WalletInfo> getInfo(@Nullable java.time.Instant expireRequestAt)
Get information about the wallet.- Parameters:
expireRequestAt- an optional Instant to expire the request at, or null for no expiration- Returns:
- an AsyncTask that resolves to a WalletInfo containing the wallet details
-
isReady
boolean isReady()
Check if the wallet is ready to use.- Returns:
- true if the wallet is ready, false otherwise
-
waitForReady
org.ngengine.platform.AsyncTask<java.lang.Boolean> waitForReady()
Wait for the wallet to be ready.- Returns:
- an AsyncTask that resolves to true if the wallet is ready, false if it failed to become ready
-
isMethodSupported
org.ngengine.platform.AsyncTask<java.lang.Boolean> isMethodSupported(@Nonnull Wallet.Methods method)Check if a specific method is supported by the wallet.- Parameters:
method- the method to check support for- Returns:
- an AsyncTask that resolves to true if the method is supported, false otherwise
-
close
void close()
Close the wallet and release any resources.
-
-