Merge pull request #33 from TheBlueMatt/main
[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 javax.annotation.Nullable;
8
9
10 /**
11  * The unsigned part of a channel_announcement
12  */
13 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
14 public class UnsignedChannelAnnouncement extends CommonBase {
15         UnsignedChannelAnnouncement(Object _dummy, long ptr) { super(ptr); }
16         @Override @SuppressWarnings("deprecation")
17         protected void finalize() throws Throwable {
18                 super.finalize();
19                 if (ptr != 0) { bindings.UnsignedChannelAnnouncement_free(ptr); }
20         }
21
22         /**
23          * The advertised channel features
24          */
25         public ChannelFeatures get_features() {
26                 long ret = bindings.UnsignedChannelAnnouncement_get_features(this.ptr);
27                 if (ret < 1024) { return null; }
28                 ChannelFeatures ret_hu_conv = new ChannelFeatures(null, ret);
29                 ret_hu_conv.ptrs_to.add(this);
30                 return ret_hu_conv;
31         }
32
33         /**
34          * The advertised channel features
35          */
36         public void set_features(ChannelFeatures val) {
37                 bindings.UnsignedChannelAnnouncement_set_features(this.ptr, val == null ? 0 : val.ptr & ~1);
38                 this.ptrs_to.add(val);
39         }
40
41         /**
42          * The genesis hash of the blockchain where the channel is to be opened
43          */
44         public byte[] get_chain_hash() {
45                 byte[] ret = bindings.UnsignedChannelAnnouncement_get_chain_hash(this.ptr);
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, val);
54         }
55
56         /**
57          * The short channel ID
58          */
59         public long get_short_channel_id() {
60                 long ret = bindings.UnsignedChannelAnnouncement_get_short_channel_id(this.ptr);
61                 return ret;
62         }
63
64         /**
65          * The short channel ID
66          */
67         public void set_short_channel_id(long val) {
68                 bindings.UnsignedChannelAnnouncement_set_short_channel_id(this.ptr, val);
69         }
70
71         /**
72          * One of the two node_ids which are endpoints of this channel
73          */
74         public byte[] get_node_id_1() {
75                 byte[] ret = bindings.UnsignedChannelAnnouncement_get_node_id_1(this.ptr);
76                 return ret;
77         }
78
79         /**
80          * One of the two node_ids which are endpoints of this channel
81          */
82         public void set_node_id_1(byte[] val) {
83                 bindings.UnsignedChannelAnnouncement_set_node_id_1(this.ptr, val);
84         }
85
86         /**
87          * The other of the two node_ids which are endpoints of this channel
88          */
89         public byte[] get_node_id_2() {
90                 byte[] ret = bindings.UnsignedChannelAnnouncement_get_node_id_2(this.ptr);
91                 return ret;
92         }
93
94         /**
95          * The other of the two node_ids which are endpoints of this channel
96          */
97         public void set_node_id_2(byte[] val) {
98                 bindings.UnsignedChannelAnnouncement_set_node_id_2(this.ptr, val);
99         }
100
101         /**
102          * The funding key for the first node
103          */
104         public byte[] get_bitcoin_key_1() {
105                 byte[] ret = bindings.UnsignedChannelAnnouncement_get_bitcoin_key_1(this.ptr);
106                 return ret;
107         }
108
109         /**
110          * The funding key for the first node
111          */
112         public void set_bitcoin_key_1(byte[] val) {
113                 bindings.UnsignedChannelAnnouncement_set_bitcoin_key_1(this.ptr, val);
114         }
115
116         /**
117          * The funding key for the second node
118          */
119         public byte[] get_bitcoin_key_2() {
120                 byte[] ret = bindings.UnsignedChannelAnnouncement_get_bitcoin_key_2(this.ptr);
121                 return ret;
122         }
123
124         /**
125          * The funding key for the second node
126          */
127         public void set_bitcoin_key_2(byte[] val) {
128                 bindings.UnsignedChannelAnnouncement_set_bitcoin_key_2(this.ptr, val);
129         }
130
131         /**
132          * Creates a copy of the UnsignedChannelAnnouncement
133          */
134         public UnsignedChannelAnnouncement clone() {
135                 long ret = bindings.UnsignedChannelAnnouncement_clone(this.ptr);
136                 if (ret < 1024) { return null; }
137                 UnsignedChannelAnnouncement ret_hu_conv = new UnsignedChannelAnnouncement(null, ret);
138                 ret_hu_conv.ptrs_to.add(this);
139                 return ret_hu_conv;
140         }
141
142         /**
143          * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
144          */
145         public byte[] write() {
146                 byte[] ret = bindings.UnsignedChannelAnnouncement_write(this.ptr);
147                 return ret;
148         }
149
150         /**
151          * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
152          */
153         public static Result_UnsignedChannelAnnouncementDecodeErrorZ read(byte[] ser) {
154                 long ret = bindings.UnsignedChannelAnnouncement_read(ser);
155                 if (ret < 1024) { return null; }
156                 Result_UnsignedChannelAnnouncementDecodeErrorZ ret_hu_conv = Result_UnsignedChannelAnnouncementDecodeErrorZ.constr_from_ptr(ret);
157                 return ret_hu_conv;
158         }
159
160 }