6 namespace org { namespace ldk { namespace structs {
10 * An accept_channel2 message to be sent by or received from the channel accepter.
12 * Used in V2 channel establishment
14 public class AcceptChannelV2 : CommonBase {
15 internal AcceptChannelV2(object _dummy, long ptr) : base(ptr) { }
17 if (ptr != 0) { bindings.AcceptChannelV2_free(ptr); }
21 * The same `temporary_channel_id` received from the initiator's `open_channel2` message.
23 public byte[] get_temporary_channel_id() {
24 byte[] ret = bindings.AcceptChannelV2_get_temporary_channel_id(this.ptr);
30 * The same `temporary_channel_id` received from the initiator's `open_channel2` message.
32 public void set_temporary_channel_id(byte[] val) {
33 bindings.AcceptChannelV2_set_temporary_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
39 * Part of the channel value contributed by the channel acceptor
41 public long get_funding_satoshis() {
42 long ret = bindings.AcceptChannelV2_get_funding_satoshis(this.ptr);
48 * Part of the channel value contributed by the channel acceptor
50 public void set_funding_satoshis(long val) {
51 bindings.AcceptChannelV2_set_funding_satoshis(this.ptr, val);
57 * The threshold below which outputs on transactions broadcast by the channel acceptor will be
60 public long get_dust_limit_satoshis() {
61 long ret = bindings.AcceptChannelV2_get_dust_limit_satoshis(this.ptr);
67 * The threshold below which outputs on transactions broadcast by the channel acceptor will be
70 public void set_dust_limit_satoshis(long val) {
71 bindings.AcceptChannelV2_set_dust_limit_satoshis(this.ptr, val);
77 * The maximum inbound HTLC value in flight towards channel acceptor, in milli-satoshi
79 public long get_max_htlc_value_in_flight_msat() {
80 long ret = bindings.AcceptChannelV2_get_max_htlc_value_in_flight_msat(this.ptr);
86 * The maximum inbound HTLC value in flight towards channel acceptor, in milli-satoshi
88 public void set_max_htlc_value_in_flight_msat(long val) {
89 bindings.AcceptChannelV2_set_max_htlc_value_in_flight_msat(this.ptr, val);
95 * The minimum HTLC size incoming to channel acceptor, in milli-satoshi
97 public long get_htlc_minimum_msat() {
98 long ret = bindings.AcceptChannelV2_get_htlc_minimum_msat(this.ptr);
104 * The minimum HTLC size incoming to channel acceptor, in milli-satoshi
106 public void set_htlc_minimum_msat(long val) {
107 bindings.AcceptChannelV2_set_htlc_minimum_msat(this.ptr, val);
113 * Minimum depth of the funding transaction before the channel is considered open
115 public int get_minimum_depth() {
116 int ret = bindings.AcceptChannelV2_get_minimum_depth(this.ptr);
122 * Minimum depth of the funding transaction before the channel is considered open
124 public void set_minimum_depth(int val) {
125 bindings.AcceptChannelV2_set_minimum_depth(this.ptr, val);
131 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they
132 * broadcast a commitment transaction
134 public short get_to_self_delay() {
135 short ret = bindings.AcceptChannelV2_get_to_self_delay(this.ptr);
141 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they
142 * broadcast a commitment transaction
144 public void set_to_self_delay(short val) {
145 bindings.AcceptChannelV2_set_to_self_delay(this.ptr, val);
151 * The maximum number of inbound HTLCs towards channel acceptor
153 public short get_max_accepted_htlcs() {
154 short ret = bindings.AcceptChannelV2_get_max_accepted_htlcs(this.ptr);
160 * The maximum number of inbound HTLCs towards channel acceptor
162 public void set_max_accepted_htlcs(short val) {
163 bindings.AcceptChannelV2_set_max_accepted_htlcs(this.ptr, val);
169 * The channel acceptor's key controlling the funding transaction
171 public byte[] get_funding_pubkey() {
172 byte[] ret = bindings.AcceptChannelV2_get_funding_pubkey(this.ptr);
178 * The channel acceptor's key controlling the funding transaction
180 public void set_funding_pubkey(byte[] val) {
181 bindings.AcceptChannelV2_set_funding_pubkey(this.ptr, InternalUtils.check_arr_len(val, 33));
187 * Used to derive a revocation key for transactions broadcast by counterparty
189 public byte[] get_revocation_basepoint() {
190 byte[] ret = bindings.AcceptChannelV2_get_revocation_basepoint(this.ptr);
196 * Used to derive a revocation key for transactions broadcast by counterparty
198 public void set_revocation_basepoint(byte[] val) {
199 bindings.AcceptChannelV2_set_revocation_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33));
205 * A payment key to channel acceptor for transactions broadcast by counterparty
207 public byte[] get_payment_basepoint() {
208 byte[] ret = bindings.AcceptChannelV2_get_payment_basepoint(this.ptr);
214 * A payment key to channel acceptor for transactions broadcast by counterparty
216 public void set_payment_basepoint(byte[] val) {
217 bindings.AcceptChannelV2_set_payment_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33));
223 * Used to derive a payment key to channel acceptor for transactions broadcast by channel
226 public byte[] get_delayed_payment_basepoint() {
227 byte[] ret = bindings.AcceptChannelV2_get_delayed_payment_basepoint(this.ptr);
233 * Used to derive a payment key to channel acceptor for transactions broadcast by channel
236 public void set_delayed_payment_basepoint(byte[] val) {
237 bindings.AcceptChannelV2_set_delayed_payment_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33));
243 * Used to derive an HTLC payment key to channel acceptor for transactions broadcast by counterparty
245 public byte[] get_htlc_basepoint() {
246 byte[] ret = bindings.AcceptChannelV2_get_htlc_basepoint(this.ptr);
252 * Used to derive an HTLC payment key to channel acceptor for transactions broadcast by counterparty
254 public void set_htlc_basepoint(byte[] val) {
255 bindings.AcceptChannelV2_set_htlc_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33));
261 * The first to-be-broadcast-by-channel-acceptor transaction's per commitment point
263 public byte[] get_first_per_commitment_point() {
264 byte[] ret = bindings.AcceptChannelV2_get_first_per_commitment_point(this.ptr);
270 * The first to-be-broadcast-by-channel-acceptor transaction's per commitment point
272 public void set_first_per_commitment_point(byte[] val) {
273 bindings.AcceptChannelV2_set_first_per_commitment_point(this.ptr, InternalUtils.check_arr_len(val, 33));
279 * The second to-be-broadcast-by-channel-acceptor transaction's per commitment point
281 public byte[] get_second_per_commitment_point() {
282 byte[] ret = bindings.AcceptChannelV2_get_second_per_commitment_point(this.ptr);
288 * The second to-be-broadcast-by-channel-acceptor transaction's per commitment point
290 public void set_second_per_commitment_point(byte[] val) {
291 bindings.AcceptChannelV2_set_second_per_commitment_point(this.ptr, InternalUtils.check_arr_len(val, 33));
297 * Optionally, a request to pre-set the to-channel-acceptor output's scriptPubkey for when we
298 * collaboratively close
300 public Option_ScriptZ get_shutdown_scriptpubkey() {
301 long ret = bindings.AcceptChannelV2_get_shutdown_scriptpubkey(this.ptr);
303 if (ret >= 0 && ret <= 4096) { return null; }
304 org.ldk.structs.Option_ScriptZ ret_hu_conv = org.ldk.structs.Option_ScriptZ.constr_from_ptr(ret);
305 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
310 * Optionally, a request to pre-set the to-channel-acceptor output's scriptPubkey for when we
311 * collaboratively close
313 public void set_shutdown_scriptpubkey(org.ldk.structs.Option_ScriptZ val) {
314 bindings.AcceptChannelV2_set_shutdown_scriptpubkey(this.ptr, val.ptr);
317 if (this != null) { this.ptrs_to.AddLast(val); };
321 * The channel type that this channel will represent. If none is set, we derive the channel
322 * type from the intersection of our feature bits with our counterparty's feature bits from
325 * This is required to match the equivalent field in [`OpenChannelV2::channel_type`].
327 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
329 public ChannelTypeFeatures get_channel_type() {
330 long ret = bindings.AcceptChannelV2_get_channel_type(this.ptr);
332 if (ret >= 0 && ret <= 4096) { return null; }
333 org.ldk.structs.ChannelTypeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelTypeFeatures(null, ret); }
334 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
339 * The channel type that this channel will represent. If none is set, we derive the channel
340 * type from the intersection of our feature bits with our counterparty's feature bits from
343 * This is required to match the equivalent field in [`OpenChannelV2::channel_type`].
345 * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
347 public void set_channel_type(org.ldk.structs.ChannelTypeFeatures val) {
348 bindings.AcceptChannelV2_set_channel_type(this.ptr, val == null ? 0 : val.ptr);
351 if (this != null) { this.ptrs_to.AddLast(val); };
355 * Optionally, a requirement that only confirmed inputs can be added
357 public COption_NoneZ get_require_confirmed_inputs() {
358 COption_NoneZ ret = bindings.AcceptChannelV2_get_require_confirmed_inputs(this.ptr);
364 * Optionally, a requirement that only confirmed inputs can be added
366 public void set_require_confirmed_inputs(COption_NoneZ val) {
367 bindings.AcceptChannelV2_set_require_confirmed_inputs(this.ptr, val);
373 * Constructs a new AcceptChannelV2 given each field
375 public static AcceptChannelV2 of(byte[] temporary_channel_id_arg, long funding_satoshis_arg, long dust_limit_satoshis_arg, long max_htlc_value_in_flight_msat_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_basepoint_arg, byte[] delayed_payment_basepoint_arg, byte[] htlc_basepoint_arg, byte[] first_per_commitment_point_arg, byte[] second_per_commitment_point_arg, org.ldk.structs.Option_ScriptZ shutdown_scriptpubkey_arg, org.ldk.structs.ChannelTypeFeatures channel_type_arg, COption_NoneZ require_confirmed_inputs_arg) {
376 long ret = bindings.AcceptChannelV2_new(InternalUtils.check_arr_len(temporary_channel_id_arg, 32), funding_satoshis_arg, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_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_basepoint_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), InternalUtils.check_arr_len(second_per_commitment_point_arg, 33), shutdown_scriptpubkey_arg.ptr, channel_type_arg == null ? 0 : channel_type_arg.ptr, require_confirmed_inputs_arg);
377 GC.KeepAlive(temporary_channel_id_arg);
378 GC.KeepAlive(funding_satoshis_arg);
379 GC.KeepAlive(dust_limit_satoshis_arg);
380 GC.KeepAlive(max_htlc_value_in_flight_msat_arg);
381 GC.KeepAlive(htlc_minimum_msat_arg);
382 GC.KeepAlive(minimum_depth_arg);
383 GC.KeepAlive(to_self_delay_arg);
384 GC.KeepAlive(max_accepted_htlcs_arg);
385 GC.KeepAlive(funding_pubkey_arg);
386 GC.KeepAlive(revocation_basepoint_arg);
387 GC.KeepAlive(payment_basepoint_arg);
388 GC.KeepAlive(delayed_payment_basepoint_arg);
389 GC.KeepAlive(htlc_basepoint_arg);
390 GC.KeepAlive(first_per_commitment_point_arg);
391 GC.KeepAlive(second_per_commitment_point_arg);
392 GC.KeepAlive(shutdown_scriptpubkey_arg);
393 GC.KeepAlive(channel_type_arg);
394 GC.KeepAlive(require_confirmed_inputs_arg);
395 if (ret >= 0 && ret <= 4096) { return null; }
396 org.ldk.structs.AcceptChannelV2 ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.AcceptChannelV2(null, ret); }
397 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
398 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(shutdown_scriptpubkey_arg); };
399 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_type_arg); };
403 internal long clone_ptr() {
404 long ret = bindings.AcceptChannelV2_clone_ptr(this.ptr);
410 * Creates a copy of the AcceptChannelV2
412 public AcceptChannelV2 clone() {
413 long ret = bindings.AcceptChannelV2_clone(this.ptr);
415 if (ret >= 0 && ret <= 4096) { return null; }
416 org.ldk.structs.AcceptChannelV2 ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.AcceptChannelV2(null, ret); }
417 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
422 * Checks if two AcceptChannelV2s contain equal inner contents.
423 * This ignores pointers and is_owned flags and looks at the values in fields.
424 * Two objects with NULL inner values will be considered "equal" here.
426 public bool eq(org.ldk.structs.AcceptChannelV2 b) {
427 bool ret = bindings.AcceptChannelV2_eq(this.ptr, b == null ? 0 : b.ptr);
430 if (this != null) { this.ptrs_to.AddLast(b); };
434 public override bool Equals(object o) {
435 if (!(o is AcceptChannelV2)) return false;
436 return this.eq((AcceptChannelV2)o);
439 * Serialize the AcceptChannelV2 object into a byte array which can be read by AcceptChannelV2_read
441 public byte[] write() {
442 byte[] ret = bindings.AcceptChannelV2_write(this.ptr);
448 * Read a AcceptChannelV2 from a byte array, created by AcceptChannelV2_write
450 public static Result_AcceptChannelV2DecodeErrorZ read(byte[] ser) {
451 long ret = bindings.AcceptChannelV2_read(ser);
453 if (ret >= 0 && ret <= 4096) { return null; }
454 Result_AcceptChannelV2DecodeErrorZ ret_hu_conv = Result_AcceptChannelV2DecodeErrorZ.constr_from_ptr(ret);