[C#] Update auto-generated files
[ldk-java] / c_sharp / src / org / ldk / structs / ChannelAnnouncement.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 [`channel_announcement`] message to be sent to or received from a peer.
11  * 
12  * [`channel_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_announcement-message
13  */
14 public class ChannelAnnouncement : CommonBase {
15         internal ChannelAnnouncement(object _dummy, long ptr) : base(ptr) { }
16         ~ChannelAnnouncement() {
17                 if (ptr != 0) { bindings.ChannelAnnouncement_free(ptr); }
18         }
19
20         /**
21          * Authentication of the announcement by the first public node
22          */
23         public byte[] get_node_signature_1() {
24                 byte[] ret = bindings.ChannelAnnouncement_get_node_signature_1(this.ptr);
25                 GC.KeepAlive(this);
26                 return ret;
27         }
28
29         /**
30          * Authentication of the announcement by the first public node
31          */
32         public void set_node_signature_1(byte[] val) {
33                 bindings.ChannelAnnouncement_set_node_signature_1(this.ptr, InternalUtils.check_arr_len(val, 64));
34                 GC.KeepAlive(this);
35                 GC.KeepAlive(val);
36         }
37
38         /**
39          * Authentication of the announcement by the second public node
40          */
41         public byte[] get_node_signature_2() {
42                 byte[] ret = bindings.ChannelAnnouncement_get_node_signature_2(this.ptr);
43                 GC.KeepAlive(this);
44                 return ret;
45         }
46
47         /**
48          * Authentication of the announcement by the second public node
49          */
50         public void set_node_signature_2(byte[] val) {
51                 bindings.ChannelAnnouncement_set_node_signature_2(this.ptr, InternalUtils.check_arr_len(val, 64));
52                 GC.KeepAlive(this);
53                 GC.KeepAlive(val);
54         }
55
56         /**
57          * Proof of funding UTXO ownership by the first public node
58          */
59         public byte[] get_bitcoin_signature_1() {
60                 byte[] ret = bindings.ChannelAnnouncement_get_bitcoin_signature_1(this.ptr);
61                 GC.KeepAlive(this);
62                 return ret;
63         }
64
65         /**
66          * Proof of funding UTXO ownership by the first public node
67          */
68         public void set_bitcoin_signature_1(byte[] val) {
69                 bindings.ChannelAnnouncement_set_bitcoin_signature_1(this.ptr, InternalUtils.check_arr_len(val, 64));
70                 GC.KeepAlive(this);
71                 GC.KeepAlive(val);
72         }
73
74         /**
75          * Proof of funding UTXO ownership by the second public node
76          */
77         public byte[] get_bitcoin_signature_2() {
78                 byte[] ret = bindings.ChannelAnnouncement_get_bitcoin_signature_2(this.ptr);
79                 GC.KeepAlive(this);
80                 return ret;
81         }
82
83         /**
84          * Proof of funding UTXO ownership by the second public node
85          */
86         public void set_bitcoin_signature_2(byte[] val) {
87                 bindings.ChannelAnnouncement_set_bitcoin_signature_2(this.ptr, InternalUtils.check_arr_len(val, 64));
88                 GC.KeepAlive(this);
89                 GC.KeepAlive(val);
90         }
91
92         /**
93          * The actual announcement
94          */
95         public UnsignedChannelAnnouncement get_contents() {
96                 long ret = bindings.ChannelAnnouncement_get_contents(this.ptr);
97                 GC.KeepAlive(this);
98                 if (ret >= 0 && ret <= 4096) { return null; }
99                 org.ldk.structs.UnsignedChannelAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UnsignedChannelAnnouncement(null, ret); }
100                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
101                 return ret_hu_conv;
102         }
103
104         /**
105          * The actual announcement
106          */
107         public void set_contents(org.ldk.structs.UnsignedChannelAnnouncement val) {
108                 bindings.ChannelAnnouncement_set_contents(this.ptr, val == null ? 0 : val.ptr);
109                 GC.KeepAlive(this);
110                 GC.KeepAlive(val);
111                 if (this != null) { this.ptrs_to.AddLast(val); };
112         }
113
114         /**
115          * Constructs a new ChannelAnnouncement given each field
116          */
117         public static ChannelAnnouncement of(byte[] node_signature_1_arg, byte[] node_signature_2_arg, byte[] bitcoin_signature_1_arg, byte[] bitcoin_signature_2_arg, org.ldk.structs.UnsignedChannelAnnouncement contents_arg) {
118                 long ret = bindings.ChannelAnnouncement_new(InternalUtils.check_arr_len(node_signature_1_arg, 64), InternalUtils.check_arr_len(node_signature_2_arg, 64), InternalUtils.check_arr_len(bitcoin_signature_1_arg, 64), InternalUtils.check_arr_len(bitcoin_signature_2_arg, 64), contents_arg == null ? 0 : contents_arg.ptr);
119                 GC.KeepAlive(node_signature_1_arg);
120                 GC.KeepAlive(node_signature_2_arg);
121                 GC.KeepAlive(bitcoin_signature_1_arg);
122                 GC.KeepAlive(bitcoin_signature_2_arg);
123                 GC.KeepAlive(contents_arg);
124                 if (ret >= 0 && ret <= 4096) { return null; }
125                 org.ldk.structs.ChannelAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelAnnouncement(null, ret); }
126                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
127                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(contents_arg); };
128                 return ret_hu_conv;
129         }
130
131         internal long clone_ptr() {
132                 long ret = bindings.ChannelAnnouncement_clone_ptr(this.ptr);
133                 GC.KeepAlive(this);
134                 return ret;
135         }
136
137         /**
138          * Creates a copy of the ChannelAnnouncement
139          */
140         public ChannelAnnouncement clone() {
141                 long ret = bindings.ChannelAnnouncement_clone(this.ptr);
142                 GC.KeepAlive(this);
143                 if (ret >= 0 && ret <= 4096) { return null; }
144                 org.ldk.structs.ChannelAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelAnnouncement(null, ret); }
145                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
146                 return ret_hu_conv;
147         }
148
149         /**
150          * Checks if two ChannelAnnouncements contain equal inner contents.
151          * This ignores pointers and is_owned flags and looks at the values in fields.
152          * Two objects with NULL inner values will be considered "equal" here.
153          */
154         public bool eq(org.ldk.structs.ChannelAnnouncement b) {
155                 bool ret = bindings.ChannelAnnouncement_eq(this.ptr, b == null ? 0 : b.ptr);
156                 GC.KeepAlive(this);
157                 GC.KeepAlive(b);
158                 if (this != null) { this.ptrs_to.AddLast(b); };
159                 return ret;
160         }
161
162         public override bool Equals(object o) {
163                 if (!(o is ChannelAnnouncement)) return false;
164                 return this.eq((ChannelAnnouncement)o);
165         }
166         /**
167          * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read
168          */
169         public byte[] write() {
170                 byte[] ret = bindings.ChannelAnnouncement_write(this.ptr);
171                 GC.KeepAlive(this);
172                 return ret;
173         }
174
175         /**
176          * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write
177          */
178         public static Result_ChannelAnnouncementDecodeErrorZ read(byte[] ser) {
179                 long ret = bindings.ChannelAnnouncement_read(ser);
180                 GC.KeepAlive(ser);
181                 if (ret >= 0 && ret <= 4096) { return null; }
182                 Result_ChannelAnnouncementDecodeErrorZ ret_hu_conv = Result_ChannelAnnouncementDecodeErrorZ.constr_from_ptr(ret);
183                 return ret_hu_conv;
184         }
185
186 }
187 } } }