[C#] Update auto-generated files
[ldk-java] / c_sharp / src / org / ldk / structs / ChannelTransactionParameters.cs
1 using org.ldk.impl;
2 using org.ldk.enums;
3 using org.ldk.util;
4 using System;
5
6 namespace org { namespace ldk { namespace structs {
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 public class ChannelTransactionParameters : CommonBase {
17         internal ChannelTransactionParameters(object _dummy, long ptr) : base(ptr) { }
18         ~ChannelTransactionParameters() {
19                 if (ptr != 0) { bindings.ChannelTransactionParameters_free(ptr); }
20         }
21
22         /**
23          * Holder public keys
24          */
25         public ChannelPublicKeys get_holder_pubkeys() {
26                 long ret = bindings.ChannelTransactionParameters_get_holder_pubkeys(this.ptr);
27                 GC.KeepAlive(this);
28                 if (ret >= 0 && ret <= 4096) { return null; }
29                 org.ldk.structs.ChannelPublicKeys ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelPublicKeys(null, ret); }
30                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
31                 return ret_hu_conv;
32         }
33
34         /**
35          * Holder public keys
36          */
37         public void set_holder_pubkeys(org.ldk.structs.ChannelPublicKeys val) {
38                 bindings.ChannelTransactionParameters_set_holder_pubkeys(this.ptr, val == null ? 0 : val.ptr);
39                 GC.KeepAlive(this);
40                 GC.KeepAlive(val);
41                 if (this != null) { this.ptrs_to.AddLast(val); };
42         }
43
44         /**
45          * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
46          */
47         public short get_holder_selected_contest_delay() {
48                 short ret = bindings.ChannelTransactionParameters_get_holder_selected_contest_delay(this.ptr);
49                 GC.KeepAlive(this);
50                 return ret;
51         }
52
53         /**
54          * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
55          */
56         public void set_holder_selected_contest_delay(short val) {
57                 bindings.ChannelTransactionParameters_set_holder_selected_contest_delay(this.ptr, val);
58                 GC.KeepAlive(this);
59                 GC.KeepAlive(val);
60         }
61
62         /**
63          * Whether the holder is the initiator of this channel.
64          * This is an input to the commitment number obscure factor computation.
65          */
66         public bool get_is_outbound_from_holder() {
67                 bool ret = bindings.ChannelTransactionParameters_get_is_outbound_from_holder(this.ptr);
68                 GC.KeepAlive(this);
69                 return ret;
70         }
71
72         /**
73          * Whether the holder is the initiator of this channel.
74          * This is an input to the commitment number obscure factor computation.
75          */
76         public void set_is_outbound_from_holder(bool val) {
77                 bindings.ChannelTransactionParameters_set_is_outbound_from_holder(this.ptr, val);
78                 GC.KeepAlive(this);
79                 GC.KeepAlive(val);
80         }
81
82         /**
83          * The late-bound counterparty channel transaction parameters.
84          * These parameters are populated at the point in the protocol where the counterparty provides them.
85          * 
86          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
87          */
88         public CounterpartyChannelTransactionParameters get_counterparty_parameters() {
89                 long ret = bindings.ChannelTransactionParameters_get_counterparty_parameters(this.ptr);
90                 GC.KeepAlive(this);
91                 if (ret >= 0 && ret <= 4096) { return null; }
92                 org.ldk.structs.CounterpartyChannelTransactionParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.CounterpartyChannelTransactionParameters(null, ret); }
93                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
94                 return ret_hu_conv;
95         }
96
97         /**
98          * The late-bound counterparty channel transaction parameters.
99          * These parameters are populated at the point in the protocol where the counterparty provides them.
100          * 
101          * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
102          */
103         public void set_counterparty_parameters(org.ldk.structs.CounterpartyChannelTransactionParameters val) {
104                 bindings.ChannelTransactionParameters_set_counterparty_parameters(this.ptr, val == null ? 0 : val.ptr);
105                 GC.KeepAlive(this);
106                 GC.KeepAlive(val);
107                 if (this != null) { this.ptrs_to.AddLast(val); };
108         }
109
110         /**
111          * The late-bound funding outpoint
112          * 
113          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
114          */
115         public OutPoint get_funding_outpoint() {
116                 long ret = bindings.ChannelTransactionParameters_get_funding_outpoint(this.ptr);
117                 GC.KeepAlive(this);
118                 if (ret >= 0 && ret <= 4096) { return null; }
119                 org.ldk.structs.OutPoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OutPoint(null, ret); }
120                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
121                 return ret_hu_conv;
122         }
123
124         /**
125          * The late-bound funding outpoint
126          * 
127          * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
128          */
129         public void set_funding_outpoint(org.ldk.structs.OutPoint val) {
130                 bindings.ChannelTransactionParameters_set_funding_outpoint(this.ptr, val == null ? 0 : val.ptr);
131                 GC.KeepAlive(this);
132                 GC.KeepAlive(val);
133                 if (this != null) { this.ptrs_to.AddLast(val); };
134         }
135
136         /**
137          * This channel's type, as negotiated during channel open. For old objects where this field
138          * wasn't serialized, it will default to static_remote_key at deserialization.
139          */
140         public ChannelTypeFeatures get_channel_type_features() {
141                 long ret = bindings.ChannelTransactionParameters_get_channel_type_features(this.ptr);
142                 GC.KeepAlive(this);
143                 if (ret >= 0 && ret <= 4096) { return null; }
144                 org.ldk.structs.ChannelTypeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelTypeFeatures(null, ret); }
145                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
146                 return ret_hu_conv;
147         }
148
149         /**
150          * This channel's type, as negotiated during channel open. For old objects where this field
151          * wasn't serialized, it will default to static_remote_key at deserialization.
152          */
153         public void set_channel_type_features(org.ldk.structs.ChannelTypeFeatures val) {
154                 bindings.ChannelTransactionParameters_set_channel_type_features(this.ptr, val == null ? 0 : val.ptr);
155                 GC.KeepAlive(this);
156                 GC.KeepAlive(val);
157                 if (this != null) { this.ptrs_to.AddLast(val); };
158         }
159
160         /**
161          * Constructs a new ChannelTransactionParameters given each field
162          */
163         public static ChannelTransactionParameters of(org.ldk.structs.ChannelPublicKeys holder_pubkeys_arg, short holder_selected_contest_delay_arg, bool is_outbound_from_holder_arg, org.ldk.structs.CounterpartyChannelTransactionParameters counterparty_parameters_arg, org.ldk.structs.OutPoint funding_outpoint_arg, org.ldk.structs.ChannelTypeFeatures channel_type_features_arg) {
164                 long ret = bindings.ChannelTransactionParameters_new(holder_pubkeys_arg == null ? 0 : holder_pubkeys_arg.ptr, holder_selected_contest_delay_arg, is_outbound_from_holder_arg, counterparty_parameters_arg == null ? 0 : counterparty_parameters_arg.ptr, funding_outpoint_arg == null ? 0 : funding_outpoint_arg.ptr, channel_type_features_arg == null ? 0 : channel_type_features_arg.ptr);
165                 GC.KeepAlive(holder_pubkeys_arg);
166                 GC.KeepAlive(holder_selected_contest_delay_arg);
167                 GC.KeepAlive(is_outbound_from_holder_arg);
168                 GC.KeepAlive(counterparty_parameters_arg);
169                 GC.KeepAlive(funding_outpoint_arg);
170                 GC.KeepAlive(channel_type_features_arg);
171                 if (ret >= 0 && ret <= 4096) { return null; }
172                 org.ldk.structs.ChannelTransactionParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelTransactionParameters(null, ret); }
173                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
174                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(holder_pubkeys_arg); };
175                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(counterparty_parameters_arg); };
176                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(funding_outpoint_arg); };
177                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_type_features_arg); };
178                 return ret_hu_conv;
179         }
180
181         internal long clone_ptr() {
182                 long ret = bindings.ChannelTransactionParameters_clone_ptr(this.ptr);
183                 GC.KeepAlive(this);
184                 return ret;
185         }
186
187         /**
188          * Creates a copy of the ChannelTransactionParameters
189          */
190         public ChannelTransactionParameters clone() {
191                 long ret = bindings.ChannelTransactionParameters_clone(this.ptr);
192                 GC.KeepAlive(this);
193                 if (ret >= 0 && ret <= 4096) { return null; }
194                 org.ldk.structs.ChannelTransactionParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelTransactionParameters(null, ret); }
195                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
196                 return ret_hu_conv;
197         }
198
199         /**
200          * Checks if two ChannelTransactionParameterss contain equal inner contents.
201          * This ignores pointers and is_owned flags and looks at the values in fields.
202          * Two objects with NULL inner values will be considered "equal" here.
203          */
204         public bool eq(org.ldk.structs.ChannelTransactionParameters b) {
205                 bool ret = bindings.ChannelTransactionParameters_eq(this.ptr, b == null ? 0 : b.ptr);
206                 GC.KeepAlive(this);
207                 GC.KeepAlive(b);
208                 if (this != null) { this.ptrs_to.AddLast(b); };
209                 return ret;
210         }
211
212         public override bool Equals(object o) {
213                 if (!(o is ChannelTransactionParameters)) return false;
214                 return this.eq((ChannelTransactionParameters)o);
215         }
216         /**
217          * Whether the late bound parameters are populated.
218          */
219         public bool is_populated() {
220                 bool ret = bindings.ChannelTransactionParameters_is_populated(this.ptr);
221                 GC.KeepAlive(this);
222                 return ret;
223         }
224
225         /**
226          * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
227          * given that the holder is the broadcaster.
228          * 
229          * self.is_populated() must be true before calling this function.
230          */
231         public DirectedChannelTransactionParameters as_holder_broadcastable() {
232                 long ret = bindings.ChannelTransactionParameters_as_holder_broadcastable(this.ptr);
233                 GC.KeepAlive(this);
234                 if (ret >= 0 && ret <= 4096) { return null; }
235                 org.ldk.structs.DirectedChannelTransactionParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.DirectedChannelTransactionParameters(null, ret); }
236                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
237                 return ret_hu_conv;
238         }
239
240         /**
241          * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
242          * given that the counterparty is the broadcaster.
243          * 
244          * self.is_populated() must be true before calling this function.
245          */
246         public DirectedChannelTransactionParameters as_counterparty_broadcastable() {
247                 long ret = bindings.ChannelTransactionParameters_as_counterparty_broadcastable(this.ptr);
248                 GC.KeepAlive(this);
249                 if (ret >= 0 && ret <= 4096) { return null; }
250                 org.ldk.structs.DirectedChannelTransactionParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.DirectedChannelTransactionParameters(null, ret); }
251                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
252                 return ret_hu_conv;
253         }
254
255         /**
256          * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read
257          */
258         public byte[] write() {
259                 byte[] ret = bindings.ChannelTransactionParameters_write(this.ptr);
260                 GC.KeepAlive(this);
261                 return ret;
262         }
263
264         /**
265          * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write
266          */
267         public static Result_ChannelTransactionParametersDecodeErrorZ read(byte[] ser) {
268                 long ret = bindings.ChannelTransactionParameters_read(ser);
269                 GC.KeepAlive(ser);
270                 if (ret >= 0 && ret <= 4096) { return null; }
271                 Result_ChannelTransactionParametersDecodeErrorZ ret_hu_conv = Result_ChannelTransactionParametersDecodeErrorZ.constr_from_ptr(ret);
272                 return ret_hu_conv;
273         }
274
275 }
276 } } }