[C#] Run tests against release library in determinism CI run
[ldk-java] / c_sharp / src / org / ldk / structs / AcceptChannelV2.cs
1 using org.ldk.impl;
2 using org.ldk.enums;
3 using org.ldk.util;
4 using System;
5
6 namespace org { namespace ldk { namespace structs {
7
8
9 /**
10  * An accept_channel2 message to be sent by or received from the channel accepter.
11  * 
12  * Used in V2 channel establishment
13  */
14 public class AcceptChannelV2 : CommonBase {
15         internal AcceptChannelV2(object _dummy, long ptr) : base(ptr) { }
16         ~AcceptChannelV2() {
17                 if (ptr != 0) { bindings.AcceptChannelV2_free(ptr); }
18         }
19
20         /**
21          * Common fields of `accept_channel(2)`-like messages
22          */
23         public CommonAcceptChannelFields get_common_fields() {
24                 long ret = bindings.AcceptChannelV2_get_common_fields(this.ptr);
25                 GC.KeepAlive(this);
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); };
29                 return ret_hu_conv;
30         }
31
32         /**
33          * Common fields of `accept_channel(2)`-like messages
34          */
35         public void set_common_fields(org.ldk.structs.CommonAcceptChannelFields val) {
36                 bindings.AcceptChannelV2_set_common_fields(this.ptr, val.ptr);
37                 GC.KeepAlive(this);
38                 GC.KeepAlive(val);
39                 if (this != null) { this.ptrs_to.AddLast(val); };
40         }
41
42         /**
43          * Part of the channel value contributed by the channel acceptor
44          */
45         public long get_funding_satoshis() {
46                 long ret = bindings.AcceptChannelV2_get_funding_satoshis(this.ptr);
47                 GC.KeepAlive(this);
48                 return ret;
49         }
50
51         /**
52          * Part of the channel value contributed by the channel acceptor
53          */
54         public void set_funding_satoshis(long val) {
55                 bindings.AcceptChannelV2_set_funding_satoshis(this.ptr, val);
56                 GC.KeepAlive(this);
57                 GC.KeepAlive(val);
58         }
59
60         /**
61          * The second to-be-broadcast-by-channel-acceptor transaction's per commitment point
62          */
63         public byte[] get_second_per_commitment_point() {
64                 long ret = bindings.AcceptChannelV2_get_second_per_commitment_point(this.ptr);
65                 GC.KeepAlive(this);
66                 if (ret >= 0 && ret <= 4096) { return null; }
67                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
68                 return ret_conv;
69         }
70
71         /**
72          * The second to-be-broadcast-by-channel-acceptor transaction's per commitment point
73          */
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)));
76                 GC.KeepAlive(this);
77                 GC.KeepAlive(val);
78         }
79
80         /**
81          * Optionally, a requirement that only confirmed inputs can be added
82          */
83         public COption_NoneZ get_require_confirmed_inputs() {
84                 COption_NoneZ ret = bindings.AcceptChannelV2_get_require_confirmed_inputs(this.ptr);
85                 GC.KeepAlive(this);
86                 return ret;
87         }
88
89         /**
90          * Optionally, a requirement that only confirmed inputs can be added
91          */
92         public void set_require_confirmed_inputs(COption_NoneZ val) {
93                 bindings.AcceptChannelV2_set_require_confirmed_inputs(this.ptr, val);
94                 GC.KeepAlive(this);
95                 GC.KeepAlive(val);
96         }
97
98         /**
99          * Constructs a new AcceptChannelV2 given each field
100          */
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); };
111                 return ret_hu_conv;
112         }
113
114         internal long clone_ptr() {
115                 long ret = bindings.AcceptChannelV2_clone_ptr(this.ptr);
116                 GC.KeepAlive(this);
117                 return ret;
118         }
119
120         /**
121          * Creates a copy of the AcceptChannelV2
122          */
123         public AcceptChannelV2 clone() {
124                 long ret = bindings.AcceptChannelV2_clone(this.ptr);
125                 GC.KeepAlive(this);
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); };
129                 return ret_hu_conv;
130         }
131
132         /**
133          * Generates a non-cryptographic 64-bit hash of the AcceptChannelV2.
134          */
135         public long hash() {
136                 long ret = bindings.AcceptChannelV2_hash(this.ptr);
137                 GC.KeepAlive(this);
138                 return ret;
139         }
140
141         public override int GetHashCode() {
142                 return (int)this.hash();
143         }
144         /**
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.
148          */
149         public bool eq(org.ldk.structs.AcceptChannelV2 b) {
150                 bool ret = bindings.AcceptChannelV2_eq(this.ptr, b.ptr);
151                 GC.KeepAlive(this);
152                 GC.KeepAlive(b);
153                 if (this != null) { this.ptrs_to.AddLast(b); };
154                 return ret;
155         }
156
157         public override bool Equals(object o) {
158                 if (!(o is AcceptChannelV2)) return false;
159                 return this.eq((AcceptChannelV2)o);
160         }
161         /**
162          * Serialize the AcceptChannelV2 object into a byte array which can be read by AcceptChannelV2_read
163          */
164         public byte[] write() {
165                 long ret = bindings.AcceptChannelV2_write(this.ptr);
166                 GC.KeepAlive(this);
167                 if (ret >= 0 && ret <= 4096) { return null; }
168                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
169                 return ret_conv;
170         }
171
172         /**
173          * Read a AcceptChannelV2 from a byte array, created by AcceptChannelV2_write
174          */
175         public static Result_AcceptChannelV2DecodeErrorZ read(byte[] ser) {
176                 long ret = bindings.AcceptChannelV2_read(InternalUtils.encodeUint8Array(ser));
177                 GC.KeepAlive(ser);
178                 if (ret >= 0 && ret <= 4096) { return null; }
179                 Result_AcceptChannelV2DecodeErrorZ ret_hu_conv = Result_AcceptChannelV2DecodeErrorZ.constr_from_ptr(ret);
180                 return ret_hu_conv;
181         }
182
183 }
184 } } }