[Java] Update auto-generated bindings to 0.0.117
[ldk-java] / src / main / java / org / ldk / structs / VerifiedInvoiceRequest.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  * An [`InvoiceRequest`] that has been verified by [`InvoiceRequest::verify`] and exposes different
13  * ways to respond depending on whether the signing keys were derived.
14  */
15 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
16 public class VerifiedInvoiceRequest extends CommonBase {
17         VerifiedInvoiceRequest(Object _dummy, long ptr) { super(ptr); }
18         @Override @SuppressWarnings("deprecation")
19         protected void finalize() throws Throwable {
20                 super.finalize();
21                 if (ptr != 0) { bindings.VerifiedInvoiceRequest_free(ptr); }
22         }
23
24         /**
25          * Keys used for signing a [`Bolt12Invoice`] if they can be derived.
26          * 
27          * If `Some`, must call [`respond_using_derived_keys`] when responding. Otherwise, call
28          * [`respond_with`].
29          * 
30          * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
31          * [`respond_using_derived_keys`]: Self::respond_using_derived_keys
32          * [`respond_with`]: Self::respond_with
33          */
34         public Option_SecretKeyZ get_keys() {
35                 long ret = bindings.VerifiedInvoiceRequest_get_keys(this.ptr);
36                 Reference.reachabilityFence(this);
37                 if (ret >= 0 && ret <= 4096) { return null; }
38                 org.ldk.structs.Option_SecretKeyZ ret_hu_conv = org.ldk.structs.Option_SecretKeyZ.constr_from_ptr(ret);
39                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
40                 return ret_hu_conv;
41         }
42
43         /**
44          * Keys used for signing a [`Bolt12Invoice`] if they can be derived.
45          * 
46          * If `Some`, must call [`respond_using_derived_keys`] when responding. Otherwise, call
47          * [`respond_with`].
48          * 
49          * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
50          * [`respond_using_derived_keys`]: Self::respond_using_derived_keys
51          * [`respond_with`]: Self::respond_with
52          */
53         public void set_keys(org.ldk.structs.Option_SecretKeyZ val) {
54                 bindings.VerifiedInvoiceRequest_set_keys(this.ptr, val.ptr);
55                 Reference.reachabilityFence(this);
56                 Reference.reachabilityFence(val);
57                 if (this != null) { this.ptrs_to.add(val); };
58         }
59
60         long clone_ptr() {
61                 long ret = bindings.VerifiedInvoiceRequest_clone_ptr(this.ptr);
62                 Reference.reachabilityFence(this);
63                 return ret;
64         }
65
66         /**
67          * Creates a copy of the VerifiedInvoiceRequest
68          */
69         public VerifiedInvoiceRequest clone() {
70                 long ret = bindings.VerifiedInvoiceRequest_clone(this.ptr);
71                 Reference.reachabilityFence(this);
72                 if (ret >= 0 && ret <= 4096) { return null; }
73                 org.ldk.structs.VerifiedInvoiceRequest ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.VerifiedInvoiceRequest(null, ret); }
74                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
75                 return ret_hu_conv;
76         }
77
78         /**
79          * The chains that may be used when paying a requested invoice (e.g., bitcoin mainnet).
80          * Payments must be denominated in units of the minimal lightning-payable unit (e.g., msats)
81          * for the selected chain.
82          */
83         public byte[][] chains() {
84                 byte[][] ret = bindings.VerifiedInvoiceRequest_chains(this.ptr);
85                 Reference.reachabilityFence(this);
86                 return ret;
87         }
88
89         /**
90          * Opaque bytes set by the originator. Useful for authentication and validating fields since it
91          * is reflected in `invoice_request` messages along with all the other fields from the `offer`.
92          */
93         public Option_CVec_u8ZZ metadata() {
94                 long ret = bindings.VerifiedInvoiceRequest_metadata(this.ptr);
95                 Reference.reachabilityFence(this);
96                 if (ret >= 0 && ret <= 4096) { return null; }
97                 org.ldk.structs.Option_CVec_u8ZZ ret_hu_conv = org.ldk.structs.Option_CVec_u8ZZ.constr_from_ptr(ret);
98                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
99                 return ret_hu_conv;
100         }
101
102         /**
103          * The minimum amount required for a successful payment of a single item.
104          * 
105          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
106          */
107         @Nullable
108         public Amount amount() {
109                 long ret = bindings.VerifiedInvoiceRequest_amount(this.ptr);
110                 Reference.reachabilityFence(this);
111                 if (ret >= 0 && ret <= 4096) { return null; }
112                 org.ldk.structs.Amount ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Amount(null, ret); }
113                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
114                 return ret_hu_conv;
115         }
116
117         /**
118          * A complete description of the purpose of the payment. Intended to be displayed to the user
119          * but with the caveat that it has not been verified in any way.
120          */
121         public PrintableString description() {
122                 long ret = bindings.VerifiedInvoiceRequest_description(this.ptr);
123                 Reference.reachabilityFence(this);
124                 if (ret >= 0 && ret <= 4096) { return null; }
125                 org.ldk.structs.PrintableString ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PrintableString(null, ret); }
126                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
127                 return ret_hu_conv;
128         }
129
130         /**
131          * Features pertaining to the offer.
132          */
133         public OfferFeatures offer_features() {
134                 long ret = bindings.VerifiedInvoiceRequest_offer_features(this.ptr);
135                 Reference.reachabilityFence(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.add(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          * If `None`, the offer does not expire.
146          */
147         public Option_u64Z absolute_expiry() {
148                 long ret = bindings.VerifiedInvoiceRequest_absolute_expiry(this.ptr);
149                 Reference.reachabilityFence(this);
150                 if (ret >= 0 && ret <= 4096) { return null; }
151                 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
152                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
153                 return ret_hu_conv;
154         }
155
156         /**
157          * The issuer of the offer, possibly beginning with `user@domain` or `domain`. Intended to be
158          * displayed to the user but with the caveat that it has not been verified in any way.
159          * 
160          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
161          */
162         @Nullable
163         public PrintableString issuer() {
164                 long ret = bindings.VerifiedInvoiceRequest_issuer(this.ptr);
165                 Reference.reachabilityFence(this);
166                 if (ret >= 0 && ret <= 4096) { return null; }
167                 org.ldk.structs.PrintableString ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PrintableString(null, ret); }
168                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
169                 return ret_hu_conv;
170         }
171
172         /**
173          * Paths to the recipient originating from publicly reachable nodes. Blinded paths provide
174          * recipient privacy by obfuscating its node id.
175          */
176         public BlindedPath[] paths() {
177                 long[] ret = bindings.VerifiedInvoiceRequest_paths(this.ptr);
178                 Reference.reachabilityFence(this);
179                 int ret_conv_13_len = ret.length;
180                 BlindedPath[] ret_conv_13_arr = new BlindedPath[ret_conv_13_len];
181                 for (int n = 0; n < ret_conv_13_len; n++) {
182                         long ret_conv_13 = ret[n];
183                         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); }
184                         if (ret_conv_13_hu_conv != null) { ret_conv_13_hu_conv.ptrs_to.add(this); };
185                         ret_conv_13_arr[n] = ret_conv_13_hu_conv;
186                 }
187                 return ret_conv_13_arr;
188         }
189
190         /**
191          * The quantity of items supported.
192          */
193         public Quantity supported_quantity() {
194                 long ret = bindings.VerifiedInvoiceRequest_supported_quantity(this.ptr);
195                 Reference.reachabilityFence(this);
196                 if (ret >= 0 && ret <= 4096) { return null; }
197                 org.ldk.structs.Quantity ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Quantity(null, ret); }
198                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
199                 return ret_hu_conv;
200         }
201
202         /**
203          * The public key used by the recipient to sign invoices.
204          */
205         public byte[] signing_pubkey() {
206                 byte[] ret = bindings.VerifiedInvoiceRequest_signing_pubkey(this.ptr);
207                 Reference.reachabilityFence(this);
208                 return ret;
209         }
210
211         /**
212          * An unpredictable series of bytes, typically containing information about the derivation of
213          * [`payer_id`].
214          * 
215          * [`payer_id`]: Self::payer_id
216          */
217         public byte[] payer_metadata() {
218                 byte[] ret = bindings.VerifiedInvoiceRequest_payer_metadata(this.ptr);
219                 Reference.reachabilityFence(this);
220                 return ret;
221         }
222
223         /**
224          * A chain from [`Offer::chains`] that the offer is valid for.
225          */
226         public byte[] chain() {
227                 byte[] ret = bindings.VerifiedInvoiceRequest_chain(this.ptr);
228                 Reference.reachabilityFence(this);
229                 return ret;
230         }
231
232         /**
233          * The amount to pay in msats (i.e., the minimum lightning-payable unit for [`chain`]), which
234          * must be greater than or equal to [`Offer::amount`], converted if necessary.
235          * 
236          * [`chain`]: Self::chain
237          */
238         public Option_u64Z amount_msats() {
239                 long ret = bindings.VerifiedInvoiceRequest_amount_msats(this.ptr);
240                 Reference.reachabilityFence(this);
241                 if (ret >= 0 && ret <= 4096) { return null; }
242                 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
243                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
244                 return ret_hu_conv;
245         }
246
247         /**
248          * Features pertaining to requesting an invoice.
249          */
250         public InvoiceRequestFeatures invoice_request_features() {
251                 long ret = bindings.VerifiedInvoiceRequest_invoice_request_features(this.ptr);
252                 Reference.reachabilityFence(this);
253                 if (ret >= 0 && ret <= 4096) { return null; }
254                 org.ldk.structs.InvoiceRequestFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InvoiceRequestFeatures(null, ret); }
255                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
256                 return ret_hu_conv;
257         }
258
259         /**
260          * The quantity of the offer's item conforming to [`Offer::is_valid_quantity`].
261          */
262         public Option_u64Z quantity() {
263                 long ret = bindings.VerifiedInvoiceRequest_quantity(this.ptr);
264                 Reference.reachabilityFence(this);
265                 if (ret >= 0 && ret <= 4096) { return null; }
266                 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
267                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
268                 return ret_hu_conv;
269         }
270
271         /**
272          * A possibly transient pubkey used to sign the invoice request.
273          */
274         public byte[] payer_id() {
275                 byte[] ret = bindings.VerifiedInvoiceRequest_payer_id(this.ptr);
276                 Reference.reachabilityFence(this);
277                 return ret;
278         }
279
280         /**
281          * A payer-provided note which will be seen by the recipient and reflected back in the invoice
282          * response.
283          * 
284          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
285          */
286         @Nullable
287         public PrintableString payer_note() {
288                 long ret = bindings.VerifiedInvoiceRequest_payer_note(this.ptr);
289                 Reference.reachabilityFence(this);
290                 if (ret >= 0 && ret <= 4096) { return null; }
291                 org.ldk.structs.PrintableString ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PrintableString(null, ret); }
292                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
293                 return ret_hu_conv;
294         }
295
296 }