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