6 namespace org { namespace ldk { namespace structs {
10 * An [`InvoiceRequest`] that has been verified by [`InvoiceRequest::verify`] and exposes different
11 * ways to respond depending on whether the signing keys were derived.
13 public class VerifiedInvoiceRequest : CommonBase {
14 internal VerifiedInvoiceRequest(object _dummy, long ptr) : base(ptr) { }
15 ~VerifiedInvoiceRequest() {
16 if (ptr != 0) { bindings.VerifiedInvoiceRequest_free(ptr); }
20 * The identifier of the [`Offer`] for which the [`InvoiceRequest`] was made.
22 public OfferId get_offer_id() {
23 long ret = bindings.VerifiedInvoiceRequest_get_offer_id(this.ptr);
25 if (ret >= 0 && ret <= 4096) { return null; }
26 org.ldk.structs.OfferId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OfferId(null, ret); }
27 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
32 * The identifier of the [`Offer`] for which the [`InvoiceRequest`] was made.
34 public void set_offer_id(org.ldk.structs.OfferId val) {
35 bindings.VerifiedInvoiceRequest_set_offer_id(this.ptr, val.ptr);
38 if (this != null) { this.ptrs_to.AddLast(val); };
42 * Keys used for signing a [`Bolt12Invoice`] if they can be derived.
44 * If `Some`, must call [`respond_using_derived_keys`] when responding. Otherwise, call
47 * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
48 * [`respond_using_derived_keys`]: Self::respond_using_derived_keys
49 * [`respond_with`]: Self::respond_with
51 public Option_SecretKeyZ get_keys() {
52 long ret = bindings.VerifiedInvoiceRequest_get_keys(this.ptr);
54 if (ret >= 0 && ret <= 4096) { return null; }
55 org.ldk.structs.Option_SecretKeyZ ret_hu_conv = org.ldk.structs.Option_SecretKeyZ.constr_from_ptr(ret);
56 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
61 * Keys used for signing a [`Bolt12Invoice`] if they can be derived.
63 * If `Some`, must call [`respond_using_derived_keys`] when responding. Otherwise, call
66 * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
67 * [`respond_using_derived_keys`]: Self::respond_using_derived_keys
68 * [`respond_with`]: Self::respond_with
70 public void set_keys(org.ldk.structs.Option_SecretKeyZ val) {
71 bindings.VerifiedInvoiceRequest_set_keys(this.ptr, val.ptr);
74 if (this != null) { this.ptrs_to.AddLast(val); };
77 internal long clone_ptr() {
78 long ret = bindings.VerifiedInvoiceRequest_clone_ptr(this.ptr);
84 * Creates a copy of the VerifiedInvoiceRequest
86 public VerifiedInvoiceRequest clone() {
87 long ret = bindings.VerifiedInvoiceRequest_clone(this.ptr);
89 if (ret >= 0 && ret <= 4096) { return null; }
90 org.ldk.structs.VerifiedInvoiceRequest ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.VerifiedInvoiceRequest(null, ret); }
91 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
96 * The chains that may be used when paying a requested invoice (e.g., bitcoin mainnet).
97 * Payments must be denominated in units of the minimal lightning-payable unit (e.g., msats)
98 * for the selected chain.
100 public byte[][] chains() {
101 long ret = bindings.VerifiedInvoiceRequest_chains(this.ptr);
103 if (ret >= 0 && ret <= 4096) { return null; }
104 int ret_conv_8_len = InternalUtils.getArrayLength(ret);
105 byte[][] ret_conv_8_arr = new byte[ret_conv_8_len][];
106 for (int i = 0; i < ret_conv_8_len; i++) {
107 long ret_conv_8 = InternalUtils.getU64ArrayElem(ret, i);
108 byte[] ret_conv_8_conv = InternalUtils.decodeUint8Array(ret_conv_8);
109 ret_conv_8_arr[i] = ret_conv_8_conv;
111 bindings.free_buffer(ret);
112 return ret_conv_8_arr;
116 * Opaque bytes set by the originator. Useful for authentication and validating fields since it
117 * is reflected in `invoice_request` messages along with all the other fields from the `offer`.
119 public Option_CVec_u8ZZ metadata() {
120 long ret = bindings.VerifiedInvoiceRequest_metadata(this.ptr);
122 if (ret >= 0 && ret <= 4096) { return null; }
123 org.ldk.structs.Option_CVec_u8ZZ ret_hu_conv = org.ldk.structs.Option_CVec_u8ZZ.constr_from_ptr(ret);
124 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
129 * The minimum amount required for a successful payment of a single item.
131 public Option_AmountZ amount() {
132 long ret = bindings.VerifiedInvoiceRequest_amount(this.ptr);
134 if (ret >= 0 && ret <= 4096) { return null; }
135 org.ldk.structs.Option_AmountZ ret_hu_conv = org.ldk.structs.Option_AmountZ.constr_from_ptr(ret);
136 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
141 * A complete description of the purpose of the payment. Intended to be displayed to the user
142 * but with the caveat that it has not been verified in any way.
144 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
146 public PrintableString description() {
147 long ret = bindings.VerifiedInvoiceRequest_description(this.ptr);
149 if (ret >= 0 && ret <= 4096) { return null; }
150 org.ldk.structs.PrintableString ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PrintableString(null, ret); }
151 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
156 * Features pertaining to the offer.
158 public OfferFeatures offer_features() {
159 long ret = bindings.VerifiedInvoiceRequest_offer_features(this.ptr);
161 if (ret >= 0 && ret <= 4096) { return null; }
162 org.ldk.structs.OfferFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OfferFeatures(null, ret); }
163 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
168 * Duration since the Unix epoch when an invoice should no longer be requested.
170 * If `None`, the offer does not expire.
172 public Option_u64Z absolute_expiry() {
173 long ret = bindings.VerifiedInvoiceRequest_absolute_expiry(this.ptr);
175 if (ret >= 0 && ret <= 4096) { return null; }
176 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
177 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
182 * The issuer of the offer, possibly beginning with `user@domain` or `domain`. Intended to be
183 * displayed to the user but with the caveat that it has not been verified in any way.
185 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
187 public PrintableString issuer() {
188 long ret = bindings.VerifiedInvoiceRequest_issuer(this.ptr);
190 if (ret >= 0 && ret <= 4096) { return null; }
191 org.ldk.structs.PrintableString ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PrintableString(null, ret); }
192 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
197 * Paths to the recipient originating from publicly reachable nodes. Blinded paths provide
198 * recipient privacy by obfuscating its node id.
200 public BlindedPath[] paths() {
201 long ret = bindings.VerifiedInvoiceRequest_paths(this.ptr);
203 if (ret >= 0 && ret <= 4096) { return null; }
204 int ret_conv_13_len = InternalUtils.getArrayLength(ret);
205 BlindedPath[] ret_conv_13_arr = new BlindedPath[ret_conv_13_len];
206 for (int n = 0; n < ret_conv_13_len; n++) {
207 long ret_conv_13 = InternalUtils.getU64ArrayElem(ret, n);
208 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); }
209 if (ret_conv_13_hu_conv != null) { ret_conv_13_hu_conv.ptrs_to.AddLast(this); };
210 ret_conv_13_arr[n] = ret_conv_13_hu_conv;
212 bindings.free_buffer(ret);
213 return ret_conv_13_arr;
217 * The quantity of items supported.
219 public Quantity supported_quantity() {
220 long ret = bindings.VerifiedInvoiceRequest_supported_quantity(this.ptr);
222 if (ret >= 0 && ret <= 4096) { return null; }
223 org.ldk.structs.Quantity ret_hu_conv = org.ldk.structs.Quantity.constr_from_ptr(ret);
224 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
229 * The public key used by the recipient to sign invoices.
231 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
233 public byte[] signing_pubkey() {
234 long ret = bindings.VerifiedInvoiceRequest_signing_pubkey(this.ptr);
236 if (ret >= 0 && ret <= 4096) { return null; }
237 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
242 * An unpredictable series of bytes, typically containing information about the derivation of
245 * [`payer_id`]: Self::payer_id
247 public byte[] payer_metadata() {
248 long ret = bindings.VerifiedInvoiceRequest_payer_metadata(this.ptr);
250 if (ret >= 0 && ret <= 4096) { return null; }
251 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
256 * A chain from [`Offer::chains`] that the offer is valid for.
258 public byte[] chain() {
259 long ret = bindings.VerifiedInvoiceRequest_chain(this.ptr);
261 if (ret >= 0 && ret <= 4096) { return null; }
262 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
267 * The amount to pay in msats (i.e., the minimum lightning-payable unit for [`chain`]), which
268 * must be greater than or equal to [`Offer::amount`], converted if necessary.
270 * [`chain`]: Self::chain
272 public Option_u64Z amount_msats() {
273 long ret = bindings.VerifiedInvoiceRequest_amount_msats(this.ptr);
275 if (ret >= 0 && ret <= 4096) { return null; }
276 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
277 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
282 * Features pertaining to requesting an invoice.
284 public InvoiceRequestFeatures invoice_request_features() {
285 long ret = bindings.VerifiedInvoiceRequest_invoice_request_features(this.ptr);
287 if (ret >= 0 && ret <= 4096) { return null; }
288 org.ldk.structs.InvoiceRequestFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InvoiceRequestFeatures(null, ret); }
289 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
294 * The quantity of the offer's item conforming to [`Offer::is_valid_quantity`].
296 public Option_u64Z quantity() {
297 long ret = bindings.VerifiedInvoiceRequest_quantity(this.ptr);
299 if (ret >= 0 && ret <= 4096) { return null; }
300 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
301 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
306 * A possibly transient pubkey used to sign the invoice request.
308 public byte[] payer_id() {
309 long ret = bindings.VerifiedInvoiceRequest_payer_id(this.ptr);
311 if (ret >= 0 && ret <= 4096) { return null; }
312 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
317 * A payer-provided note which will be seen by the recipient and reflected back in the invoice
320 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
322 public PrintableString payer_note() {
323 long ret = bindings.VerifiedInvoiceRequest_payer_note(this.ptr);
325 if (ret >= 0 && ret <= 4096) { return null; }
326 org.ldk.structs.PrintableString ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PrintableString(null, ret); }
327 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
332 * Creates an [`InvoiceBuilder`] for the request with the given required fields and using the
333 * [`Duration`] since [`std::time::SystemTime::UNIX_EPOCH`] as the creation time.
335 * See [`InvoiceRequest::respond_with_no_std`] for further details where the aforementioned
336 * creation time is used for the `created_at` parameter.
338 * [`Duration`]: core::time::Duration
340 public Result_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ respond_with(TwoTuple_BlindedPayInfoBlindedPathZ[] payment_paths, byte[] payment_hash) {
341 long ret = bindings.VerifiedInvoiceRequest_respond_with(this.ptr, InternalUtils.encodeUint64Array(InternalUtils.mapArray(payment_paths, payment_paths_conv_37 => payment_paths_conv_37.ptr)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payment_hash, 32)));
343 GC.KeepAlive(payment_paths);
344 GC.KeepAlive(payment_hash);
345 if (ret >= 0 && ret <= 4096) { return null; }
346 Result_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ ret_hu_conv = Result_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ.constr_from_ptr(ret);
351 * Creates an [`InvoiceBuilder`] for the request with the given required fields.
353 * Unless [`InvoiceBuilder::relative_expiry`] is set, the invoice will expire two hours after
354 * `created_at`, which is used to set [`Bolt12Invoice::created_at`]. Useful for `no-std` builds
355 * where [`std::time::SystemTime`] is not available.
357 * The caller is expected to remember the preimage of `payment_hash` in order to claim a payment
360 * The `payment_paths` parameter is useful for maintaining the payment recipient's privacy. It
361 * must contain one or more elements ordered from most-preferred to least-preferred, if there's
362 * a preference. Note, however, that any privacy is lost if a public node id was used for
363 * [`Offer::signing_pubkey`].
365 * Errors if the request contains unknown required features.
369 * If the originating [`Offer`] was created using [`OfferBuilder::deriving_signing_pubkey`],
370 * then use [`InvoiceRequest::verify`] and [`VerifiedInvoiceRequest`] methods instead.
372 * [`Bolt12Invoice::created_at`]: crate::offers::invoice::Bolt12Invoice::created_at
373 * [`OfferBuilder::deriving_signing_pubkey`]: crate::offers::offer::OfferBuilder::deriving_signing_pubkey
375 public Result_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ respond_with_no_std(TwoTuple_BlindedPayInfoBlindedPathZ[] payment_paths, byte[] payment_hash, long created_at) {
376 long ret = bindings.VerifiedInvoiceRequest_respond_with_no_std(this.ptr, InternalUtils.encodeUint64Array(InternalUtils.mapArray(payment_paths, payment_paths_conv_37 => payment_paths_conv_37.ptr)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payment_hash, 32)), created_at);
378 GC.KeepAlive(payment_paths);
379 GC.KeepAlive(payment_hash);
380 GC.KeepAlive(created_at);
381 if (ret >= 0 && ret <= 4096) { return null; }
382 Result_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ ret_hu_conv = Result_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ.constr_from_ptr(ret);
387 * Creates an [`InvoiceBuilder`] for the request using the given required fields and that uses
388 * derived signing keys from the originating [`Offer`] to sign the [`Bolt12Invoice`]. Must use
389 * the same [`ExpandedKey`] as the one used to create the offer.
391 * See [`InvoiceRequest::respond_with`] for further details.
393 * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
395 public Result_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ respond_using_derived_keys(TwoTuple_BlindedPayInfoBlindedPathZ[] payment_paths, byte[] payment_hash) {
396 long ret = bindings.VerifiedInvoiceRequest_respond_using_derived_keys(this.ptr, InternalUtils.encodeUint64Array(InternalUtils.mapArray(payment_paths, payment_paths_conv_37 => payment_paths_conv_37.ptr)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payment_hash, 32)));
398 GC.KeepAlive(payment_paths);
399 GC.KeepAlive(payment_hash);
400 if (ret >= 0 && ret <= 4096) { return null; }
401 Result_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ ret_hu_conv = Result_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ.constr_from_ptr(ret);
406 * Creates an [`InvoiceBuilder`] for the request using the given required fields and that uses
407 * derived signing keys from the originating [`Offer`] to sign the [`Bolt12Invoice`]. Must use
408 * the same [`ExpandedKey`] as the one used to create the offer.
410 * See [`InvoiceRequest::respond_with_no_std`] for further details.
412 * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
414 public Result_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ respond_using_derived_keys_no_std(TwoTuple_BlindedPayInfoBlindedPathZ[] payment_paths, byte[] payment_hash, long created_at) {
415 long ret = bindings.VerifiedInvoiceRequest_respond_using_derived_keys_no_std(this.ptr, InternalUtils.encodeUint64Array(InternalUtils.mapArray(payment_paths, payment_paths_conv_37 => payment_paths_conv_37.ptr)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payment_hash, 32)), created_at);
417 GC.KeepAlive(payment_paths);
418 GC.KeepAlive(payment_hash);
419 GC.KeepAlive(created_at);
420 if (ret >= 0 && ret <= 4096) { return null; }
421 Result_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ ret_hu_conv = Result_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ.constr_from_ptr(ret);