[TS] Update auto-generated bindings to LDK-C-Bindings 0.0.123.1
[ldk-java] / c_sharp / src / org / ldk / structs / UnsignedBolt12Invoice.cs
1 using org.ldk.impl;
2 using org.ldk.enums;
3 using org.ldk.util;
4 using System;
5
6 namespace org { namespace ldk { namespace structs {
7
8
9 /**
10  * A semantically valid [`Bolt12Invoice`] that hasn't been signed.
11  * 
12  * # Serialization
13  * 
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.
16  */
17 public class UnsignedBolt12Invoice : CommonBase {
18         internal UnsignedBolt12Invoice(object _dummy, long ptr) : base(ptr) { }
19         ~UnsignedBolt12Invoice() {
20                 if (ptr != 0) { bindings.UnsignedBolt12Invoice_free(ptr); }
21         }
22
23         internal long clone_ptr() {
24                 long ret = bindings.UnsignedBolt12Invoice_clone_ptr(this.ptr);
25                 GC.KeepAlive(this);
26                 return ret;
27         }
28
29         /**
30          * Creates a copy of the UnsignedBolt12Invoice
31          */
32         public UnsignedBolt12Invoice clone() {
33                 long ret = bindings.UnsignedBolt12Invoice_clone(this.ptr);
34                 GC.KeepAlive(this);
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); };
38                 return ret_hu_conv;
39         }
40
41         /**
42          * Returns the [`TaggedHash`] of the invoice to sign.
43          */
44         public TaggedHash tagged_hash() {
45                 long ret = bindings.UnsignedBolt12Invoice_tagged_hash(this.ptr);
46                 GC.KeepAlive(this);
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); };
50                 return ret_hu_conv;
51         }
52
53         /**
54          * The chains that may be used when paying a requested invoice.
55          * 
56          * From [`Offer::chains`]; `None` if the invoice was created in response to a [`Refund`].
57          * 
58          * [`Offer::chains`]: crate::offers::offer::Offer::chains
59          */
60         public Option_CVec_ThirtyTwoBytesZZ offer_chains() {
61                 long ret = bindings.UnsignedBolt12Invoice_offer_chains(this.ptr);
62                 GC.KeepAlive(this);
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); };
66                 return ret_hu_conv;
67         }
68
69         /**
70          * The chain that must be used when paying the invoice; selected from [`offer_chains`] if the
71          * invoice originated from an offer.
72          * 
73          * From [`InvoiceRequest::chain`] or [`Refund::chain`].
74          * 
75          * [`offer_chains`]: Self::offer_chains
76          * [`InvoiceRequest::chain`]: crate::offers::invoice_request::InvoiceRequest::chain
77          */
78         public byte[] chain() {
79                 long ret = bindings.UnsignedBolt12Invoice_chain(this.ptr);
80                 GC.KeepAlive(this);
81                 if (ret >= 0 && ret <= 4096) { return null; }
82                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
83                 return ret_conv;
84         }
85
86         /**
87          * Opaque bytes set by the originating [`Offer`].
88          * 
89          * From [`Offer::metadata`]; `None` if the invoice was created in response to a [`Refund`] or
90          * if the [`Offer`] did not set it.
91          * 
92          * [`Offer`]: crate::offers::offer::Offer
93          * [`Offer::metadata`]: crate::offers::offer::Offer::metadata
94          */
95         public Option_CVec_u8ZZ metadata() {
96                 long ret = bindings.UnsignedBolt12Invoice_metadata(this.ptr);
97                 GC.KeepAlive(this);
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); };
101                 return ret_hu_conv;
102         }
103
104         /**
105          * The minimum amount required for a successful payment of a single item.
106          * 
107          * From [`Offer::amount`]; `None` if the invoice was created in response to a [`Refund`] or if
108          * the [`Offer`] did not set it.
109          * 
110          * [`Offer`]: crate::offers::offer::Offer
111          * [`Offer::amount`]: crate::offers::offer::Offer::amount
112          */
113         public Option_AmountZ amount() {
114                 long ret = bindings.UnsignedBolt12Invoice_amount(this.ptr);
115                 GC.KeepAlive(this);
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); };
119                 return ret_hu_conv;
120         }
121
122         /**
123          * Features pertaining to the originating [`Offer`].
124          * 
125          * From [`Offer::offer_features`]; `None` if the invoice was created in response to a
126          * [`Refund`].
127          * 
128          * [`Offer`]: crate::offers::offer::Offer
129          * [`Offer::offer_features`]: crate::offers::offer::Offer::offer_features
130          * 
131          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
132          */
133         public OfferFeatures offer_features() {
134                 long ret = bindings.UnsignedBolt12Invoice_offer_features(this.ptr);
135                 GC.KeepAlive(this);
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); };
139                 return ret_hu_conv;
140         }
141
142         /**
143          * A complete description of the purpose of the originating offer or refund.
144          * 
145          * From [`Offer::description`] or [`Refund::description`].
146          * 
147          * [`Offer::description`]: crate::offers::offer::Offer::description
148          * 
149          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
150          */
151         public PrintableString description() {
152                 long ret = bindings.UnsignedBolt12Invoice_description(this.ptr);
153                 GC.KeepAlive(this);
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); };
157                 return ret_hu_conv;
158         }
159
160         /**
161          * Duration since the Unix epoch when an invoice should no longer be requested.
162          * 
163          * From [`Offer::absolute_expiry`] or [`Refund::absolute_expiry`].
164          * 
165          * [`Offer::absolute_expiry`]: crate::offers::offer::Offer::absolute_expiry
166          */
167         public Option_u64Z absolute_expiry() {
168                 long ret = bindings.UnsignedBolt12Invoice_absolute_expiry(this.ptr);
169                 GC.KeepAlive(this);
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); };
173                 return ret_hu_conv;
174         }
175
176         /**
177          * The issuer of the offer or refund.
178          * 
179          * From [`Offer::issuer`] or [`Refund::issuer`].
180          * 
181          * [`Offer::issuer`]: crate::offers::offer::Offer::issuer
182          * 
183          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
184          */
185         public PrintableString issuer() {
186                 long ret = bindings.UnsignedBolt12Invoice_issuer(this.ptr);
187                 GC.KeepAlive(this);
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); };
191                 return ret_hu_conv;
192         }
193
194         /**
195          * Paths to the recipient originating from publicly reachable nodes.
196          * 
197          * From [`Offer::paths`] or [`Refund::paths`].
198          * 
199          * [`Offer::paths`]: crate::offers::offer::Offer::paths
200          */
201         public BlindedPath[] message_paths() {
202                 long ret = bindings.UnsignedBolt12Invoice_message_paths(this.ptr);
203                 GC.KeepAlive(this);
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;
212                 }
213                 bindings.free_buffer(ret);
214                 return ret_conv_13_arr;
215         }
216
217         /**
218          * The quantity of items supported.
219          * 
220          * From [`Offer::supported_quantity`]; `None` if the invoice was created in response to a
221          * [`Refund`].
222          * 
223          * [`Offer::supported_quantity`]: crate::offers::offer::Offer::supported_quantity
224          */
225         public Option_QuantityZ supported_quantity() {
226                 long ret = bindings.UnsignedBolt12Invoice_supported_quantity(this.ptr);
227                 GC.KeepAlive(this);
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); };
231                 return ret_hu_conv;
232         }
233
234         /**
235          * An unpredictable series of bytes from the payer.
236          * 
237          * From [`InvoiceRequest::payer_metadata`] or [`Refund::payer_metadata`].
238          */
239         public byte[] payer_metadata() {
240                 long ret = bindings.UnsignedBolt12Invoice_payer_metadata(this.ptr);
241                 GC.KeepAlive(this);
242                 if (ret >= 0 && ret <= 4096) { return null; }
243                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
244                 return ret_conv;
245         }
246
247         /**
248          * Features pertaining to requesting an invoice.
249          * 
250          * From [`InvoiceRequest::invoice_request_features`] or [`Refund::features`].
251          */
252         public InvoiceRequestFeatures invoice_request_features() {
253                 long ret = bindings.UnsignedBolt12Invoice_invoice_request_features(this.ptr);
254                 GC.KeepAlive(this);
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); };
258                 return ret_hu_conv;
259         }
260
261         /**
262          * The quantity of items requested or refunded for.
263          * 
264          * From [`InvoiceRequest::quantity`] or [`Refund::quantity`].
265          */
266         public Option_u64Z quantity() {
267                 long ret = bindings.UnsignedBolt12Invoice_quantity(this.ptr);
268                 GC.KeepAlive(this);
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); };
272                 return ret_hu_conv;
273         }
274
275         /**
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`].
278          * 
279          * [`message_paths`]: Self::message_paths
280          */
281         public byte[] payer_id() {
282                 long ret = bindings.UnsignedBolt12Invoice_payer_id(this.ptr);
283                 GC.KeepAlive(this);
284                 if (ret >= 0 && ret <= 4096) { return null; }
285                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
286                 return ret_conv;
287         }
288
289         /**
290          * A payer-provided note reflected back in the invoice.
291          * 
292          * From [`InvoiceRequest::payer_note`] or [`Refund::payer_note`].
293          * 
294          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
295          */
296         public PrintableString payer_note() {
297                 long ret = bindings.UnsignedBolt12Invoice_payer_note(this.ptr);
298                 GC.KeepAlive(this);
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); };
302                 return ret_hu_conv;
303         }
304
305         /**
306          * Duration since the Unix epoch when the invoice was created.
307          */
308         public long created_at() {
309                 long ret = bindings.UnsignedBolt12Invoice_created_at(this.ptr);
310                 GC.KeepAlive(this);
311                 return ret;
312         }
313
314         /**
315          * Duration since [`Bolt12Invoice::created_at`] when the invoice has expired and therefore
316          * should no longer be paid.
317          */
318         public long relative_expiry() {
319                 long ret = bindings.UnsignedBolt12Invoice_relative_expiry(this.ptr);
320                 GC.KeepAlive(this);
321                 return ret;
322         }
323
324         /**
325          * Whether the invoice has expired.
326          */
327         public bool is_expired() {
328                 bool ret = bindings.UnsignedBolt12Invoice_is_expired(this.ptr);
329                 GC.KeepAlive(this);
330                 return ret;
331         }
332
333         /**
334          * SHA256 hash of the payment preimage that will be given in return for paying the invoice.
335          */
336         public byte[] payment_hash() {
337                 long ret = bindings.UnsignedBolt12Invoice_payment_hash(this.ptr);
338                 GC.KeepAlive(this);
339                 if (ret >= 0 && ret <= 4096) { return null; }
340                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
341                 return ret_conv;
342         }
343
344         /**
345          * The minimum amount required for a successful payment of the invoice.
346          */
347         public long amount_msats() {
348                 long ret = bindings.UnsignedBolt12Invoice_amount_msats(this.ptr);
349                 GC.KeepAlive(this);
350                 return ret;
351         }
352
353         /**
354          * Features pertaining to paying an invoice.
355          */
356         public Bolt12InvoiceFeatures invoice_features() {
357                 long ret = bindings.UnsignedBolt12Invoice_invoice_features(this.ptr);
358                 GC.KeepAlive(this);
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); };
362                 return ret_hu_conv;
363         }
364
365         /**
366          * The public key corresponding to the key used to sign the invoice.
367          */
368         public byte[] signing_pubkey() {
369                 long ret = bindings.UnsignedBolt12Invoice_signing_pubkey(this.ptr);
370                 GC.KeepAlive(this);
371                 if (ret >= 0 && ret <= 4096) { return null; }
372                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
373                 return ret_conv;
374         }
375
376         /**
377          * Serialize the UnsignedBolt12Invoice object into a byte array which can be read by UnsignedBolt12Invoice_read
378          */
379         public byte[] write() {
380                 long ret = bindings.UnsignedBolt12Invoice_write(this.ptr);
381                 GC.KeepAlive(this);
382                 if (ret >= 0 && ret <= 4096) { return null; }
383                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
384                 return ret_conv;
385         }
386
387 }
388 } } }