70157f071269742ac2f48a76868a072984dec179
[ldk-java] / src / main / java / org / ldk / structs / AcceptChannel.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 java.lang.ref.Reference;
8 import javax.annotation.Nullable;
9
10
11 /**
12  * An accept_channel message to be sent or received from a peer
13  */
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class AcceptChannel extends CommonBase {
16         AcceptChannel(Object _dummy, long ptr) { super(ptr); }
17         @Override @SuppressWarnings("deprecation")
18         protected void finalize() throws Throwable {
19                 super.finalize();
20                 if (ptr != 0) { bindings.AcceptChannel_free(ptr); }
21         }
22
23         /**
24          * A temporary channel ID, until the funding outpoint is announced
25          */
26         public byte[] get_temporary_channel_id() {
27                 byte[] ret = bindings.AcceptChannel_get_temporary_channel_id(this.ptr);
28                 Reference.reachabilityFence(this);
29                 return ret;
30         }
31
32         /**
33          * A temporary channel ID, until the funding outpoint is announced
34          */
35         public void set_temporary_channel_id(byte[] val) {
36                 bindings.AcceptChannel_set_temporary_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
37                 Reference.reachabilityFence(this);
38                 Reference.reachabilityFence(val);
39         }
40
41         /**
42          * The threshold below which outputs on transactions broadcast by sender will be omitted
43          */
44         public long get_dust_limit_satoshis() {
45                 long ret = bindings.AcceptChannel_get_dust_limit_satoshis(this.ptr);
46                 Reference.reachabilityFence(this);
47                 return ret;
48         }
49
50         /**
51          * The threshold below which outputs on transactions broadcast by sender will be omitted
52          */
53         public void set_dust_limit_satoshis(long val) {
54                 bindings.AcceptChannel_set_dust_limit_satoshis(this.ptr, val);
55                 Reference.reachabilityFence(this);
56                 Reference.reachabilityFence(val);
57         }
58
59         /**
60          * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
61          */
62         public long get_max_htlc_value_in_flight_msat() {
63                 long ret = bindings.AcceptChannel_get_max_htlc_value_in_flight_msat(this.ptr);
64                 Reference.reachabilityFence(this);
65                 return ret;
66         }
67
68         /**
69          * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
70          */
71         public void set_max_htlc_value_in_flight_msat(long val) {
72                 bindings.AcceptChannel_set_max_htlc_value_in_flight_msat(this.ptr, val);
73                 Reference.reachabilityFence(this);
74                 Reference.reachabilityFence(val);
75         }
76
77         /**
78          * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
79          */
80         public long get_channel_reserve_satoshis() {
81                 long ret = bindings.AcceptChannel_get_channel_reserve_satoshis(this.ptr);
82                 Reference.reachabilityFence(this);
83                 return ret;
84         }
85
86         /**
87          * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
88          */
89         public void set_channel_reserve_satoshis(long val) {
90                 bindings.AcceptChannel_set_channel_reserve_satoshis(this.ptr, val);
91                 Reference.reachabilityFence(this);
92                 Reference.reachabilityFence(val);
93         }
94
95         /**
96          * The minimum HTLC size incoming to sender, in milli-satoshi
97          */
98         public long get_htlc_minimum_msat() {
99                 long ret = bindings.AcceptChannel_get_htlc_minimum_msat(this.ptr);
100                 Reference.reachabilityFence(this);
101                 return ret;
102         }
103
104         /**
105          * The minimum HTLC size incoming to sender, in milli-satoshi
106          */
107         public void set_htlc_minimum_msat(long val) {
108                 bindings.AcceptChannel_set_htlc_minimum_msat(this.ptr, val);
109                 Reference.reachabilityFence(this);
110                 Reference.reachabilityFence(val);
111         }
112
113         /**
114          * Minimum depth of the funding transaction before the channel is considered open
115          */
116         public int get_minimum_depth() {
117                 int ret = bindings.AcceptChannel_get_minimum_depth(this.ptr);
118                 Reference.reachabilityFence(this);
119                 return ret;
120         }
121
122         /**
123          * Minimum depth of the funding transaction before the channel is considered open
124          */
125         public void set_minimum_depth(int val) {
126                 bindings.AcceptChannel_set_minimum_depth(this.ptr, val);
127                 Reference.reachabilityFence(this);
128                 Reference.reachabilityFence(val);
129         }
130
131         /**
132          * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
133          */
134         public short get_to_self_delay() {
135                 short ret = bindings.AcceptChannel_get_to_self_delay(this.ptr);
136                 Reference.reachabilityFence(this);
137                 return ret;
138         }
139
140         /**
141          * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
142          */
143         public void set_to_self_delay(short val) {
144                 bindings.AcceptChannel_set_to_self_delay(this.ptr, val);
145                 Reference.reachabilityFence(this);
146                 Reference.reachabilityFence(val);
147         }
148
149         /**
150          * The maximum number of inbound HTLCs towards sender
151          */
152         public short get_max_accepted_htlcs() {
153                 short ret = bindings.AcceptChannel_get_max_accepted_htlcs(this.ptr);
154                 Reference.reachabilityFence(this);
155                 return ret;
156         }
157
158         /**
159          * The maximum number of inbound HTLCs towards sender
160          */
161         public void set_max_accepted_htlcs(short val) {
162                 bindings.AcceptChannel_set_max_accepted_htlcs(this.ptr, val);
163                 Reference.reachabilityFence(this);
164                 Reference.reachabilityFence(val);
165         }
166
167         /**
168          * The sender's key controlling the funding transaction
169          */
170         public byte[] get_funding_pubkey() {
171                 byte[] ret = bindings.AcceptChannel_get_funding_pubkey(this.ptr);
172                 Reference.reachabilityFence(this);
173                 return ret;
174         }
175
176         /**
177          * The sender's key controlling the funding transaction
178          */
179         public void set_funding_pubkey(byte[] val) {
180                 bindings.AcceptChannel_set_funding_pubkey(this.ptr, InternalUtils.check_arr_len(val, 33));
181                 Reference.reachabilityFence(this);
182                 Reference.reachabilityFence(val);
183         }
184
185         /**
186          * Used to derive a revocation key for transactions broadcast by counterparty
187          */
188         public byte[] get_revocation_basepoint() {
189                 byte[] ret = bindings.AcceptChannel_get_revocation_basepoint(this.ptr);
190                 Reference.reachabilityFence(this);
191                 return ret;
192         }
193
194         /**
195          * Used to derive a revocation key for transactions broadcast by counterparty
196          */
197         public void set_revocation_basepoint(byte[] val) {
198                 bindings.AcceptChannel_set_revocation_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33));
199                 Reference.reachabilityFence(this);
200                 Reference.reachabilityFence(val);
201         }
202
203         /**
204          * A payment key to sender for transactions broadcast by counterparty
205          */
206         public byte[] get_payment_point() {
207                 byte[] ret = bindings.AcceptChannel_get_payment_point(this.ptr);
208                 Reference.reachabilityFence(this);
209                 return ret;
210         }
211
212         /**
213          * A payment key to sender for transactions broadcast by counterparty
214          */
215         public void set_payment_point(byte[] val) {
216                 bindings.AcceptChannel_set_payment_point(this.ptr, InternalUtils.check_arr_len(val, 33));
217                 Reference.reachabilityFence(this);
218                 Reference.reachabilityFence(val);
219         }
220
221         /**
222          * Used to derive a payment key to sender for transactions broadcast by sender
223          */
224         public byte[] get_delayed_payment_basepoint() {
225                 byte[] ret = bindings.AcceptChannel_get_delayed_payment_basepoint(this.ptr);
226                 Reference.reachabilityFence(this);
227                 return ret;
228         }
229
230         /**
231          * Used to derive a payment key to sender for transactions broadcast by sender
232          */
233         public void set_delayed_payment_basepoint(byte[] val) {
234                 bindings.AcceptChannel_set_delayed_payment_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33));
235                 Reference.reachabilityFence(this);
236                 Reference.reachabilityFence(val);
237         }
238
239         /**
240          * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
241          */
242         public byte[] get_htlc_basepoint() {
243                 byte[] ret = bindings.AcceptChannel_get_htlc_basepoint(this.ptr);
244                 Reference.reachabilityFence(this);
245                 return ret;
246         }
247
248         /**
249          * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
250          */
251         public void set_htlc_basepoint(byte[] val) {
252                 bindings.AcceptChannel_set_htlc_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33));
253                 Reference.reachabilityFence(this);
254                 Reference.reachabilityFence(val);
255         }
256
257         /**
258          * The first to-be-broadcast-by-sender transaction's per commitment point
259          */
260         public byte[] get_first_per_commitment_point() {
261                 byte[] ret = bindings.AcceptChannel_get_first_per_commitment_point(this.ptr);
262                 Reference.reachabilityFence(this);
263                 return ret;
264         }
265
266         /**
267          * The first to-be-broadcast-by-sender transaction's per commitment point
268          */
269         public void set_first_per_commitment_point(byte[] val) {
270                 bindings.AcceptChannel_set_first_per_commitment_point(this.ptr, InternalUtils.check_arr_len(val, 33));
271                 Reference.reachabilityFence(this);
272                 Reference.reachabilityFence(val);
273         }
274
275         long clone_ptr() {
276                 long ret = bindings.AcceptChannel_clone_ptr(this.ptr);
277                 Reference.reachabilityFence(this);
278                 return ret;
279         }
280
281         /**
282          * Creates a copy of the AcceptChannel
283          */
284         public AcceptChannel clone() {
285                 long ret = bindings.AcceptChannel_clone(this.ptr);
286                 Reference.reachabilityFence(this);
287                 if (ret >= 0 && ret <= 4096) { return null; }
288                 AcceptChannel ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new AcceptChannel(null, ret); }
289                 ret_hu_conv.ptrs_to.add(this);
290                 return ret_hu_conv;
291         }
292
293         /**
294          * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read
295          */
296         public byte[] write() {
297                 byte[] ret = bindings.AcceptChannel_write(this.ptr);
298                 Reference.reachabilityFence(this);
299                 return ret;
300         }
301
302         /**
303          * Read a AcceptChannel from a byte array, created by AcceptChannel_write
304          */
305         public static Result_AcceptChannelDecodeErrorZ read(byte[] ser) {
306                 long ret = bindings.AcceptChannel_read(ser);
307                 Reference.reachabilityFence(ser);
308                 if (ret >= 0 && ret <= 4096) { return null; }
309                 Result_AcceptChannelDecodeErrorZ ret_hu_conv = Result_AcceptChannelDecodeErrorZ.constr_from_ptr(ret);
310                 return ret_hu_conv;
311         }
312
313 }