1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
10 * The unsigned part of a node_announcement
12 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
13 public class UnsignedNodeAnnouncement extends CommonBase {
14 UnsignedNodeAnnouncement(Object _dummy, long ptr) { super(ptr); }
15 @Override @SuppressWarnings("deprecation")
16 protected void finalize() throws Throwable {
18 if (ptr != 0) { bindings.UnsignedNodeAnnouncement_free(ptr); }
22 * The advertised features
24 public NodeFeatures get_features() {
25 long ret = bindings.UnsignedNodeAnnouncement_get_features(this.ptr);
26 NodeFeatures ret_hu_conv = new NodeFeatures(null, ret);
27 ret_hu_conv.ptrs_to.add(this);
32 * The advertised features
34 public void set_features(NodeFeatures val) {
35 bindings.UnsignedNodeAnnouncement_set_features(this.ptr, val == null ? 0 : val.ptr & ~1);
36 this.ptrs_to.add(val);
40 * A strictly monotonic announcement counter, with gaps allowed
42 public int get_timestamp() {
43 int ret = bindings.UnsignedNodeAnnouncement_get_timestamp(this.ptr);
48 * A strictly monotonic announcement counter, with gaps allowed
50 public void set_timestamp(int val) {
51 bindings.UnsignedNodeAnnouncement_set_timestamp(this.ptr, val);
55 * The node_id this announcement originated from (don't rebroadcast the node_announcement back
58 public byte[] get_node_id() {
59 byte[] ret = bindings.UnsignedNodeAnnouncement_get_node_id(this.ptr);
64 * The node_id this announcement originated from (don't rebroadcast the node_announcement back
67 public void set_node_id(byte[] val) {
68 bindings.UnsignedNodeAnnouncement_set_node_id(this.ptr, val);
72 * An RGB color for UI purposes
74 public byte[] get_rgb() {
75 byte[] ret = bindings.UnsignedNodeAnnouncement_get_rgb(this.ptr);
80 * An RGB color for UI purposes
82 public void set_rgb(byte[] val) {
83 bindings.UnsignedNodeAnnouncement_set_rgb(this.ptr, val);
87 * An alias, for UI purposes. This should be sanitized before use. There is no guarantee
90 public byte[] get_alias() {
91 byte[] ret = bindings.UnsignedNodeAnnouncement_get_alias(this.ptr);
96 * An alias, for UI purposes. This should be sanitized before use. There is no guarantee
99 public void set_alias(byte[] val) {
100 bindings.UnsignedNodeAnnouncement_set_alias(this.ptr, val);
104 * List of addresses on which this node is reachable
106 public void set_addresses(NetAddress[] val) {
107 bindings.UnsignedNodeAnnouncement_set_addresses(this.ptr, Arrays.stream(val).mapToLong(val_conv_12 -> val_conv_12.ptr).toArray());
108 /* TODO 2 NetAddress */;
112 * Creates a copy of the UnsignedNodeAnnouncement
114 public UnsignedNodeAnnouncement clone() {
115 long ret = bindings.UnsignedNodeAnnouncement_clone(this.ptr);
116 UnsignedNodeAnnouncement ret_hu_conv = new UnsignedNodeAnnouncement(null, ret);
117 ret_hu_conv.ptrs_to.add(this);
122 * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
124 public byte[] write() {
125 byte[] ret = bindings.UnsignedNodeAnnouncement_write(this.ptr);
130 * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
132 public static Result_UnsignedNodeAnnouncementDecodeErrorZ read(byte[] ser) {
133 long ret = bindings.UnsignedNodeAnnouncement_read(ser);
134 Result_UnsignedNodeAnnouncementDecodeErrorZ ret_hu_conv = Result_UnsignedNodeAnnouncementDecodeErrorZ.constr_from_ptr(ret);