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 * Common fields of `open_channel(2)`-like messages
23 public CommonOpenChannelFields get_common_fields() {
24 long ret = bindings.OpenChannelV2_get_common_fields(this.ptr);
26 if (ret >= 0 && ret <= 4096) { return null; }
27 org.ldk.structs.CommonOpenChannelFields ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.CommonOpenChannelFields(null, ret); }
28 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
33 * Common fields of `open_channel(2)`-like messages
35 public void set_common_fields(org.ldk.structs.CommonOpenChannelFields val) {
36 bindings.OpenChannelV2_set_common_fields(this.ptr, val.ptr);
39 if (this != null) { this.ptrs_to.AddLast(val); };
43 * The feerate for the funding transaction set by the channel initiator
45 public int get_funding_feerate_sat_per_1000_weight() {
46 int ret = bindings.OpenChannelV2_get_funding_feerate_sat_per_1000_weight(this.ptr);
52 * The feerate for the funding transaction set by the channel initiator
54 public void set_funding_feerate_sat_per_1000_weight(int val) {
55 bindings.OpenChannelV2_set_funding_feerate_sat_per_1000_weight(this.ptr, val);
61 * The locktime for the funding transaction
63 public int get_locktime() {
64 int ret = bindings.OpenChannelV2_get_locktime(this.ptr);
70 * The locktime for the funding transaction
72 public void set_locktime(int val) {
73 bindings.OpenChannelV2_set_locktime(this.ptr, val);
79 * The second to-be-broadcast-by-channel-initiator transaction's per commitment point
81 public byte[] get_second_per_commitment_point() {
82 long ret = bindings.OpenChannelV2_get_second_per_commitment_point(this.ptr);
84 if (ret >= 0 && ret <= 4096) { return null; }
85 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
90 * The second to-be-broadcast-by-channel-initiator transaction's per commitment point
92 public void set_second_per_commitment_point(byte[] val) {
93 bindings.OpenChannelV2_set_second_per_commitment_point(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
99 * Optionally, a requirement that only confirmed inputs can be added
101 public COption_NoneZ get_require_confirmed_inputs() {
102 COption_NoneZ ret = bindings.OpenChannelV2_get_require_confirmed_inputs(this.ptr);
108 * Optionally, a requirement that only confirmed inputs can be added
110 public void set_require_confirmed_inputs(COption_NoneZ val) {
111 bindings.OpenChannelV2_set_require_confirmed_inputs(this.ptr, val);
117 * Constructs a new OpenChannelV2 given each field
119 public static OpenChannelV2 of(org.ldk.structs.CommonOpenChannelFields common_fields_arg, int funding_feerate_sat_per_1000_weight_arg, int locktime_arg, byte[] second_per_commitment_point_arg, COption_NoneZ require_confirmed_inputs_arg) {
120 long ret = bindings.OpenChannelV2_new(common_fields_arg.ptr, funding_feerate_sat_per_1000_weight_arg, locktime_arg, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(second_per_commitment_point_arg, 33)), require_confirmed_inputs_arg);
121 GC.KeepAlive(common_fields_arg);
122 GC.KeepAlive(funding_feerate_sat_per_1000_weight_arg);
123 GC.KeepAlive(locktime_arg);
124 GC.KeepAlive(second_per_commitment_point_arg);
125 GC.KeepAlive(require_confirmed_inputs_arg);
126 if (ret >= 0 && ret <= 4096) { return null; }
127 org.ldk.structs.OpenChannelV2 ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OpenChannelV2(null, ret); }
128 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
129 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(common_fields_arg); };
133 internal long clone_ptr() {
134 long ret = bindings.OpenChannelV2_clone_ptr(this.ptr);
140 * Creates a copy of the OpenChannelV2
142 public OpenChannelV2 clone() {
143 long ret = bindings.OpenChannelV2_clone(this.ptr);
145 if (ret >= 0 && ret <= 4096) { return null; }
146 org.ldk.structs.OpenChannelV2 ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OpenChannelV2(null, ret); }
147 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
152 * Generates a non-cryptographic 64-bit hash of the OpenChannelV2.
155 long ret = bindings.OpenChannelV2_hash(this.ptr);
160 public override int GetHashCode() {
161 return (int)this.hash();
164 * Checks if two OpenChannelV2s contain equal inner contents.
165 * This ignores pointers and is_owned flags and looks at the values in fields.
166 * Two objects with NULL inner values will be considered "equal" here.
168 public bool eq(org.ldk.structs.OpenChannelV2 b) {
169 bool ret = bindings.OpenChannelV2_eq(this.ptr, b.ptr);
172 if (this != null) { this.ptrs_to.AddLast(b); };
176 public override bool Equals(object o) {
177 if (!(o is OpenChannelV2)) return false;
178 return this.eq((OpenChannelV2)o);
181 * Serialize the OpenChannelV2 object into a byte array which can be read by OpenChannelV2_read
183 public byte[] write() {
184 long ret = bindings.OpenChannelV2_write(this.ptr);
186 if (ret >= 0 && ret <= 4096) { return null; }
187 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
192 * Read a OpenChannelV2 from a byte array, created by OpenChannelV2_write
194 public static Result_OpenChannelV2DecodeErrorZ read(byte[] ser) {
195 long ret = bindings.OpenChannelV2_read(InternalUtils.encodeUint8Array(ser));
197 if (ret >= 0 && ret <= 4096) { return null; }
198 Result_OpenChannelV2DecodeErrorZ ret_hu_conv = Result_OpenChannelV2DecodeErrorZ.constr_from_ptr(ret);