6 namespace org { namespace ldk { namespace structs {
10 * An `InvoiceRequest` is a request for a [`Bolt12Invoice`] formulated from an [`Offer`].
12 * An offer may provide choices such as quantity, amount, chain, features, etc. An invoice request
13 * specifies these such that its recipient can send an invoice for payment.
15 * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
16 * [`Offer`]: crate::offers::offer::Offer
18 public class InvoiceRequest : CommonBase {
19 internal InvoiceRequest(object _dummy, long ptr) : base(ptr) { }
21 if (ptr != 0) { bindings.InvoiceRequest_free(ptr); }
24 internal long clone_ptr() {
25 long ret = bindings.InvoiceRequest_clone_ptr(this.ptr);
31 * Creates a copy of the InvoiceRequest
33 public InvoiceRequest clone() {
34 long ret = bindings.InvoiceRequest_clone(this.ptr);
36 if (ret >= 0 && ret <= 4096) { return null; }
37 org.ldk.structs.InvoiceRequest ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InvoiceRequest(null, ret); }
38 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
43 * An unpredictable series of bytes, typically containing information about the derivation of
46 * [`payer_id`]: Self::payer_id
48 public byte[] metadata() {
49 byte[] ret = bindings.InvoiceRequest_metadata(this.ptr);
55 * A chain from [`Offer::chains`] that the offer is valid for.
57 public byte[] chain() {
58 byte[] ret = bindings.InvoiceRequest_chain(this.ptr);
64 * The amount to pay in msats (i.e., the minimum lightning-payable unit for [`chain`]), which
65 * must be greater than or equal to [`Offer::amount`], converted if necessary.
67 * [`chain`]: Self::chain
69 public Option_u64Z amount_msats() {
70 long ret = bindings.InvoiceRequest_amount_msats(this.ptr);
72 if (ret >= 0 && ret <= 4096) { return null; }
73 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
74 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
79 * Features pertaining to requesting an invoice.
81 public InvoiceRequestFeatures features() {
82 long ret = bindings.InvoiceRequest_features(this.ptr);
84 if (ret >= 0 && ret <= 4096) { return null; }
85 org.ldk.structs.InvoiceRequestFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InvoiceRequestFeatures(null, ret); }
86 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
91 * The quantity of the offer's item conforming to [`Offer::is_valid_quantity`].
93 public Option_u64Z quantity() {
94 long ret = bindings.InvoiceRequest_quantity(this.ptr);
96 if (ret >= 0 && ret <= 4096) { return null; }
97 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
98 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
103 * A possibly transient pubkey used to sign the invoice request.
105 public byte[] payer_id() {
106 byte[] ret = bindings.InvoiceRequest_payer_id(this.ptr);
112 * A payer-provided note which will be seen by the recipient and reflected back in the invoice
115 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
117 public PrintableString payer_note() {
118 long ret = bindings.InvoiceRequest_payer_note(this.ptr);
120 if (ret >= 0 && ret <= 4096) { return null; }
121 org.ldk.structs.PrintableString ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PrintableString(null, ret); }
122 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
127 * Verifies that the request was for an offer created using the given key. Returns the derived
128 * keys need to sign an [`Bolt12Invoice`] for the request if they could be extracted from the
131 * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
133 public Result_COption_KeyPairZNoneZ verify(org.ldk.structs.ExpandedKey key) {
134 long ret = bindings.InvoiceRequest_verify(this.ptr, key == null ? 0 : key.ptr);
137 if (ret >= 0 && ret <= 4096) { return null; }
138 Result_COption_KeyPairZNoneZ ret_hu_conv = Result_COption_KeyPairZNoneZ.constr_from_ptr(ret);
139 if (this != null) { this.ptrs_to.AddLast(key); };
144 * Serialize the InvoiceRequest object into a byte array which can be read by InvoiceRequest_read
146 public byte[] write() {
147 byte[] ret = bindings.InvoiceRequest_write(this.ptr);