6 namespace org { namespace ldk { namespace structs {
10 * Represents a signed [`RawBolt11Invoice`] with cached hash. The signature is not checked and may be
14 * The hash has to be either from the deserialized invoice or from the serialized [`RawBolt11Invoice`].
16 public class SignedRawBolt11Invoice : CommonBase {
17 internal SignedRawBolt11Invoice(object _dummy, long ptr) : base(ptr) { }
18 ~SignedRawBolt11Invoice() {
19 if (ptr != 0) { bindings.SignedRawBolt11Invoice_free(ptr); }
23 * Checks if two SignedRawBolt11Invoices contain equal inner contents.
24 * This ignores pointers and is_owned flags and looks at the values in fields.
25 * Two objects with NULL inner values will be considered "equal" here.
27 public bool eq(org.ldk.structs.SignedRawBolt11Invoice b) {
28 bool ret = bindings.SignedRawBolt11Invoice_eq(this.ptr, b == null ? 0 : b.ptr);
31 if (this != null) { this.ptrs_to.AddLast(b); };
35 public override bool Equals(object o) {
36 if (!(o is SignedRawBolt11Invoice)) return false;
37 return this.eq((SignedRawBolt11Invoice)o);
39 internal long clone_ptr() {
40 long ret = bindings.SignedRawBolt11Invoice_clone_ptr(this.ptr);
46 * Creates a copy of the SignedRawBolt11Invoice
48 public SignedRawBolt11Invoice clone() {
49 long ret = bindings.SignedRawBolt11Invoice_clone(this.ptr);
51 if (ret >= 0 && ret <= 4096) { return null; }
52 org.ldk.structs.SignedRawBolt11Invoice ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.SignedRawBolt11Invoice(null, ret); }
53 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
58 * Generates a non-cryptographic 64-bit hash of the SignedRawBolt11Invoice.
61 long ret = bindings.SignedRawBolt11Invoice_hash(this.ptr);
66 public override int GetHashCode() {
67 return (int)this.hash();
70 * Disassembles the `SignedRawBolt11Invoice` into its three parts:
72 * 2. hash of the raw invoice
75 public ThreeTuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ into_parts() {
76 long ret = bindings.SignedRawBolt11Invoice_into_parts(this.ptr);
78 if (ret >= 0 && ret <= 4096) { return null; }
79 ThreeTuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ ret_hu_conv = new ThreeTuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ(null, ret);
80 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
81 if (this != null) { this.ptrs_to.AddLast(this); };
86 * The [`RawBolt11Invoice`] which was signed.
88 public RawBolt11Invoice raw_invoice() {
89 long ret = bindings.SignedRawBolt11Invoice_raw_invoice(this.ptr);
91 if (ret >= 0 && ret <= 4096) { return null; }
92 org.ldk.structs.RawBolt11Invoice ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RawBolt11Invoice(null, ret); }
93 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
98 * The hash of the [`RawBolt11Invoice`] that was signed.
100 public byte[] signable_hash() {
101 long ret = bindings.SignedRawBolt11Invoice_signable_hash(this.ptr);
103 if (ret >= 0 && ret <= 4096) { return null; }
104 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
109 * Signature for the invoice.
111 public Bolt11InvoiceSignature signature() {
112 long ret = bindings.SignedRawBolt11Invoice_signature(this.ptr);
114 if (ret >= 0 && ret <= 4096) { return null; }
115 org.ldk.structs.Bolt11InvoiceSignature ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Bolt11InvoiceSignature(null, ret); }
116 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
121 * Recovers the public key used for signing the invoice from the recoverable signature.
123 public Result_PayeePubKeySecp256k1ErrorZ recover_payee_pub_key() {
124 long ret = bindings.SignedRawBolt11Invoice_recover_payee_pub_key(this.ptr);
126 if (ret >= 0 && ret <= 4096) { return null; }
127 Result_PayeePubKeySecp256k1ErrorZ ret_hu_conv = Result_PayeePubKeySecp256k1ErrorZ.constr_from_ptr(ret);
132 * Checks if the signature is valid for the included payee public key or if none exists if it's
133 * valid for the recovered signature (which should always be true?).
135 public bool check_signature() {
136 bool ret = bindings.SignedRawBolt11Invoice_check_signature(this.ptr);
142 * Read a SignedRawBolt11Invoice object from a string
144 public static Result_SignedRawBolt11InvoiceBolt11ParseErrorZ from_str(string s) {
145 long ret = bindings.SignedRawBolt11Invoice_from_str(InternalUtils.encodeString(s));
147 if (ret >= 0 && ret <= 4096) { return null; }
148 Result_SignedRawBolt11InvoiceBolt11ParseErrorZ ret_hu_conv = Result_SignedRawBolt11InvoiceBolt11ParseErrorZ.constr_from_ptr(ret);
153 * Get the string representation of a SignedRawBolt11Invoice object
155 public string to_str() {
156 long ret = bindings.SignedRawBolt11Invoice_to_str(this.ptr);
158 if (ret >= 0 && ret <= 4096) { return null; }
159 string ret_conv = InternalUtils.decodeString(ret);