[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / RawBolt11Invoice.cs
1 using org.ldk.impl;
2 using org.ldk.enums;
3 using org.ldk.util;
4 using System;
5
6 namespace org { namespace ldk { namespace structs {
7
8
9 /**
10  * Represents an syntactically correct [`Bolt11Invoice`] for a payment on the lightning network,
11  * but without the signature information.
12  * Decoding and encoding should not lead to information loss but may lead to different hashes.
13  * 
14  * For methods without docs see the corresponding methods in [`Bolt11Invoice`].
15  */
16 public class RawBolt11Invoice : CommonBase {
17         internal RawBolt11Invoice(object _dummy, long ptr) : base(ptr) { }
18         ~RawBolt11Invoice() {
19                 if (ptr != 0) { bindings.RawBolt11Invoice_free(ptr); }
20         }
21
22         /**
23          * data part
24          */
25         public RawDataPart get_data() {
26                 long ret = bindings.RawBolt11Invoice_get_data(this.ptr);
27                 GC.KeepAlive(this);
28                 if (ret >= 0 && ret <= 4096) { return null; }
29                 org.ldk.structs.RawDataPart ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RawDataPart(null, ret); }
30                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
31                 return ret_hu_conv;
32         }
33
34         /**
35          * data part
36          */
37         public void set_data(org.ldk.structs.RawDataPart val) {
38                 bindings.RawBolt11Invoice_set_data(this.ptr, val == null ? 0 : val.ptr);
39                 GC.KeepAlive(this);
40                 GC.KeepAlive(val);
41                 if (this != null) { this.ptrs_to.AddLast(val); };
42         }
43
44         /**
45          * Checks if two RawBolt11Invoices contain equal inner contents.
46          * This ignores pointers and is_owned flags and looks at the values in fields.
47          * Two objects with NULL inner values will be considered "equal" here.
48          */
49         public bool eq(org.ldk.structs.RawBolt11Invoice b) {
50                 bool ret = bindings.RawBolt11Invoice_eq(this.ptr, b == null ? 0 : b.ptr);
51                 GC.KeepAlive(this);
52                 GC.KeepAlive(b);
53                 if (this != null) { this.ptrs_to.AddLast(b); };
54                 return ret;
55         }
56
57         public override bool Equals(object o) {
58                 if (!(o is RawBolt11Invoice)) return false;
59                 return this.eq((RawBolt11Invoice)o);
60         }
61         internal long clone_ptr() {
62                 long ret = bindings.RawBolt11Invoice_clone_ptr(this.ptr);
63                 GC.KeepAlive(this);
64                 return ret;
65         }
66
67         /**
68          * Creates a copy of the RawBolt11Invoice
69          */
70         public RawBolt11Invoice clone() {
71                 long ret = bindings.RawBolt11Invoice_clone(this.ptr);
72                 GC.KeepAlive(this);
73                 if (ret >= 0 && ret <= 4096) { return null; }
74                 org.ldk.structs.RawBolt11Invoice ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RawBolt11Invoice(null, ret); }
75                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
76                 return ret_hu_conv;
77         }
78
79         /**
80          * Generates a non-cryptographic 64-bit hash of the RawBolt11Invoice.
81          */
82         public long hash() {
83                 long ret = bindings.RawBolt11Invoice_hash(this.ptr);
84                 GC.KeepAlive(this);
85                 return ret;
86         }
87
88         public override int GetHashCode() {
89                 return (int)this.hash();
90         }
91         /**
92          * Calculate the hash of the encoded `RawBolt11Invoice` which should be signed.
93          */
94         public byte[] signable_hash() {
95                 long ret = bindings.RawBolt11Invoice_signable_hash(this.ptr);
96                 GC.KeepAlive(this);
97                 if (ret >= 0 && ret <= 4096) { return null; }
98                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
99                 return ret_conv;
100         }
101
102         /**
103          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
104          */
105         public Sha256 payment_hash() {
106                 long ret = bindings.RawBolt11Invoice_payment_hash(this.ptr);
107                 GC.KeepAlive(this);
108                 if (ret >= 0 && ret <= 4096) { return null; }
109                 org.ldk.structs.Sha256 ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Sha256(null, ret); }
110                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
111                 return ret_hu_conv;
112         }
113
114         /**
115          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
116          */
117         public Description description() {
118                 long ret = bindings.RawBolt11Invoice_description(this.ptr);
119                 GC.KeepAlive(this);
120                 if (ret >= 0 && ret <= 4096) { return null; }
121                 org.ldk.structs.Description ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Description(null, ret); }
122                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
123                 return ret_hu_conv;
124         }
125
126         /**
127          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
128          */
129         public PayeePubKey payee_pub_key() {
130                 long ret = bindings.RawBolt11Invoice_payee_pub_key(this.ptr);
131                 GC.KeepAlive(this);
132                 if (ret >= 0 && ret <= 4096) { return null; }
133                 org.ldk.structs.PayeePubKey ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PayeePubKey(null, ret); }
134                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
135                 return ret_hu_conv;
136         }
137
138         /**
139          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
140          */
141         public Sha256 description_hash() {
142                 long ret = bindings.RawBolt11Invoice_description_hash(this.ptr);
143                 GC.KeepAlive(this);
144                 if (ret >= 0 && ret <= 4096) { return null; }
145                 org.ldk.structs.Sha256 ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Sha256(null, ret); }
146                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
147                 return ret_hu_conv;
148         }
149
150         /**
151          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
152          */
153         public ExpiryTime expiry_time() {
154                 long ret = bindings.RawBolt11Invoice_expiry_time(this.ptr);
155                 GC.KeepAlive(this);
156                 if (ret >= 0 && ret <= 4096) { return null; }
157                 org.ldk.structs.ExpiryTime ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ExpiryTime(null, ret); }
158                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
159                 return ret_hu_conv;
160         }
161
162         /**
163          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
164          */
165         public MinFinalCltvExpiryDelta min_final_cltv_expiry_delta() {
166                 long ret = bindings.RawBolt11Invoice_min_final_cltv_expiry_delta(this.ptr);
167                 GC.KeepAlive(this);
168                 if (ret >= 0 && ret <= 4096) { return null; }
169                 org.ldk.structs.MinFinalCltvExpiryDelta ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.MinFinalCltvExpiryDelta(null, ret); }
170                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
171                 return ret_hu_conv;
172         }
173
174         public Option_ThirtyTwoBytesZ payment_secret() {
175                 long ret = bindings.RawBolt11Invoice_payment_secret(this.ptr);
176                 GC.KeepAlive(this);
177                 if (ret >= 0 && ret <= 4096) { return null; }
178                 org.ldk.structs.Option_ThirtyTwoBytesZ ret_hu_conv = org.ldk.structs.Option_ThirtyTwoBytesZ.constr_from_ptr(ret);
179                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
180                 return ret_hu_conv;
181         }
182
183         public Option_CVec_u8ZZ payment_metadata() {
184                 long ret = bindings.RawBolt11Invoice_payment_metadata(this.ptr);
185                 GC.KeepAlive(this);
186                 if (ret >= 0 && ret <= 4096) { return null; }
187                 org.ldk.structs.Option_CVec_u8ZZ ret_hu_conv = org.ldk.structs.Option_CVec_u8ZZ.constr_from_ptr(ret);
188                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
189                 return ret_hu_conv;
190         }
191
192         /**
193          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
194          */
195         public Bolt11InvoiceFeatures features() {
196                 long ret = bindings.RawBolt11Invoice_features(this.ptr);
197                 GC.KeepAlive(this);
198                 if (ret >= 0 && ret <= 4096) { return null; }
199                 org.ldk.structs.Bolt11InvoiceFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Bolt11InvoiceFeatures(null, ret); }
200                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
201                 return ret_hu_conv;
202         }
203
204         public PrivateRoute[] private_routes() {
205                 long ret = bindings.RawBolt11Invoice_private_routes(this.ptr);
206                 GC.KeepAlive(this);
207                 if (ret >= 0 && ret <= 4096) { return null; }
208                 int ret_conv_14_len = InternalUtils.getArrayLength(ret);
209                 PrivateRoute[] ret_conv_14_arr = new PrivateRoute[ret_conv_14_len];
210                 for (int o = 0; o < ret_conv_14_len; o++) {
211                         long ret_conv_14 = InternalUtils.getU64ArrayElem(ret, o);
212                         org.ldk.structs.PrivateRoute ret_conv_14_hu_conv = null; if (ret_conv_14 < 0 || ret_conv_14 > 4096) { ret_conv_14_hu_conv = new org.ldk.structs.PrivateRoute(null, ret_conv_14); }
213                         if (ret_conv_14_hu_conv != null) { ret_conv_14_hu_conv.ptrs_to.AddLast(this); };
214                         ret_conv_14_arr[o] = ret_conv_14_hu_conv;
215                 }
216                 bindings.free_buffer(ret);
217                 return ret_conv_14_arr;
218         }
219
220         public Option_u64Z amount_pico_btc() {
221                 long ret = bindings.RawBolt11Invoice_amount_pico_btc(this.ptr);
222                 GC.KeepAlive(this);
223                 if (ret >= 0 && ret <= 4096) { return null; }
224                 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
225                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
226                 return ret_hu_conv;
227         }
228
229         public Currency currency() {
230                 Currency ret = bindings.RawBolt11Invoice_currency(this.ptr);
231                 GC.KeepAlive(this);
232                 return ret;
233         }
234
235 }
236 } } }