3 import CommonBase from './CommonBase';
4 import * as bindings from '../bindings' // TODO: figure out location
8 export default class NetGraphMsgHandler extends CommonBase {
9 constructor(_dummy: object, ptr: number) {
14 protected finalize() {
18 bindings.NetGraphMsgHandler_free(this.ptr);
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);
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);
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);
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);
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);
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);