[C#] Update auto-generated files
[ldk-java] / c_sharp / src / org / ldk / structs / AcceptChannel.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  * An [`accept_channel`] message to be sent to or received from a peer.
11  * 
12  * Used in V1 channel establishment
13  * 
14  * [`accept_channel`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-accept_channel-message
15  */
16 public class AcceptChannel : CommonBase {
17         internal AcceptChannel(object _dummy, long ptr) : base(ptr) { }
18         ~AcceptChannel() {
19                 if (ptr != 0) { bindings.AcceptChannel_free(ptr); }
20         }
21
22         /**
23          * A temporary channel ID, until the funding outpoint is announced
24          */
25         public byte[] get_temporary_channel_id() {
26                 byte[] ret = bindings.AcceptChannel_get_temporary_channel_id(this.ptr);
27                 GC.KeepAlive(this);
28                 return ret;
29         }
30
31         /**
32          * A temporary channel ID, until the funding outpoint is announced
33          */
34         public void set_temporary_channel_id(byte[] val) {
35                 bindings.AcceptChannel_set_temporary_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
36                 GC.KeepAlive(this);
37                 GC.KeepAlive(val);
38         }
39
40         /**
41          * The threshold below which outputs on transactions broadcast by sender will be omitted
42          */
43         public long get_dust_limit_satoshis() {
44                 long ret = bindings.AcceptChannel_get_dust_limit_satoshis(this.ptr);
45                 GC.KeepAlive(this);
46                 return ret;
47         }
48
49         /**
50          * The threshold below which outputs on transactions broadcast by sender will be omitted
51          */
52         public void set_dust_limit_satoshis(long val) {
53                 bindings.AcceptChannel_set_dust_limit_satoshis(this.ptr, val);
54                 GC.KeepAlive(this);
55                 GC.KeepAlive(val);
56         }
57
58         /**
59          * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
60          */
61         public long get_max_htlc_value_in_flight_msat() {
62                 long ret = bindings.AcceptChannel_get_max_htlc_value_in_flight_msat(this.ptr);
63                 GC.KeepAlive(this);
64                 return ret;
65         }
66
67         /**
68          * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
69          */
70         public void set_max_htlc_value_in_flight_msat(long val) {
71                 bindings.AcceptChannel_set_max_htlc_value_in_flight_msat(this.ptr, val);
72                 GC.KeepAlive(this);
73                 GC.KeepAlive(val);
74         }
75
76         /**
77          * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
78          */
79         public long get_channel_reserve_satoshis() {
80                 long ret = bindings.AcceptChannel_get_channel_reserve_satoshis(this.ptr);
81                 GC.KeepAlive(this);
82                 return ret;
83         }
84
85         /**
86          * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
87          */
88         public void set_channel_reserve_satoshis(long val) {
89                 bindings.AcceptChannel_set_channel_reserve_satoshis(this.ptr, val);
90                 GC.KeepAlive(this);
91                 GC.KeepAlive(val);
92         }
93
94         /**
95          * The minimum HTLC size incoming to sender, in milli-satoshi
96          */
97         public long get_htlc_minimum_msat() {
98                 long ret = bindings.AcceptChannel_get_htlc_minimum_msat(this.ptr);
99                 GC.KeepAlive(this);
100                 return ret;
101         }
102
103         /**
104          * The minimum HTLC size incoming to sender, in milli-satoshi
105          */
106         public void set_htlc_minimum_msat(long val) {
107                 bindings.AcceptChannel_set_htlc_minimum_msat(this.ptr, val);
108                 GC.KeepAlive(this);
109                 GC.KeepAlive(val);
110         }
111
112         /**
113          * Minimum depth of the funding transaction before the channel is considered open
114          */
115         public int get_minimum_depth() {
116                 int ret = bindings.AcceptChannel_get_minimum_depth(this.ptr);
117                 GC.KeepAlive(this);
118                 return ret;
119         }
120
121         /**
122          * Minimum depth of the funding transaction before the channel is considered open
123          */
124         public void set_minimum_depth(int val) {
125                 bindings.AcceptChannel_set_minimum_depth(this.ptr, val);
126                 GC.KeepAlive(this);
127                 GC.KeepAlive(val);
128         }
129
130         /**
131          * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
132          */
133         public short get_to_self_delay() {
134                 short ret = bindings.AcceptChannel_get_to_self_delay(this.ptr);
135                 GC.KeepAlive(this);
136                 return ret;
137         }
138
139         /**
140          * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
141          */
142         public void set_to_self_delay(short val) {
143                 bindings.AcceptChannel_set_to_self_delay(this.ptr, val);
144                 GC.KeepAlive(this);
145                 GC.KeepAlive(val);
146         }
147
148         /**
149          * The maximum number of inbound HTLCs towards sender
150          */
151         public short get_max_accepted_htlcs() {
152                 short ret = bindings.AcceptChannel_get_max_accepted_htlcs(this.ptr);
153                 GC.KeepAlive(this);
154                 return ret;
155         }
156
157         /**
158          * The maximum number of inbound HTLCs towards sender
159          */
160         public void set_max_accepted_htlcs(short val) {
161                 bindings.AcceptChannel_set_max_accepted_htlcs(this.ptr, val);
162                 GC.KeepAlive(this);
163                 GC.KeepAlive(val);
164         }
165
166         /**
167          * The sender's key controlling the funding transaction
168          */
169         public byte[] get_funding_pubkey() {
170                 byte[] ret = bindings.AcceptChannel_get_funding_pubkey(this.ptr);
171                 GC.KeepAlive(this);
172                 return ret;
173         }
174
175         /**
176          * The sender's key controlling the funding transaction
177          */
178         public void set_funding_pubkey(byte[] val) {
179                 bindings.AcceptChannel_set_funding_pubkey(this.ptr, InternalUtils.check_arr_len(val, 33));
180                 GC.KeepAlive(this);
181                 GC.KeepAlive(val);
182         }
183
184         /**
185          * Used to derive a revocation key for transactions broadcast by counterparty
186          */
187         public byte[] get_revocation_basepoint() {
188                 byte[] ret = bindings.AcceptChannel_get_revocation_basepoint(this.ptr);
189                 GC.KeepAlive(this);
190                 return ret;
191         }
192
193         /**
194          * Used to derive a revocation key for transactions broadcast by counterparty
195          */
196         public void set_revocation_basepoint(byte[] val) {
197                 bindings.AcceptChannel_set_revocation_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33));
198                 GC.KeepAlive(this);
199                 GC.KeepAlive(val);
200         }
201
202         /**
203          * A payment key to sender for transactions broadcast by counterparty
204          */
205         public byte[] get_payment_point() {
206                 byte[] ret = bindings.AcceptChannel_get_payment_point(this.ptr);
207                 GC.KeepAlive(this);
208                 return ret;
209         }
210
211         /**
212          * A payment key to sender for transactions broadcast by counterparty
213          */
214         public void set_payment_point(byte[] val) {
215                 bindings.AcceptChannel_set_payment_point(this.ptr, InternalUtils.check_arr_len(val, 33));
216                 GC.KeepAlive(this);
217                 GC.KeepAlive(val);
218         }
219
220         /**
221          * Used to derive a payment key to sender for transactions broadcast by sender
222          */
223         public byte[] get_delayed_payment_basepoint() {
224                 byte[] ret = bindings.AcceptChannel_get_delayed_payment_basepoint(this.ptr);
225                 GC.KeepAlive(this);
226                 return ret;
227         }
228
229         /**
230          * Used to derive a payment key to sender for transactions broadcast by sender
231          */
232         public void set_delayed_payment_basepoint(byte[] val) {
233                 bindings.AcceptChannel_set_delayed_payment_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33));
234                 GC.KeepAlive(this);
235                 GC.KeepAlive(val);
236         }
237
238         /**
239          * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
240          */
241         public byte[] get_htlc_basepoint() {
242                 byte[] ret = bindings.AcceptChannel_get_htlc_basepoint(this.ptr);
243                 GC.KeepAlive(this);
244                 return ret;
245         }
246
247         /**
248          * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
249          */
250         public void set_htlc_basepoint(byte[] val) {
251                 bindings.AcceptChannel_set_htlc_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33));
252                 GC.KeepAlive(this);
253                 GC.KeepAlive(val);
254         }
255
256         /**
257          * The first to-be-broadcast-by-sender transaction's per commitment point
258          */
259         public byte[] get_first_per_commitment_point() {
260                 byte[] ret = bindings.AcceptChannel_get_first_per_commitment_point(this.ptr);
261                 GC.KeepAlive(this);
262                 return ret;
263         }
264
265         /**
266          * The first to-be-broadcast-by-sender transaction's per commitment point
267          */
268         public void set_first_per_commitment_point(byte[] val) {
269                 bindings.AcceptChannel_set_first_per_commitment_point(this.ptr, InternalUtils.check_arr_len(val, 33));
270                 GC.KeepAlive(this);
271                 GC.KeepAlive(val);
272         }
273
274         /**
275          * A request to pre-set the to-sender output's scriptPubkey for when we collaboratively close
276          */
277         public Option_ScriptZ get_shutdown_scriptpubkey() {
278                 long ret = bindings.AcceptChannel_get_shutdown_scriptpubkey(this.ptr);
279                 GC.KeepAlive(this);
280                 if (ret >= 0 && ret <= 4096) { return null; }
281                 org.ldk.structs.Option_ScriptZ ret_hu_conv = org.ldk.structs.Option_ScriptZ.constr_from_ptr(ret);
282                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
283                 return ret_hu_conv;
284         }
285
286         /**
287          * A request to pre-set the to-sender output's scriptPubkey for when we collaboratively close
288          */
289         public void set_shutdown_scriptpubkey(org.ldk.structs.Option_ScriptZ val) {
290                 bindings.AcceptChannel_set_shutdown_scriptpubkey(this.ptr, val.ptr);
291                 GC.KeepAlive(this);
292                 GC.KeepAlive(val);
293                 if (this != null) { this.ptrs_to.AddLast(val); };
294         }
295
296         /**
297          * The channel type that this channel will represent.
298          * 
299          * If this is `None`, we derive the channel type from the intersection of
300          * our feature bits with our counterparty's feature bits from the [`Init`] message.
301          * This is required to match the equivalent field in [`OpenChannel::channel_type`].
302          * 
303          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
304          */
305         public ChannelTypeFeatures get_channel_type() {
306                 long ret = bindings.AcceptChannel_get_channel_type(this.ptr);
307                 GC.KeepAlive(this);
308                 if (ret >= 0 && ret <= 4096) { return null; }
309                 org.ldk.structs.ChannelTypeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelTypeFeatures(null, ret); }
310                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
311                 return ret_hu_conv;
312         }
313
314         /**
315          * The channel type that this channel will represent.
316          * 
317          * If this is `None`, we derive the channel type from the intersection of
318          * our feature bits with our counterparty's feature bits from the [`Init`] message.
319          * This is required to match the equivalent field in [`OpenChannel::channel_type`].
320          * 
321          * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
322          */
323         public void set_channel_type(org.ldk.structs.ChannelTypeFeatures val) {
324                 bindings.AcceptChannel_set_channel_type(this.ptr, val == null ? 0 : val.ptr);
325                 GC.KeepAlive(this);
326                 GC.KeepAlive(val);
327                 if (this != null) { this.ptrs_to.AddLast(val); };
328         }
329
330         /**
331          * Constructs a new AcceptChannel given each field
332          */
333         public static AcceptChannel of(byte[] temporary_channel_id_arg, long dust_limit_satoshis_arg, long max_htlc_value_in_flight_msat_arg, long channel_reserve_satoshis_arg, long htlc_minimum_msat_arg, int minimum_depth_arg, short to_self_delay_arg, short max_accepted_htlcs_arg, byte[] funding_pubkey_arg, byte[] revocation_basepoint_arg, byte[] payment_point_arg, byte[] delayed_payment_basepoint_arg, byte[] htlc_basepoint_arg, byte[] first_per_commitment_point_arg, org.ldk.structs.Option_ScriptZ shutdown_scriptpubkey_arg, org.ldk.structs.ChannelTypeFeatures channel_type_arg) {
334                 long ret = bindings.AcceptChannel_new(InternalUtils.check_arr_len(temporary_channel_id_arg, 32), dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, channel_reserve_satoshis_arg, htlc_minimum_msat_arg, minimum_depth_arg, to_self_delay_arg, max_accepted_htlcs_arg, InternalUtils.check_arr_len(funding_pubkey_arg, 33), InternalUtils.check_arr_len(revocation_basepoint_arg, 33), InternalUtils.check_arr_len(payment_point_arg, 33), InternalUtils.check_arr_len(delayed_payment_basepoint_arg, 33), InternalUtils.check_arr_len(htlc_basepoint_arg, 33), InternalUtils.check_arr_len(first_per_commitment_point_arg, 33), shutdown_scriptpubkey_arg.ptr, channel_type_arg == null ? 0 : channel_type_arg.ptr);
335                 GC.KeepAlive(temporary_channel_id_arg);
336                 GC.KeepAlive(dust_limit_satoshis_arg);
337                 GC.KeepAlive(max_htlc_value_in_flight_msat_arg);
338                 GC.KeepAlive(channel_reserve_satoshis_arg);
339                 GC.KeepAlive(htlc_minimum_msat_arg);
340                 GC.KeepAlive(minimum_depth_arg);
341                 GC.KeepAlive(to_self_delay_arg);
342                 GC.KeepAlive(max_accepted_htlcs_arg);
343                 GC.KeepAlive(funding_pubkey_arg);
344                 GC.KeepAlive(revocation_basepoint_arg);
345                 GC.KeepAlive(payment_point_arg);
346                 GC.KeepAlive(delayed_payment_basepoint_arg);
347                 GC.KeepAlive(htlc_basepoint_arg);
348                 GC.KeepAlive(first_per_commitment_point_arg);
349                 GC.KeepAlive(shutdown_scriptpubkey_arg);
350                 GC.KeepAlive(channel_type_arg);
351                 if (ret >= 0 && ret <= 4096) { return null; }
352                 org.ldk.structs.AcceptChannel ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.AcceptChannel(null, ret); }
353                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
354                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(shutdown_scriptpubkey_arg); };
355                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_type_arg); };
356                 return ret_hu_conv;
357         }
358
359         internal long clone_ptr() {
360                 long ret = bindings.AcceptChannel_clone_ptr(this.ptr);
361                 GC.KeepAlive(this);
362                 return ret;
363         }
364
365         /**
366          * Creates a copy of the AcceptChannel
367          */
368         public AcceptChannel clone() {
369                 long ret = bindings.AcceptChannel_clone(this.ptr);
370                 GC.KeepAlive(this);
371                 if (ret >= 0 && ret <= 4096) { return null; }
372                 org.ldk.structs.AcceptChannel ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.AcceptChannel(null, ret); }
373                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
374                 return ret_hu_conv;
375         }
376
377         /**
378          * Checks if two AcceptChannels contain equal inner contents.
379          * This ignores pointers and is_owned flags and looks at the values in fields.
380          * Two objects with NULL inner values will be considered "equal" here.
381          */
382         public bool eq(org.ldk.structs.AcceptChannel b) {
383                 bool ret = bindings.AcceptChannel_eq(this.ptr, b == null ? 0 : b.ptr);
384                 GC.KeepAlive(this);
385                 GC.KeepAlive(b);
386                 if (this != null) { this.ptrs_to.AddLast(b); };
387                 return ret;
388         }
389
390         public override bool Equals(object o) {
391                 if (!(o is AcceptChannel)) return false;
392                 return this.eq((AcceptChannel)o);
393         }
394         /**
395          * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read
396          */
397         public byte[] write() {
398                 byte[] ret = bindings.AcceptChannel_write(this.ptr);
399                 GC.KeepAlive(this);
400                 return ret;
401         }
402
403         /**
404          * Read a AcceptChannel from a byte array, created by AcceptChannel_write
405          */
406         public static Result_AcceptChannelDecodeErrorZ read(byte[] ser) {
407                 long ret = bindings.AcceptChannel_read(ser);
408                 GC.KeepAlive(ser);
409                 if (ret >= 0 && ret <= 4096) { return null; }
410                 Result_AcceptChannelDecodeErrorZ ret_hu_conv = Result_AcceptChannelDecodeErrorZ.constr_from_ptr(ret);
411                 return ret_hu_conv;
412         }
413
414 }
415 } } }