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