3 import CommonBase from './CommonBase';
4 import * as bindings from '../bindings' // TODO: figure out location
8 export default class ChannelDetails extends CommonBase {
9 constructor(_dummy: object, ptr: number) {
14 protected finalize() {
18 bindings.ChannelDetails_free(this.ptr);
21 public ChannelDetails clone() {
22 number ret = bindings.ChannelDetails_clone(this.ptr);
23 const ret_hu_conv: ChannelDetails = new ChannelDetails(null, ret);
24 ret_hu_conv.ptrs_to.add(this);
28 public Uint8Array get_channel_id() {
29 Uint8Array ret = bindings.ChannelDetails_get_channel_id(this.ptr);
33 public void set_channel_id(Uint8Array val) {
34 bindings.ChannelDetails_set_channel_id(this.ptr, val);
37 public Uint8Array get_remote_network_id() {
38 Uint8Array ret = bindings.ChannelDetails_get_remote_network_id(this.ptr);
42 public void set_remote_network_id(Uint8Array val) {
43 bindings.ChannelDetails_set_remote_network_id(this.ptr, val);
46 public InitFeatures get_counterparty_features() {
47 number ret = bindings.ChannelDetails_get_counterparty_features(this.ptr);
48 const ret_hu_conv: InitFeatures = new InitFeatures(null, ret);
49 ret_hu_conv.ptrs_to.add(this);
53 public void set_counterparty_features(InitFeatures val) {
54 bindings.ChannelDetails_set_counterparty_features(this.ptr, val == null ? 0 : val.ptr & ~1);
55 this.ptrs_to.add(val);
56 // Due to rust's strict-ownership memory model, in some cases we need to "move"
57 // an object to pass exclusive ownership to the function being called.
58 // In most cases, we avoid this being visible in GC'd languages by cloning the object
59 // at the FFI layer, creating a new object which Rust can claim ownership of
60 // However, in some cases (eg here), there is no way to clone an object, and thus
61 // we actually have to pass full ownership to Rust.
62 // Thus, after this call, val is reset to null and is now a dummy object.
66 public number get_channel_value_satoshis() {
67 number ret = bindings.ChannelDetails_get_channel_value_satoshis(this.ptr);
71 public void set_channel_value_satoshis(number val) {
72 bindings.ChannelDetails_set_channel_value_satoshis(this.ptr, val);
75 public number get_user_id() {
76 number ret = bindings.ChannelDetails_get_user_id(this.ptr);
80 public void set_user_id(number val) {
81 bindings.ChannelDetails_set_user_id(this.ptr, val);
84 public number get_outbound_capacity_msat() {
85 number ret = bindings.ChannelDetails_get_outbound_capacity_msat(this.ptr);
89 public void set_outbound_capacity_msat(number val) {
90 bindings.ChannelDetails_set_outbound_capacity_msat(this.ptr, val);
93 public number get_inbound_capacity_msat() {
94 number ret = bindings.ChannelDetails_get_inbound_capacity_msat(this.ptr);
98 public void set_inbound_capacity_msat(number val) {
99 bindings.ChannelDetails_set_inbound_capacity_msat(this.ptr, val);
102 public boolean get_is_live() {
103 boolean ret = bindings.ChannelDetails_get_is_live(this.ptr);
107 public void set_is_live(boolean val) {
108 bindings.ChannelDetails_set_is_live(this.ptr, val);