[Java] Update auto-generated bindings to 0.0.117
[ldk-java] / src / main / java / org / ldk / structs / UnsignedInvoiceRequest.java
1 package org.ldk.structs;
2
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
5 import org.ldk.util.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
9
10
11 /**
12  * A semantically valid [`InvoiceRequest`] that hasn't been signed.
13  * 
14  * # Serialization
15  * 
16  * This is serialized as a TLV stream, which includes TLV records from the originating message. As
17  * such, it may include unknown, odd TLV records.
18  */
19 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
20 public class UnsignedInvoiceRequest extends CommonBase {
21         UnsignedInvoiceRequest(Object _dummy, long ptr) { super(ptr); }
22         @Override @SuppressWarnings("deprecation")
23         protected void finalize() throws Throwable {
24                 super.finalize();
25                 if (ptr != 0) { bindings.UnsignedInvoiceRequest_free(ptr); }
26         }
27
28         /**
29          * Returns the [`TaggedHash`] of the invoice to sign.
30          */
31         public TaggedHash tagged_hash() {
32                 long ret = bindings.UnsignedInvoiceRequest_tagged_hash(this.ptr);
33                 Reference.reachabilityFence(this);
34                 if (ret >= 0 && ret <= 4096) { return null; }
35                 org.ldk.structs.TaggedHash ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TaggedHash(null, ret); }
36                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
37                 return ret_hu_conv;
38         }
39
40         /**
41          * The chains that may be used when paying a requested invoice (e.g., bitcoin mainnet).
42          * Payments must be denominated in units of the minimal lightning-payable unit (e.g., msats)
43          * for the selected chain.
44          */
45         public byte[][] chains() {
46                 byte[][] ret = bindings.UnsignedInvoiceRequest_chains(this.ptr);
47                 Reference.reachabilityFence(this);
48                 return ret;
49         }
50
51         /**
52          * Opaque bytes set by the originator. Useful for authentication and validating fields since it
53          * is reflected in `invoice_request` messages along with all the other fields from the `offer`.
54          */
55         public Option_CVec_u8ZZ metadata() {
56                 long ret = bindings.UnsignedInvoiceRequest_metadata(this.ptr);
57                 Reference.reachabilityFence(this);
58                 if (ret >= 0 && ret <= 4096) { return null; }
59                 org.ldk.structs.Option_CVec_u8ZZ ret_hu_conv = org.ldk.structs.Option_CVec_u8ZZ.constr_from_ptr(ret);
60                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
61                 return ret_hu_conv;
62         }
63
64         /**
65          * The minimum amount required for a successful payment of a single item.
66          * 
67          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
68          */
69         @Nullable
70         public Amount amount() {
71                 long ret = bindings.UnsignedInvoiceRequest_amount(this.ptr);
72                 Reference.reachabilityFence(this);
73                 if (ret >= 0 && ret <= 4096) { return null; }
74                 org.ldk.structs.Amount ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Amount(null, ret); }
75                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
76                 return ret_hu_conv;
77         }
78
79         /**
80          * A complete description of the purpose of the payment. Intended to be displayed to the user
81          * but with the caveat that it has not been verified in any way.
82          */
83         public PrintableString description() {
84                 long ret = bindings.UnsignedInvoiceRequest_description(this.ptr);
85                 Reference.reachabilityFence(this);
86                 if (ret >= 0 && ret <= 4096) { return null; }
87                 org.ldk.structs.PrintableString ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PrintableString(null, ret); }
88                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
89                 return ret_hu_conv;
90         }
91
92         /**
93          * Features pertaining to the offer.
94          */
95         public OfferFeatures offer_features() {
96                 long ret = bindings.UnsignedInvoiceRequest_offer_features(this.ptr);
97                 Reference.reachabilityFence(this);
98                 if (ret >= 0 && ret <= 4096) { return null; }
99                 org.ldk.structs.OfferFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OfferFeatures(null, ret); }
100                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
101                 return ret_hu_conv;
102         }
103
104         /**
105          * Duration since the Unix epoch when an invoice should no longer be requested.
106          * 
107          * If `None`, the offer does not expire.
108          */
109         public Option_u64Z absolute_expiry() {
110                 long ret = bindings.UnsignedInvoiceRequest_absolute_expiry(this.ptr);
111                 Reference.reachabilityFence(this);
112                 if (ret >= 0 && ret <= 4096) { return null; }
113                 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
114                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
115                 return ret_hu_conv;
116         }
117
118         /**
119          * The issuer of the offer, possibly beginning with `user@domain` or `domain`. Intended to be
120          * displayed to the user but with the caveat that it has not been verified in any way.
121          * 
122          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
123          */
124         @Nullable
125         public PrintableString issuer() {
126                 long ret = bindings.UnsignedInvoiceRequest_issuer(this.ptr);
127                 Reference.reachabilityFence(this);
128                 if (ret >= 0 && ret <= 4096) { return null; }
129                 org.ldk.structs.PrintableString ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PrintableString(null, ret); }
130                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
131                 return ret_hu_conv;
132         }
133
134         /**
135          * Paths to the recipient originating from publicly reachable nodes. Blinded paths provide
136          * recipient privacy by obfuscating its node id.
137          */
138         public BlindedPath[] paths() {
139                 long[] ret = bindings.UnsignedInvoiceRequest_paths(this.ptr);
140                 Reference.reachabilityFence(this);
141                 int ret_conv_13_len = ret.length;
142                 BlindedPath[] ret_conv_13_arr = new BlindedPath[ret_conv_13_len];
143                 for (int n = 0; n < ret_conv_13_len; n++) {
144                         long ret_conv_13 = ret[n];
145                         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); }
146                         if (ret_conv_13_hu_conv != null) { ret_conv_13_hu_conv.ptrs_to.add(this); };
147                         ret_conv_13_arr[n] = ret_conv_13_hu_conv;
148                 }
149                 return ret_conv_13_arr;
150         }
151
152         /**
153          * The quantity of items supported.
154          */
155         public Quantity supported_quantity() {
156                 long ret = bindings.UnsignedInvoiceRequest_supported_quantity(this.ptr);
157                 Reference.reachabilityFence(this);
158                 if (ret >= 0 && ret <= 4096) { return null; }
159                 org.ldk.structs.Quantity ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Quantity(null, ret); }
160                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
161                 return ret_hu_conv;
162         }
163
164         /**
165          * The public key used by the recipient to sign invoices.
166          */
167         public byte[] signing_pubkey() {
168                 byte[] ret = bindings.UnsignedInvoiceRequest_signing_pubkey(this.ptr);
169                 Reference.reachabilityFence(this);
170                 return ret;
171         }
172
173         /**
174          * An unpredictable series of bytes, typically containing information about the derivation of
175          * [`payer_id`].
176          * 
177          * [`payer_id`]: Self::payer_id
178          */
179         public byte[] payer_metadata() {
180                 byte[] ret = bindings.UnsignedInvoiceRequest_payer_metadata(this.ptr);
181                 Reference.reachabilityFence(this);
182                 return ret;
183         }
184
185         /**
186          * A chain from [`Offer::chains`] that the offer is valid for.
187          */
188         public byte[] chain() {
189                 byte[] ret = bindings.UnsignedInvoiceRequest_chain(this.ptr);
190                 Reference.reachabilityFence(this);
191                 return ret;
192         }
193
194         /**
195          * The amount to pay in msats (i.e., the minimum lightning-payable unit for [`chain`]), which
196          * must be greater than or equal to [`Offer::amount`], converted if necessary.
197          * 
198          * [`chain`]: Self::chain
199          */
200         public Option_u64Z amount_msats() {
201                 long ret = bindings.UnsignedInvoiceRequest_amount_msats(this.ptr);
202                 Reference.reachabilityFence(this);
203                 if (ret >= 0 && ret <= 4096) { return null; }
204                 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
205                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
206                 return ret_hu_conv;
207         }
208
209         /**
210          * Features pertaining to requesting an invoice.
211          */
212         public InvoiceRequestFeatures invoice_request_features() {
213                 long ret = bindings.UnsignedInvoiceRequest_invoice_request_features(this.ptr);
214                 Reference.reachabilityFence(this);
215                 if (ret >= 0 && ret <= 4096) { return null; }
216                 org.ldk.structs.InvoiceRequestFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InvoiceRequestFeatures(null, ret); }
217                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
218                 return ret_hu_conv;
219         }
220
221         /**
222          * The quantity of the offer's item conforming to [`Offer::is_valid_quantity`].
223          */
224         public Option_u64Z quantity() {
225                 long ret = bindings.UnsignedInvoiceRequest_quantity(this.ptr);
226                 Reference.reachabilityFence(this);
227                 if (ret >= 0 && ret <= 4096) { return null; }
228                 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
229                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
230                 return ret_hu_conv;
231         }
232
233         /**
234          * A possibly transient pubkey used to sign the invoice request.
235          */
236         public byte[] payer_id() {
237                 byte[] ret = bindings.UnsignedInvoiceRequest_payer_id(this.ptr);
238                 Reference.reachabilityFence(this);
239                 return ret;
240         }
241
242         /**
243          * A payer-provided note which will be seen by the recipient and reflected back in the invoice
244          * response.
245          * 
246          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
247          */
248         @Nullable
249         public PrintableString payer_note() {
250                 long ret = bindings.UnsignedInvoiceRequest_payer_note(this.ptr);
251                 Reference.reachabilityFence(this);
252                 if (ret >= 0 && ret <= 4096) { return null; }
253                 org.ldk.structs.PrintableString ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PrintableString(null, ret); }
254                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
255                 return ret_hu_conv;
256         }
257
258         /**
259          * Serialize the UnsignedInvoiceRequest object into a byte array which can be read by UnsignedInvoiceRequest_read
260          */
261         public byte[] write() {
262                 byte[] ret = bindings.UnsignedInvoiceRequest_write(this.ptr);
263                 Reference.reachabilityFence(this);
264                 return ret;
265         }
266
267 }