Update auto-generated bindings
[ldk-java] / src / main / java / org / ldk / structs / RawInvoice.java
1 package org.ldk.structs;
2
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
5 import org.ldk.util.*;
6 import java.util.Arrays;
7
8
9 /**
10  * Represents an syntactically correct Invoice for a payment on the lightning network,
11  * but without the signature information.
12  * De- 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 `Invoice`.
15  */
16 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
17 public class RawInvoice extends CommonBase {
18         RawInvoice(Object _dummy, long ptr) { super(ptr); }
19         @Override @SuppressWarnings("deprecation")
20         protected void finalize() throws Throwable {
21                 super.finalize();
22                 if (ptr != 0) { bindings.RawInvoice_free(ptr); }
23         }
24
25         /**
26          * data part
27          */
28         public RawDataPart get_data() {
29                 long ret = bindings.RawInvoice_get_data(this.ptr);
30                 if (ret < 1024) { return null; }
31                 RawDataPart ret_hu_conv = new RawDataPart(null, ret);
32                 ret_hu_conv.ptrs_to.add(this);
33                 return ret_hu_conv;
34         }
35
36         /**
37          * data part
38          */
39         public void set_data(RawDataPart val) {
40                 bindings.RawInvoice_set_data(this.ptr, val == null ? 0 : val.ptr & ~1);
41                 this.ptrs_to.add(val);
42         }
43
44         /**
45          * Checks if two RawInvoices 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 boolean eq(RawInvoice b) {
50                 boolean ret = bindings.RawInvoice_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
51                 this.ptrs_to.add(b);
52                 return ret;
53         }
54
55         /**
56          * Creates a copy of the RawInvoice
57          */
58         public RawInvoice clone() {
59                 long ret = bindings.RawInvoice_clone(this.ptr);
60                 if (ret < 1024) { return null; }
61                 RawInvoice ret_hu_conv = new RawInvoice(null, ret);
62                 ret_hu_conv.ptrs_to.add(this);
63                 return ret_hu_conv;
64         }
65
66         /**
67          * Calculate the hash of the encoded `RawInvoice`
68          */
69         public byte[] hash() {
70                 byte[] ret = bindings.RawInvoice_hash(this.ptr);
71                 return ret;
72         }
73
74         /**
75          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
76          */
77         @Nullable
78         public Sha256 payment_hash() {
79                 long ret = bindings.RawInvoice_payment_hash(this.ptr);
80                 if (ret < 1024) { return null; }
81                 Sha256 ret_hu_conv = new Sha256(null, ret);
82                 ret_hu_conv.ptrs_to.add(this);
83                 return ret_hu_conv;
84         }
85
86         /**
87          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
88          */
89         @Nullable
90         public Description description() {
91                 long ret = bindings.RawInvoice_description(this.ptr);
92                 if (ret < 1024) { return null; }
93                 Description ret_hu_conv = new Description(null, ret);
94                 ret_hu_conv.ptrs_to.add(this);
95                 return ret_hu_conv;
96         }
97
98         /**
99          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
100          */
101         @Nullable
102         public PayeePubKey payee_pub_key() {
103                 long ret = bindings.RawInvoice_payee_pub_key(this.ptr);
104                 if (ret < 1024) { return null; }
105                 PayeePubKey ret_hu_conv = new PayeePubKey(null, ret);
106                 ret_hu_conv.ptrs_to.add(this);
107                 return ret_hu_conv;
108         }
109
110         /**
111          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
112          */
113         @Nullable
114         public Sha256 description_hash() {
115                 long ret = bindings.RawInvoice_description_hash(this.ptr);
116                 if (ret < 1024) { return null; }
117                 Sha256 ret_hu_conv = new Sha256(null, ret);
118                 ret_hu_conv.ptrs_to.add(this);
119                 return ret_hu_conv;
120         }
121
122         /**
123          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
124          */
125         @Nullable
126         public ExpiryTime expiry_time() {
127                 long ret = bindings.RawInvoice_expiry_time(this.ptr);
128                 if (ret < 1024) { return null; }
129                 ExpiryTime ret_hu_conv = new ExpiryTime(null, ret);
130                 ret_hu_conv.ptrs_to.add(this);
131                 return ret_hu_conv;
132         }
133
134         /**
135          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
136          */
137         @Nullable
138         public MinFinalCltvExpiry min_final_cltv_expiry() {
139                 long ret = bindings.RawInvoice_min_final_cltv_expiry(this.ptr);
140                 if (ret < 1024) { return null; }
141                 MinFinalCltvExpiry ret_hu_conv = new MinFinalCltvExpiry(null, ret);
142                 ret_hu_conv.ptrs_to.add(this);
143                 return ret_hu_conv;
144         }
145
146         /**
147          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
148          */
149         @Nullable
150         public byte[] payment_secret() {
151                 byte[] ret = bindings.RawInvoice_payment_secret(this.ptr);
152                 return ret;
153         }
154
155         /**
156          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
157          */
158         @Nullable
159         public InvoiceFeatures features() {
160                 long ret = bindings.RawInvoice_features(this.ptr);
161                 if (ret < 1024) { return null; }
162                 InvoiceFeatures ret_hu_conv = new InvoiceFeatures(null, ret);
163                 ret_hu_conv.ptrs_to.add(this);
164                 return ret_hu_conv;
165         }
166
167         /**
168          * 
169          */
170         public PrivateRoute[] private_routes() {
171                 long[] ret = bindings.RawInvoice_private_routes(this.ptr);
172                 PrivateRoute[] ret_conv_14_arr = new PrivateRoute[ret.length];
173                 for (int o = 0; o < ret.length; o++) {
174                         long ret_conv_14 = ret[o];
175                         PrivateRoute ret_conv_14_hu_conv = new PrivateRoute(null, ret_conv_14);
176                         ret_conv_14_hu_conv.ptrs_to.add(this);
177                         ret_conv_14_arr[o] = ret_conv_14_hu_conv;
178                 }
179                 return ret_conv_14_arr;
180         }
181
182         /**
183          * 
184          */
185         public Option_u64Z amount_pico_btc() {
186                 long ret = bindings.RawInvoice_amount_pico_btc(this.ptr);
187                 if (ret < 1024) { return null; }
188                 Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret);
189                 ret_hu_conv.ptrs_to.add(this);
190                 return ret_hu_conv;
191         }
192
193         /**
194          * 
195          */
196         public Currency currency() {
197                 Currency ret = bindings.RawInvoice_currency(this.ptr);
198                 return ret;
199         }
200
201 }