1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import javax.annotation.Nullable;
11 * The unsigned part of a channel_announcement
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 {
19 if (ptr != 0) { bindings.UnsignedChannelAnnouncement_free(ptr); }
23 * The advertised channel features
25 public ChannelFeatures get_features() {
26 long ret = bindings.UnsignedChannelAnnouncement_get_features(this.ptr);
27 if (ret >= 0 && ret <= 4096) { return null; }
28 ChannelFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelFeatures(null, ret); }
29 ret_hu_conv.ptrs_to.add(this);
34 * The advertised channel features
36 public void set_features(ChannelFeatures val) {
37 bindings.UnsignedChannelAnnouncement_set_features(this.ptr, val == null ? 0 : val.ptr & ~1);
41 * The genesis hash of the blockchain where the channel is to be opened
43 public byte[] get_chain_hash() {
44 byte[] ret = bindings.UnsignedChannelAnnouncement_get_chain_hash(this.ptr);
49 * The genesis hash of the blockchain where the channel is to be opened
51 public void set_chain_hash(byte[] val) {
52 bindings.UnsignedChannelAnnouncement_set_chain_hash(this.ptr, val);
56 * The short channel ID
58 public long get_short_channel_id() {
59 long ret = bindings.UnsignedChannelAnnouncement_get_short_channel_id(this.ptr);
64 * The short channel ID
66 public void set_short_channel_id(long val) {
67 bindings.UnsignedChannelAnnouncement_set_short_channel_id(this.ptr, val);
71 * One of the two node_ids which are endpoints of this channel
73 public byte[] get_node_id_1() {
74 byte[] ret = bindings.UnsignedChannelAnnouncement_get_node_id_1(this.ptr);
79 * One of the two node_ids which are endpoints of this channel
81 public void set_node_id_1(byte[] val) {
82 bindings.UnsignedChannelAnnouncement_set_node_id_1(this.ptr, val);
86 * The other of the two node_ids which are endpoints of this channel
88 public byte[] get_node_id_2() {
89 byte[] ret = bindings.UnsignedChannelAnnouncement_get_node_id_2(this.ptr);
94 * The other of the two node_ids which are endpoints of this channel
96 public void set_node_id_2(byte[] val) {
97 bindings.UnsignedChannelAnnouncement_set_node_id_2(this.ptr, val);
101 * The funding key for the first node
103 public byte[] get_bitcoin_key_1() {
104 byte[] ret = bindings.UnsignedChannelAnnouncement_get_bitcoin_key_1(this.ptr);
109 * The funding key for the first node
111 public void set_bitcoin_key_1(byte[] val) {
112 bindings.UnsignedChannelAnnouncement_set_bitcoin_key_1(this.ptr, val);
116 * The funding key for the second node
118 public byte[] get_bitcoin_key_2() {
119 byte[] ret = bindings.UnsignedChannelAnnouncement_get_bitcoin_key_2(this.ptr);
124 * The funding key for the second node
126 public void set_bitcoin_key_2(byte[] val) {
127 bindings.UnsignedChannelAnnouncement_set_bitcoin_key_2(this.ptr, val);
131 * Creates a copy of the UnsignedChannelAnnouncement
133 public UnsignedChannelAnnouncement clone() {
134 long ret = bindings.UnsignedChannelAnnouncement_clone(this.ptr);
135 if (ret >= 0 && ret <= 4096) { return null; }
136 UnsignedChannelAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new UnsignedChannelAnnouncement(null, ret); }
137 ret_hu_conv.ptrs_to.add(this);
142 * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
144 public byte[] write() {
145 byte[] ret = bindings.UnsignedChannelAnnouncement_write(this.ptr);
150 * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
152 public static Result_UnsignedChannelAnnouncementDecodeErrorZ read(byte[] ser) {
153 long ret = bindings.UnsignedChannelAnnouncement_read(ser);
154 if (ret >= 0 && ret <= 4096) { return null; }
155 Result_UnsignedChannelAnnouncementDecodeErrorZ ret_hu_conv = Result_UnsignedChannelAnnouncementDecodeErrorZ.constr_from_ptr(ret);