]> git.bitcoin.ninja Git - ldk-java/blob - ts/structs/NetworkGraph.ts
Merge pull request #14 from TheBlueMatt/2021-03-fix-enums
[ldk-java] / ts / structs / NetworkGraph.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 NetworkGraph 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.NetworkGraph_free(this.ptr);
19                     }
20                 }
21         public NetworkGraph clone() {
22                 number ret = bindings.NetworkGraph_clone(this.ptr);
23                 const ret_hu_conv: NetworkGraph = new NetworkGraph(null, ret);
24                 ret_hu_conv.ptrs_to.add(this);
25                 return ret_hu_conv;
26         }
27
28         public Uint8Array write() {
29                 Uint8Array ret = bindings.NetworkGraph_write(this.ptr);
30                 return ret;
31         }
32
33         public static Result_NetworkGraphDecodeErrorZ constructor_read(Uint8Array ser) {
34                 number ret = bindings.NetworkGraph_read(ser);
35                 Result_NetworkGraphDecodeErrorZ ret_hu_conv = Result_NetworkGraphDecodeErrorZ.constr_from_ptr(ret);
36                 return ret_hu_conv;
37         }
38
39         public static NetworkGraph constructor_new(Uint8Array genesis_hash) {
40                 number ret = bindings.NetworkGraph_new(genesis_hash);
41                 const ret_hu_conv: NetworkGraph = new NetworkGraph(null, ret);
42                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
43                 return ret_hu_conv;
44         }
45
46         public Result_NoneLightningErrorZ update_node_from_announcement(NodeAnnouncement msg) {
47                 number ret = bindings.NetworkGraph_update_node_from_announcement(this.ptr, msg == null ? 0 : msg.ptr & ~1);
48                 Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret);
49                 this.ptrs_to.add(msg);
50                 return ret_hu_conv;
51         }
52
53         public Result_NoneLightningErrorZ update_node_from_unsigned_announcement(UnsignedNodeAnnouncement msg) {
54                 number ret = bindings.NetworkGraph_update_node_from_unsigned_announcement(this.ptr, msg == null ? 0 : msg.ptr & ~1);
55                 Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret);
56                 this.ptrs_to.add(msg);
57                 return ret_hu_conv;
58         }
59
60         public Result_NoneLightningErrorZ update_channel_from_announcement(ChannelAnnouncement msg, Access chain_access) {
61                 number ret = bindings.NetworkGraph_update_channel_from_announcement(this.ptr, msg == null ? 0 : msg.ptr & ~1, chain_access == null ? 0 : chain_access.ptr);
62                 Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret);
63                 this.ptrs_to.add(msg);
64                 this.ptrs_to.add(chain_access);
65                 return ret_hu_conv;
66         }
67
68         public Result_NoneLightningErrorZ update_channel_from_unsigned_announcement(UnsignedChannelAnnouncement msg, Access chain_access) {
69                 number ret = bindings.NetworkGraph_update_channel_from_unsigned_announcement(this.ptr, msg == null ? 0 : msg.ptr & ~1, chain_access == null ? 0 : chain_access.ptr);
70                 Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret);
71                 this.ptrs_to.add(msg);
72                 this.ptrs_to.add(chain_access);
73                 return ret_hu_conv;
74         }
75
76         public void close_channel_from_update(number short_channel_id, boolean is_permanent) {
77                 bindings.NetworkGraph_close_channel_from_update(this.ptr, short_channel_id, is_permanent);
78         }
79
80         public Result_NoneLightningErrorZ update_channel(ChannelUpdate msg) {
81                 number ret = bindings.NetworkGraph_update_channel(this.ptr, msg == null ? 0 : msg.ptr & ~1);
82                 Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret);
83                 this.ptrs_to.add(msg);
84                 return ret_hu_conv;
85         }
86
87         public Result_NoneLightningErrorZ update_channel_unsigned(UnsignedChannelUpdate msg) {
88                 number ret = bindings.NetworkGraph_update_channel_unsigned(this.ptr, msg == null ? 0 : msg.ptr & ~1);
89                 Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret);
90                 this.ptrs_to.add(msg);
91                 return ret_hu_conv;
92         }
93
94 }