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