[C#] Update auto-generated files
[ldk-java] / c_sharp / src / org / ldk / structs / UnsignedChannelAnnouncement.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  * The unsigned part of a [`channel_announcement`] message.
11  * 
12  * [`channel_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_announcement-message
13  */
14 public class UnsignedChannelAnnouncement : CommonBase {
15         internal UnsignedChannelAnnouncement(object _dummy, long ptr) : base(ptr) { }
16         ~UnsignedChannelAnnouncement() {
17                 if (ptr != 0) { bindings.UnsignedChannelAnnouncement_free(ptr); }
18         }
19
20         /**
21          * The advertised channel features
22          */
23         public ChannelFeatures get_features() {
24                 long ret = bindings.UnsignedChannelAnnouncement_get_features(this.ptr);
25                 GC.KeepAlive(this);
26                 if (ret >= 0 && ret <= 4096) { return null; }
27                 org.ldk.structs.ChannelFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelFeatures(null, ret); }
28                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
29                 return ret_hu_conv;
30         }
31
32         /**
33          * The advertised channel features
34          */
35         public void set_features(org.ldk.structs.ChannelFeatures val) {
36                 bindings.UnsignedChannelAnnouncement_set_features(this.ptr, val == null ? 0 : val.ptr);
37                 GC.KeepAlive(this);
38                 GC.KeepAlive(val);
39                 if (this != null) { this.ptrs_to.AddLast(val); };
40         }
41
42         /**
43          * The genesis hash of the blockchain where the channel is to be opened
44          */
45         public byte[] get_chain_hash() {
46                 byte[] ret = bindings.UnsignedChannelAnnouncement_get_chain_hash(this.ptr);
47                 GC.KeepAlive(this);
48                 return ret;
49         }
50
51         /**
52          * The genesis hash of the blockchain where the channel is to be opened
53          */
54         public void set_chain_hash(byte[] val) {
55                 bindings.UnsignedChannelAnnouncement_set_chain_hash(this.ptr, InternalUtils.check_arr_len(val, 32));
56                 GC.KeepAlive(this);
57                 GC.KeepAlive(val);
58         }
59
60         /**
61          * The short channel ID
62          */
63         public long get_short_channel_id() {
64                 long ret = bindings.UnsignedChannelAnnouncement_get_short_channel_id(this.ptr);
65                 GC.KeepAlive(this);
66                 return ret;
67         }
68
69         /**
70          * The short channel ID
71          */
72         public void set_short_channel_id(long val) {
73                 bindings.UnsignedChannelAnnouncement_set_short_channel_id(this.ptr, val);
74                 GC.KeepAlive(this);
75                 GC.KeepAlive(val);
76         }
77
78         /**
79          * One of the two `node_id`s which are endpoints of this channel
80          */
81         public NodeId get_node_id_1() {
82                 long ret = bindings.UnsignedChannelAnnouncement_get_node_id_1(this.ptr);
83                 GC.KeepAlive(this);
84                 if (ret >= 0 && ret <= 4096) { return null; }
85                 org.ldk.structs.NodeId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeId(null, ret); }
86                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
87                 return ret_hu_conv;
88         }
89
90         /**
91          * One of the two `node_id`s which are endpoints of this channel
92          */
93         public void set_node_id_1(org.ldk.structs.NodeId val) {
94                 bindings.UnsignedChannelAnnouncement_set_node_id_1(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          * The other of the two `node_id`s which are endpoints of this channel
102          */
103         public NodeId get_node_id_2() {
104                 long ret = bindings.UnsignedChannelAnnouncement_get_node_id_2(this.ptr);
105                 GC.KeepAlive(this);
106                 if (ret >= 0 && ret <= 4096) { return null; }
107                 org.ldk.structs.NodeId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeId(null, ret); }
108                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
109                 return ret_hu_conv;
110         }
111
112         /**
113          * The other of the two `node_id`s which are endpoints of this channel
114          */
115         public void set_node_id_2(org.ldk.structs.NodeId val) {
116                 bindings.UnsignedChannelAnnouncement_set_node_id_2(this.ptr, val == null ? 0 : val.ptr);
117                 GC.KeepAlive(this);
118                 GC.KeepAlive(val);
119                 if (this != null) { this.ptrs_to.AddLast(val); };
120         }
121
122         /**
123          * The funding key for the first node
124          */
125         public NodeId get_bitcoin_key_1() {
126                 long ret = bindings.UnsignedChannelAnnouncement_get_bitcoin_key_1(this.ptr);
127                 GC.KeepAlive(this);
128                 if (ret >= 0 && ret <= 4096) { return null; }
129                 org.ldk.structs.NodeId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeId(null, ret); }
130                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
131                 return ret_hu_conv;
132         }
133
134         /**
135          * The funding key for the first node
136          */
137         public void set_bitcoin_key_1(org.ldk.structs.NodeId val) {
138                 bindings.UnsignedChannelAnnouncement_set_bitcoin_key_1(this.ptr, val == null ? 0 : val.ptr);
139                 GC.KeepAlive(this);
140                 GC.KeepAlive(val);
141                 if (this != null) { this.ptrs_to.AddLast(val); };
142         }
143
144         /**
145          * The funding key for the second node
146          */
147         public NodeId get_bitcoin_key_2() {
148                 long ret = bindings.UnsignedChannelAnnouncement_get_bitcoin_key_2(this.ptr);
149                 GC.KeepAlive(this);
150                 if (ret >= 0 && ret <= 4096) { return null; }
151                 org.ldk.structs.NodeId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeId(null, ret); }
152                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
153                 return ret_hu_conv;
154         }
155
156         /**
157          * The funding key for the second node
158          */
159         public void set_bitcoin_key_2(org.ldk.structs.NodeId val) {
160                 bindings.UnsignedChannelAnnouncement_set_bitcoin_key_2(this.ptr, val == null ? 0 : val.ptr);
161                 GC.KeepAlive(this);
162                 GC.KeepAlive(val);
163                 if (this != null) { this.ptrs_to.AddLast(val); };
164         }
165
166         internal long clone_ptr() {
167                 long ret = bindings.UnsignedChannelAnnouncement_clone_ptr(this.ptr);
168                 GC.KeepAlive(this);
169                 return ret;
170         }
171
172         /**
173          * Creates a copy of the UnsignedChannelAnnouncement
174          */
175         public UnsignedChannelAnnouncement clone() {
176                 long ret = bindings.UnsignedChannelAnnouncement_clone(this.ptr);
177                 GC.KeepAlive(this);
178                 if (ret >= 0 && ret <= 4096) { return null; }
179                 org.ldk.structs.UnsignedChannelAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UnsignedChannelAnnouncement(null, ret); }
180                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
181                 return ret_hu_conv;
182         }
183
184         /**
185          * Checks if two UnsignedChannelAnnouncements contain equal inner contents.
186          * This ignores pointers and is_owned flags and looks at the values in fields.
187          * Two objects with NULL inner values will be considered "equal" here.
188          */
189         public bool eq(org.ldk.structs.UnsignedChannelAnnouncement b) {
190                 bool ret = bindings.UnsignedChannelAnnouncement_eq(this.ptr, b == null ? 0 : b.ptr);
191                 GC.KeepAlive(this);
192                 GC.KeepAlive(b);
193                 if (this != null) { this.ptrs_to.AddLast(b); };
194                 return ret;
195         }
196
197         public override bool Equals(object o) {
198                 if (!(o is UnsignedChannelAnnouncement)) return false;
199                 return this.eq((UnsignedChannelAnnouncement)o);
200         }
201         /**
202          * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
203          */
204         public byte[] write() {
205                 byte[] ret = bindings.UnsignedChannelAnnouncement_write(this.ptr);
206                 GC.KeepAlive(this);
207                 return ret;
208         }
209
210         /**
211          * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
212          */
213         public static Result_UnsignedChannelAnnouncementDecodeErrorZ read(byte[] ser) {
214                 long ret = bindings.UnsignedChannelAnnouncement_read(ser);
215                 GC.KeepAlive(ser);
216                 if (ret >= 0 && ret <= 4096) { return null; }
217                 Result_UnsignedChannelAnnouncementDecodeErrorZ ret_hu_conv = Result_UnsignedChannelAnnouncementDecodeErrorZ.constr_from_ptr(ret);
218                 return ret_hu_conv;
219         }
220
221 }
222 } } }