]> git.bitcoin.ninja Git - ldk-java/blob - ts/structs/ChannelInfo.ts
Merge pull request #20 from TheBlueMatt/main
[ldk-java] / ts / structs / ChannelInfo.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 ChannelInfo 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.ChannelInfo_free(this.ptr);
19                     }
20                 }
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);
25                 return ret_hu_conv;
26         }
27
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         }
32
33         public Uint8Array get_node_one() {
34                 Uint8Array ret = bindings.ChannelInfo_get_node_one(this.ptr);
35                 return ret;
36         }
37
38         public void set_node_one(Uint8Array val) {
39                 bindings.ChannelInfo_set_node_one(this.ptr, val);
40         }
41
42         public DirectionalChannelInfo get_one_to_two() {
43                 number ret = bindings.ChannelInfo_get_one_to_two(this.ptr);
44                 const ret_hu_conv: DirectionalChannelInfo = new DirectionalChannelInfo(null, ret);
45                 ret_hu_conv.ptrs_to.add(this);
46                 return ret_hu_conv;
47         }
48
49         public void set_one_to_two(DirectionalChannelInfo val) {
50                 bindings.ChannelInfo_set_one_to_two(this.ptr, val == null ? 0 : val.ptr & ~1);
51                 this.ptrs_to.add(val);
52         }
53
54         public Uint8Array get_node_two() {
55                 Uint8Array ret = bindings.ChannelInfo_get_node_two(this.ptr);
56                 return ret;
57         }
58
59         public void set_node_two(Uint8Array val) {
60                 bindings.ChannelInfo_set_node_two(this.ptr, val);
61         }
62
63         public DirectionalChannelInfo get_two_to_one() {
64                 number ret = bindings.ChannelInfo_get_two_to_one(this.ptr);
65                 const ret_hu_conv: DirectionalChannelInfo = new DirectionalChannelInfo(null, ret);
66                 ret_hu_conv.ptrs_to.add(this);
67                 return ret_hu_conv;
68         }
69
70         public void set_two_to_one(DirectionalChannelInfo val) {
71                 bindings.ChannelInfo_set_two_to_one(this.ptr, val == null ? 0 : val.ptr & ~1);
72                 this.ptrs_to.add(val);
73         }
74
75         public Option_u64Z get_capacity_sats() {
76                 number ret = bindings.ChannelInfo_get_capacity_sats(this.ptr);
77                 Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret);
78                 ret_hu_conv.ptrs_to.add(this);
79                 return ret_hu_conv;
80         }
81
82         public void set_capacity_sats(Option_u64Z val) {
83                 bindings.ChannelInfo_set_capacity_sats(this.ptr, val.ptr);
84         }
85
86         public ChannelAnnouncement get_announcement_message() {
87                 number ret = bindings.ChannelInfo_get_announcement_message(this.ptr);
88                 const ret_hu_conv: ChannelAnnouncement = new ChannelAnnouncement(null, ret);
89                 ret_hu_conv.ptrs_to.add(this);
90                 return ret_hu_conv;
91         }
92
93         public void set_announcement_message(ChannelAnnouncement val) {
94                 bindings.ChannelInfo_set_announcement_message(this.ptr, val == null ? 0 : val.ptr & ~1);
95                 this.ptrs_to.add(val);
96         }
97
98         public static ChannelInfo constructor_new(ChannelFeatures features_arg, Uint8Array node_one_arg, DirectionalChannelInfo one_to_two_arg, Uint8Array node_two_arg, DirectionalChannelInfo two_to_one_arg, Option_u64Z capacity_sats_arg, ChannelAnnouncement announcement_message_arg) {
99                 number ret = bindings.ChannelInfo_new(features_arg == null ? 0 : features_arg.ptr & ~1, node_one_arg, one_to_two_arg == null ? 0 : one_to_two_arg.ptr & ~1, node_two_arg, two_to_one_arg == null ? 0 : two_to_one_arg.ptr & ~1, capacity_sats_arg.ptr, announcement_message_arg == null ? 0 : announcement_message_arg.ptr & ~1);
100                 const ret_hu_conv: ChannelInfo = new ChannelInfo(null, ret);
101                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
102                 ret_hu_conv.ptrs_to.add(features_arg);
103                 ret_hu_conv.ptrs_to.add(one_to_two_arg);
104                 ret_hu_conv.ptrs_to.add(two_to_one_arg);
105                 ret_hu_conv.ptrs_to.add(announcement_message_arg);
106                 return ret_hu_conv;
107         }
108
109         public ChannelInfo clone() {
110                 number ret = bindings.ChannelInfo_clone(this.ptr);
111                 const ret_hu_conv: ChannelInfo = new ChannelInfo(null, ret);
112                 ret_hu_conv.ptrs_to.add(this);
113                 return ret_hu_conv;
114         }
115
116         public Uint8Array write() {
117                 Uint8Array ret = bindings.ChannelInfo_write(this.ptr);
118                 return ret;
119         }
120
121         public static Result_ChannelInfoDecodeErrorZ constructor_read(Uint8Array ser) {
122                 number ret = bindings.ChannelInfo_read(ser);
123                 Result_ChannelInfoDecodeErrorZ ret_hu_conv = Result_ChannelInfoDecodeErrorZ.constr_from_ptr(ret);
124                 return ret_hu_conv;
125         }
126
127 }