Package org.ldk.structs
Class InvoicePayer
- java.lang.Object
-
- org.ldk.structs.InvoicePayer
-
public class InvoicePayer extends Object
A utility for paying [`Invoice`]s and sending spontaneous payments. See [module-level documentation] for details. [module-level documentation]: crate::payment
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description EventHandleras_EventHandler()Constructs a new EventHandler which calls the relevant methods on this_arg.protected voidfinalize()static InvoicePayerof(Payer payer, Router router, MultiThreadedLockableScore scorer, Logger logger, EventHandler event_handler, Retry retry)Creates an invoice payer that retries failed payment paths.Result_PaymentIdPaymentErrorZpay_invoice(Invoice invoice)Pays the given [`Invoice`], caching it for later use in case a retry is needed.Result_PaymentIdPaymentErrorZpay_pubkey(byte[] pubkey, byte[] payment_preimage, long amount_msats, int final_cltv_expiry_delta)Pays `pubkey` an amount using the hash of the given preimage, caching it for later use in case a retry is needed.Result_PaymentIdPaymentErrorZpay_zero_value_invoice(Invoice invoice, long amount_msats)Pays the given zero-value [`Invoice`] using the given amount, caching it for later use in case a retry is needed.voidremove_cached_payment(byte[] payment_hash)Removes the payment cached by the given payment hash.
-
-
-
Method Detail
-
finalize
protected void finalize() throws Throwable
-
of
public static InvoicePayer of(Payer payer, Router router, MultiThreadedLockableScore scorer, Logger logger, EventHandler event_handler, Retry retry)
Creates an invoice payer that retries failed payment paths. Will forward any [`Event::PaymentPathFailed`] events to the decorated `event_handler` once `retry` has been exceeded for a given [`Invoice`].
-
pay_invoice
public Result_PaymentIdPaymentErrorZ pay_invoice(Invoice invoice)
Pays the given [`Invoice`], caching it for later use in case a retry is needed. You should ensure that the `invoice.payment_hash()` is unique and the same payment_hash has never been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so for you.
-
pay_zero_value_invoice
public Result_PaymentIdPaymentErrorZ pay_zero_value_invoice(Invoice invoice, long amount_msats)
Pays the given zero-value [`Invoice`] using the given amount, caching it for later use in case a retry is needed. You should ensure that the `invoice.payment_hash()` is unique and the same payment_hash has never been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so for you.
-
pay_pubkey
public Result_PaymentIdPaymentErrorZ pay_pubkey(byte[] pubkey, byte[] payment_preimage, long amount_msats, int final_cltv_expiry_delta)
Pays `pubkey` an amount using the hash of the given preimage, caching it for later use in case a retry is needed. You should ensure that `payment_preimage` is unique and that its `payment_hash` has never been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so for you.
-
remove_cached_payment
public void remove_cached_payment(byte[] payment_hash)
Removes the payment cached by the given payment hash. Should be called once a payment has failed or succeeded if not using [`InvoicePayer`] as an [`EventHandler`]. Otherwise, calling this method is unnecessary.
-
as_EventHandler
public EventHandler as_EventHandler()
Constructs a new EventHandler which calls the relevant methods on this_arg. This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is
-
-