X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FInvoiceRequest.java;fp=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FInvoiceRequest.java;h=2706e52dd88bc3b09a03951156ae8eeb40725c7a;hb=07d5d868dfe064aadb28a7f7ca6002c16be9723d;hp=8fed3238317c5d8f2c7a22f78c34b4ceb9e74230;hpb=32973ea2749f8efd05b543dd774763513013b38b;p=ldk-java diff --git a/src/main/java/org/ldk/structs/InvoiceRequest.java b/src/main/java/org/ldk/structs/InvoiceRequest.java index 8fed3238..2706e52d 100644 --- a/src/main/java/org/ldk/structs/InvoiceRequest.java +++ b/src/main/java/org/ldk/structs/InvoiceRequest.java @@ -44,14 +44,147 @@ public class InvoiceRequest extends CommonBase { return ret_hu_conv; } + /** + * The chains that may be used when paying a requested invoice (e.g., bitcoin mainnet). + * Payments must be denominated in units of the minimal lightning-payable unit (e.g., msats) + * for the selected chain. + */ + public byte[][] chains() { + byte[][] ret = bindings.InvoiceRequest_chains(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Opaque bytes set by the originator. Useful for authentication and validating fields since it + * is reflected in `invoice_request` messages along with all the other fields from the `offer`. + */ + public Option_CVec_u8ZZ metadata() { + long ret = bindings.InvoiceRequest_metadata(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Option_CVec_u8ZZ ret_hu_conv = org.ldk.structs.Option_CVec_u8ZZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + /** + * The minimum amount required for a successful payment of a single item. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + @Nullable + public Amount amount() { + long ret = bindings.InvoiceRequest_amount(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Amount ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Amount(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + /** + * A complete description of the purpose of the payment. Intended to be displayed to the user + * but with the caveat that it has not been verified in any way. + */ + public PrintableString description() { + long ret = bindings.InvoiceRequest_description(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.PrintableString ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PrintableString(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + /** + * Features pertaining to the offer. + */ + public OfferFeatures offer_features() { + long ret = bindings.InvoiceRequest_offer_features(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.OfferFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OfferFeatures(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + /** + * Duration since the Unix epoch when an invoice should no longer be requested. + * + * If `None`, the offer does not expire. + */ + public Option_u64Z absolute_expiry() { + long ret = bindings.InvoiceRequest_absolute_expiry(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + /** + * The issuer of the offer, possibly beginning with `user@domain` or `domain`. Intended to be + * displayed to the user but with the caveat that it has not been verified in any way. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + @Nullable + public PrintableString issuer() { + long ret = bindings.InvoiceRequest_issuer(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.PrintableString ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PrintableString(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + /** + * Paths to the recipient originating from publicly reachable nodes. Blinded paths provide + * recipient privacy by obfuscating its node id. + */ + public BlindedPath[] paths() { + long[] ret = bindings.InvoiceRequest_paths(this.ptr); + Reference.reachabilityFence(this); + int ret_conv_13_len = ret.length; + BlindedPath[] ret_conv_13_arr = new BlindedPath[ret_conv_13_len]; + for (int n = 0; n < ret_conv_13_len; n++) { + long ret_conv_13 = ret[n]; + 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); } + if (ret_conv_13_hu_conv != null) { ret_conv_13_hu_conv.ptrs_to.add(this); }; + ret_conv_13_arr[n] = ret_conv_13_hu_conv; + } + return ret_conv_13_arr; + } + + /** + * The quantity of items supported. + */ + public Quantity supported_quantity() { + long ret = bindings.InvoiceRequest_supported_quantity(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Quantity ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Quantity(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + /** + * The public key used by the recipient to sign invoices. + */ + public byte[] signing_pubkey() { + byte[] ret = bindings.InvoiceRequest_signing_pubkey(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + /** * An unpredictable series of bytes, typically containing information about the derivation of * [`payer_id`]. * * [`payer_id`]: Self::payer_id */ - public byte[] metadata() { - byte[] ret = bindings.InvoiceRequest_metadata(this.ptr); + public byte[] payer_metadata() { + byte[] ret = bindings.InvoiceRequest_payer_metadata(this.ptr); Reference.reachabilityFence(this); return ret; } @@ -83,8 +216,8 @@ public class InvoiceRequest extends CommonBase { /** * Features pertaining to requesting an invoice. */ - public InvoiceRequestFeatures features() { - long ret = bindings.InvoiceRequest_features(this.ptr); + public InvoiceRequestFeatures invoice_request_features() { + long ret = bindings.InvoiceRequest_invoice_request_features(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.InvoiceRequestFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InvoiceRequestFeatures(null, ret); } @@ -130,19 +263,31 @@ public class InvoiceRequest extends CommonBase { } /** - * Verifies that the request was for an offer created using the given key. Returns the derived - * keys need to sign an [`Bolt12Invoice`] for the request if they could be extracted from the - * metadata. + * Signature of the invoice request using [`payer_id`]. + * + * [`payer_id`]: Self::payer_id + */ + public byte[] signature() { + byte[] ret = bindings.InvoiceRequest_signature(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Verifies that the request was for an offer created using the given key. Returns the verified + * request which contains the derived keys needed to sign a [`Bolt12Invoice`] for the request + * if they could be extracted from the metadata. * * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice */ - public Result_COption_KeyPairZNoneZ verify(org.ldk.structs.ExpandedKey key) { + public Result_VerifiedInvoiceRequestNoneZ verify(org.ldk.structs.ExpandedKey key) { long ret = bindings.InvoiceRequest_verify(this.ptr, key == null ? 0 : key.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(key); if (ret >= 0 && ret <= 4096) { return null; } - Result_COption_KeyPairZNoneZ ret_hu_conv = Result_COption_KeyPairZNoneZ.constr_from_ptr(ret); + Result_VerifiedInvoiceRequestNoneZ ret_hu_conv = Result_VerifiedInvoiceRequestNoneZ.constr_from_ptr(ret); if (this != null) { this.ptrs_to.add(key); }; + if (this != null) { this.ptrs_to.add(this); }; return ret_hu_conv; }