Update auto-generated bindings
[ldk-java] / src / main / java / org / ldk / structs / ChannelAnnouncement.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
8
9 /**
10  * A channel_announcement message to be sent or received from a peer
11  */
12 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
13 public class ChannelAnnouncement extends CommonBase {
14         ChannelAnnouncement(Object _dummy, long ptr) { super(ptr); }
15         @Override @SuppressWarnings("deprecation")
16         protected void finalize() throws Throwable {
17                 super.finalize();
18                 if (ptr != 0) { bindings.ChannelAnnouncement_free(ptr); }
19         }
20
21         /**
22          * Authentication of the announcement by the first public node
23          */
24         public byte[] get_node_signature_1() {
25                 byte[] ret = bindings.ChannelAnnouncement_get_node_signature_1(this.ptr);
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, val);
34         }
35
36         /**
37          * Authentication of the announcement by the second public node
38          */
39         public byte[] get_node_signature_2() {
40                 byte[] ret = bindings.ChannelAnnouncement_get_node_signature_2(this.ptr);
41                 return ret;
42         }
43
44         /**
45          * Authentication of the announcement by the second public node
46          */
47         public void set_node_signature_2(byte[] val) {
48                 bindings.ChannelAnnouncement_set_node_signature_2(this.ptr, val);
49         }
50
51         /**
52          * Proof of funding UTXO ownership by the first public node
53          */
54         public byte[] get_bitcoin_signature_1() {
55                 byte[] ret = bindings.ChannelAnnouncement_get_bitcoin_signature_1(this.ptr);
56                 return ret;
57         }
58
59         /**
60          * Proof of funding UTXO ownership by the first public node
61          */
62         public void set_bitcoin_signature_1(byte[] val) {
63                 bindings.ChannelAnnouncement_set_bitcoin_signature_1(this.ptr, val);
64         }
65
66         /**
67          * Proof of funding UTXO ownership by the second public node
68          */
69         public byte[] get_bitcoin_signature_2() {
70                 byte[] ret = bindings.ChannelAnnouncement_get_bitcoin_signature_2(this.ptr);
71                 return ret;
72         }
73
74         /**
75          * Proof of funding UTXO ownership by the second public node
76          */
77         public void set_bitcoin_signature_2(byte[] val) {
78                 bindings.ChannelAnnouncement_set_bitcoin_signature_2(this.ptr, val);
79         }
80
81         /**
82          * The actual announcement
83          */
84         public UnsignedChannelAnnouncement get_contents() {
85                 long ret = bindings.ChannelAnnouncement_get_contents(this.ptr);
86                 if (ret < 1024) { return null; }
87                 UnsignedChannelAnnouncement ret_hu_conv = new UnsignedChannelAnnouncement(null, ret);
88                 ret_hu_conv.ptrs_to.add(this);
89                 return ret_hu_conv;
90         }
91
92         /**
93          * The actual announcement
94          */
95         public void set_contents(UnsignedChannelAnnouncement val) {
96                 bindings.ChannelAnnouncement_set_contents(this.ptr, val == null ? 0 : val.ptr & ~1);
97                 this.ptrs_to.add(val);
98         }
99
100         /**
101          * Constructs a new ChannelAnnouncement given each field
102          */
103         public static ChannelAnnouncement of(byte[] node_signature_1_arg, byte[] node_signature_2_arg, byte[] bitcoin_signature_1_arg, byte[] bitcoin_signature_2_arg, UnsignedChannelAnnouncement contents_arg) {
104                 long ret = bindings.ChannelAnnouncement_new(node_signature_1_arg, node_signature_2_arg, bitcoin_signature_1_arg, bitcoin_signature_2_arg, contents_arg == null ? 0 : contents_arg.ptr & ~1);
105                 if (ret < 1024) { return null; }
106                 ChannelAnnouncement ret_hu_conv = new ChannelAnnouncement(null, ret);
107                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
108                 ret_hu_conv.ptrs_to.add(contents_arg);
109                 return ret_hu_conv;
110         }
111
112         /**
113          * Creates a copy of the ChannelAnnouncement
114          */
115         public ChannelAnnouncement clone() {
116                 long ret = bindings.ChannelAnnouncement_clone(this.ptr);
117                 if (ret < 1024) { return null; }
118                 ChannelAnnouncement ret_hu_conv = new ChannelAnnouncement(null, ret);
119                 ret_hu_conv.ptrs_to.add(this);
120                 return ret_hu_conv;
121         }
122
123         /**
124          * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read
125          */
126         public byte[] write() {
127                 byte[] ret = bindings.ChannelAnnouncement_write(this.ptr);
128                 return ret;
129         }
130
131         /**
132          * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write
133          */
134         public static Result_ChannelAnnouncementDecodeErrorZ read(byte[] ser) {
135                 long ret = bindings.ChannelAnnouncement_read(ser);
136                 if (ret < 1024) { return null; }
137                 Result_ChannelAnnouncementDecodeErrorZ ret_hu_conv = Result_ChannelAnnouncementDecodeErrorZ.constr_from_ptr(ret);
138                 return ret_hu_conv;
139         }
140
141 }