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 byte[] ret = bindings.OpenChannelV2_get_chain_hash(this.ptr);
30 * The genesis hash of the blockchain where the channel is to be opened
32 public void set_chain_hash(byte[] val) {
33 bindings.OpenChannelV2_set_chain_hash(this.ptr, InternalUtils.check_arr_len(val, 32));
39 * A temporary channel ID derived using a zeroed out value for the channel acceptor's revocation basepoint
41 public byte[] get_temporary_channel_id() {
42 byte[] ret = bindings.OpenChannelV2_get_temporary_channel_id(this.ptr);
48 * A temporary channel ID derived using a zeroed out value for the channel acceptor's revocation basepoint
50 public void set_temporary_channel_id(byte[] val) {
51 bindings.OpenChannelV2_set_temporary_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
57 * The feerate for the funding transaction set by the channel initiator
59 public int get_funding_feerate_sat_per_1000_weight() {
60 int ret = bindings.OpenChannelV2_get_funding_feerate_sat_per_1000_weight(this.ptr);
66 * The feerate for the funding transaction set by the channel initiator
68 public void set_funding_feerate_sat_per_1000_weight(int val) {
69 bindings.OpenChannelV2_set_funding_feerate_sat_per_1000_weight(this.ptr, val);
75 * The feerate for the commitment transaction set by the channel initiator
77 public int get_commitment_feerate_sat_per_1000_weight() {
78 int ret = bindings.OpenChannelV2_get_commitment_feerate_sat_per_1000_weight(this.ptr);
84 * The feerate for the commitment transaction set by the channel initiator
86 public void set_commitment_feerate_sat_per_1000_weight(int val) {
87 bindings.OpenChannelV2_set_commitment_feerate_sat_per_1000_weight(this.ptr, val);
93 * Part of the channel value contributed by the channel initiator
95 public long get_funding_satoshis() {
96 long ret = bindings.OpenChannelV2_get_funding_satoshis(this.ptr);
102 * Part of the channel value contributed by the channel initiator
104 public void set_funding_satoshis(long val) {
105 bindings.OpenChannelV2_set_funding_satoshis(this.ptr, val);
111 * The threshold below which outputs on transactions broadcast by the channel initiator will be
114 public long get_dust_limit_satoshis() {
115 long ret = bindings.OpenChannelV2_get_dust_limit_satoshis(this.ptr);
121 * The threshold below which outputs on transactions broadcast by the channel initiator will be
124 public void set_dust_limit_satoshis(long val) {
125 bindings.OpenChannelV2_set_dust_limit_satoshis(this.ptr, val);
131 * The maximum inbound HTLC value in flight towards channel initiator, in milli-satoshi
133 public long get_max_htlc_value_in_flight_msat() {
134 long ret = bindings.OpenChannelV2_get_max_htlc_value_in_flight_msat(this.ptr);
140 * The maximum inbound HTLC value in flight towards channel initiator, in milli-satoshi
142 public void set_max_htlc_value_in_flight_msat(long val) {
143 bindings.OpenChannelV2_set_max_htlc_value_in_flight_msat(this.ptr, val);
149 * The minimum HTLC size incoming to channel initiator, in milli-satoshi
151 public long get_htlc_minimum_msat() {
152 long ret = bindings.OpenChannelV2_get_htlc_minimum_msat(this.ptr);
158 * The minimum HTLC size incoming to channel initiator, in milli-satoshi
160 public void set_htlc_minimum_msat(long val) {
161 bindings.OpenChannelV2_set_htlc_minimum_msat(this.ptr, val);
167 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they
168 * broadcast a commitment transaction
170 public short get_to_self_delay() {
171 short ret = bindings.OpenChannelV2_get_to_self_delay(this.ptr);
177 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they
178 * broadcast a commitment transaction
180 public void set_to_self_delay(short val) {
181 bindings.OpenChannelV2_set_to_self_delay(this.ptr, val);
187 * The maximum number of inbound HTLCs towards channel initiator
189 public short get_max_accepted_htlcs() {
190 short ret = bindings.OpenChannelV2_get_max_accepted_htlcs(this.ptr);
196 * The maximum number of inbound HTLCs towards channel initiator
198 public void set_max_accepted_htlcs(short val) {
199 bindings.OpenChannelV2_set_max_accepted_htlcs(this.ptr, val);
205 * The locktime for the funding transaction
207 public int get_locktime() {
208 int ret = bindings.OpenChannelV2_get_locktime(this.ptr);
214 * The locktime for the funding transaction
216 public void set_locktime(int val) {
217 bindings.OpenChannelV2_set_locktime(this.ptr, val);
223 * The channel initiator's key controlling the funding transaction
225 public byte[] get_funding_pubkey() {
226 byte[] ret = bindings.OpenChannelV2_get_funding_pubkey(this.ptr);
232 * The channel initiator's key controlling the funding transaction
234 public void set_funding_pubkey(byte[] val) {
235 bindings.OpenChannelV2_set_funding_pubkey(this.ptr, InternalUtils.check_arr_len(val, 33));
241 * Used to derive a revocation key for transactions broadcast by counterparty
243 public byte[] get_revocation_basepoint() {
244 byte[] ret = bindings.OpenChannelV2_get_revocation_basepoint(this.ptr);
250 * Used to derive a revocation key for transactions broadcast by counterparty
252 public void set_revocation_basepoint(byte[] val) {
253 bindings.OpenChannelV2_set_revocation_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33));
259 * A payment key to channel initiator for transactions broadcast by counterparty
261 public byte[] get_payment_basepoint() {
262 byte[] ret = bindings.OpenChannelV2_get_payment_basepoint(this.ptr);
268 * A payment key to channel initiator for transactions broadcast by counterparty
270 public void set_payment_basepoint(byte[] val) {
271 bindings.OpenChannelV2_set_payment_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33));
277 * Used to derive a payment key to channel initiator for transactions broadcast by channel
280 public byte[] get_delayed_payment_basepoint() {
281 byte[] ret = bindings.OpenChannelV2_get_delayed_payment_basepoint(this.ptr);
287 * Used to derive a payment key to channel initiator for transactions broadcast by channel
290 public void set_delayed_payment_basepoint(byte[] val) {
291 bindings.OpenChannelV2_set_delayed_payment_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33));
297 * Used to derive an HTLC payment key to channel initiator
299 public byte[] get_htlc_basepoint() {
300 byte[] ret = bindings.OpenChannelV2_get_htlc_basepoint(this.ptr);
306 * Used to derive an HTLC payment key to channel initiator
308 public void set_htlc_basepoint(byte[] val) {
309 bindings.OpenChannelV2_set_htlc_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33));
315 * The first to-be-broadcast-by-channel-initiator transaction's per commitment point
317 public byte[] get_first_per_commitment_point() {
318 byte[] ret = bindings.OpenChannelV2_get_first_per_commitment_point(this.ptr);
324 * The first to-be-broadcast-by-channel-initiator transaction's per commitment point
326 public void set_first_per_commitment_point(byte[] val) {
327 bindings.OpenChannelV2_set_first_per_commitment_point(this.ptr, InternalUtils.check_arr_len(val, 33));
333 * The second to-be-broadcast-by-channel-initiator transaction's per commitment point
335 public byte[] get_second_per_commitment_point() {
336 byte[] ret = bindings.OpenChannelV2_get_second_per_commitment_point(this.ptr);
342 * The second to-be-broadcast-by-channel-initiator transaction's per commitment point
344 public void set_second_per_commitment_point(byte[] val) {
345 bindings.OpenChannelV2_set_second_per_commitment_point(this.ptr, InternalUtils.check_arr_len(val, 33));
353 public byte get_channel_flags() {
354 byte ret = bindings.OpenChannelV2_get_channel_flags(this.ptr);
362 public void set_channel_flags(byte val) {
363 bindings.OpenChannelV2_set_channel_flags(this.ptr, val);
369 * Optionally, a request to pre-set the to-channel-initiator output's scriptPubkey for when we
370 * collaboratively close
372 public Option_ScriptZ get_shutdown_scriptpubkey() {
373 long ret = bindings.OpenChannelV2_get_shutdown_scriptpubkey(this.ptr);
375 if (ret >= 0 && ret <= 4096) { return null; }
376 org.ldk.structs.Option_ScriptZ ret_hu_conv = org.ldk.structs.Option_ScriptZ.constr_from_ptr(ret);
377 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
382 * Optionally, a request to pre-set the to-channel-initiator output's scriptPubkey for when we
383 * collaboratively close
385 public void set_shutdown_scriptpubkey(org.ldk.structs.Option_ScriptZ val) {
386 bindings.OpenChannelV2_set_shutdown_scriptpubkey(this.ptr, val.ptr);
389 if (this != null) { this.ptrs_to.AddLast(val); };
393 * The channel type that this channel will represent. If none is set, we derive the channel
394 * type from the intersection of our feature bits with our counterparty's feature bits from
397 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
399 public ChannelTypeFeatures get_channel_type() {
400 long ret = bindings.OpenChannelV2_get_channel_type(this.ptr);
402 if (ret >= 0 && ret <= 4096) { return null; }
403 org.ldk.structs.ChannelTypeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelTypeFeatures(null, ret); }
404 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
409 * The channel type that this channel will represent. If none is set, we derive the channel
410 * type from the intersection of our feature bits with our counterparty's feature bits from
413 * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
415 public void set_channel_type(org.ldk.structs.ChannelTypeFeatures val) {
416 bindings.OpenChannelV2_set_channel_type(this.ptr, val == null ? 0 : val.ptr);
419 if (this != null) { this.ptrs_to.AddLast(val); };
423 * Optionally, a requirement that only confirmed inputs can be added
425 public COption_NoneZ get_require_confirmed_inputs() {
426 COption_NoneZ ret = bindings.OpenChannelV2_get_require_confirmed_inputs(this.ptr);
432 * Optionally, a requirement that only confirmed inputs can be added
434 public void set_require_confirmed_inputs(COption_NoneZ val) {
435 bindings.OpenChannelV2_set_require_confirmed_inputs(this.ptr, val);
441 * Constructs a new OpenChannelV2 given each field
443 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_ScriptZ shutdown_scriptpubkey_arg, org.ldk.structs.ChannelTypeFeatures channel_type_arg, COption_NoneZ require_confirmed_inputs_arg) {
444 long ret = bindings.OpenChannelV2_new(InternalUtils.check_arr_len(chain_hash_arg, 32), 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.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), channel_flags_arg, shutdown_scriptpubkey_arg.ptr, channel_type_arg == null ? 0 : channel_type_arg.ptr, require_confirmed_inputs_arg);
445 GC.KeepAlive(chain_hash_arg);
446 GC.KeepAlive(temporary_channel_id_arg);
447 GC.KeepAlive(funding_feerate_sat_per_1000_weight_arg);
448 GC.KeepAlive(commitment_feerate_sat_per_1000_weight_arg);
449 GC.KeepAlive(funding_satoshis_arg);
450 GC.KeepAlive(dust_limit_satoshis_arg);
451 GC.KeepAlive(max_htlc_value_in_flight_msat_arg);
452 GC.KeepAlive(htlc_minimum_msat_arg);
453 GC.KeepAlive(to_self_delay_arg);
454 GC.KeepAlive(max_accepted_htlcs_arg);
455 GC.KeepAlive(locktime_arg);
456 GC.KeepAlive(funding_pubkey_arg);
457 GC.KeepAlive(revocation_basepoint_arg);
458 GC.KeepAlive(payment_basepoint_arg);
459 GC.KeepAlive(delayed_payment_basepoint_arg);
460 GC.KeepAlive(htlc_basepoint_arg);
461 GC.KeepAlive(first_per_commitment_point_arg);
462 GC.KeepAlive(second_per_commitment_point_arg);
463 GC.KeepAlive(channel_flags_arg);
464 GC.KeepAlive(shutdown_scriptpubkey_arg);
465 GC.KeepAlive(channel_type_arg);
466 GC.KeepAlive(require_confirmed_inputs_arg);
467 if (ret >= 0 && ret <= 4096) { return null; }
468 org.ldk.structs.OpenChannelV2 ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OpenChannelV2(null, ret); }
469 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
470 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(shutdown_scriptpubkey_arg); };
471 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_type_arg); };
475 internal long clone_ptr() {
476 long ret = bindings.OpenChannelV2_clone_ptr(this.ptr);
482 * Creates a copy of the OpenChannelV2
484 public OpenChannelV2 clone() {
485 long ret = bindings.OpenChannelV2_clone(this.ptr);
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(this); };
494 * Checks if two OpenChannelV2s contain equal inner contents.
495 * This ignores pointers and is_owned flags and looks at the values in fields.
496 * Two objects with NULL inner values will be considered "equal" here.
498 public bool eq(org.ldk.structs.OpenChannelV2 b) {
499 bool ret = bindings.OpenChannelV2_eq(this.ptr, b == null ? 0 : b.ptr);
502 if (this != null) { this.ptrs_to.AddLast(b); };
506 public override bool Equals(object o) {
507 if (!(o is OpenChannelV2)) return false;
508 return this.eq((OpenChannelV2)o);
511 * Serialize the OpenChannelV2 object into a byte array which can be read by OpenChannelV2_read
513 public byte[] write() {
514 byte[] ret = bindings.OpenChannelV2_write(this.ptr);
520 * Read a OpenChannelV2 from a byte array, created by OpenChannelV2_write
522 public static Result_OpenChannelV2DecodeErrorZ read(byte[] ser) {
523 long ret = bindings.OpenChannelV2_read(ser);
525 if (ret >= 0 && ret <= 4096) { return null; }
526 Result_OpenChannelV2DecodeErrorZ ret_hu_conv = Result_OpenChannelV2DecodeErrorZ.constr_from_ptr(ret);