6 namespace org { namespace ldk { namespace structs {
10 * A `Bolt12Invoice` is a payment request, typically corresponding to an [`Offer`] or a [`Refund`].
12 * An invoice may be sent in response to an [`InvoiceRequest`] in the case of an offer or sent
13 * directly after scanning a refund. It includes all the information needed to pay a recipient.
15 * [`Offer`]: crate::offers::offer::Offer
16 * [`Refund`]: crate::offers::refund::Refund
17 * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
19 public class Bolt12Invoice : CommonBase {
20 internal Bolt12Invoice(object _dummy, long ptr) : base(ptr) { }
22 if (ptr != 0) { bindings.Bolt12Invoice_free(ptr); }
25 internal long clone_ptr() {
26 long ret = bindings.Bolt12Invoice_clone_ptr(this.ptr);
32 * Creates a copy of the Bolt12Invoice
34 public Bolt12Invoice clone() {
35 long ret = bindings.Bolt12Invoice_clone(this.ptr);
37 if (ret >= 0 && ret <= 4096) { return null; }
38 org.ldk.structs.Bolt12Invoice ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Bolt12Invoice(null, ret); }
39 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
44 * A complete description of the purpose of the originating offer or refund. Intended to be
45 * displayed to the user but with the caveat that it has not been verified in any way.
47 public PrintableString description() {
48 long ret = bindings.Bolt12Invoice_description(this.ptr);
50 if (ret >= 0 && ret <= 4096) { return null; }
51 org.ldk.structs.PrintableString ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PrintableString(null, ret); }
52 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
57 * Duration since the Unix epoch when the invoice was created.
59 public long created_at() {
60 long ret = bindings.Bolt12Invoice_created_at(this.ptr);
66 * Duration since [`Bolt12Invoice::created_at`] when the invoice has expired and therefore
67 * should no longer be paid.
69 public long relative_expiry() {
70 long ret = bindings.Bolt12Invoice_relative_expiry(this.ptr);
76 * Whether the invoice has expired.
78 public bool is_expired() {
79 bool ret = bindings.Bolt12Invoice_is_expired(this.ptr);
85 * SHA256 hash of the payment preimage that will be given in return for paying the invoice.
87 public byte[] payment_hash() {
88 byte[] ret = bindings.Bolt12Invoice_payment_hash(this.ptr);
94 * The minimum amount required for a successful payment of the invoice.
96 public long amount_msats() {
97 long ret = bindings.Bolt12Invoice_amount_msats(this.ptr);
103 * Features pertaining to paying an invoice.
105 public Bolt12InvoiceFeatures features() {
106 long ret = bindings.Bolt12Invoice_features(this.ptr);
108 if (ret >= 0 && ret <= 4096) { return null; }
109 org.ldk.structs.Bolt12InvoiceFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Bolt12InvoiceFeatures(null, ret); }
110 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
115 * The public key corresponding to the key used to sign the invoice.
117 public byte[] signing_pubkey() {
118 byte[] ret = bindings.Bolt12Invoice_signing_pubkey(this.ptr);
124 * Hash that was used for signing the invoice.
126 public byte[] signable_hash() {
127 byte[] ret = bindings.Bolt12Invoice_signable_hash(this.ptr);
133 * Verifies that the invoice was for a request or refund created using the given key.
135 public bool verify(org.ldk.structs.ExpandedKey key) {
136 bool ret = bindings.Bolt12Invoice_verify(this.ptr, key == null ? 0 : key.ptr);
139 if (this != null) { this.ptrs_to.AddLast(key); };
144 * Serialize the Bolt12Invoice object into a byte array which can be read by Bolt12Invoice_read
146 public byte[] write() {
147 byte[] ret = bindings.Bolt12Invoice_write(this.ptr);