Package org.ldk.structs
Class Offer
- java.lang.Object
-
- org.ldk.structs.Offer
-
public class Offer extends Object
An `Offer` is a potentially long-lived proposal for payment of a good or service. An offer is a precursor to an [`InvoiceRequest`]. A merchant publishes an offer from which a customer may request an [`Invoice`] for a specific quantity and using an amount sufficient to cover that quantity (i.e., at least `quantity * amount`). See [`Offer::amount`]. Offers may be denominated in currency other than bitcoin but are ultimately paid using the latter. Through the use of [`BlindedPath`]s, offers provide recipient privacy. [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest [`Invoice`]: crate::offers::invoice::Invoice
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Option_DurationZ
absolute_expiry()
Duration since the Unix epoch when an invoice should no longer be requested.Amount
amount()
The minimum amount required for a successful payment of a single item.byte[][]
chains()
The chains that may be used when paying a requested invoice (e.g., bitcoin mainnet).Offer
clone()
Creates a copy of the OfferPrintableString
description()
A complete description of the purpose of the payment.boolean
expects_quantity()
Returns whether a quantity is expected in an [`InvoiceRequest`] for the offer.OfferFeatures
features()
Features pertaining to the offer.protected void
finalize()
boolean
is_expired()
Whether the offer has expired.boolean
is_valid_quantity(long quantity)
Returns whether the given quantity is valid for the offer.PrintableString
issuer()
The issuer of the offer, possibly beginning with `user@domain` or `domain`.Option_CVec_u8ZZ
metadata()
Opaque bytes set by the originator.BlindedPath[]
paths()
Paths to the recipient originating from publicly reachable nodes.byte[]
signing_pubkey()
The public key used by the recipient to sign invoices.Quantity
supported_quantity()
The quantity of items supported.boolean
supports_chain(byte[] chain)
Returns whether the given chain is supported by the offer.byte[]
write()
Serialize the Offer object into a byte array which can be read by Offer_read
-
-
-
Method Detail
-
finalize
protected void finalize() throws Throwable
-
chains
public byte[][] chains()
The chains that may be used when paying a requested invoice (e.g., bitcoin mainnet). Payments must be denominated in units of the minimal lightning-payable unit (e.g., msats) for the selected chain.
-
supports_chain
public boolean supports_chain(byte[] chain)
Returns whether the given chain is supported by the offer.
-
metadata
public Option_CVec_u8ZZ metadata()
Opaque bytes set by the originator. Useful for authentication and validating fields since it is reflected in `invoice_request` messages along with all the other fields from the `offer`.
-
amount
@Nullable public Amount amount()
The minimum amount required for a successful payment of a single item. Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
-
description
public PrintableString description()
A complete description of the purpose of the payment. Intended to be displayed to the user but with the caveat that it has not been verified in any way.
-
features
public OfferFeatures features()
Features pertaining to the offer.
-
absolute_expiry
public Option_DurationZ absolute_expiry()
Duration since the Unix epoch when an invoice should no longer be requested. If `None`, the offer does not expire.
-
is_expired
public boolean is_expired()
Whether the offer has expired.
-
issuer
@Nullable public PrintableString issuer()
The issuer of the offer, possibly beginning with `user@domain` or `domain`. Intended to be displayed to the user but with the caveat that it has not been verified in any way. Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
-
paths
public BlindedPath[] paths()
Paths to the recipient originating from publicly reachable nodes. Blinded paths provide recipient privacy by obfuscating its node id.
-
supported_quantity
public Quantity supported_quantity()
The quantity of items supported.
-
is_valid_quantity
public boolean is_valid_quantity(long quantity)
Returns whether the given quantity is valid for the offer.
-
expects_quantity
public boolean expects_quantity()
Returns whether a quantity is expected in an [`InvoiceRequest`] for the offer. [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
-
signing_pubkey
public byte[] signing_pubkey()
The public key used by the recipient to sign invoices.
-
write
public byte[] write()
Serialize the Offer object into a byte array which can be read by Offer_read
-
-