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 * Common fields of `accept_channel(2)`-like messages
23 public CommonAcceptChannelFields get_common_fields() {
24 long ret = bindings.AcceptChannelV2_get_common_fields(this.ptr);
26 if (ret >= 0 && ret <= 4096) { return null; }
27 org.ldk.structs.CommonAcceptChannelFields ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.CommonAcceptChannelFields(null, ret); }
28 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
33 * Common fields of `accept_channel(2)`-like messages
35 public void set_common_fields(org.ldk.structs.CommonAcceptChannelFields val) {
36 bindings.AcceptChannelV2_set_common_fields(this.ptr, val.ptr);
39 if (this != null) { this.ptrs_to.AddLast(val); };
43 * Part of the channel value contributed by the channel acceptor
45 public long get_funding_satoshis() {
46 long ret = bindings.AcceptChannelV2_get_funding_satoshis(this.ptr);
52 * Part of the channel value contributed by the channel acceptor
54 public void set_funding_satoshis(long val) {
55 bindings.AcceptChannelV2_set_funding_satoshis(this.ptr, val);
61 * The second to-be-broadcast-by-channel-acceptor transaction's per commitment point
63 public byte[] get_second_per_commitment_point() {
64 long ret = bindings.AcceptChannelV2_get_second_per_commitment_point(this.ptr);
66 if (ret >= 0 && ret <= 4096) { return null; }
67 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
72 * The second to-be-broadcast-by-channel-acceptor transaction's per commitment point
74 public void set_second_per_commitment_point(byte[] val) {
75 bindings.AcceptChannelV2_set_second_per_commitment_point(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
81 * Optionally, a requirement that only confirmed inputs can be added
83 public COption_NoneZ get_require_confirmed_inputs() {
84 COption_NoneZ ret = bindings.AcceptChannelV2_get_require_confirmed_inputs(this.ptr);
90 * Optionally, a requirement that only confirmed inputs can be added
92 public void set_require_confirmed_inputs(COption_NoneZ val) {
93 bindings.AcceptChannelV2_set_require_confirmed_inputs(this.ptr, val);
99 * Constructs a new AcceptChannelV2 given each field
101 public static AcceptChannelV2 of(org.ldk.structs.CommonAcceptChannelFields common_fields_arg, long funding_satoshis_arg, byte[] second_per_commitment_point_arg, COption_NoneZ require_confirmed_inputs_arg) {
102 long ret = bindings.AcceptChannelV2_new(common_fields_arg.ptr, funding_satoshis_arg, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(second_per_commitment_point_arg, 33)), require_confirmed_inputs_arg);
103 GC.KeepAlive(common_fields_arg);
104 GC.KeepAlive(funding_satoshis_arg);
105 GC.KeepAlive(second_per_commitment_point_arg);
106 GC.KeepAlive(require_confirmed_inputs_arg);
107 if (ret >= 0 && ret <= 4096) { return null; }
108 org.ldk.structs.AcceptChannelV2 ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.AcceptChannelV2(null, ret); }
109 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
110 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(common_fields_arg); };
114 internal long clone_ptr() {
115 long ret = bindings.AcceptChannelV2_clone_ptr(this.ptr);
121 * Creates a copy of the AcceptChannelV2
123 public AcceptChannelV2 clone() {
124 long ret = bindings.AcceptChannelV2_clone(this.ptr);
126 if (ret >= 0 && ret <= 4096) { return null; }
127 org.ldk.structs.AcceptChannelV2 ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.AcceptChannelV2(null, ret); }
128 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
133 * Generates a non-cryptographic 64-bit hash of the AcceptChannelV2.
136 long ret = bindings.AcceptChannelV2_hash(this.ptr);
141 public override int GetHashCode() {
142 return (int)this.hash();
145 * Checks if two AcceptChannelV2s contain equal inner contents.
146 * This ignores pointers and is_owned flags and looks at the values in fields.
147 * Two objects with NULL inner values will be considered "equal" here.
149 public bool eq(org.ldk.structs.AcceptChannelV2 b) {
150 bool ret = bindings.AcceptChannelV2_eq(this.ptr, b.ptr);
153 if (this != null) { this.ptrs_to.AddLast(b); };
157 public override bool Equals(object o) {
158 if (!(o is AcceptChannelV2)) return false;
159 return this.eq((AcceptChannelV2)o);
162 * Serialize the AcceptChannelV2 object into a byte array which can be read by AcceptChannelV2_read
164 public byte[] write() {
165 long ret = bindings.AcceptChannelV2_write(this.ptr);
167 if (ret >= 0 && ret <= 4096) { return null; }
168 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
173 * Read a AcceptChannelV2 from a byte array, created by AcceptChannelV2_write
175 public static Result_AcceptChannelV2DecodeErrorZ read(byte[] ser) {
176 long ret = bindings.AcceptChannelV2_read(InternalUtils.encodeUint8Array(ser));
178 if (ret >= 0 && ret <= 4096) { return null; }
179 Result_AcceptChannelV2DecodeErrorZ ret_hu_conv = Result_AcceptChannelV2DecodeErrorZ.constr_from_ptr(ret);