[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / RoutingFees.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  * Fees for routing via a given channel or a node
11  */
12 public class RoutingFees : CommonBase {
13         internal RoutingFees(object _dummy, long ptr) : base(ptr) { }
14         ~RoutingFees() {
15                 if (ptr != 0) { bindings.RoutingFees_free(ptr); }
16         }
17
18         /**
19          * Flat routing fee in millisatoshis.
20          */
21         public int get_base_msat() {
22                 int ret = bindings.RoutingFees_get_base_msat(this.ptr);
23                 GC.KeepAlive(this);
24                 return ret;
25         }
26
27         /**
28          * Flat routing fee in millisatoshis.
29          */
30         public void set_base_msat(int val) {
31                 bindings.RoutingFees_set_base_msat(this.ptr, val);
32                 GC.KeepAlive(this);
33                 GC.KeepAlive(val);
34         }
35
36         /**
37          * Liquidity-based routing fee in millionths of a routed amount.
38          * In other words, 10000 is 1%.
39          */
40         public int get_proportional_millionths() {
41                 int ret = bindings.RoutingFees_get_proportional_millionths(this.ptr);
42                 GC.KeepAlive(this);
43                 return ret;
44         }
45
46         /**
47          * Liquidity-based routing fee in millionths of a routed amount.
48          * In other words, 10000 is 1%.
49          */
50         public void set_proportional_millionths(int val) {
51                 bindings.RoutingFees_set_proportional_millionths(this.ptr, val);
52                 GC.KeepAlive(this);
53                 GC.KeepAlive(val);
54         }
55
56         /**
57          * Constructs a new RoutingFees given each field
58          */
59         public static RoutingFees of(int base_msat_arg, int proportional_millionths_arg) {
60                 long ret = bindings.RoutingFees_new(base_msat_arg, proportional_millionths_arg);
61                 GC.KeepAlive(base_msat_arg);
62                 GC.KeepAlive(proportional_millionths_arg);
63                 if (ret >= 0 && ret <= 4096) { return null; }
64                 org.ldk.structs.RoutingFees ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RoutingFees(null, ret); }
65                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
66                 return ret_hu_conv;
67         }
68
69         /**
70          * Checks if two RoutingFeess contain equal inner contents.
71          * This ignores pointers and is_owned flags and looks at the values in fields.
72          * Two objects with NULL inner values will be considered "equal" here.
73          */
74         public bool eq(org.ldk.structs.RoutingFees b) {
75                 bool ret = bindings.RoutingFees_eq(this.ptr, b == null ? 0 : b.ptr);
76                 GC.KeepAlive(this);
77                 GC.KeepAlive(b);
78                 if (this != null) { this.ptrs_to.AddLast(b); };
79                 return ret;
80         }
81
82         public override bool Equals(object o) {
83                 if (!(o is RoutingFees)) return false;
84                 return this.eq((RoutingFees)o);
85         }
86         internal long clone_ptr() {
87                 long ret = bindings.RoutingFees_clone_ptr(this.ptr);
88                 GC.KeepAlive(this);
89                 return ret;
90         }
91
92         /**
93          * Creates a copy of the RoutingFees
94          */
95         public RoutingFees clone() {
96                 long ret = bindings.RoutingFees_clone(this.ptr);
97                 GC.KeepAlive(this);
98                 if (ret >= 0 && ret <= 4096) { return null; }
99                 org.ldk.structs.RoutingFees ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RoutingFees(null, ret); }
100                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
101                 return ret_hu_conv;
102         }
103
104         /**
105          * Generates a non-cryptographic 64-bit hash of the RoutingFees.
106          */
107         public long hash() {
108                 long ret = bindings.RoutingFees_hash(this.ptr);
109                 GC.KeepAlive(this);
110                 return ret;
111         }
112
113         public override int GetHashCode() {
114                 return (int)this.hash();
115         }
116         /**
117          * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read
118          */
119         public byte[] write() {
120                 long ret = bindings.RoutingFees_write(this.ptr);
121                 GC.KeepAlive(this);
122                 if (ret >= 0 && ret <= 4096) { return null; }
123                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
124                 return ret_conv;
125         }
126
127         /**
128          * Read a RoutingFees from a byte array, created by RoutingFees_write
129          */
130         public static Result_RoutingFeesDecodeErrorZ read(byte[] ser) {
131                 long ret = bindings.RoutingFees_read(InternalUtils.encodeUint8Array(ser));
132                 GC.KeepAlive(ser);
133                 if (ret >= 0 && ret <= 4096) { return null; }
134                 Result_RoutingFeesDecodeErrorZ ret_hu_conv = Result_RoutingFeesDecodeErrorZ.constr_from_ptr(ret);
135                 return ret_hu_conv;
136         }
137
138 }
139 } } }