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, Uint8Array network_graph_genesis_hash) {
31 number ret = bindings.NetGraphMsgHandler_from_net_graph(chain_access == null ? 0 : chain_access.ptr, logger == null ? 0 : logger.ptr, bindings.NetworkGraph_new(network_graph_genesis_hash));
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);
39 public LockedNetworkGraph read_locked_graph() {
40 number ret = bindings.NetGraphMsgHandler_read_locked_graph(this.ptr);
41 const ret_hu_conv: LockedNetworkGraph = new LockedNetworkGraph(null, ret);
42 ret_hu_conv.ptrs_to.add(this);
46 public RoutingMessageHandler as_RoutingMessageHandler() {
47 number ret = bindings.NetGraphMsgHandler_as_RoutingMessageHandler(this.ptr);
48 RoutingMessageHandler ret_hu_conv = new RoutingMessageHandler(null, ret);
49 ret_hu_conv.ptrs_to.add(this);
53 public MessageSendEventsProvider as_MessageSendEventsProvider() {
54 number ret = bindings.NetGraphMsgHandler_as_MessageSendEventsProvider(this.ptr);
55 MessageSendEventsProvider ret_hu_conv = new MessageSendEventsProvider(null, ret);
56 ret_hu_conv.ptrs_to.add(this);