6 namespace org { namespace ldk { namespace structs {
10 * A semantically valid [`Bolt12Invoice`] that hasn't been signed.
14 * This is serialized as a TLV stream, which includes TLV records from the originating message. As
15 * such, it may include unknown, odd TLV records.
17 public class UnsignedBolt12Invoice : CommonBase {
18 internal UnsignedBolt12Invoice(object _dummy, long ptr) : base(ptr) { }
19 ~UnsignedBolt12Invoice() {
20 if (ptr != 0) { bindings.UnsignedBolt12Invoice_free(ptr); }
23 internal long clone_ptr() {
24 long ret = bindings.UnsignedBolt12Invoice_clone_ptr(this.ptr);
30 * Creates a copy of the UnsignedBolt12Invoice
32 public UnsignedBolt12Invoice clone() {
33 long ret = bindings.UnsignedBolt12Invoice_clone(this.ptr);
35 if (ret >= 0 && ret <= 4096) { return null; }
36 org.ldk.structs.UnsignedBolt12Invoice ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UnsignedBolt12Invoice(null, ret); }
37 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
42 * Returns the [`TaggedHash`] of the invoice to sign.
44 public TaggedHash tagged_hash() {
45 long ret = bindings.UnsignedBolt12Invoice_tagged_hash(this.ptr);
47 if (ret >= 0 && ret <= 4096) { return null; }
48 org.ldk.structs.TaggedHash ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TaggedHash(null, ret); }
49 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
54 * The chains that may be used when paying a requested invoice.
56 * From [`Offer::chains`]; `None` if the invoice was created in response to a [`Refund`].
58 * [`Offer::chains`]: crate::offers::offer::Offer::chains
60 public Option_CVec_ThirtyTwoBytesZZ offer_chains() {
61 long ret = bindings.UnsignedBolt12Invoice_offer_chains(this.ptr);
63 if (ret >= 0 && ret <= 4096) { return null; }
64 org.ldk.structs.Option_CVec_ThirtyTwoBytesZZ ret_hu_conv = org.ldk.structs.Option_CVec_ThirtyTwoBytesZZ.constr_from_ptr(ret);
65 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
70 * The chain that must be used when paying the invoice; selected from [`offer_chains`] if the
71 * invoice originated from an offer.
73 * From [`InvoiceRequest::chain`] or [`Refund::chain`].
75 * [`offer_chains`]: Self::offer_chains
76 * [`InvoiceRequest::chain`]: crate::offers::invoice_request::InvoiceRequest::chain
78 public byte[] chain() {
79 long ret = bindings.UnsignedBolt12Invoice_chain(this.ptr);
81 if (ret >= 0 && ret <= 4096) { return null; }
82 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
87 * Opaque bytes set by the originating [`Offer`].
89 * From [`Offer::metadata`]; `None` if the invoice was created in response to a [`Refund`] or
90 * if the [`Offer`] did not set it.
92 * [`Offer`]: crate::offers::offer::Offer
93 * [`Offer::metadata`]: crate::offers::offer::Offer::metadata
95 public Option_CVec_u8ZZ metadata() {
96 long ret = bindings.UnsignedBolt12Invoice_metadata(this.ptr);
98 if (ret >= 0 && ret <= 4096) { return null; }
99 org.ldk.structs.Option_CVec_u8ZZ ret_hu_conv = org.ldk.structs.Option_CVec_u8ZZ.constr_from_ptr(ret);
100 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
105 * The minimum amount required for a successful payment of a single item.
107 * From [`Offer::amount`]; `None` if the invoice was created in response to a [`Refund`] or if
108 * the [`Offer`] did not set it.
110 * [`Offer`]: crate::offers::offer::Offer
111 * [`Offer::amount`]: crate::offers::offer::Offer::amount
113 public Option_AmountZ amount() {
114 long ret = bindings.UnsignedBolt12Invoice_amount(this.ptr);
116 if (ret >= 0 && ret <= 4096) { return null; }
117 org.ldk.structs.Option_AmountZ ret_hu_conv = org.ldk.structs.Option_AmountZ.constr_from_ptr(ret);
118 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
123 * Features pertaining to the originating [`Offer`].
125 * From [`Offer::offer_features`]; `None` if the invoice was created in response to a
128 * [`Offer`]: crate::offers::offer::Offer
129 * [`Offer::offer_features`]: crate::offers::offer::Offer::offer_features
131 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
133 public OfferFeatures offer_features() {
134 long ret = bindings.UnsignedBolt12Invoice_offer_features(this.ptr);
136 if (ret >= 0 && ret <= 4096) { return null; }
137 org.ldk.structs.OfferFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OfferFeatures(null, ret); }
138 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
143 * A complete description of the purpose of the originating offer or refund.
145 * From [`Offer::description`] or [`Refund::description`].
147 * [`Offer::description`]: crate::offers::offer::Offer::description
149 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
151 public PrintableString description() {
152 long ret = bindings.UnsignedBolt12Invoice_description(this.ptr);
154 if (ret >= 0 && ret <= 4096) { return null; }
155 org.ldk.structs.PrintableString ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PrintableString(null, ret); }
156 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
161 * Duration since the Unix epoch when an invoice should no longer be requested.
163 * From [`Offer::absolute_expiry`] or [`Refund::absolute_expiry`].
165 * [`Offer::absolute_expiry`]: crate::offers::offer::Offer::absolute_expiry
167 public Option_u64Z absolute_expiry() {
168 long ret = bindings.UnsignedBolt12Invoice_absolute_expiry(this.ptr);
170 if (ret >= 0 && ret <= 4096) { return null; }
171 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
172 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
177 * The issuer of the offer or refund.
179 * From [`Offer::issuer`] or [`Refund::issuer`].
181 * [`Offer::issuer`]: crate::offers::offer::Offer::issuer
183 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
185 public PrintableString issuer() {
186 long ret = bindings.UnsignedBolt12Invoice_issuer(this.ptr);
188 if (ret >= 0 && ret <= 4096) { return null; }
189 org.ldk.structs.PrintableString ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PrintableString(null, ret); }
190 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
195 * Paths to the recipient originating from publicly reachable nodes.
197 * From [`Offer::paths`] or [`Refund::paths`].
199 * [`Offer::paths`]: crate::offers::offer::Offer::paths
201 public BlindedPath[] message_paths() {
202 long ret = bindings.UnsignedBolt12Invoice_message_paths(this.ptr);
204 if (ret >= 0 && ret <= 4096) { return null; }
205 int ret_conv_13_len = InternalUtils.getArrayLength(ret);
206 BlindedPath[] ret_conv_13_arr = new BlindedPath[ret_conv_13_len];
207 for (int n = 0; n < ret_conv_13_len; n++) {
208 long ret_conv_13 = InternalUtils.getU64ArrayElem(ret, n);
209 org.ldk.structs.BlindedPath ret_conv_13_hu_conv = null; if (ret_conv_13 < 0 || ret_conv_13 > 4096) { ret_conv_13_hu_conv = new org.ldk.structs.BlindedPath(null, ret_conv_13); }
210 if (ret_conv_13_hu_conv != null) { ret_conv_13_hu_conv.ptrs_to.AddLast(this); };
211 ret_conv_13_arr[n] = ret_conv_13_hu_conv;
213 bindings.free_buffer(ret);
214 return ret_conv_13_arr;
218 * The quantity of items supported.
220 * From [`Offer::supported_quantity`]; `None` if the invoice was created in response to a
223 * [`Offer::supported_quantity`]: crate::offers::offer::Offer::supported_quantity
225 public Option_QuantityZ supported_quantity() {
226 long ret = bindings.UnsignedBolt12Invoice_supported_quantity(this.ptr);
228 if (ret >= 0 && ret <= 4096) { return null; }
229 org.ldk.structs.Option_QuantityZ ret_hu_conv = org.ldk.structs.Option_QuantityZ.constr_from_ptr(ret);
230 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
235 * An unpredictable series of bytes from the payer.
237 * From [`InvoiceRequest::payer_metadata`] or [`Refund::payer_metadata`].
239 public byte[] payer_metadata() {
240 long ret = bindings.UnsignedBolt12Invoice_payer_metadata(this.ptr);
242 if (ret >= 0 && ret <= 4096) { return null; }
243 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
248 * Features pertaining to requesting an invoice.
250 * From [`InvoiceRequest::invoice_request_features`] or [`Refund::features`].
252 public InvoiceRequestFeatures invoice_request_features() {
253 long ret = bindings.UnsignedBolt12Invoice_invoice_request_features(this.ptr);
255 if (ret >= 0 && ret <= 4096) { return null; }
256 org.ldk.structs.InvoiceRequestFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InvoiceRequestFeatures(null, ret); }
257 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
262 * The quantity of items requested or refunded for.
264 * From [`InvoiceRequest::quantity`] or [`Refund::quantity`].
266 public Option_u64Z quantity() {
267 long ret = bindings.UnsignedBolt12Invoice_quantity(this.ptr);
269 if (ret >= 0 && ret <= 4096) { return null; }
270 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
271 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
276 * A possibly transient pubkey used to sign the invoice request or to send an invoice for a
277 * refund in case there are no [`message_paths`].
279 * [`message_paths`]: Self::message_paths
281 public byte[] payer_id() {
282 long ret = bindings.UnsignedBolt12Invoice_payer_id(this.ptr);
284 if (ret >= 0 && ret <= 4096) { return null; }
285 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
290 * A payer-provided note reflected back in the invoice.
292 * From [`InvoiceRequest::payer_note`] or [`Refund::payer_note`].
294 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
296 public PrintableString payer_note() {
297 long ret = bindings.UnsignedBolt12Invoice_payer_note(this.ptr);
299 if (ret >= 0 && ret <= 4096) { return null; }
300 org.ldk.structs.PrintableString ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PrintableString(null, ret); }
301 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
306 * Duration since the Unix epoch when the invoice was created.
308 public long created_at() {
309 long ret = bindings.UnsignedBolt12Invoice_created_at(this.ptr);
315 * Duration since [`Bolt12Invoice::created_at`] when the invoice has expired and therefore
316 * should no longer be paid.
318 public long relative_expiry() {
319 long ret = bindings.UnsignedBolt12Invoice_relative_expiry(this.ptr);
325 * Whether the invoice has expired.
327 public bool is_expired() {
328 bool ret = bindings.UnsignedBolt12Invoice_is_expired(this.ptr);
334 * SHA256 hash of the payment preimage that will be given in return for paying the invoice.
336 public byte[] payment_hash() {
337 long ret = bindings.UnsignedBolt12Invoice_payment_hash(this.ptr);
339 if (ret >= 0 && ret <= 4096) { return null; }
340 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
345 * The minimum amount required for a successful payment of the invoice.
347 public long amount_msats() {
348 long ret = bindings.UnsignedBolt12Invoice_amount_msats(this.ptr);
354 * Features pertaining to paying an invoice.
356 public Bolt12InvoiceFeatures invoice_features() {
357 long ret = bindings.UnsignedBolt12Invoice_invoice_features(this.ptr);
359 if (ret >= 0 && ret <= 4096) { return null; }
360 org.ldk.structs.Bolt12InvoiceFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Bolt12InvoiceFeatures(null, ret); }
361 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
366 * The public key corresponding to the key used to sign the invoice.
368 public byte[] signing_pubkey() {
369 long ret = bindings.UnsignedBolt12Invoice_signing_pubkey(this.ptr);
371 if (ret >= 0 && ret <= 4096) { return null; }
372 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
377 * Serialize the UnsignedBolt12Invoice object into a byte array which can be read by UnsignedBolt12Invoice_read
379 public byte[] write() {
380 long ret = bindings.UnsignedBolt12Invoice_write(this.ptr);
382 if (ret >= 0 && ret <= 4096) { return null; }
383 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);