1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
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.
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 {
21 if (ptr != 0) { bindings.VerifiedInvoiceRequest_free(ptr); }
25 * Keys used for signing a [`Bolt12Invoice`] if they can be derived.
27 * If `Some`, must call [`respond_using_derived_keys`] when responding. Otherwise, call
30 * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
31 * [`respond_using_derived_keys`]: Self::respond_using_derived_keys
32 * [`respond_with`]: Self::respond_with
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); };
44 * Keys used for signing a [`Bolt12Invoice`] if they can be derived.
46 * If `Some`, must call [`respond_using_derived_keys`] when responding. Otherwise, call
49 * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
50 * [`respond_using_derived_keys`]: Self::respond_using_derived_keys
51 * [`respond_with`]: Self::respond_with
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); };
61 long ret = bindings.VerifiedInvoiceRequest_clone_ptr(this.ptr);
62 Reference.reachabilityFence(this);
67 * Creates a copy of the VerifiedInvoiceRequest
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); };
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.
83 public byte[][] chains() {
84 byte[][] ret = bindings.VerifiedInvoiceRequest_chains(this.ptr);
85 Reference.reachabilityFence(this);
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`.
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); };
103 * The minimum amount required for a successful payment of a single item.
105 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
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); };
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.
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); };
131 * Features pertaining to the offer.
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); };
143 * Duration since the Unix epoch when an invoice should no longer be requested.
145 * If `None`, the offer does not expire.
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); };
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.
160 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
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); };
173 * Paths to the recipient originating from publicly reachable nodes. Blinded paths provide
174 * recipient privacy by obfuscating its node id.
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;
187 return ret_conv_13_arr;
191 * The quantity of items supported.
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); };
203 * The public key used by the recipient to sign invoices.
205 public byte[] signing_pubkey() {
206 byte[] ret = bindings.VerifiedInvoiceRequest_signing_pubkey(this.ptr);
207 Reference.reachabilityFence(this);
212 * An unpredictable series of bytes, typically containing information about the derivation of
215 * [`payer_id`]: Self::payer_id
217 public byte[] payer_metadata() {
218 byte[] ret = bindings.VerifiedInvoiceRequest_payer_metadata(this.ptr);
219 Reference.reachabilityFence(this);
224 * A chain from [`Offer::chains`] that the offer is valid for.
226 public byte[] chain() {
227 byte[] ret = bindings.VerifiedInvoiceRequest_chain(this.ptr);
228 Reference.reachabilityFence(this);
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.
236 * [`chain`]: Self::chain
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); };
248 * Features pertaining to requesting an invoice.
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); };
260 * The quantity of the offer's item conforming to [`Offer::is_valid_quantity`].
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); };
272 * A possibly transient pubkey used to sign the invoice request.
274 public byte[] payer_id() {
275 byte[] ret = bindings.VerifiedInvoiceRequest_payer_id(this.ptr);
276 Reference.reachabilityFence(this);
281 * A payer-provided note which will be seen by the recipient and reflected back in the invoice
284 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
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); };