[Java] Update auto-generated Java bindings
[ldk-java] / src / main / java / org / ldk / structs / DelayedPaymentOutputDescriptor.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 a P2WSH script. See
13  * SpendableOutputDescriptor::DelayedPaymentOutput for more details on how to spend this.
14  */
15 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
16 public class DelayedPaymentOutputDescriptor extends CommonBase {
17         DelayedPaymentOutputDescriptor(Object _dummy, long ptr) { super(ptr); }
18         @Override @SuppressWarnings("deprecation")
19         protected void finalize() throws Throwable {
20                 super.finalize();
21                 if (ptr != 0) { bindings.DelayedPaymentOutputDescriptor_free(ptr); }
22         }
23
24         /**
25          * The outpoint which is spendable
26          */
27         public OutPoint get_outpoint() {
28                 long ret = bindings.DelayedPaymentOutputDescriptor_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                 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.DelayedPaymentOutputDescriptor_set_outpoint(this.ptr, val == null ? 0 : val.ptr);
41                 Reference.reachabilityFence(this);
42                 Reference.reachabilityFence(val);
43                 this.ptrs_to.add(val);
44         }
45
46         /**
47          * Per commitment point to derive delayed_payment_key by key holder
48          */
49         public byte[] get_per_commitment_point() {
50                 byte[] ret = bindings.DelayedPaymentOutputDescriptor_get_per_commitment_point(this.ptr);
51                 Reference.reachabilityFence(this);
52                 return ret;
53         }
54
55         /**
56          * Per commitment point to derive delayed_payment_key by key holder
57          */
58         public void set_per_commitment_point(byte[] val) {
59                 bindings.DelayedPaymentOutputDescriptor_set_per_commitment_point(this.ptr, InternalUtils.check_arr_len(val, 33));
60                 Reference.reachabilityFence(this);
61                 Reference.reachabilityFence(val);
62         }
63
64         /**
65          * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
66          * the witness_script.
67          */
68         public short get_to_self_delay() {
69                 short ret = bindings.DelayedPaymentOutputDescriptor_get_to_self_delay(this.ptr);
70                 Reference.reachabilityFence(this);
71                 return ret;
72         }
73
74         /**
75          * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
76          * the witness_script.
77          */
78         public void set_to_self_delay(short val) {
79                 bindings.DelayedPaymentOutputDescriptor_set_to_self_delay(this.ptr, val);
80                 Reference.reachabilityFence(this);
81                 Reference.reachabilityFence(val);
82         }
83
84         /**
85          * The output which is referenced by the given outpoint
86          * 
87          * Returns a copy of the field.
88          */
89         public TxOut get_output() {
90                 long ret = bindings.DelayedPaymentOutputDescriptor_get_output(this.ptr);
91                 Reference.reachabilityFence(this);
92                 if (ret >= 0 && ret <= 4096) { return null; }
93                 TxOut ret_conv = new TxOut(null, ret);
94                 return ret_conv;
95         }
96
97         /**
98          * The output which is referenced by the given outpoint
99          */
100         public void set_output(TxOut val) {
101                 bindings.DelayedPaymentOutputDescriptor_set_output(this.ptr, val.ptr);
102                 Reference.reachabilityFence(this);
103                 Reference.reachabilityFence(val);
104         }
105
106         /**
107          * The revocation point specific to the commitment transaction which was broadcast. Used to
108          * derive the witnessScript for this output.
109          */
110         public byte[] get_revocation_pubkey() {
111                 byte[] ret = bindings.DelayedPaymentOutputDescriptor_get_revocation_pubkey(this.ptr);
112                 Reference.reachabilityFence(this);
113                 return ret;
114         }
115
116         /**
117          * The revocation point specific to the commitment transaction which was broadcast. Used to
118          * derive the witnessScript for this output.
119          */
120         public void set_revocation_pubkey(byte[] val) {
121                 bindings.DelayedPaymentOutputDescriptor_set_revocation_pubkey(this.ptr, InternalUtils.check_arr_len(val, 33));
122                 Reference.reachabilityFence(this);
123                 Reference.reachabilityFence(val);
124         }
125
126         /**
127          * Arbitrary identification information returned by a call to
128          * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
129          * the channel to spend the output.
130          */
131         public byte[] get_channel_keys_id() {
132                 byte[] ret = bindings.DelayedPaymentOutputDescriptor_get_channel_keys_id(this.ptr);
133                 Reference.reachabilityFence(this);
134                 return ret;
135         }
136
137         /**
138          * Arbitrary identification information returned by a call to
139          * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
140          * the channel to spend the output.
141          */
142         public void set_channel_keys_id(byte[] val) {
143                 bindings.DelayedPaymentOutputDescriptor_set_channel_keys_id(this.ptr, InternalUtils.check_arr_len(val, 32));
144                 Reference.reachabilityFence(this);
145                 Reference.reachabilityFence(val);
146         }
147
148         /**
149          * The value of the channel which this output originated from, possibly indirectly.
150          */
151         public long get_channel_value_satoshis() {
152                 long ret = bindings.DelayedPaymentOutputDescriptor_get_channel_value_satoshis(this.ptr);
153                 Reference.reachabilityFence(this);
154                 return ret;
155         }
156
157         /**
158          * The value of the channel which this output originated from, possibly indirectly.
159          */
160         public void set_channel_value_satoshis(long val) {
161                 bindings.DelayedPaymentOutputDescriptor_set_channel_value_satoshis(this.ptr, val);
162                 Reference.reachabilityFence(this);
163                 Reference.reachabilityFence(val);
164         }
165
166         /**
167          * Constructs a new DelayedPaymentOutputDescriptor given each field
168          */
169         public static DelayedPaymentOutputDescriptor of(OutPoint outpoint_arg, byte[] per_commitment_point_arg, short to_self_delay_arg, TxOut output_arg, byte[] revocation_pubkey_arg, byte[] channel_keys_id_arg, long channel_value_satoshis_arg) {
170                 long ret = bindings.DelayedPaymentOutputDescriptor_new(outpoint_arg == null ? 0 : outpoint_arg.ptr, InternalUtils.check_arr_len(per_commitment_point_arg, 33), to_self_delay_arg, output_arg.ptr, InternalUtils.check_arr_len(revocation_pubkey_arg, 33), InternalUtils.check_arr_len(channel_keys_id_arg, 32), channel_value_satoshis_arg);
171                 Reference.reachabilityFence(outpoint_arg);
172                 Reference.reachabilityFence(per_commitment_point_arg);
173                 Reference.reachabilityFence(to_self_delay_arg);
174                 Reference.reachabilityFence(output_arg);
175                 Reference.reachabilityFence(revocation_pubkey_arg);
176                 Reference.reachabilityFence(channel_keys_id_arg);
177                 Reference.reachabilityFence(channel_value_satoshis_arg);
178                 if (ret >= 0 && ret <= 4096) { return null; }
179                 org.ldk.structs.DelayedPaymentOutputDescriptor ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.DelayedPaymentOutputDescriptor(null, ret); }
180                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
181                 ret_hu_conv.ptrs_to.add(outpoint_arg);
182                 return ret_hu_conv;
183         }
184
185         long clone_ptr() {
186                 long ret = bindings.DelayedPaymentOutputDescriptor_clone_ptr(this.ptr);
187                 Reference.reachabilityFence(this);
188                 return ret;
189         }
190
191         /**
192          * Creates a copy of the DelayedPaymentOutputDescriptor
193          */
194         public DelayedPaymentOutputDescriptor clone() {
195                 long ret = bindings.DelayedPaymentOutputDescriptor_clone(this.ptr);
196                 Reference.reachabilityFence(this);
197                 if (ret >= 0 && ret <= 4096) { return null; }
198                 org.ldk.structs.DelayedPaymentOutputDescriptor ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.DelayedPaymentOutputDescriptor(null, ret); }
199                 ret_hu_conv.ptrs_to.add(this);
200                 return ret_hu_conv;
201         }
202
203         /**
204          * Serialize the DelayedPaymentOutputDescriptor object into a byte array which can be read by DelayedPaymentOutputDescriptor_read
205          */
206         public byte[] write() {
207                 byte[] ret = bindings.DelayedPaymentOutputDescriptor_write(this.ptr);
208                 Reference.reachabilityFence(this);
209                 return ret;
210         }
211
212         /**
213          * Read a DelayedPaymentOutputDescriptor from a byte array, created by DelayedPaymentOutputDescriptor_write
214          */
215         public static Result_DelayedPaymentOutputDescriptorDecodeErrorZ read(byte[] ser) {
216                 long ret = bindings.DelayedPaymentOutputDescriptor_read(ser);
217                 Reference.reachabilityFence(ser);
218                 if (ret >= 0 && ret <= 4096) { return null; }
219                 Result_DelayedPaymentOutputDescriptorDecodeErrorZ ret_hu_conv = Result_DelayedPaymentOutputDescriptorDecodeErrorZ.constr_from_ptr(ret);
220                 return ret_hu_conv;
221         }
222
223 }