Update auto-generated 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 javax.annotation.Nullable;
8
9
10 /**
11  * Information about a spendable output to a P2WSH script. See
12  * SpendableOutputDescriptor::DelayedPaymentOutput for more details on how to spend this.
13  */
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class DelayedPaymentOutputDescriptor extends CommonBase {
16         DelayedPaymentOutputDescriptor(Object _dummy, long ptr) { super(ptr); }
17         @Override @SuppressWarnings("deprecation")
18         protected void finalize() throws Throwable {
19                 super.finalize();
20                 if (ptr != 0) { bindings.DelayedPaymentOutputDescriptor_free(ptr); }
21         }
22
23         /**
24          * The outpoint which is spendable
25          */
26         public OutPoint get_outpoint() {
27                 long ret = bindings.DelayedPaymentOutputDescriptor_get_outpoint(this.ptr);
28                 if (ret >= 0 && ret <= 4096) { return null; }
29                 OutPoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new OutPoint(null, ret); }
30                 ret_hu_conv.ptrs_to.add(this);
31                 return ret_hu_conv;
32         }
33
34         /**
35          * The outpoint which is spendable
36          */
37         public void set_outpoint(OutPoint val) {
38                 bindings.DelayedPaymentOutputDescriptor_set_outpoint(this.ptr, val == null ? 0 : val.ptr & ~1);
39         }
40
41         /**
42          * Per commitment point to derive delayed_payment_key by key holder
43          */
44         public byte[] get_per_commitment_point() {
45                 byte[] ret = bindings.DelayedPaymentOutputDescriptor_get_per_commitment_point(this.ptr);
46                 return ret;
47         }
48
49         /**
50          * Per commitment point to derive delayed_payment_key by key holder
51          */
52         public void set_per_commitment_point(byte[] val) {
53                 bindings.DelayedPaymentOutputDescriptor_set_per_commitment_point(this.ptr, InternalUtils.check_arr_len(val, 33));
54         }
55
56         /**
57          * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
58          * the witness_script.
59          */
60         public short get_to_self_delay() {
61                 short ret = bindings.DelayedPaymentOutputDescriptor_get_to_self_delay(this.ptr);
62                 return ret;
63         }
64
65         /**
66          * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
67          * the witness_script.
68          */
69         public void set_to_self_delay(short val) {
70                 bindings.DelayedPaymentOutputDescriptor_set_to_self_delay(this.ptr, val);
71         }
72
73         /**
74          * The output which is referenced by the given outpoint
75          */
76         public void set_output(TxOut val) {
77                 bindings.DelayedPaymentOutputDescriptor_set_output(this.ptr, val.ptr);
78         }
79
80         /**
81          * The revocation point specific to the commitment transaction which was broadcast. Used to
82          * derive the witnessScript for this output.
83          */
84         public byte[] get_revocation_pubkey() {
85                 byte[] ret = bindings.DelayedPaymentOutputDescriptor_get_revocation_pubkey(this.ptr);
86                 return ret;
87         }
88
89         /**
90          * The revocation point specific to the commitment transaction which was broadcast. Used to
91          * derive the witnessScript for this output.
92          */
93         public void set_revocation_pubkey(byte[] val) {
94                 bindings.DelayedPaymentOutputDescriptor_set_revocation_pubkey(this.ptr, InternalUtils.check_arr_len(val, 33));
95         }
96
97         /**
98          * Arbitrary identification information returned by a call to
99          * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
100          * the channel to spend the output.
101          */
102         public byte[] get_channel_keys_id() {
103                 byte[] ret = bindings.DelayedPaymentOutputDescriptor_get_channel_keys_id(this.ptr);
104                 return ret;
105         }
106
107         /**
108          * Arbitrary identification information returned by a call to
109          * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
110          * the channel to spend the output.
111          */
112         public void set_channel_keys_id(byte[] val) {
113                 bindings.DelayedPaymentOutputDescriptor_set_channel_keys_id(this.ptr, InternalUtils.check_arr_len(val, 32));
114         }
115
116         /**
117          * The value of the channel which this output originated from, possibly indirectly.
118          */
119         public long get_channel_value_satoshis() {
120                 long ret = bindings.DelayedPaymentOutputDescriptor_get_channel_value_satoshis(this.ptr);
121                 return ret;
122         }
123
124         /**
125          * The value of the channel which this output originated from, possibly indirectly.
126          */
127         public void set_channel_value_satoshis(long val) {
128                 bindings.DelayedPaymentOutputDescriptor_set_channel_value_satoshis(this.ptr, val);
129         }
130
131         /**
132          * Constructs a new DelayedPaymentOutputDescriptor given each field
133          */
134         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) {
135                 long ret = bindings.DelayedPaymentOutputDescriptor_new(outpoint_arg == null ? 0 : outpoint_arg.ptr & ~1, 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);
136                 if (ret >= 0 && ret <= 4096) { return null; }
137                 DelayedPaymentOutputDescriptor ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new DelayedPaymentOutputDescriptor(null, ret); }
138                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
139                 return ret_hu_conv;
140         }
141
142         long clone_ptr() {
143                 long ret = bindings.DelayedPaymentOutputDescriptor_clone_ptr(this.ptr);
144                 return ret;
145         }
146
147         /**
148          * Creates a copy of the DelayedPaymentOutputDescriptor
149          */
150         public DelayedPaymentOutputDescriptor clone() {
151                 long ret = bindings.DelayedPaymentOutputDescriptor_clone(this.ptr);
152                 if (ret >= 0 && ret <= 4096) { return null; }
153                 DelayedPaymentOutputDescriptor ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new DelayedPaymentOutputDescriptor(null, ret); }
154                 ret_hu_conv.ptrs_to.add(this);
155                 return ret_hu_conv;
156         }
157
158         /**
159          * Serialize the DelayedPaymentOutputDescriptor object into a byte array which can be read by DelayedPaymentOutputDescriptor_read
160          */
161         public byte[] write() {
162                 byte[] ret = bindings.DelayedPaymentOutputDescriptor_write(this.ptr);
163                 return ret;
164         }
165
166         /**
167          * Read a DelayedPaymentOutputDescriptor from a byte array, created by DelayedPaymentOutputDescriptor_write
168          */
169         public static Result_DelayedPaymentOutputDescriptorDecodeErrorZ read(byte[] ser) {
170                 long ret = bindings.DelayedPaymentOutputDescriptor_read(ser);
171                 if (ret >= 0 && ret <= 4096) { return null; }
172                 Result_DelayedPaymentOutputDescriptorDecodeErrorZ ret_hu_conv = Result_DelayedPaymentOutputDescriptorDecodeErrorZ.constr_from_ptr(ret);
173                 return ret_hu_conv;
174         }
175
176 }