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                 RawDataPart ret_hu_conv = new RawDataPart(null, ret);
31                 ret_hu_conv.ptrs_to.add(this);
32                 return ret_hu_conv;
33         }
34
35         /**
36          * data part
37          */
38         public void set_data(RawDataPart val) {
39                 bindings.RawInvoice_set_data(this.ptr, val == null ? 0 : val.ptr & ~1);
40                 this.ptrs_to.add(val);
41         }
42
43         /**
44          * Checks if two RawInvoices contain equal inner contents.
45          * This ignores pointers and is_owned flags and looks at the values in fields.
46          * Two objects with NULL inner values will be considered "equal" here.
47          */
48         public boolean eq(RawInvoice b) {
49                 boolean ret = bindings.RawInvoice_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
50                 this.ptrs_to.add(b);
51                 return ret;
52         }
53
54         /**
55          * Creates a copy of the RawInvoice
56          */
57         public RawInvoice clone() {
58                 long ret = bindings.RawInvoice_clone(this.ptr);
59                 RawInvoice ret_hu_conv = new RawInvoice(null, ret);
60                 ret_hu_conv.ptrs_to.add(this);
61                 return ret_hu_conv;
62         }
63
64         /**
65          * Calculate the hash of the encoded `RawInvoice`
66          */
67         public byte[] hash() {
68                 byte[] ret = bindings.RawInvoice_hash(this.ptr);
69                 return ret;
70         }
71
72         public Sha256 payment_hash() {
73                 long ret = bindings.RawInvoice_payment_hash(this.ptr);
74                 Sha256 ret_hu_conv = new Sha256(null, ret);
75                 ret_hu_conv.ptrs_to.add(this);
76                 return ret_hu_conv;
77         }
78
79         public Description description() {
80                 long ret = bindings.RawInvoice_description(this.ptr);
81                 Description ret_hu_conv = new Description(null, ret);
82                 ret_hu_conv.ptrs_to.add(this);
83                 return ret_hu_conv;
84         }
85
86         public PayeePubKey payee_pub_key() {
87                 long ret = bindings.RawInvoice_payee_pub_key(this.ptr);
88                 PayeePubKey ret_hu_conv = new PayeePubKey(null, ret);
89                 ret_hu_conv.ptrs_to.add(this);
90                 return ret_hu_conv;
91         }
92
93         public Sha256 description_hash() {
94                 long ret = bindings.RawInvoice_description_hash(this.ptr);
95                 Sha256 ret_hu_conv = new Sha256(null, ret);
96                 ret_hu_conv.ptrs_to.add(this);
97                 return ret_hu_conv;
98         }
99
100         public ExpiryTime expiry_time() {
101                 long ret = bindings.RawInvoice_expiry_time(this.ptr);
102                 ExpiryTime ret_hu_conv = new ExpiryTime(null, ret);
103                 ret_hu_conv.ptrs_to.add(this);
104                 return ret_hu_conv;
105         }
106
107         public MinFinalCltvExpiry min_final_cltv_expiry() {
108                 long ret = bindings.RawInvoice_min_final_cltv_expiry(this.ptr);
109                 MinFinalCltvExpiry ret_hu_conv = new MinFinalCltvExpiry(null, ret);
110                 ret_hu_conv.ptrs_to.add(this);
111                 return ret_hu_conv;
112         }
113
114         public byte[] payment_secret() {
115                 byte[] ret = bindings.RawInvoice_payment_secret(this.ptr);
116                 return ret;
117         }
118
119         public InvoiceFeatures features() {
120                 long ret = bindings.RawInvoice_features(this.ptr);
121                 InvoiceFeatures ret_hu_conv = new InvoiceFeatures(null, ret);
122                 ret_hu_conv.ptrs_to.add(this);
123                 return ret_hu_conv;
124         }
125
126         public PrivateRoute[] private_routes() {
127                 long[] ret = bindings.RawInvoice_private_routes(this.ptr);
128                 PrivateRoute[] ret_conv_14_arr = new PrivateRoute[ret.length];
129                 for (int o = 0; o < ret.length; o++) {
130                         long ret_conv_14 = ret[o];
131                         PrivateRoute ret_conv_14_hu_conv = new PrivateRoute(null, ret_conv_14);
132                         ret_conv_14_hu_conv.ptrs_to.add(this);
133                         ret_conv_14_arr[o] = ret_conv_14_hu_conv;
134                 }
135                 return ret_conv_14_arr;
136         }
137
138         public Option_u64Z amount_pico_btc() {
139                 long ret = bindings.RawInvoice_amount_pico_btc(this.ptr);
140                 Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret);
141                 ret_hu_conv.ptrs_to.add(this);
142                 return ret_hu_conv;
143         }
144
145         public Currency currency() {
146                 Currency ret = bindings.RawInvoice_currency(this.ptr);
147                 return ret;
148         }
149
150 }