6 namespace org { namespace ldk { namespace structs {
10 * An open_channel2 message to be sent by or received from the channel initiator.
12 * Used in V2 channel establishment
14 public class OpenChannelV2 : CommonBase {
15 internal OpenChannelV2(object _dummy, long ptr) : base(ptr) { }
17 if (ptr != 0) { bindings.OpenChannelV2_free(ptr); }
21 * The genesis hash of the blockchain where the channel is to be opened
23 public byte[] get_chain_hash() {
24 long ret = bindings.OpenChannelV2_get_chain_hash(this.ptr);
26 if (ret >= 0 && ret <= 4096) { return null; }
27 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
32 * The genesis hash of the blockchain where the channel is to be opened
34 public void set_chain_hash(byte[] val) {
35 bindings.OpenChannelV2_set_chain_hash(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
41 * A temporary channel ID derived using a zeroed out value for the channel acceptor's revocation basepoint
43 public byte[] get_temporary_channel_id() {
44 long ret = bindings.OpenChannelV2_get_temporary_channel_id(this.ptr);
46 if (ret >= 0 && ret <= 4096) { return null; }
47 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
52 * A temporary channel ID derived using a zeroed out value for the channel acceptor's revocation basepoint
54 public void set_temporary_channel_id(byte[] val) {
55 bindings.OpenChannelV2_set_temporary_channel_id(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
61 * The feerate for the funding transaction set by the channel initiator
63 public int get_funding_feerate_sat_per_1000_weight() {
64 int ret = bindings.OpenChannelV2_get_funding_feerate_sat_per_1000_weight(this.ptr);
70 * The feerate for the funding transaction set by the channel initiator
72 public void set_funding_feerate_sat_per_1000_weight(int val) {
73 bindings.OpenChannelV2_set_funding_feerate_sat_per_1000_weight(this.ptr, val);
79 * The feerate for the commitment transaction set by the channel initiator
81 public int get_commitment_feerate_sat_per_1000_weight() {
82 int ret = bindings.OpenChannelV2_get_commitment_feerate_sat_per_1000_weight(this.ptr);
88 * The feerate for the commitment transaction set by the channel initiator
90 public void set_commitment_feerate_sat_per_1000_weight(int val) {
91 bindings.OpenChannelV2_set_commitment_feerate_sat_per_1000_weight(this.ptr, val);
97 * Part of the channel value contributed by the channel initiator
99 public long get_funding_satoshis() {
100 long ret = bindings.OpenChannelV2_get_funding_satoshis(this.ptr);
106 * Part of the channel value contributed by the channel initiator
108 public void set_funding_satoshis(long val) {
109 bindings.OpenChannelV2_set_funding_satoshis(this.ptr, val);
115 * The threshold below which outputs on transactions broadcast by the channel initiator will be
118 public long get_dust_limit_satoshis() {
119 long ret = bindings.OpenChannelV2_get_dust_limit_satoshis(this.ptr);
125 * The threshold below which outputs on transactions broadcast by the channel initiator will be
128 public void set_dust_limit_satoshis(long val) {
129 bindings.OpenChannelV2_set_dust_limit_satoshis(this.ptr, val);
135 * The maximum inbound HTLC value in flight towards channel initiator, in milli-satoshi
137 public long get_max_htlc_value_in_flight_msat() {
138 long ret = bindings.OpenChannelV2_get_max_htlc_value_in_flight_msat(this.ptr);
144 * The maximum inbound HTLC value in flight towards channel initiator, in milli-satoshi
146 public void set_max_htlc_value_in_flight_msat(long val) {
147 bindings.OpenChannelV2_set_max_htlc_value_in_flight_msat(this.ptr, val);
153 * The minimum HTLC size incoming to channel initiator, in milli-satoshi
155 public long get_htlc_minimum_msat() {
156 long ret = bindings.OpenChannelV2_get_htlc_minimum_msat(this.ptr);
162 * The minimum HTLC size incoming to channel initiator, in milli-satoshi
164 public void set_htlc_minimum_msat(long val) {
165 bindings.OpenChannelV2_set_htlc_minimum_msat(this.ptr, val);
171 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they
172 * broadcast a commitment transaction
174 public short get_to_self_delay() {
175 short ret = bindings.OpenChannelV2_get_to_self_delay(this.ptr);
181 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they
182 * broadcast a commitment transaction
184 public void set_to_self_delay(short val) {
185 bindings.OpenChannelV2_set_to_self_delay(this.ptr, val);
191 * The maximum number of inbound HTLCs towards channel initiator
193 public short get_max_accepted_htlcs() {
194 short ret = bindings.OpenChannelV2_get_max_accepted_htlcs(this.ptr);
200 * The maximum number of inbound HTLCs towards channel initiator
202 public void set_max_accepted_htlcs(short val) {
203 bindings.OpenChannelV2_set_max_accepted_htlcs(this.ptr, val);
209 * The locktime for the funding transaction
211 public int get_locktime() {
212 int ret = bindings.OpenChannelV2_get_locktime(this.ptr);
218 * The locktime for the funding transaction
220 public void set_locktime(int val) {
221 bindings.OpenChannelV2_set_locktime(this.ptr, val);
227 * The channel initiator's key controlling the funding transaction
229 public byte[] get_funding_pubkey() {
230 long ret = bindings.OpenChannelV2_get_funding_pubkey(this.ptr);
232 if (ret >= 0 && ret <= 4096) { return null; }
233 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
238 * The channel initiator's key controlling the funding transaction
240 public void set_funding_pubkey(byte[] val) {
241 bindings.OpenChannelV2_set_funding_pubkey(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
247 * Used to derive a revocation key for transactions broadcast by counterparty
249 public byte[] get_revocation_basepoint() {
250 long ret = bindings.OpenChannelV2_get_revocation_basepoint(this.ptr);
252 if (ret >= 0 && ret <= 4096) { return null; }
253 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
258 * Used to derive a revocation key for transactions broadcast by counterparty
260 public void set_revocation_basepoint(byte[] val) {
261 bindings.OpenChannelV2_set_revocation_basepoint(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
267 * A payment key to channel initiator for transactions broadcast by counterparty
269 public byte[] get_payment_basepoint() {
270 long ret = bindings.OpenChannelV2_get_payment_basepoint(this.ptr);
272 if (ret >= 0 && ret <= 4096) { return null; }
273 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
278 * A payment key to channel initiator for transactions broadcast by counterparty
280 public void set_payment_basepoint(byte[] val) {
281 bindings.OpenChannelV2_set_payment_basepoint(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
287 * Used to derive a payment key to channel initiator for transactions broadcast by channel
290 public byte[] get_delayed_payment_basepoint() {
291 long ret = bindings.OpenChannelV2_get_delayed_payment_basepoint(this.ptr);
293 if (ret >= 0 && ret <= 4096) { return null; }
294 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
299 * Used to derive a payment key to channel initiator for transactions broadcast by channel
302 public void set_delayed_payment_basepoint(byte[] val) {
303 bindings.OpenChannelV2_set_delayed_payment_basepoint(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
309 * Used to derive an HTLC payment key to channel initiator
311 public byte[] get_htlc_basepoint() {
312 long ret = bindings.OpenChannelV2_get_htlc_basepoint(this.ptr);
314 if (ret >= 0 && ret <= 4096) { return null; }
315 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
320 * Used to derive an HTLC payment key to channel initiator
322 public void set_htlc_basepoint(byte[] val) {
323 bindings.OpenChannelV2_set_htlc_basepoint(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
329 * The first to-be-broadcast-by-channel-initiator transaction's per commitment point
331 public byte[] get_first_per_commitment_point() {
332 long ret = bindings.OpenChannelV2_get_first_per_commitment_point(this.ptr);
334 if (ret >= 0 && ret <= 4096) { return null; }
335 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
340 * The first to-be-broadcast-by-channel-initiator transaction's per commitment point
342 public void set_first_per_commitment_point(byte[] val) {
343 bindings.OpenChannelV2_set_first_per_commitment_point(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
349 * The second to-be-broadcast-by-channel-initiator transaction's per commitment point
351 public byte[] get_second_per_commitment_point() {
352 long ret = bindings.OpenChannelV2_get_second_per_commitment_point(this.ptr);
354 if (ret >= 0 && ret <= 4096) { return null; }
355 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
360 * The second to-be-broadcast-by-channel-initiator transaction's per commitment point
362 public void set_second_per_commitment_point(byte[] val) {
363 bindings.OpenChannelV2_set_second_per_commitment_point(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
371 public byte get_channel_flags() {
372 byte ret = bindings.OpenChannelV2_get_channel_flags(this.ptr);
380 public void set_channel_flags(byte val) {
381 bindings.OpenChannelV2_set_channel_flags(this.ptr, val);
387 * Optionally, a request to pre-set the to-channel-initiator output's scriptPubkey for when we
388 * collaboratively close
390 public Option_CVec_u8ZZ get_shutdown_scriptpubkey() {
391 long ret = bindings.OpenChannelV2_get_shutdown_scriptpubkey(this.ptr);
393 if (ret >= 0 && ret <= 4096) { return null; }
394 org.ldk.structs.Option_CVec_u8ZZ ret_hu_conv = org.ldk.structs.Option_CVec_u8ZZ.constr_from_ptr(ret);
395 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
400 * Optionally, a request to pre-set the to-channel-initiator output's scriptPubkey for when we
401 * collaboratively close
403 public void set_shutdown_scriptpubkey(org.ldk.structs.Option_CVec_u8ZZ val) {
404 bindings.OpenChannelV2_set_shutdown_scriptpubkey(this.ptr, val.ptr);
407 if (this != null) { this.ptrs_to.AddLast(val); };
411 * The channel type that this channel will represent. If none is set, we derive the channel
412 * type from the intersection of our feature bits with our counterparty's feature bits from
415 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
417 public ChannelTypeFeatures get_channel_type() {
418 long ret = bindings.OpenChannelV2_get_channel_type(this.ptr);
420 if (ret >= 0 && ret <= 4096) { return null; }
421 org.ldk.structs.ChannelTypeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelTypeFeatures(null, ret); }
422 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
427 * The channel type that this channel will represent. If none is set, we derive the channel
428 * type from the intersection of our feature bits with our counterparty's feature bits from
431 * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
433 public void set_channel_type(org.ldk.structs.ChannelTypeFeatures val) {
434 bindings.OpenChannelV2_set_channel_type(this.ptr, val == null ? 0 : val.ptr);
437 if (this != null) { this.ptrs_to.AddLast(val); };
441 * Optionally, a requirement that only confirmed inputs can be added
443 public COption_NoneZ get_require_confirmed_inputs() {
444 COption_NoneZ ret = bindings.OpenChannelV2_get_require_confirmed_inputs(this.ptr);
450 * Optionally, a requirement that only confirmed inputs can be added
452 public void set_require_confirmed_inputs(COption_NoneZ val) {
453 bindings.OpenChannelV2_set_require_confirmed_inputs(this.ptr, val);
459 * Constructs a new OpenChannelV2 given each field
461 * Note that channel_type_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
463 public static OpenChannelV2 of(byte[] chain_hash_arg, byte[] temporary_channel_id_arg, int funding_feerate_sat_per_1000_weight_arg, int commitment_feerate_sat_per_1000_weight_arg, long funding_satoshis_arg, long dust_limit_satoshis_arg, long max_htlc_value_in_flight_msat_arg, long htlc_minimum_msat_arg, short to_self_delay_arg, short max_accepted_htlcs_arg, int locktime_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, byte channel_flags_arg, org.ldk.structs.Option_CVec_u8ZZ shutdown_scriptpubkey_arg, org.ldk.structs.ChannelTypeFeatures channel_type_arg, COption_NoneZ require_confirmed_inputs_arg) {
464 long ret = bindings.OpenChannelV2_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(chain_hash_arg, 32)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(temporary_channel_id_arg, 32)), funding_feerate_sat_per_1000_weight_arg, commitment_feerate_sat_per_1000_weight_arg, funding_satoshis_arg, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, htlc_minimum_msat_arg, to_self_delay_arg, max_accepted_htlcs_arg, locktime_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)), channel_flags_arg, shutdown_scriptpubkey_arg.ptr, channel_type_arg == null ? 0 : channel_type_arg.ptr, require_confirmed_inputs_arg);
465 GC.KeepAlive(chain_hash_arg);
466 GC.KeepAlive(temporary_channel_id_arg);
467 GC.KeepAlive(funding_feerate_sat_per_1000_weight_arg);
468 GC.KeepAlive(commitment_feerate_sat_per_1000_weight_arg);
469 GC.KeepAlive(funding_satoshis_arg);
470 GC.KeepAlive(dust_limit_satoshis_arg);
471 GC.KeepAlive(max_htlc_value_in_flight_msat_arg);
472 GC.KeepAlive(htlc_minimum_msat_arg);
473 GC.KeepAlive(to_self_delay_arg);
474 GC.KeepAlive(max_accepted_htlcs_arg);
475 GC.KeepAlive(locktime_arg);
476 GC.KeepAlive(funding_pubkey_arg);
477 GC.KeepAlive(revocation_basepoint_arg);
478 GC.KeepAlive(payment_basepoint_arg);
479 GC.KeepAlive(delayed_payment_basepoint_arg);
480 GC.KeepAlive(htlc_basepoint_arg);
481 GC.KeepAlive(first_per_commitment_point_arg);
482 GC.KeepAlive(second_per_commitment_point_arg);
483 GC.KeepAlive(channel_flags_arg);
484 GC.KeepAlive(shutdown_scriptpubkey_arg);
485 GC.KeepAlive(channel_type_arg);
486 GC.KeepAlive(require_confirmed_inputs_arg);
487 if (ret >= 0 && ret <= 4096) { return null; }
488 org.ldk.structs.OpenChannelV2 ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OpenChannelV2(null, ret); }
489 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
490 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(shutdown_scriptpubkey_arg); };
491 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_type_arg); };
495 internal long clone_ptr() {
496 long ret = bindings.OpenChannelV2_clone_ptr(this.ptr);
502 * Creates a copy of the OpenChannelV2
504 public OpenChannelV2 clone() {
505 long ret = bindings.OpenChannelV2_clone(this.ptr);
507 if (ret >= 0 && ret <= 4096) { return null; }
508 org.ldk.structs.OpenChannelV2 ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OpenChannelV2(null, ret); }
509 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
514 * Checks if two OpenChannelV2s contain equal inner contents.
515 * This ignores pointers and is_owned flags and looks at the values in fields.
516 * Two objects with NULL inner values will be considered "equal" here.
518 public bool eq(org.ldk.structs.OpenChannelV2 b) {
519 bool ret = bindings.OpenChannelV2_eq(this.ptr, b == null ? 0 : b.ptr);
522 if (this != null) { this.ptrs_to.AddLast(b); };
526 public override bool Equals(object o) {
527 if (!(o is OpenChannelV2)) return false;
528 return this.eq((OpenChannelV2)o);
531 * Serialize the OpenChannelV2 object into a byte array which can be read by OpenChannelV2_read
533 public byte[] write() {
534 long ret = bindings.OpenChannelV2_write(this.ptr);
536 if (ret >= 0 && ret <= 4096) { return null; }
537 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
542 * Read a OpenChannelV2 from a byte array, created by OpenChannelV2_write
544 public static Result_OpenChannelV2DecodeErrorZ read(byte[] ser) {
545 long ret = bindings.OpenChannelV2_read(InternalUtils.encodeUint8Array(ser));
547 if (ret >= 0 && ret <= 4096) { return null; }
548 Result_OpenChannelV2DecodeErrorZ ret_hu_conv = Result_OpenChannelV2DecodeErrorZ.constr_from_ptr(ret);