Update auto-generated bindings
[ldk-java] / src / main / java / org / ldk / structs / ChannelTransactionParameters.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  * Per-channel data used to build transactions in conjunction with the per-commitment data (CommitmentTransaction).
11  * The fields are organized by holder/counterparty.
12  * 
13  * Normally, this is converted to the broadcaster/countersignatory-organized DirectedChannelTransactionParameters
14  * before use, via the as_holder_broadcastable and as_counterparty_broadcastable functions.
15  */
16 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
17 public class ChannelTransactionParameters extends CommonBase {
18         ChannelTransactionParameters(Object _dummy, long ptr) { super(ptr); }
19         @Override @SuppressWarnings("deprecation")
20         protected void finalize() throws Throwable {
21                 super.finalize();
22                 if (ptr != 0) { bindings.ChannelTransactionParameters_free(ptr); }
23         }
24
25         /**
26          * Holder public keys
27          */
28         public ChannelPublicKeys get_holder_pubkeys() {
29                 long ret = bindings.ChannelTransactionParameters_get_holder_pubkeys(this.ptr);
30                 ChannelPublicKeys ret_hu_conv = new ChannelPublicKeys(null, ret);
31                 ret_hu_conv.ptrs_to.add(this);
32                 return ret_hu_conv;
33         }
34
35         /**
36          * Holder public keys
37          */
38         public void set_holder_pubkeys(ChannelPublicKeys val) {
39                 bindings.ChannelTransactionParameters_set_holder_pubkeys(this.ptr, val == null ? 0 : val.ptr & ~1);
40                 this.ptrs_to.add(val);
41         }
42
43         /**
44          * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
45          */
46         public short get_holder_selected_contest_delay() {
47                 short ret = bindings.ChannelTransactionParameters_get_holder_selected_contest_delay(this.ptr);
48                 return ret;
49         }
50
51         /**
52          * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
53          */
54         public void set_holder_selected_contest_delay(short val) {
55                 bindings.ChannelTransactionParameters_set_holder_selected_contest_delay(this.ptr, val);
56         }
57
58         /**
59          * Whether the holder is the initiator of this channel.
60          * This is an input to the commitment number obscure factor computation.
61          */
62         public boolean get_is_outbound_from_holder() {
63                 boolean ret = bindings.ChannelTransactionParameters_get_is_outbound_from_holder(this.ptr);
64                 return ret;
65         }
66
67         /**
68          * Whether the holder is the initiator of this channel.
69          * This is an input to the commitment number obscure factor computation.
70          */
71         public void set_is_outbound_from_holder(boolean val) {
72                 bindings.ChannelTransactionParameters_set_is_outbound_from_holder(this.ptr, val);
73         }
74
75         /**
76          * The late-bound counterparty channel transaction parameters.
77          * These parameters are populated at the point in the protocol where the counterparty provides them.
78          */
79         public CounterpartyChannelTransactionParameters get_counterparty_parameters() {
80                 long ret = bindings.ChannelTransactionParameters_get_counterparty_parameters(this.ptr);
81                 CounterpartyChannelTransactionParameters ret_hu_conv = new CounterpartyChannelTransactionParameters(null, ret);
82                 ret_hu_conv.ptrs_to.add(this);
83                 return ret_hu_conv;
84         }
85
86         /**
87          * The late-bound counterparty channel transaction parameters.
88          * These parameters are populated at the point in the protocol where the counterparty provides them.
89          */
90         public void set_counterparty_parameters(CounterpartyChannelTransactionParameters val) {
91                 bindings.ChannelTransactionParameters_set_counterparty_parameters(this.ptr, val == null ? 0 : val.ptr & ~1);
92                 this.ptrs_to.add(val);
93         }
94
95         /**
96          * The late-bound funding outpoint
97          */
98         public OutPoint get_funding_outpoint() {
99                 long ret = bindings.ChannelTransactionParameters_get_funding_outpoint(this.ptr);
100                 OutPoint ret_hu_conv = new OutPoint(null, ret);
101                 ret_hu_conv.ptrs_to.add(this);
102                 return ret_hu_conv;
103         }
104
105         /**
106          * The late-bound funding outpoint
107          */
108         public void set_funding_outpoint(OutPoint val) {
109                 bindings.ChannelTransactionParameters_set_funding_outpoint(this.ptr, val == null ? 0 : val.ptr & ~1);
110                 this.ptrs_to.add(val);
111         }
112
113         /**
114          * Constructs a new ChannelTransactionParameters given each field
115          */
116         public static ChannelTransactionParameters of(ChannelPublicKeys holder_pubkeys_arg, short holder_selected_contest_delay_arg, boolean is_outbound_from_holder_arg, CounterpartyChannelTransactionParameters counterparty_parameters_arg, OutPoint funding_outpoint_arg) {
117                 long ret = bindings.ChannelTransactionParameters_new(holder_pubkeys_arg == null ? 0 : holder_pubkeys_arg.ptr & ~1, holder_selected_contest_delay_arg, is_outbound_from_holder_arg, counterparty_parameters_arg == null ? 0 : counterparty_parameters_arg.ptr & ~1, funding_outpoint_arg == null ? 0 : funding_outpoint_arg.ptr & ~1);
118                 ChannelTransactionParameters ret_hu_conv = new ChannelTransactionParameters(null, ret);
119                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
120                 ret_hu_conv.ptrs_to.add(holder_pubkeys_arg);
121                 ret_hu_conv.ptrs_to.add(counterparty_parameters_arg);
122                 ret_hu_conv.ptrs_to.add(funding_outpoint_arg);
123                 return ret_hu_conv;
124         }
125
126         /**
127          * Creates a copy of the ChannelTransactionParameters
128          */
129         public ChannelTransactionParameters clone() {
130                 long ret = bindings.ChannelTransactionParameters_clone(this.ptr);
131                 ChannelTransactionParameters ret_hu_conv = new ChannelTransactionParameters(null, ret);
132                 ret_hu_conv.ptrs_to.add(this);
133                 return ret_hu_conv;
134         }
135
136         /**
137          * Whether the late bound parameters are populated.
138          */
139         public boolean is_populated() {
140                 boolean ret = bindings.ChannelTransactionParameters_is_populated(this.ptr);
141                 return ret;
142         }
143
144         /**
145          * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
146          * given that the holder is the broadcaster.
147          * 
148          * self.is_populated() must be true before calling this function.
149          */
150         public DirectedChannelTransactionParameters as_holder_broadcastable() {
151                 long ret = bindings.ChannelTransactionParameters_as_holder_broadcastable(this.ptr);
152                 DirectedChannelTransactionParameters ret_hu_conv = new DirectedChannelTransactionParameters(null, ret);
153                 ret_hu_conv.ptrs_to.add(this);
154                 return ret_hu_conv;
155         }
156
157         /**
158          * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
159          * given that the counterparty is the broadcaster.
160          * 
161          * self.is_populated() must be true before calling this function.
162          */
163         public DirectedChannelTransactionParameters as_counterparty_broadcastable() {
164                 long ret = bindings.ChannelTransactionParameters_as_counterparty_broadcastable(this.ptr);
165                 DirectedChannelTransactionParameters ret_hu_conv = new DirectedChannelTransactionParameters(null, ret);
166                 ret_hu_conv.ptrs_to.add(this);
167                 return ret_hu_conv;
168         }
169
170         /**
171          * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read
172          */
173         public byte[] write() {
174                 byte[] ret = bindings.ChannelTransactionParameters_write(this.ptr);
175                 return ret;
176         }
177
178         /**
179          * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write
180          */
181         public static Result_ChannelTransactionParametersDecodeErrorZ read(byte[] ser) {
182                 long ret = bindings.ChannelTransactionParameters_read(ser);
183                 Result_ChannelTransactionParametersDecodeErrorZ ret_hu_conv = Result_ChannelTransactionParametersDecodeErrorZ.constr_from_ptr(ret);
184                 return ret_hu_conv;
185         }
186
187 }