]> git.bitcoin.ninja Git - ldk-java/blob - ts/structs/NetGraphMsgHandler.ts
Merge pull request #20 from TheBlueMatt/main
[ldk-java] / ts / structs / NetGraphMsgHandler.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 NetGraphMsgHandler 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.NetGraphMsgHandler_free(this.ptr);
19                     }
20                 }
21         public static NetGraphMsgHandler constructor_new(Uint8Array genesis_hash, Access chain_access, Logger logger) {
22                 number ret = bindings.NetGraphMsgHandler_new(genesis_hash, chain_access == null ? 0 : chain_access.ptr, logger == null ? 0 : logger.ptr);
23                 const ret_hu_conv: NetGraphMsgHandler = new NetGraphMsgHandler(null, ret);
24                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
25                 ret_hu_conv.ptrs_to.add(chain_access);
26                 ret_hu_conv.ptrs_to.add(logger);
27                 return ret_hu_conv;
28         }
29
30         public static NetGraphMsgHandler constructor_from_net_graph(Access chain_access, Logger logger, NetworkGraph network_graph) {
31                 number ret = bindings.NetGraphMsgHandler_from_net_graph(chain_access == null ? 0 : chain_access.ptr, logger == null ? 0 : logger.ptr, network_graph == null ? 0 : network_graph.ptr & ~1);
32                 const ret_hu_conv: NetGraphMsgHandler = new NetGraphMsgHandler(null, ret);
33                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
34                 ret_hu_conv.ptrs_to.add(chain_access);
35                 ret_hu_conv.ptrs_to.add(logger);
36                 ret_hu_conv.ptrs_to.add(network_graph);
37                 return ret_hu_conv;
38         }
39
40         public void add_chain_access(Access chain_access) {
41                 bindings.NetGraphMsgHandler_add_chain_access(this.ptr, chain_access == null ? 0 : chain_access.ptr);
42                 this.ptrs_to.add(chain_access);
43         }
44
45         public LockedNetworkGraph read_locked_graph() {
46                 number ret = bindings.NetGraphMsgHandler_read_locked_graph(this.ptr);
47                 const ret_hu_conv: LockedNetworkGraph = new LockedNetworkGraph(null, ret);
48                 ret_hu_conv.ptrs_to.add(this);
49                 return ret_hu_conv;
50         }
51
52         public RoutingMessageHandler as_RoutingMessageHandler() {
53                 number ret = bindings.NetGraphMsgHandler_as_RoutingMessageHandler(this.ptr);
54                 RoutingMessageHandler ret_hu_conv = new RoutingMessageHandler(null, ret);
55                 ret_hu_conv.ptrs_to.add(this);
56                 return ret_hu_conv;
57         }
58
59         public MessageSendEventsProvider as_MessageSendEventsProvider() {
60                 number ret = bindings.NetGraphMsgHandler_as_MessageSendEventsProvider(this.ptr);
61                 MessageSendEventsProvider ret_hu_conv = new MessageSendEventsProvider(null, ret);
62                 ret_hu_conv.ptrs_to.add(this);
63                 return ret_hu_conv;
64         }
65
66 }