[C#] Update auto-generated C# bindings
[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         /**
24          * Returns the [`TaggedHash`] of the invoice to sign.
25          */
26         public TaggedHash tagged_hash() {
27                 long ret = bindings.UnsignedBolt12Invoice_tagged_hash(this.ptr);
28                 GC.KeepAlive(this);
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); };
32                 return ret_hu_conv;
33         }
34
35         /**
36          * The chains that may be used when paying a requested invoice.
37          * 
38          * From [`Offer::chains`]; `None` if the invoice was created in response to a [`Refund`].
39          * 
40          * [`Offer::chains`]: crate::offers::offer::Offer::chains
41          */
42         public Option_CVec_ThirtyTwoBytesZZ offer_chains() {
43                 long ret = bindings.UnsignedBolt12Invoice_offer_chains(this.ptr);
44                 GC.KeepAlive(this);
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); };
48                 return ret_hu_conv;
49         }
50
51         /**
52          * The chain that must be used when paying the invoice; selected from [`offer_chains`] if the
53          * invoice originated from an offer.
54          * 
55          * From [`InvoiceRequest::chain`] or [`Refund::chain`].
56          * 
57          * [`offer_chains`]: Self::offer_chains
58          * [`InvoiceRequest::chain`]: crate::offers::invoice_request::InvoiceRequest::chain
59          */
60         public byte[] chain() {
61                 long ret = bindings.UnsignedBolt12Invoice_chain(this.ptr);
62                 GC.KeepAlive(this);
63                 if (ret >= 0 && ret <= 4096) { return null; }
64                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
65                 return ret_conv;
66         }
67
68         /**
69          * Opaque bytes set by the originating [`Offer`].
70          * 
71          * From [`Offer::metadata`]; `None` if the invoice was created in response to a [`Refund`] or
72          * if the [`Offer`] did not set it.
73          * 
74          * [`Offer`]: crate::offers::offer::Offer
75          * [`Offer::metadata`]: crate::offers::offer::Offer::metadata
76          */
77         public Option_CVec_u8ZZ metadata() {
78                 long ret = bindings.UnsignedBolt12Invoice_metadata(this.ptr);
79                 GC.KeepAlive(this);
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); };
83                 return ret_hu_conv;
84         }
85
86         /**
87          * The minimum amount required for a successful payment of a single item.
88          * 
89          * From [`Offer::amount`]; `None` if the invoice was created in response to a [`Refund`] or if
90          * the [`Offer`] did not set it.
91          * 
92          * [`Offer`]: crate::offers::offer::Offer
93          * [`Offer::amount`]: crate::offers::offer::Offer::amount
94          * 
95          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
96          */
97         public Amount amount() {
98                 long ret = bindings.UnsignedBolt12Invoice_amount(this.ptr);
99                 GC.KeepAlive(this);
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); };
103                 return ret_hu_conv;
104         }
105
106         /**
107          * Features pertaining to the originating [`Offer`].
108          * 
109          * From [`Offer::offer_features`]; `None` if the invoice was created in response to a
110          * [`Refund`].
111          * 
112          * [`Offer`]: crate::offers::offer::Offer
113          * [`Offer::offer_features`]: crate::offers::offer::Offer::offer_features
114          * 
115          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
116          */
117         public OfferFeatures offer_features() {
118                 long ret = bindings.UnsignedBolt12Invoice_offer_features(this.ptr);
119                 GC.KeepAlive(this);
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); };
123                 return ret_hu_conv;
124         }
125
126         /**
127          * A complete description of the purpose of the originating offer or refund.
128          * 
129          * From [`Offer::description`] or [`Refund::description`].
130          * 
131          * [`Offer::description`]: crate::offers::offer::Offer::description
132          */
133         public PrintableString description() {
134                 long ret = bindings.UnsignedBolt12Invoice_description(this.ptr);
135                 GC.KeepAlive(this);
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); };
139                 return ret_hu_conv;
140         }
141
142         /**
143          * Duration since the Unix epoch when an invoice should no longer be requested.
144          * 
145          * From [`Offer::absolute_expiry`] or [`Refund::absolute_expiry`].
146          * 
147          * [`Offer::absolute_expiry`]: crate::offers::offer::Offer::absolute_expiry
148          */
149         public Option_u64Z absolute_expiry() {
150                 long ret = bindings.UnsignedBolt12Invoice_absolute_expiry(this.ptr);
151                 GC.KeepAlive(this);
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); };
155                 return ret_hu_conv;
156         }
157
158         /**
159          * The issuer of the offer or refund.
160          * 
161          * From [`Offer::issuer`] or [`Refund::issuer`].
162          * 
163          * [`Offer::issuer`]: crate::offers::offer::Offer::issuer
164          * 
165          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
166          */
167         public PrintableString issuer() {
168                 long ret = bindings.UnsignedBolt12Invoice_issuer(this.ptr);
169                 GC.KeepAlive(this);
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); };
173                 return ret_hu_conv;
174         }
175
176         /**
177          * Paths to the recipient originating from publicly reachable nodes.
178          * 
179          * From [`Offer::paths`] or [`Refund::paths`].
180          * 
181          * [`Offer::paths`]: crate::offers::offer::Offer::paths
182          */
183         public BlindedPath[] message_paths() {
184                 long ret = bindings.UnsignedBolt12Invoice_message_paths(this.ptr);
185                 GC.KeepAlive(this);
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;
194                 }
195                 bindings.free_buffer(ret);
196                 return ret_conv_13_arr;
197         }
198
199         /**
200          * The quantity of items supported.
201          * 
202          * From [`Offer::supported_quantity`]; `None` if the invoice was created in response to a
203          * [`Refund`].
204          * 
205          * [`Offer::supported_quantity`]: crate::offers::offer::Offer::supported_quantity
206          * 
207          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
208          */
209         public Quantity supported_quantity() {
210                 long ret = bindings.UnsignedBolt12Invoice_supported_quantity(this.ptr);
211                 GC.KeepAlive(this);
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); };
215                 return ret_hu_conv;
216         }
217
218         /**
219          * An unpredictable series of bytes from the payer.
220          * 
221          * From [`InvoiceRequest::payer_metadata`] or [`Refund::payer_metadata`].
222          */
223         public byte[] payer_metadata() {
224                 long ret = bindings.UnsignedBolt12Invoice_payer_metadata(this.ptr);
225                 GC.KeepAlive(this);
226                 if (ret >= 0 && ret <= 4096) { return null; }
227                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
228                 return ret_conv;
229         }
230
231         /**
232          * Features pertaining to requesting an invoice.
233          * 
234          * From [`InvoiceRequest::invoice_request_features`] or [`Refund::features`].
235          */
236         public InvoiceRequestFeatures invoice_request_features() {
237                 long ret = bindings.UnsignedBolt12Invoice_invoice_request_features(this.ptr);
238                 GC.KeepAlive(this);
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); };
242                 return ret_hu_conv;
243         }
244
245         /**
246          * The quantity of items requested or refunded for.
247          * 
248          * From [`InvoiceRequest::quantity`] or [`Refund::quantity`].
249          */
250         public Option_u64Z quantity() {
251                 long ret = bindings.UnsignedBolt12Invoice_quantity(this.ptr);
252                 GC.KeepAlive(this);
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); };
256                 return ret_hu_conv;
257         }
258
259         /**
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`].
262          * 
263          * [`message_paths`]: Self::message_paths
264          */
265         public byte[] payer_id() {
266                 long ret = bindings.UnsignedBolt12Invoice_payer_id(this.ptr);
267                 GC.KeepAlive(this);
268                 if (ret >= 0 && ret <= 4096) { return null; }
269                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
270                 return ret_conv;
271         }
272
273         /**
274          * A payer-provided note reflected back in the invoice.
275          * 
276          * From [`InvoiceRequest::payer_note`] or [`Refund::payer_note`].
277          * 
278          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
279          */
280         public PrintableString payer_note() {
281                 long ret = bindings.UnsignedBolt12Invoice_payer_note(this.ptr);
282                 GC.KeepAlive(this);
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); };
286                 return ret_hu_conv;
287         }
288
289         /**
290          * Duration since the Unix epoch when the invoice was created.
291          */
292         public long created_at() {
293                 long ret = bindings.UnsignedBolt12Invoice_created_at(this.ptr);
294                 GC.KeepAlive(this);
295                 return ret;
296         }
297
298         /**
299          * Duration since [`Bolt12Invoice::created_at`] when the invoice has expired and therefore
300          * should no longer be paid.
301          */
302         public long relative_expiry() {
303                 long ret = bindings.UnsignedBolt12Invoice_relative_expiry(this.ptr);
304                 GC.KeepAlive(this);
305                 return ret;
306         }
307
308         /**
309          * Whether the invoice has expired.
310          */
311         public bool is_expired() {
312                 bool ret = bindings.UnsignedBolt12Invoice_is_expired(this.ptr);
313                 GC.KeepAlive(this);
314                 return ret;
315         }
316
317         /**
318          * SHA256 hash of the payment preimage that will be given in return for paying the invoice.
319          */
320         public byte[] payment_hash() {
321                 long ret = bindings.UnsignedBolt12Invoice_payment_hash(this.ptr);
322                 GC.KeepAlive(this);
323                 if (ret >= 0 && ret <= 4096) { return null; }
324                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
325                 return ret_conv;
326         }
327
328         /**
329          * The minimum amount required for a successful payment of the invoice.
330          */
331         public long amount_msats() {
332                 long ret = bindings.UnsignedBolt12Invoice_amount_msats(this.ptr);
333                 GC.KeepAlive(this);
334                 return ret;
335         }
336
337         /**
338          * Features pertaining to paying an invoice.
339          */
340         public Bolt12InvoiceFeatures invoice_features() {
341                 long ret = bindings.UnsignedBolt12Invoice_invoice_features(this.ptr);
342                 GC.KeepAlive(this);
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); };
346                 return ret_hu_conv;
347         }
348
349         /**
350          * The public key corresponding to the key used to sign the invoice.
351          */
352         public byte[] signing_pubkey() {
353                 long ret = bindings.UnsignedBolt12Invoice_signing_pubkey(this.ptr);
354                 GC.KeepAlive(this);
355                 if (ret >= 0 && ret <= 4096) { return null; }
356                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
357                 return ret_conv;
358         }
359
360         /**
361          * Serialize the UnsignedBolt12Invoice object into a byte array which can be read by UnsignedBolt12Invoice_read
362          */
363         public byte[] write() {
364                 long ret = bindings.UnsignedBolt12Invoice_write(this.ptr);
365                 GC.KeepAlive(this);
366                 if (ret >= 0 && ret <= 4096) { return null; }
367                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
368                 return ret_conv;
369         }
370
371 }
372 } } }