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); }
24 * Returns the [`TaggedHash`] of the invoice to sign.
26 public TaggedHash tagged_hash() {
27 long ret = bindings.UnsignedBolt12Invoice_tagged_hash(this.ptr);
29 if (ret >= 0 && ret <= 4096) { return null; }
30 org.ldk.structs.TaggedHash ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TaggedHash(null, ret); }
31 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
36 * The chains that may be used when paying a requested invoice.
38 * From [`Offer::chains`]; `None` if the invoice was created in response to a [`Refund`].
40 * [`Offer::chains`]: crate::offers::offer::Offer::chains
42 public Option_CVec_ThirtyTwoBytesZZ offer_chains() {
43 long ret = bindings.UnsignedBolt12Invoice_offer_chains(this.ptr);
45 if (ret >= 0 && ret <= 4096) { return null; }
46 org.ldk.structs.Option_CVec_ThirtyTwoBytesZZ ret_hu_conv = org.ldk.structs.Option_CVec_ThirtyTwoBytesZZ.constr_from_ptr(ret);
47 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
52 * The chain that must be used when paying the invoice; selected from [`offer_chains`] if the
53 * invoice originated from an offer.
55 * From [`InvoiceRequest::chain`] or [`Refund::chain`].
57 * [`offer_chains`]: Self::offer_chains
58 * [`InvoiceRequest::chain`]: crate::offers::invoice_request::InvoiceRequest::chain
60 public byte[] chain() {
61 long ret = bindings.UnsignedBolt12Invoice_chain(this.ptr);
63 if (ret >= 0 && ret <= 4096) { return null; }
64 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
69 * Opaque bytes set by the originating [`Offer`].
71 * From [`Offer::metadata`]; `None` if the invoice was created in response to a [`Refund`] or
72 * if the [`Offer`] did not set it.
74 * [`Offer`]: crate::offers::offer::Offer
75 * [`Offer::metadata`]: crate::offers::offer::Offer::metadata
77 public Option_CVec_u8ZZ metadata() {
78 long ret = bindings.UnsignedBolt12Invoice_metadata(this.ptr);
80 if (ret >= 0 && ret <= 4096) { return null; }
81 org.ldk.structs.Option_CVec_u8ZZ ret_hu_conv = org.ldk.structs.Option_CVec_u8ZZ.constr_from_ptr(ret);
82 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
87 * The minimum amount required for a successful payment of a single item.
89 * From [`Offer::amount`]; `None` if the invoice was created in response to a [`Refund`] or if
90 * the [`Offer`] did not set it.
92 * [`Offer`]: crate::offers::offer::Offer
93 * [`Offer::amount`]: crate::offers::offer::Offer::amount
95 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
97 public Amount amount() {
98 long ret = bindings.UnsignedBolt12Invoice_amount(this.ptr);
100 if (ret >= 0 && ret <= 4096) { return null; }
101 org.ldk.structs.Amount ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Amount(null, ret); }
102 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
107 * Features pertaining to the originating [`Offer`].
109 * From [`Offer::offer_features`]; `None` if the invoice was created in response to a
112 * [`Offer`]: crate::offers::offer::Offer
113 * [`Offer::offer_features`]: crate::offers::offer::Offer::offer_features
115 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
117 public OfferFeatures offer_features() {
118 long ret = bindings.UnsignedBolt12Invoice_offer_features(this.ptr);
120 if (ret >= 0 && ret <= 4096) { return null; }
121 org.ldk.structs.OfferFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OfferFeatures(null, ret); }
122 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
127 * A complete description of the purpose of the originating offer or refund.
129 * From [`Offer::description`] or [`Refund::description`].
131 * [`Offer::description`]: crate::offers::offer::Offer::description
133 public PrintableString description() {
134 long ret = bindings.UnsignedBolt12Invoice_description(this.ptr);
136 if (ret >= 0 && ret <= 4096) { return null; }
137 org.ldk.structs.PrintableString ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PrintableString(null, ret); }
138 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
143 * Duration since the Unix epoch when an invoice should no longer be requested.
145 * From [`Offer::absolute_expiry`] or [`Refund::absolute_expiry`].
147 * [`Offer::absolute_expiry`]: crate::offers::offer::Offer::absolute_expiry
149 public Option_u64Z absolute_expiry() {
150 long ret = bindings.UnsignedBolt12Invoice_absolute_expiry(this.ptr);
152 if (ret >= 0 && ret <= 4096) { return null; }
153 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
154 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
159 * The issuer of the offer or refund.
161 * From [`Offer::issuer`] or [`Refund::issuer`].
163 * [`Offer::issuer`]: crate::offers::offer::Offer::issuer
165 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
167 public PrintableString issuer() {
168 long ret = bindings.UnsignedBolt12Invoice_issuer(this.ptr);
170 if (ret >= 0 && ret <= 4096) { return null; }
171 org.ldk.structs.PrintableString ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PrintableString(null, ret); }
172 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
177 * Paths to the recipient originating from publicly reachable nodes.
179 * From [`Offer::paths`] or [`Refund::paths`].
181 * [`Offer::paths`]: crate::offers::offer::Offer::paths
183 public BlindedPath[] message_paths() {
184 long ret = bindings.UnsignedBolt12Invoice_message_paths(this.ptr);
186 if (ret >= 0 && ret <= 4096) { return null; }
187 int ret_conv_13_len = InternalUtils.getArrayLength(ret);
188 BlindedPath[] ret_conv_13_arr = new BlindedPath[ret_conv_13_len];
189 for (int n = 0; n < ret_conv_13_len; n++) {
190 long ret_conv_13 = InternalUtils.getU64ArrayElem(ret, n);
191 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); }
192 if (ret_conv_13_hu_conv != null) { ret_conv_13_hu_conv.ptrs_to.AddLast(this); };
193 ret_conv_13_arr[n] = ret_conv_13_hu_conv;
195 bindings.free_buffer(ret);
196 return ret_conv_13_arr;
200 * The quantity of items supported.
202 * From [`Offer::supported_quantity`]; `None` if the invoice was created in response to a
205 * [`Offer::supported_quantity`]: crate::offers::offer::Offer::supported_quantity
207 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
209 public Quantity supported_quantity() {
210 long ret = bindings.UnsignedBolt12Invoice_supported_quantity(this.ptr);
212 if (ret >= 0 && ret <= 4096) { return null; }
213 org.ldk.structs.Quantity ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Quantity(null, ret); }
214 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
219 * An unpredictable series of bytes from the payer.
221 * From [`InvoiceRequest::payer_metadata`] or [`Refund::payer_metadata`].
223 public byte[] payer_metadata() {
224 long ret = bindings.UnsignedBolt12Invoice_payer_metadata(this.ptr);
226 if (ret >= 0 && ret <= 4096) { return null; }
227 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
232 * Features pertaining to requesting an invoice.
234 * From [`InvoiceRequest::invoice_request_features`] or [`Refund::features`].
236 public InvoiceRequestFeatures invoice_request_features() {
237 long ret = bindings.UnsignedBolt12Invoice_invoice_request_features(this.ptr);
239 if (ret >= 0 && ret <= 4096) { return null; }
240 org.ldk.structs.InvoiceRequestFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InvoiceRequestFeatures(null, ret); }
241 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
246 * The quantity of items requested or refunded for.
248 * From [`InvoiceRequest::quantity`] or [`Refund::quantity`].
250 public Option_u64Z quantity() {
251 long ret = bindings.UnsignedBolt12Invoice_quantity(this.ptr);
253 if (ret >= 0 && ret <= 4096) { return null; }
254 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
255 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
260 * A possibly transient pubkey used to sign the invoice request or to send an invoice for a
261 * refund in case there are no [`message_paths`].
263 * [`message_paths`]: Self::message_paths
265 public byte[] payer_id() {
266 long ret = bindings.UnsignedBolt12Invoice_payer_id(this.ptr);
268 if (ret >= 0 && ret <= 4096) { return null; }
269 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
274 * A payer-provided note reflected back in the invoice.
276 * From [`InvoiceRequest::payer_note`] or [`Refund::payer_note`].
278 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
280 public PrintableString payer_note() {
281 long ret = bindings.UnsignedBolt12Invoice_payer_note(this.ptr);
283 if (ret >= 0 && ret <= 4096) { return null; }
284 org.ldk.structs.PrintableString ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PrintableString(null, ret); }
285 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
290 * Duration since the Unix epoch when the invoice was created.
292 public long created_at() {
293 long ret = bindings.UnsignedBolt12Invoice_created_at(this.ptr);
299 * Duration since [`Bolt12Invoice::created_at`] when the invoice has expired and therefore
300 * should no longer be paid.
302 public long relative_expiry() {
303 long ret = bindings.UnsignedBolt12Invoice_relative_expiry(this.ptr);
309 * Whether the invoice has expired.
311 public bool is_expired() {
312 bool ret = bindings.UnsignedBolt12Invoice_is_expired(this.ptr);
318 * SHA256 hash of the payment preimage that will be given in return for paying the invoice.
320 public byte[] payment_hash() {
321 long ret = bindings.UnsignedBolt12Invoice_payment_hash(this.ptr);
323 if (ret >= 0 && ret <= 4096) { return null; }
324 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
329 * The minimum amount required for a successful payment of the invoice.
331 public long amount_msats() {
332 long ret = bindings.UnsignedBolt12Invoice_amount_msats(this.ptr);
338 * Features pertaining to paying an invoice.
340 public Bolt12InvoiceFeatures invoice_features() {
341 long ret = bindings.UnsignedBolt12Invoice_invoice_features(this.ptr);
343 if (ret >= 0 && ret <= 4096) { return null; }
344 org.ldk.structs.Bolt12InvoiceFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Bolt12InvoiceFeatures(null, ret); }
345 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
350 * The public key corresponding to the key used to sign the invoice.
352 public byte[] signing_pubkey() {
353 long ret = bindings.UnsignedBolt12Invoice_signing_pubkey(this.ptr);
355 if (ret >= 0 && ret <= 4096) { return null; }
356 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
361 * Serialize the UnsignedBolt12Invoice object into a byte array which can be read by UnsignedBolt12Invoice_read
363 public byte[] write() {
364 long ret = bindings.UnsignedBolt12Invoice_write(this.ptr);
366 if (ret >= 0 && ret <= 4096) { return null; }
367 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);