[C#] Check in initial auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / ClosingSigned.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  * A closing_signed message to be sent or received from a peer
11  */
12 public class ClosingSigned : CommonBase {
13         internal ClosingSigned(object _dummy, long ptr) : base(ptr) { }
14         ~ClosingSigned() {
15                 if (ptr != 0) { bindings.ClosingSigned_free(ptr); }
16         }
17
18         /**
19          * The channel ID
20          */
21         public byte[] get_channel_id() {
22                 byte[] ret = bindings.ClosingSigned_get_channel_id(this.ptr);
23                 GC.KeepAlive(this);
24                 return ret;
25         }
26
27         /**
28          * The channel ID
29          */
30         public void set_channel_id(byte[] val) {
31                 bindings.ClosingSigned_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
32                 GC.KeepAlive(this);
33                 GC.KeepAlive(val);
34         }
35
36         /**
37          * The proposed total fee for the closing transaction
38          */
39         public long get_fee_satoshis() {
40                 long ret = bindings.ClosingSigned_get_fee_satoshis(this.ptr);
41                 GC.KeepAlive(this);
42                 return ret;
43         }
44
45         /**
46          * The proposed total fee for the closing transaction
47          */
48         public void set_fee_satoshis(long val) {
49                 bindings.ClosingSigned_set_fee_satoshis(this.ptr, val);
50                 GC.KeepAlive(this);
51                 GC.KeepAlive(val);
52         }
53
54         /**
55          * A signature on the closing transaction
56          */
57         public byte[] get_signature() {
58                 byte[] ret = bindings.ClosingSigned_get_signature(this.ptr);
59                 GC.KeepAlive(this);
60                 return ret;
61         }
62
63         /**
64          * A signature on the closing transaction
65          */
66         public void set_signature(byte[] val) {
67                 bindings.ClosingSigned_set_signature(this.ptr, InternalUtils.check_arr_len(val, 64));
68                 GC.KeepAlive(this);
69                 GC.KeepAlive(val);
70         }
71
72         /**
73          * The minimum and maximum fees which the sender is willing to accept, provided only by new
74          * nodes.
75          * 
76          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
77          */
78         public ClosingSignedFeeRange get_fee_range() {
79                 long ret = bindings.ClosingSigned_get_fee_range(this.ptr);
80                 GC.KeepAlive(this);
81                 if (ret >= 0 && ret <= 4096) { return null; }
82                 org.ldk.structs.ClosingSignedFeeRange ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ClosingSignedFeeRange(null, ret); }
83                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
84                 return ret_hu_conv;
85         }
86
87         /**
88          * The minimum and maximum fees which the sender is willing to accept, provided only by new
89          * nodes.
90          * 
91          * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
92          */
93         public void set_fee_range(org.ldk.structs.ClosingSignedFeeRange val) {
94                 bindings.ClosingSigned_set_fee_range(this.ptr, val == null ? 0 : val.ptr);
95                 GC.KeepAlive(this);
96                 GC.KeepAlive(val);
97                 if (this != null) { this.ptrs_to.AddLast(val); };
98         }
99
100         /**
101          * Constructs a new ClosingSigned given each field
102          */
103         public static ClosingSigned of(byte[] channel_id_arg, long fee_satoshis_arg, byte[] signature_arg, org.ldk.structs.ClosingSignedFeeRange fee_range_arg) {
104                 long ret = bindings.ClosingSigned_new(InternalUtils.check_arr_len(channel_id_arg, 32), fee_satoshis_arg, InternalUtils.check_arr_len(signature_arg, 64), fee_range_arg == null ? 0 : fee_range_arg.ptr);
105                 GC.KeepAlive(channel_id_arg);
106                 GC.KeepAlive(fee_satoshis_arg);
107                 GC.KeepAlive(signature_arg);
108                 GC.KeepAlive(fee_range_arg);
109                 if (ret >= 0 && ret <= 4096) { return null; }
110                 org.ldk.structs.ClosingSigned ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ClosingSigned(null, ret); }
111                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
112                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(fee_range_arg); };
113                 return ret_hu_conv;
114         }
115
116         internal long clone_ptr() {
117                 long ret = bindings.ClosingSigned_clone_ptr(this.ptr);
118                 GC.KeepAlive(this);
119                 return ret;
120         }
121
122         /**
123          * Creates a copy of the ClosingSigned
124          */
125         public ClosingSigned clone() {
126                 long ret = bindings.ClosingSigned_clone(this.ptr);
127                 GC.KeepAlive(this);
128                 if (ret >= 0 && ret <= 4096) { return null; }
129                 org.ldk.structs.ClosingSigned ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ClosingSigned(null, ret); }
130                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
131                 return ret_hu_conv;
132         }
133
134         /**
135          * Checks if two ClosingSigneds contain equal inner contents.
136          * This ignores pointers and is_owned flags and looks at the values in fields.
137          * Two objects with NULL inner values will be considered "equal" here.
138          */
139         public bool eq(org.ldk.structs.ClosingSigned b) {
140                 bool ret = bindings.ClosingSigned_eq(this.ptr, b == null ? 0 : b.ptr);
141                 GC.KeepAlive(this);
142                 GC.KeepAlive(b);
143                 if (this != null) { this.ptrs_to.AddLast(b); };
144                 return ret;
145         }
146
147         public override bool Equals(object o) {
148                 if (!(o is ClosingSigned)) return false;
149                 return this.eq((ClosingSigned)o);
150         }
151         /**
152          * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read
153          */
154         public byte[] write() {
155                 byte[] ret = bindings.ClosingSigned_write(this.ptr);
156                 GC.KeepAlive(this);
157                 return ret;
158         }
159
160         /**
161          * Read a ClosingSigned from a byte array, created by ClosingSigned_write
162          */
163         public static Result_ClosingSignedDecodeErrorZ read(byte[] ser) {
164                 long ret = bindings.ClosingSigned_read(ser);
165                 GC.KeepAlive(ser);
166                 if (ret >= 0 && ret <= 4096) { return null; }
167                 Result_ClosingSignedDecodeErrorZ ret_hu_conv = Result_ClosingSignedDecodeErrorZ.constr_from_ptr(ret);
168                 return ret_hu_conv;
169         }
170
171 }
172 } } }