3 import CommonBase from './CommonBase';
4 import * as bindings from '../bindings' // TODO: figure out location
8 export default class ChannelInfo extends CommonBase {
9 constructor(_dummy: object, ptr: number) {
14 protected finalize() {
18 bindings.ChannelInfo_free(this.ptr);
21 public ChannelFeatures get_features() {
22 number ret = bindings.ChannelInfo_get_features(this.ptr);
23 const ret_hu_conv: ChannelFeatures = new ChannelFeatures(null, ret);
24 ret_hu_conv.ptrs_to.add(this);
28 public void set_features(ChannelFeatures val) {
29 bindings.ChannelInfo_set_features(this.ptr, val == null ? 0 : val.ptr & ~1);
30 this.ptrs_to.add(val);
31 // Due to rust's strict-ownership memory model, in some cases we need to "move"
32 // an object to pass exclusive ownership to the function being called.
33 // In most cases, we avoid this being visible in GC'd languages by cloning the object
34 // at the FFI layer, creating a new object which Rust can claim ownership of
35 // However, in some cases (eg here), there is no way to clone an object, and thus
36 // we actually have to pass full ownership to Rust.
37 // Thus, after this call, val is reset to null and is now a dummy object.
41 public Uint8Array get_node_one() {
42 Uint8Array ret = bindings.ChannelInfo_get_node_one(this.ptr);
46 public void set_node_one(Uint8Array val) {
47 bindings.ChannelInfo_set_node_one(this.ptr, val);
50 public DirectionalChannelInfo get_one_to_two() {
51 number ret = bindings.ChannelInfo_get_one_to_two(this.ptr);
52 const ret_hu_conv: DirectionalChannelInfo = new DirectionalChannelInfo(null, ret);
53 ret_hu_conv.ptrs_to.add(this);
57 public void set_one_to_two(DirectionalChannelInfo val) {
58 bindings.ChannelInfo_set_one_to_two(this.ptr, val == null ? 0 : val.ptr & ~1);
59 this.ptrs_to.add(val);
62 public Uint8Array get_node_two() {
63 Uint8Array ret = bindings.ChannelInfo_get_node_two(this.ptr);
67 public void set_node_two(Uint8Array val) {
68 bindings.ChannelInfo_set_node_two(this.ptr, val);
71 public DirectionalChannelInfo get_two_to_one() {
72 number ret = bindings.ChannelInfo_get_two_to_one(this.ptr);
73 const ret_hu_conv: DirectionalChannelInfo = new DirectionalChannelInfo(null, ret);
74 ret_hu_conv.ptrs_to.add(this);
78 public void set_two_to_one(DirectionalChannelInfo val) {
79 bindings.ChannelInfo_set_two_to_one(this.ptr, val == null ? 0 : val.ptr & ~1);
80 this.ptrs_to.add(val);
83 public ChannelAnnouncement get_announcement_message() {
84 number ret = bindings.ChannelInfo_get_announcement_message(this.ptr);
85 const ret_hu_conv: ChannelAnnouncement = new ChannelAnnouncement(null, ret);
86 ret_hu_conv.ptrs_to.add(this);
90 public void set_announcement_message(ChannelAnnouncement val) {
91 bindings.ChannelInfo_set_announcement_message(this.ptr, val == null ? 0 : val.ptr & ~1);
92 this.ptrs_to.add(val);
95 public Uint8Array write() {
96 Uint8Array ret = bindings.ChannelInfo_write(this.ptr);
100 public static ChannelInfo constructor_read(Uint8Array ser) {
101 number ret = bindings.ChannelInfo_read(ser);
102 const ret_hu_conv: ChannelInfo = new ChannelInfo(null, ret);
103 ret_hu_conv.ptrs_to.add(ret_hu_conv);