3 import CommonBase from './CommonBase';
4 import * as bindings from '../bindings' // TODO: figure out location
8 export default class NetworkGraph extends CommonBase {
9 constructor(_dummy: object, ptr: number) {
14 protected finalize() {
18 bindings.NetworkGraph_free(this.ptr);
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);
28 public Uint8Array write() {
29 Uint8Array ret = bindings.NetworkGraph_write(this.ptr);
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);
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);
46 public ReadOnlyNetworkGraph read_only() {
47 number ret = bindings.NetworkGraph_read_only(this.ptr);
48 const ret_hu_conv: ReadOnlyNetworkGraph = new ReadOnlyNetworkGraph(null, ret);
49 ret_hu_conv.ptrs_to.add(this);
53 public Result_NoneLightningErrorZ update_node_from_announcement(NodeAnnouncement msg) {
54 number ret = bindings.NetworkGraph_update_node_from_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);
60 public Result_NoneLightningErrorZ update_node_from_unsigned_announcement(UnsignedNodeAnnouncement msg) {
61 number ret = bindings.NetworkGraph_update_node_from_unsigned_announcement(this.ptr, msg == null ? 0 : msg.ptr & ~1);
62 Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret);
63 this.ptrs_to.add(msg);
67 public Result_NoneLightningErrorZ update_channel_from_announcement(ChannelAnnouncement msg, Option_AccessZ chain_access) {
68 number ret = bindings.NetworkGraph_update_channel_from_announcement(this.ptr, msg == null ? 0 : msg.ptr & ~1, chain_access.ptr);
69 Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret);
70 this.ptrs_to.add(msg);
74 public Result_NoneLightningErrorZ update_channel_from_unsigned_announcement(UnsignedChannelAnnouncement msg, Option_AccessZ chain_access) {
75 number ret = bindings.NetworkGraph_update_channel_from_unsigned_announcement(this.ptr, msg == null ? 0 : msg.ptr & ~1, chain_access.ptr);
76 Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret);
77 this.ptrs_to.add(msg);
81 public void close_channel_from_update(number short_channel_id, boolean is_permanent) {
82 bindings.NetworkGraph_close_channel_from_update(this.ptr, short_channel_id, is_permanent);
85 public void fail_node(Uint8Array _node_id, boolean is_permanent) {
86 bindings.NetworkGraph_fail_node(this.ptr, _node_id, is_permanent);
89 public Result_NoneLightningErrorZ update_channel(ChannelUpdate msg) {
90 number ret = bindings.NetworkGraph_update_channel(this.ptr, msg == null ? 0 : msg.ptr & ~1);
91 Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret);
92 this.ptrs_to.add(msg);
96 public Result_NoneLightningErrorZ update_channel_unsigned(UnsignedChannelUpdate msg) {
97 number ret = bindings.NetworkGraph_update_channel_unsigned(this.ptr, msg == null ? 0 : msg.ptr & ~1);
98 Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret);
99 this.ptrs_to.add(msg);