Class NWCWallet
java.lang.Object
org.ngengine.wallets.nip47.NWCWallet
- All Implemented Interfaces:
Wallet
-
Nested Class Summary
Nested classes/interfaces inherited from interface Wallet
Wallet.Methods -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the wallet and release any resources.org.ngengine.platform.AsyncTask<Long> getBalance(Instant expireRequestAt) Get the msats balance of the wallet.org.ngengine.platform.AsyncTask<WalletInfo> Get information about the wallet.org.ngengine.platform.AsyncTask<Boolean> isMethodSupported(Wallet.Methods method) Check if a specific method is supported by the wallet.booleanisReady()Check if the wallet is ready to use.org.ngengine.platform.AsyncTask<NWCKeysendResponse> keySend(String id, long amountMsats, String pubkey, String preimage, List<NWCTLVRecord> tlvRecords, Instant expireRequestAt) org.ngengine.platform.AsyncTask<List<TransactionInfo>> listTransactions(Instant from, Instant until, Integer limit, Integer offset, boolean includeUnpaid, TransactionType type, Instant expireRequestAt) List transactions in the wallet.org.ngengine.platform.AsyncTask<InvoiceData> lookupInvoice(String paymentHash, String invoice, Instant expireRequestAt) Lookup an invoice by payment hash or invoice string.org.ngengine.platform.AsyncTask<InvoiceData> makeInvoice(InvoiceProperties req, Instant expireRequestAt) Create a lightning invoiceorg.ngengine.platform.AsyncTask<PayResponse> payInvoice(String invoice, Long amountMsats, Instant expireRequestAt) Pay a lightning invoiceorg.ngengine.platform.AsyncTask<Boolean> Wait for the wallet to be ready.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Wallet
getBalance, getInfo, listTransactions, lookupInvoice, makeInvoice, payInvoice
-
Field Details
-
INFO_KIND
public static final int INFO_KIND- See Also:
-
REQUEST_KIND
public static final int REQUEST_KIND- See Also:
-
RESPONSE_KIND
public static final int RESPONSE_KIND- See Also:
-
NOTIFICATION_KIND
public static final int NOTIFICATION_KIND- See Also:
-
pool
-
uri
-
supportedMethods
-
tempPool
protected boolean tempPool -
closer
-
-
Constructor Details
-
NWCWallet
-
NWCWallet
-
-
Method Details
-
close
-
getSupportedMethods
-
payInvoice
public org.ngengine.platform.AsyncTask<PayResponse> payInvoice(@Nonnull String invoice, @Nullable Long amountMsats, @Nullable Instant expireRequestAt) Description copied from interface:WalletPay a lightning invoice- Specified by:
payInvoicein interfaceWallet- 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
-
keySend
public org.ngengine.platform.AsyncTask<NWCKeysendResponse> keySend(@Nullable String id, long amountMsats, @Nonnull String pubkey, @Nullable String preimage, @Nullable List<NWCTLVRecord> tlvRecords, @Nullable Instant expireRequestAt) -
makeInvoice
public org.ngengine.platform.AsyncTask<InvoiceData> makeInvoice(InvoiceProperties req, @Nullable Instant expireRequestAt) Description copied from interface:WalletCreate a lightning invoice- Specified by:
makeInvoicein interfaceWallet- Parameters:
req- the properties for the invoice to createexpireRequestAt- an optional Instant to expire the request at, or null for no expiration- Returns:
-
lookupInvoice
public org.ngengine.platform.AsyncTask<InvoiceData> lookupInvoice(@Nullable String paymentHash, @Nullable String invoice, @Nullable Instant expireRequestAt) Description copied from interface:WalletLookup an invoice by payment hash or invoice string.- Specified by:
lookupInvoicein interfaceWallet- 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
public org.ngengine.platform.AsyncTask<List<TransactionInfo>> listTransactions(@Nullable Instant from, @Nullable Instant until, @Nullable Integer limit, @Nullable Integer offset, boolean includeUnpaid, @Nullable TransactionType type, @Nullable Instant expireRequestAt) Description copied from interface:WalletList transactions in the wallet.- Specified by:
listTransactionsin interfaceWallet- 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
Description copied from interface:WalletGet the msats balance of the wallet.- Specified by:
getBalancein interfaceWallet- 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
Description copied from interface:WalletGet information about the wallet. -
isReady
-
waitForReady
Description copied from interface:WalletWait for the wallet to be ready.- Specified by:
waitForReadyin interfaceWallet- Returns:
- an AsyncTask that resolves to true if the wallet is ready, false if it failed to become ready
-
isMethodSupported
Description copied from interface:WalletCheck if a specific method is supported by the wallet.- Specified by:
isMethodSupportedin interfaceWallet- Parameters:
method- the method to check support for- Returns:
- an AsyncTask that resolves to true if the method is supported, false otherwise
-