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 long ret = bindings.AcceptChannelV2_get_temporary_channel_id(this.ptr);
26 if (ret >= 0 && ret <= 4096) { return null; }
27 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
32 * The same `temporary_channel_id` received from the initiator's `open_channel2` message.
34 public void set_temporary_channel_id(byte[] val) {
35 bindings.AcceptChannelV2_set_temporary_channel_id(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
41 * Part of the channel value contributed by the channel acceptor
43 public long get_funding_satoshis() {
44 long ret = bindings.AcceptChannelV2_get_funding_satoshis(this.ptr);
50 * Part of the channel value contributed by the channel acceptor
52 public void set_funding_satoshis(long val) {
53 bindings.AcceptChannelV2_set_funding_satoshis(this.ptr, val);
59 * The threshold below which outputs on transactions broadcast by the channel acceptor will be
62 public long get_dust_limit_satoshis() {
63 long ret = bindings.AcceptChannelV2_get_dust_limit_satoshis(this.ptr);
69 * The threshold below which outputs on transactions broadcast by the channel acceptor will be
72 public void set_dust_limit_satoshis(long val) {
73 bindings.AcceptChannelV2_set_dust_limit_satoshis(this.ptr, val);
79 * The maximum inbound HTLC value in flight towards channel acceptor, in milli-satoshi
81 public long get_max_htlc_value_in_flight_msat() {
82 long ret = bindings.AcceptChannelV2_get_max_htlc_value_in_flight_msat(this.ptr);
88 * The maximum inbound HTLC value in flight towards channel acceptor, in milli-satoshi
90 public void set_max_htlc_value_in_flight_msat(long val) {
91 bindings.AcceptChannelV2_set_max_htlc_value_in_flight_msat(this.ptr, val);
97 * The minimum HTLC size incoming to channel acceptor, in milli-satoshi
99 public long get_htlc_minimum_msat() {
100 long ret = bindings.AcceptChannelV2_get_htlc_minimum_msat(this.ptr);
106 * The minimum HTLC size incoming to channel acceptor, in milli-satoshi
108 public void set_htlc_minimum_msat(long val) {
109 bindings.AcceptChannelV2_set_htlc_minimum_msat(this.ptr, val);
115 * Minimum depth of the funding transaction before the channel is considered open
117 public int get_minimum_depth() {
118 int ret = bindings.AcceptChannelV2_get_minimum_depth(this.ptr);
124 * Minimum depth of the funding transaction before the channel is considered open
126 public void set_minimum_depth(int val) {
127 bindings.AcceptChannelV2_set_minimum_depth(this.ptr, val);
133 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they
134 * broadcast a commitment transaction
136 public short get_to_self_delay() {
137 short ret = bindings.AcceptChannelV2_get_to_self_delay(this.ptr);
143 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they
144 * broadcast a commitment transaction
146 public void set_to_self_delay(short val) {
147 bindings.AcceptChannelV2_set_to_self_delay(this.ptr, val);
153 * The maximum number of inbound HTLCs towards channel acceptor
155 public short get_max_accepted_htlcs() {
156 short ret = bindings.AcceptChannelV2_get_max_accepted_htlcs(this.ptr);
162 * The maximum number of inbound HTLCs towards channel acceptor
164 public void set_max_accepted_htlcs(short val) {
165 bindings.AcceptChannelV2_set_max_accepted_htlcs(this.ptr, val);
171 * The channel acceptor's key controlling the funding transaction
173 public byte[] get_funding_pubkey() {
174 long ret = bindings.AcceptChannelV2_get_funding_pubkey(this.ptr);
176 if (ret >= 0 && ret <= 4096) { return null; }
177 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
182 * The channel acceptor's key controlling the funding transaction
184 public void set_funding_pubkey(byte[] val) {
185 bindings.AcceptChannelV2_set_funding_pubkey(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
191 * Used to derive a revocation key for transactions broadcast by counterparty
193 public byte[] get_revocation_basepoint() {
194 long ret = bindings.AcceptChannelV2_get_revocation_basepoint(this.ptr);
196 if (ret >= 0 && ret <= 4096) { return null; }
197 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
202 * Used to derive a revocation key for transactions broadcast by counterparty
204 public void set_revocation_basepoint(byte[] val) {
205 bindings.AcceptChannelV2_set_revocation_basepoint(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
211 * A payment key to channel acceptor for transactions broadcast by counterparty
213 public byte[] get_payment_basepoint() {
214 long ret = bindings.AcceptChannelV2_get_payment_basepoint(this.ptr);
216 if (ret >= 0 && ret <= 4096) { return null; }
217 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
222 * A payment key to channel acceptor for transactions broadcast by counterparty
224 public void set_payment_basepoint(byte[] val) {
225 bindings.AcceptChannelV2_set_payment_basepoint(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
231 * Used to derive a payment key to channel acceptor for transactions broadcast by channel
234 public byte[] get_delayed_payment_basepoint() {
235 long ret = bindings.AcceptChannelV2_get_delayed_payment_basepoint(this.ptr);
237 if (ret >= 0 && ret <= 4096) { return null; }
238 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
243 * Used to derive a payment key to channel acceptor for transactions broadcast by channel
246 public void set_delayed_payment_basepoint(byte[] val) {
247 bindings.AcceptChannelV2_set_delayed_payment_basepoint(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
253 * Used to derive an HTLC payment key to channel acceptor for transactions broadcast by counterparty
255 public byte[] get_htlc_basepoint() {
256 long ret = bindings.AcceptChannelV2_get_htlc_basepoint(this.ptr);
258 if (ret >= 0 && ret <= 4096) { return null; }
259 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
264 * Used to derive an HTLC payment key to channel acceptor for transactions broadcast by counterparty
266 public void set_htlc_basepoint(byte[] val) {
267 bindings.AcceptChannelV2_set_htlc_basepoint(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
273 * The first to-be-broadcast-by-channel-acceptor transaction's per commitment point
275 public byte[] get_first_per_commitment_point() {
276 long ret = bindings.AcceptChannelV2_get_first_per_commitment_point(this.ptr);
278 if (ret >= 0 && ret <= 4096) { return null; }
279 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
284 * The first to-be-broadcast-by-channel-acceptor transaction's per commitment point
286 public void set_first_per_commitment_point(byte[] val) {
287 bindings.AcceptChannelV2_set_first_per_commitment_point(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
293 * The second to-be-broadcast-by-channel-acceptor transaction's per commitment point
295 public byte[] get_second_per_commitment_point() {
296 long ret = bindings.AcceptChannelV2_get_second_per_commitment_point(this.ptr);
298 if (ret >= 0 && ret <= 4096) { return null; }
299 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
304 * The second to-be-broadcast-by-channel-acceptor transaction's per commitment point
306 public void set_second_per_commitment_point(byte[] val) {
307 bindings.AcceptChannelV2_set_second_per_commitment_point(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
313 * Optionally, a request to pre-set the to-channel-acceptor output's scriptPubkey for when we
314 * collaboratively close
316 public Option_CVec_u8ZZ get_shutdown_scriptpubkey() {
317 long ret = bindings.AcceptChannelV2_get_shutdown_scriptpubkey(this.ptr);
319 if (ret >= 0 && ret <= 4096) { return null; }
320 org.ldk.structs.Option_CVec_u8ZZ ret_hu_conv = org.ldk.structs.Option_CVec_u8ZZ.constr_from_ptr(ret);
321 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
326 * Optionally, a request to pre-set the to-channel-acceptor output's scriptPubkey for when we
327 * collaboratively close
329 public void set_shutdown_scriptpubkey(org.ldk.structs.Option_CVec_u8ZZ val) {
330 bindings.AcceptChannelV2_set_shutdown_scriptpubkey(this.ptr, val.ptr);
333 if (this != null) { this.ptrs_to.AddLast(val); };
337 * The channel type that this channel will represent. If none is set, we derive the channel
338 * type from the intersection of our feature bits with our counterparty's feature bits from
341 * This is required to match the equivalent field in [`OpenChannelV2::channel_type`].
343 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
345 public ChannelTypeFeatures get_channel_type() {
346 long ret = bindings.AcceptChannelV2_get_channel_type(this.ptr);
348 if (ret >= 0 && ret <= 4096) { return null; }
349 org.ldk.structs.ChannelTypeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelTypeFeatures(null, ret); }
350 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
355 * The channel type that this channel will represent. If none is set, we derive the channel
356 * type from the intersection of our feature bits with our counterparty's feature bits from
359 * This is required to match the equivalent field in [`OpenChannelV2::channel_type`].
361 * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
363 public void set_channel_type(org.ldk.structs.ChannelTypeFeatures val) {
364 bindings.AcceptChannelV2_set_channel_type(this.ptr, val == null ? 0 : val.ptr);
367 if (this != null) { this.ptrs_to.AddLast(val); };
371 * Optionally, a requirement that only confirmed inputs can be added
373 public COption_NoneZ get_require_confirmed_inputs() {
374 COption_NoneZ ret = bindings.AcceptChannelV2_get_require_confirmed_inputs(this.ptr);
380 * Optionally, a requirement that only confirmed inputs can be added
382 public void set_require_confirmed_inputs(COption_NoneZ val) {
383 bindings.AcceptChannelV2_set_require_confirmed_inputs(this.ptr, val);
389 * Constructs a new AcceptChannelV2 given each field
391 * Note that channel_type_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
393 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_CVec_u8ZZ shutdown_scriptpubkey_arg, org.ldk.structs.ChannelTypeFeatures channel_type_arg, COption_NoneZ require_confirmed_inputs_arg) {
394 long ret = bindings.AcceptChannelV2_new(InternalUtils.encodeUint8Array(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.encodeUint8Array(InternalUtils.check_arr_len(funding_pubkey_arg, 33)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(revocation_basepoint_arg, 33)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payment_basepoint_arg, 33)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(delayed_payment_basepoint_arg, 33)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(htlc_basepoint_arg, 33)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(first_per_commitment_point_arg, 33)), InternalUtils.encodeUint8Array(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);
395 GC.KeepAlive(temporary_channel_id_arg);
396 GC.KeepAlive(funding_satoshis_arg);
397 GC.KeepAlive(dust_limit_satoshis_arg);
398 GC.KeepAlive(max_htlc_value_in_flight_msat_arg);
399 GC.KeepAlive(htlc_minimum_msat_arg);
400 GC.KeepAlive(minimum_depth_arg);
401 GC.KeepAlive(to_self_delay_arg);
402 GC.KeepAlive(max_accepted_htlcs_arg);
403 GC.KeepAlive(funding_pubkey_arg);
404 GC.KeepAlive(revocation_basepoint_arg);
405 GC.KeepAlive(payment_basepoint_arg);
406 GC.KeepAlive(delayed_payment_basepoint_arg);
407 GC.KeepAlive(htlc_basepoint_arg);
408 GC.KeepAlive(first_per_commitment_point_arg);
409 GC.KeepAlive(second_per_commitment_point_arg);
410 GC.KeepAlive(shutdown_scriptpubkey_arg);
411 GC.KeepAlive(channel_type_arg);
412 GC.KeepAlive(require_confirmed_inputs_arg);
413 if (ret >= 0 && ret <= 4096) { return null; }
414 org.ldk.structs.AcceptChannelV2 ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.AcceptChannelV2(null, ret); }
415 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
416 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(shutdown_scriptpubkey_arg); };
417 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_type_arg); };
421 internal long clone_ptr() {
422 long ret = bindings.AcceptChannelV2_clone_ptr(this.ptr);
428 * Creates a copy of the AcceptChannelV2
430 public AcceptChannelV2 clone() {
431 long ret = bindings.AcceptChannelV2_clone(this.ptr);
433 if (ret >= 0 && ret <= 4096) { return null; }
434 org.ldk.structs.AcceptChannelV2 ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.AcceptChannelV2(null, ret); }
435 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
440 * Checks if two AcceptChannelV2s contain equal inner contents.
441 * This ignores pointers and is_owned flags and looks at the values in fields.
442 * Two objects with NULL inner values will be considered "equal" here.
444 public bool eq(org.ldk.structs.AcceptChannelV2 b) {
445 bool ret = bindings.AcceptChannelV2_eq(this.ptr, b == null ? 0 : b.ptr);
448 if (this != null) { this.ptrs_to.AddLast(b); };
452 public override bool Equals(object o) {
453 if (!(o is AcceptChannelV2)) return false;
454 return this.eq((AcceptChannelV2)o);
457 * Serialize the AcceptChannelV2 object into a byte array which can be read by AcceptChannelV2_read
459 public byte[] write() {
460 long ret = bindings.AcceptChannelV2_write(this.ptr);
462 if (ret >= 0 && ret <= 4096) { return null; }
463 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
468 * Read a AcceptChannelV2 from a byte array, created by AcceptChannelV2_write
470 public static Result_AcceptChannelV2DecodeErrorZ read(byte[] ser) {
471 long ret = bindings.AcceptChannelV2_read(InternalUtils.encodeUint8Array(ser));
473 if (ret >= 0 && ret <= 4096) { return null; }
474 Result_AcceptChannelV2DecodeErrorZ ret_hu_conv = Result_AcceptChannelV2DecodeErrorZ.constr_from_ptr(ret);