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 Result_NoneLightningErrorZ update_node_from_announcement(NodeAnnouncement msg) {
47 number ret = bindings.NetworkGraph_update_node_from_announcement(this.ptr, msg == null ? 0 : msg.ptr & ~1);
48 Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret);
49 this.ptrs_to.add(msg);
53 public Result_NoneLightningErrorZ update_node_from_unsigned_announcement(UnsignedNodeAnnouncement msg) {
54 number ret = bindings.NetworkGraph_update_node_from_unsigned_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_channel_from_announcement(ChannelAnnouncement msg, Access chain_access) {
61 number ret = bindings.NetworkGraph_update_channel_from_announcement(this.ptr, msg == null ? 0 : msg.ptr & ~1, chain_access == null ? 0 : chain_access.ptr);
62 Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret);
63 this.ptrs_to.add(msg);
64 this.ptrs_to.add(chain_access);
68 public Result_NoneLightningErrorZ update_channel_from_unsigned_announcement(UnsignedChannelAnnouncement msg, Access chain_access) {
69 number ret = bindings.NetworkGraph_update_channel_from_unsigned_announcement(this.ptr, msg == null ? 0 : msg.ptr & ~1, chain_access == null ? 0 : chain_access.ptr);
70 Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret);
71 this.ptrs_to.add(msg);
72 this.ptrs_to.add(chain_access);
76 public void close_channel_from_update(number short_channel_id, boolean is_permanent) {
77 bindings.NetworkGraph_close_channel_from_update(this.ptr, short_channel_id, is_permanent);
80 public Result_NoneLightningErrorZ update_channel(ChannelUpdate msg) {
81 number ret = bindings.NetworkGraph_update_channel(this.ptr, msg == null ? 0 : msg.ptr & ~1);
82 Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret);
83 this.ptrs_to.add(msg);
87 public Result_NoneLightningErrorZ update_channel_unsigned(UnsignedChannelUpdate msg) {
88 number ret = bindings.NetworkGraph_update_channel_unsigned(this.ptr, msg == null ? 0 : msg.ptr & ~1);
89 Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret);
90 this.ptrs_to.add(msg);