c08ef7555cf6a4c2abb4333803956c282f01a805
[ldk-java] / c_sharp / src / org / ldk / structs / DirectedChannelInfo.cs
1 using org.ldk.impl;
2 using org.ldk.enums;
3 using org.ldk.util;
4 using System;
5
6 namespace org { namespace ldk { namespace structs {
7
8
9 /**
10  * A wrapper around [`ChannelInfo`] representing information about the channel as directed from a
11  * source node to a target node.
12  */
13 public class DirectedChannelInfo : CommonBase {
14         internal DirectedChannelInfo(object _dummy, long ptr) : base(ptr) { }
15         ~DirectedChannelInfo() {
16                 if (ptr != 0) { bindings.DirectedChannelInfo_free(ptr); }
17         }
18
19         internal long clone_ptr() {
20                 long ret = bindings.DirectedChannelInfo_clone_ptr(this.ptr);
21                 GC.KeepAlive(this);
22                 return ret;
23         }
24
25         /**
26          * Creates a copy of the DirectedChannelInfo
27          */
28         public DirectedChannelInfo clone() {
29                 long ret = bindings.DirectedChannelInfo_clone(this.ptr);
30                 GC.KeepAlive(this);
31                 if (ret >= 0 && ret <= 4096) { return null; }
32                 org.ldk.structs.DirectedChannelInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.DirectedChannelInfo(null, ret); }
33                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
34                 return ret_hu_conv;
35         }
36
37         /**
38          * Returns information for the channel.
39          */
40         public ChannelInfo channel() {
41                 long ret = bindings.DirectedChannelInfo_channel(this.ptr);
42                 GC.KeepAlive(this);
43                 if (ret >= 0 && ret <= 4096) { return null; }
44                 org.ldk.structs.ChannelInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelInfo(null, ret); }
45                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
46                 return ret_hu_conv;
47         }
48
49         /**
50          * Returns the maximum HTLC amount allowed over the channel in the direction.
51          */
52         public long htlc_maximum_msat() {
53                 long ret = bindings.DirectedChannelInfo_htlc_maximum_msat(this.ptr);
54                 GC.KeepAlive(this);
55                 return ret;
56         }
57
58         /**
59          * Returns the [`EffectiveCapacity`] of the channel in the direction.
60          * 
61          * This is either the total capacity from the funding transaction, if known, or the
62          * `htlc_maximum_msat` for the direction as advertised by the gossip network, if known,
63          * otherwise.
64          */
65         public EffectiveCapacity effective_capacity() {
66                 long ret = bindings.DirectedChannelInfo_effective_capacity(this.ptr);
67                 GC.KeepAlive(this);
68                 if (ret >= 0 && ret <= 4096) { return null; }
69                 org.ldk.structs.EffectiveCapacity ret_hu_conv = org.ldk.structs.EffectiveCapacity.constr_from_ptr(ret);
70                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
71                 return ret_hu_conv;
72         }
73
74 }
75 } } }