[Java] Update auto-generated Java bindings
[ldk-java] / src / main / java / org / ldk / structs / StaticPaymentOutputDescriptor.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 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
9
10
11 /**
12  * Information about a spendable output to our \"payment key\". See
13  * SpendableOutputDescriptor::StaticPaymentOutput for more details on how to spend this.
14  */
15 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
16 public class StaticPaymentOutputDescriptor extends CommonBase {
17         StaticPaymentOutputDescriptor(Object _dummy, long ptr) { super(ptr); }
18         @Override @SuppressWarnings("deprecation")
19         protected void finalize() throws Throwable {
20                 super.finalize();
21                 if (ptr != 0) { bindings.StaticPaymentOutputDescriptor_free(ptr); }
22         }
23
24         /**
25          * The outpoint which is spendable
26          */
27         public OutPoint get_outpoint() {
28                 long ret = bindings.StaticPaymentOutputDescriptor_get_outpoint(this.ptr);
29                 Reference.reachabilityFence(this);
30                 if (ret >= 0 && ret <= 4096) { return null; }
31                 org.ldk.structs.OutPoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OutPoint(null, ret); }
32                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
33                 return ret_hu_conv;
34         }
35
36         /**
37          * The outpoint which is spendable
38          */
39         public void set_outpoint(OutPoint val) {
40                 bindings.StaticPaymentOutputDescriptor_set_outpoint(this.ptr, val == null ? 0 : val.ptr & ~1);
41                 Reference.reachabilityFence(this);
42                 Reference.reachabilityFence(val);
43         }
44
45         /**
46          * The output which is referenced by the given outpoint
47          * 
48          * Returns a copy of the field.
49          */
50         public TxOut get_output() {
51                 long ret = bindings.StaticPaymentOutputDescriptor_get_output(this.ptr);
52                 Reference.reachabilityFence(this);
53                 if (ret >= 0 && ret <= 4096) { return null; }
54                 TxOut ret_conv = new TxOut(null, ret);
55                 return ret_conv;
56         }
57
58         /**
59          * The output which is referenced by the given outpoint
60          */
61         public void set_output(TxOut val) {
62                 bindings.StaticPaymentOutputDescriptor_set_output(this.ptr, val.ptr);
63                 Reference.reachabilityFence(this);
64                 Reference.reachabilityFence(val);
65         }
66
67         /**
68          * Arbitrary identification information returned by a call to
69          * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
70          * the channel to spend the output.
71          */
72         public byte[] get_channel_keys_id() {
73                 byte[] ret = bindings.StaticPaymentOutputDescriptor_get_channel_keys_id(this.ptr);
74                 Reference.reachabilityFence(this);
75                 return ret;
76         }
77
78         /**
79          * Arbitrary identification information returned by a call to
80          * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
81          * the channel to spend the output.
82          */
83         public void set_channel_keys_id(byte[] val) {
84                 bindings.StaticPaymentOutputDescriptor_set_channel_keys_id(this.ptr, InternalUtils.check_arr_len(val, 32));
85                 Reference.reachabilityFence(this);
86                 Reference.reachabilityFence(val);
87         }
88
89         /**
90          * The value of the channel which this transactions spends.
91          */
92         public long get_channel_value_satoshis() {
93                 long ret = bindings.StaticPaymentOutputDescriptor_get_channel_value_satoshis(this.ptr);
94                 Reference.reachabilityFence(this);
95                 return ret;
96         }
97
98         /**
99          * The value of the channel which this transactions spends.
100          */
101         public void set_channel_value_satoshis(long val) {
102                 bindings.StaticPaymentOutputDescriptor_set_channel_value_satoshis(this.ptr, val);
103                 Reference.reachabilityFence(this);
104                 Reference.reachabilityFence(val);
105         }
106
107         /**
108          * Constructs a new StaticPaymentOutputDescriptor given each field
109          */
110         public static StaticPaymentOutputDescriptor of(OutPoint outpoint_arg, TxOut output_arg, byte[] channel_keys_id_arg, long channel_value_satoshis_arg) {
111                 long ret = bindings.StaticPaymentOutputDescriptor_new(outpoint_arg == null ? 0 : outpoint_arg.ptr & ~1, output_arg.ptr, InternalUtils.check_arr_len(channel_keys_id_arg, 32), channel_value_satoshis_arg);
112                 Reference.reachabilityFence(outpoint_arg);
113                 Reference.reachabilityFence(output_arg);
114                 Reference.reachabilityFence(channel_keys_id_arg);
115                 Reference.reachabilityFence(channel_value_satoshis_arg);
116                 if (ret >= 0 && ret <= 4096) { return null; }
117                 org.ldk.structs.StaticPaymentOutputDescriptor ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.StaticPaymentOutputDescriptor(null, ret); }
118                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
119                 return ret_hu_conv;
120         }
121
122         long clone_ptr() {
123                 long ret = bindings.StaticPaymentOutputDescriptor_clone_ptr(this.ptr);
124                 Reference.reachabilityFence(this);
125                 return ret;
126         }
127
128         /**
129          * Creates a copy of the StaticPaymentOutputDescriptor
130          */
131         public StaticPaymentOutputDescriptor clone() {
132                 long ret = bindings.StaticPaymentOutputDescriptor_clone(this.ptr);
133                 Reference.reachabilityFence(this);
134                 if (ret >= 0 && ret <= 4096) { return null; }
135                 org.ldk.structs.StaticPaymentOutputDescriptor ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.StaticPaymentOutputDescriptor(null, ret); }
136                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
137                 return ret_hu_conv;
138         }
139
140         /**
141          * Serialize the StaticPaymentOutputDescriptor object into a byte array which can be read by StaticPaymentOutputDescriptor_read
142          */
143         public byte[] write() {
144                 byte[] ret = bindings.StaticPaymentOutputDescriptor_write(this.ptr);
145                 Reference.reachabilityFence(this);
146                 return ret;
147         }
148
149         /**
150          * Read a StaticPaymentOutputDescriptor from a byte array, created by StaticPaymentOutputDescriptor_write
151          */
152         public static Result_StaticPaymentOutputDescriptorDecodeErrorZ read(byte[] ser) {
153                 long ret = bindings.StaticPaymentOutputDescriptor_read(ser);
154                 Reference.reachabilityFence(ser);
155                 if (ret >= 0 && ret <= 4096) { return null; }
156                 Result_StaticPaymentOutputDescriptorDecodeErrorZ ret_hu_conv = Result_StaticPaymentOutputDescriptorDecodeErrorZ.constr_from_ptr(ret);
157                 return ret_hu_conv;
158         }
159
160 }