Update auto-updated Java files
[ldk-java] / src / main / java / org / ldk / structs / UnsignedChannelAnnouncement.java
1 package org.ldk.structs;
2
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
5 import org.ldk.util.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
9
10
11 /**
12  * The unsigned part of a channel_announcement
13  */
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class UnsignedChannelAnnouncement extends CommonBase {
16         UnsignedChannelAnnouncement(Object _dummy, long ptr) { super(ptr); }
17         @Override @SuppressWarnings("deprecation")
18         protected void finalize() throws Throwable {
19                 super.finalize();
20                 if (ptr != 0) { bindings.UnsignedChannelAnnouncement_free(ptr); }
21         }
22
23         /**
24          * The advertised channel features
25          */
26         public ChannelFeatures get_features() {
27                 long ret = bindings.UnsignedChannelAnnouncement_get_features(this.ptr);
28                 Reference.reachabilityFence(this);
29                 if (ret >= 0 && ret <= 4096) { return null; }
30                 ChannelFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelFeatures(null, ret); }
31                 ret_hu_conv.ptrs_to.add(this);
32                 return ret_hu_conv;
33         }
34
35         /**
36          * The advertised channel features
37          */
38         public void set_features(ChannelFeatures val) {
39                 bindings.UnsignedChannelAnnouncement_set_features(this.ptr, val == null ? 0 : val.ptr & ~1);
40                 Reference.reachabilityFence(this);
41                 Reference.reachabilityFence(val);
42         }
43
44         /**
45          * The genesis hash of the blockchain where the channel is to be opened
46          */
47         public byte[] get_chain_hash() {
48                 byte[] ret = bindings.UnsignedChannelAnnouncement_get_chain_hash(this.ptr);
49                 Reference.reachabilityFence(this);
50                 return ret;
51         }
52
53         /**
54          * The genesis hash of the blockchain where the channel is to be opened
55          */
56         public void set_chain_hash(byte[] val) {
57                 bindings.UnsignedChannelAnnouncement_set_chain_hash(this.ptr, InternalUtils.check_arr_len(val, 32));
58                 Reference.reachabilityFence(this);
59                 Reference.reachabilityFence(val);
60         }
61
62         /**
63          * The short channel ID
64          */
65         public long get_short_channel_id() {
66                 long ret = bindings.UnsignedChannelAnnouncement_get_short_channel_id(this.ptr);
67                 Reference.reachabilityFence(this);
68                 return ret;
69         }
70
71         /**
72          * The short channel ID
73          */
74         public void set_short_channel_id(long val) {
75                 bindings.UnsignedChannelAnnouncement_set_short_channel_id(this.ptr, val);
76                 Reference.reachabilityFence(this);
77                 Reference.reachabilityFence(val);
78         }
79
80         /**
81          * One of the two node_ids which are endpoints of this channel
82          */
83         public byte[] get_node_id_1() {
84                 byte[] ret = bindings.UnsignedChannelAnnouncement_get_node_id_1(this.ptr);
85                 Reference.reachabilityFence(this);
86                 return ret;
87         }
88
89         /**
90          * One of the two node_ids which are endpoints of this channel
91          */
92         public void set_node_id_1(byte[] val) {
93                 bindings.UnsignedChannelAnnouncement_set_node_id_1(this.ptr, InternalUtils.check_arr_len(val, 33));
94                 Reference.reachabilityFence(this);
95                 Reference.reachabilityFence(val);
96         }
97
98         /**
99          * The other of the two node_ids which are endpoints of this channel
100          */
101         public byte[] get_node_id_2() {
102                 byte[] ret = bindings.UnsignedChannelAnnouncement_get_node_id_2(this.ptr);
103                 Reference.reachabilityFence(this);
104                 return ret;
105         }
106
107         /**
108          * The other of the two node_ids which are endpoints of this channel
109          */
110         public void set_node_id_2(byte[] val) {
111                 bindings.UnsignedChannelAnnouncement_set_node_id_2(this.ptr, InternalUtils.check_arr_len(val, 33));
112                 Reference.reachabilityFence(this);
113                 Reference.reachabilityFence(val);
114         }
115
116         /**
117          * The funding key for the first node
118          */
119         public byte[] get_bitcoin_key_1() {
120                 byte[] ret = bindings.UnsignedChannelAnnouncement_get_bitcoin_key_1(this.ptr);
121                 Reference.reachabilityFence(this);
122                 return ret;
123         }
124
125         /**
126          * The funding key for the first node
127          */
128         public void set_bitcoin_key_1(byte[] val) {
129                 bindings.UnsignedChannelAnnouncement_set_bitcoin_key_1(this.ptr, InternalUtils.check_arr_len(val, 33));
130                 Reference.reachabilityFence(this);
131                 Reference.reachabilityFence(val);
132         }
133
134         /**
135          * The funding key for the second node
136          */
137         public byte[] get_bitcoin_key_2() {
138                 byte[] ret = bindings.UnsignedChannelAnnouncement_get_bitcoin_key_2(this.ptr);
139                 Reference.reachabilityFence(this);
140                 return ret;
141         }
142
143         /**
144          * The funding key for the second node
145          */
146         public void set_bitcoin_key_2(byte[] val) {
147                 bindings.UnsignedChannelAnnouncement_set_bitcoin_key_2(this.ptr, InternalUtils.check_arr_len(val, 33));
148                 Reference.reachabilityFence(this);
149                 Reference.reachabilityFence(val);
150         }
151
152         long clone_ptr() {
153                 long ret = bindings.UnsignedChannelAnnouncement_clone_ptr(this.ptr);
154                 Reference.reachabilityFence(this);
155                 return ret;
156         }
157
158         /**
159          * Creates a copy of the UnsignedChannelAnnouncement
160          */
161         public UnsignedChannelAnnouncement clone() {
162                 long ret = bindings.UnsignedChannelAnnouncement_clone(this.ptr);
163                 Reference.reachabilityFence(this);
164                 if (ret >= 0 && ret <= 4096) { return null; }
165                 UnsignedChannelAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new UnsignedChannelAnnouncement(null, ret); }
166                 ret_hu_conv.ptrs_to.add(this);
167                 return ret_hu_conv;
168         }
169
170         /**
171          * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
172          */
173         public byte[] write() {
174                 byte[] ret = bindings.UnsignedChannelAnnouncement_write(this.ptr);
175                 Reference.reachabilityFence(this);
176                 return ret;
177         }
178
179         /**
180          * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
181          */
182         public static Result_UnsignedChannelAnnouncementDecodeErrorZ read(byte[] ser) {
183                 long ret = bindings.UnsignedChannelAnnouncement_read(ser);
184                 Reference.reachabilityFence(ser);
185                 if (ret >= 0 && ret <= 4096) { return null; }
186                 Result_UnsignedChannelAnnouncementDecodeErrorZ ret_hu_conv = Result_UnsignedChannelAnnouncementDecodeErrorZ.constr_from_ptr(ret);
187                 return ret_hu_conv;
188         }
189
190 }