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 node_announcement
13 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
14 public class UnsignedNodeAnnouncement extends CommonBase {
15 UnsignedNodeAnnouncement(Object _dummy, long ptr) { super(ptr); }
16 @Override @SuppressWarnings("deprecation")
17 protected void finalize() throws Throwable {
19 if (ptr != 0) { bindings.UnsignedNodeAnnouncement_free(ptr); }
23 * The advertised features
25 public NodeFeatures get_features() {
26 long ret = bindings.UnsignedNodeAnnouncement_get_features(this.ptr);
27 if (ret >= 0 && ret < 1024) { return null; }
28 NodeFeatures ret_hu_conv = new NodeFeatures(null, ret);
29 ret_hu_conv.ptrs_to.add(this);
34 * The advertised features
36 public void set_features(NodeFeatures val) {
37 bindings.UnsignedNodeAnnouncement_set_features(this.ptr, val == null ? 0 : val.ptr & ~1);
41 * A strictly monotonic announcement counter, with gaps allowed
43 public int get_timestamp() {
44 int ret = bindings.UnsignedNodeAnnouncement_get_timestamp(this.ptr);
49 * A strictly monotonic announcement counter, with gaps allowed
51 public void set_timestamp(int val) {
52 bindings.UnsignedNodeAnnouncement_set_timestamp(this.ptr, val);
56 * The node_id this announcement originated from (don't rebroadcast the node_announcement back
59 public byte[] get_node_id() {
60 byte[] ret = bindings.UnsignedNodeAnnouncement_get_node_id(this.ptr);
65 * The node_id this announcement originated from (don't rebroadcast the node_announcement back
68 public void set_node_id(byte[] val) {
69 bindings.UnsignedNodeAnnouncement_set_node_id(this.ptr, val);
73 * An RGB color for UI purposes
75 public byte[] get_rgb() {
76 byte[] ret = bindings.UnsignedNodeAnnouncement_get_rgb(this.ptr);
81 * An RGB color for UI purposes
83 public void set_rgb(byte[] val) {
84 bindings.UnsignedNodeAnnouncement_set_rgb(this.ptr, val);
88 * An alias, for UI purposes. This should be sanitized before use. There is no guarantee
91 public byte[] get_alias() {
92 byte[] ret = bindings.UnsignedNodeAnnouncement_get_alias(this.ptr);
97 * An alias, for UI purposes. This should be sanitized before use. There is no guarantee
100 public void set_alias(byte[] val) {
101 bindings.UnsignedNodeAnnouncement_set_alias(this.ptr, val);
105 * List of addresses on which this node is reachable
107 public void set_addresses(NetAddress[] val) {
108 bindings.UnsignedNodeAnnouncement_set_addresses(this.ptr, val != null ? Arrays.stream(val).mapToLong(val_conv_12 -> val_conv_12.ptr).toArray() : null);
112 * Creates a copy of the UnsignedNodeAnnouncement
114 public UnsignedNodeAnnouncement clone() {
115 long ret = bindings.UnsignedNodeAnnouncement_clone(this.ptr);
116 if (ret >= 0 && ret < 1024) { return null; }
117 UnsignedNodeAnnouncement ret_hu_conv = new UnsignedNodeAnnouncement(null, ret);
118 ret_hu_conv.ptrs_to.add(this);
123 * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
125 public byte[] write() {
126 byte[] ret = bindings.UnsignedNodeAnnouncement_write(this.ptr);
131 * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
133 public static Result_UnsignedNodeAnnouncementDecodeErrorZ read(byte[] ser) {
134 long ret = bindings.UnsignedNodeAnnouncement_read(ser);
135 if (ret >= 0 && ret < 1024) { return null; }
136 Result_UnsignedNodeAnnouncementDecodeErrorZ ret_hu_conv = Result_UnsignedNodeAnnouncementDecodeErrorZ.constr_from_ptr(ret);