import * as bindings from '../bindings.mjs'
+/**
+ * Receives and validates network updates from peers,
+ * stores authentic and relevant data as a network graph.
+ * This network graph is then used for routing payments.
+ * Provides interface to help with initial routing sync by
+ * serving historical announcements.
+ *
+ * Serves as an [`EventHandler`] for applying updates from [`Event::PaymentPathFailed`] to the
+ * [`NetworkGraph`].
+ */
export class NetGraphMsgHandler extends CommonBase {
/* @internal */
public constructor(_dummy: object, ptr: number) {
super(ptr, bindings.NetGraphMsgHandler_free);
}
+ /**
+ * Constructs a new EventHandler which calls the relevant methods on this_arg.
+ * This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is
+ */
public as_EventHandler(): EventHandler {
const ret: number = bindings.NetGraphMsgHandler_as_EventHandler(this.ptr);
const ret_hu_conv: EventHandler = new EventHandler(null, ret);
return ret_hu_conv;
}
+ /**
+ * Creates a new tracker of the actual state of the network of channels and nodes,
+ * assuming an existing Network Graph.
+ * Chain monitor is used to make sure announced channels exist on-chain,
+ * channel data is correct, and that the announcement is signed with
+ * channel owners' keys.
+ */
public static constructor_new(network_graph: NetworkGraph, chain_access: Option_AccessZ, logger: Logger): NetGraphMsgHandler {
const ret: number = bindings.NetGraphMsgHandler_new(network_graph == null ? 0 : CommonBase.get_ptr_of(network_graph) & ~1, CommonBase.get_ptr_of(chain_access), logger == null ? 0 : CommonBase.get_ptr_of(logger));
const ret_hu_conv: NetGraphMsgHandler = new NetGraphMsgHandler(null, ret);
return ret_hu_conv;
}
+ /**
+ * Adds a provider used to check new announcements. Does not affect
+ * existing announcements unless they are updated.
+ * Add, update or remove the provider would replace the current one.
+ */
public add_chain_access(chain_access: Option_AccessZ): void {
bindings.NetGraphMsgHandler_add_chain_access(this.ptr, CommonBase.get_ptr_of(chain_access));
CommonBase.add_ref_from(this, chain_access);
}
+ /**
+ * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
+ * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
+ */
public as_RoutingMessageHandler(): RoutingMessageHandler {
const ret: number = bindings.NetGraphMsgHandler_as_RoutingMessageHandler(this.ptr);
const ret_hu_conv: RoutingMessageHandler = new RoutingMessageHandler(null, ret);
return ret_hu_conv;
}
+ /**
+ * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
+ * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
+ */
public as_MessageSendEventsProvider(): MessageSendEventsProvider {
const ret: number = bindings.NetGraphMsgHandler_as_MessageSendEventsProvider(this.ptr);
const ret_hu_conv: MessageSendEventsProvider = new MessageSendEventsProvider(null, ret);