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 < 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);
38 this.ptrs_to.add(val);
42 * A strictly monotonic announcement counter, with gaps allowed
44 public int get_timestamp() {
45 int ret = bindings.UnsignedNodeAnnouncement_get_timestamp(this.ptr);
50 * A strictly monotonic announcement counter, with gaps allowed
52 public void set_timestamp(int val) {
53 bindings.UnsignedNodeAnnouncement_set_timestamp(this.ptr, val);
57 * The node_id this announcement originated from (don't rebroadcast the node_announcement back
60 public byte[] get_node_id() {
61 byte[] ret = bindings.UnsignedNodeAnnouncement_get_node_id(this.ptr);
66 * The node_id this announcement originated from (don't rebroadcast the node_announcement back
69 public void set_node_id(byte[] val) {
70 bindings.UnsignedNodeAnnouncement_set_node_id(this.ptr, val);
74 * An RGB color for UI purposes
76 public byte[] get_rgb() {
77 byte[] ret = bindings.UnsignedNodeAnnouncement_get_rgb(this.ptr);
82 * An RGB color for UI purposes
84 public void set_rgb(byte[] val) {
85 bindings.UnsignedNodeAnnouncement_set_rgb(this.ptr, val);
89 * An alias, for UI purposes. This should be sanitized before use. There is no guarantee
92 public byte[] get_alias() {
93 byte[] ret = bindings.UnsignedNodeAnnouncement_get_alias(this.ptr);
98 * An alias, for UI purposes. This should be sanitized before use. There is no guarantee
101 public void set_alias(byte[] val) {
102 bindings.UnsignedNodeAnnouncement_set_alias(this.ptr, val);
106 * List of addresses on which this node is reachable
108 public void set_addresses(NetAddress[] val) {
109 bindings.UnsignedNodeAnnouncement_set_addresses(this.ptr, val != null ? Arrays.stream(val).mapToLong(val_conv_12 -> val_conv_12.ptr).toArray() : null);
110 /* TODO 2 NetAddress */;
114 * Creates a copy of the UnsignedNodeAnnouncement
116 public UnsignedNodeAnnouncement clone() {
117 long ret = bindings.UnsignedNodeAnnouncement_clone(this.ptr);
118 if (ret < 1024) { return null; }
119 UnsignedNodeAnnouncement ret_hu_conv = new UnsignedNodeAnnouncement(null, ret);
120 ret_hu_conv.ptrs_to.add(this);
125 * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
127 public byte[] write() {
128 byte[] ret = bindings.UnsignedNodeAnnouncement_write(this.ptr);
133 * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
135 public static Result_UnsignedNodeAnnouncementDecodeErrorZ read(byte[] ser) {
136 long ret = bindings.UnsignedNodeAnnouncement_read(ser);
137 if (ret < 1024) { return null; }
138 Result_UnsignedNodeAnnouncementDecodeErrorZ ret_hu_conv = Result_UnsignedNodeAnnouncementDecodeErrorZ.constr_from_ptr(ret);