c874fc3be00e7297de7591cc485d372a67158739
[ldk-java] / ts / structs / UnsignedNodeAnnouncement.ts
1
2             
3 import CommonBase from './CommonBase';
4 import * as bindings from '../bindings' // TODO: figure out location
5
6
7
8             export default class UnsignedNodeAnnouncement extends CommonBase {
9                 constructor(_dummy: object, ptr: number) {
10                     super(ptr);
11                 }
12
13                 
14                 protected finalize() {
15                     super.finalize();
16
17                     if (this.ptr != 0) {
18                         bindings.UnsignedNodeAnnouncement_free(this.ptr);
19                     }
20                 }
21         public UnsignedNodeAnnouncement clone() {
22                 number ret = bindings.UnsignedNodeAnnouncement_clone(this.ptr);
23                 const ret_hu_conv: UnsignedNodeAnnouncement = new UnsignedNodeAnnouncement(null, ret);
24                 ret_hu_conv.ptrs_to.add(this);
25                 return ret_hu_conv;
26         }
27
28         public NodeFeatures get_features() {
29                 number ret = bindings.UnsignedNodeAnnouncement_get_features(this.ptr);
30                 const ret_hu_conv: NodeFeatures = new NodeFeatures(null, ret);
31                 ret_hu_conv.ptrs_to.add(this);
32                 return ret_hu_conv;
33         }
34
35         public void set_features(NodeFeatures val) {
36                 bindings.UnsignedNodeAnnouncement_set_features(this.ptr, val == null ? 0 : val.ptr & ~1);
37                 this.ptrs_to.add(val);
38                 // Due to rust's strict-ownership memory model, in some cases we need to "move"
39                 // an object to pass exclusive ownership to the function being called.
40                 // In most cases, we avoid this being visible in GC'd languages by cloning the object
41                 // at the FFI layer, creating a new object which Rust can claim ownership of
42                 // However, in some cases (eg here), there is no way to clone an object, and thus
43                 // we actually have to pass full ownership to Rust.
44                 // Thus, after this call, val is reset to null and is now a dummy object.
45                 val.ptr = 0;
46         }
47
48         public number get_timestamp() {
49                 number ret = bindings.UnsignedNodeAnnouncement_get_timestamp(this.ptr);
50                 return ret;
51         }
52
53         public void set_timestamp(number val) {
54                 bindings.UnsignedNodeAnnouncement_set_timestamp(this.ptr, val);
55         }
56
57         public Uint8Array get_node_id() {
58                 Uint8Array ret = bindings.UnsignedNodeAnnouncement_get_node_id(this.ptr);
59                 return ret;
60         }
61
62         public void set_node_id(Uint8Array val) {
63                 bindings.UnsignedNodeAnnouncement_set_node_id(this.ptr, val);
64         }
65
66         public Uint8Array get_rgb() {
67                 Uint8Array ret = bindings.UnsignedNodeAnnouncement_get_rgb(this.ptr);
68                 return ret;
69         }
70
71         public void set_rgb(Uint8Array val) {
72                 bindings.UnsignedNodeAnnouncement_set_rgb(this.ptr, val);
73         }
74
75         public Uint8Array get_alias() {
76                 Uint8Array ret = bindings.UnsignedNodeAnnouncement_get_alias(this.ptr);
77                 return ret;
78         }
79
80         public void set_alias(Uint8Array val) {
81                 bindings.UnsignedNodeAnnouncement_set_alias(this.ptr, val);
82         }
83
84         public void set_addresses(NetAddress[] val) {
85                 bindings.UnsignedNodeAnnouncement_set_addresses(this.ptr, (number[])Arrays.stream(val).map(arr_conv_12 -> arr_conv_12.ptr).toArray());
86                 /* TODO 2 NetAddress  */;
87         }
88
89         public Uint8Array write() {
90                 Uint8Array ret = bindings.UnsignedNodeAnnouncement_write(this.ptr);
91                 return ret;
92         }
93
94         public static Result_UnsignedNodeAnnouncementDecodeErrorZ constructor_read(Uint8Array ser) {
95                 number ret = bindings.UnsignedNodeAnnouncement_read(ser);
96                 Result_UnsignedNodeAnnouncementDecodeErrorZ ret_hu_conv = Result_UnsignedNodeAnnouncementDecodeErrorZ.constr_from_ptr(ret);
97                 return ret_hu_conv;
98         }
99
100 }