Update auto-generated bindings
[ldk-java] / src / main / java / org / ldk / structs / RoutingFees.java
1 package org.ldk.structs;
2
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
5 import org.ldk.util.*;
6 import java.util.Arrays;
7
8
9 /**
10  * Fees for routing via a given channel or a node
11  */
12 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
13 public class RoutingFees extends CommonBase {
14         RoutingFees(Object _dummy, long ptr) { super(ptr); }
15         @Override @SuppressWarnings("deprecation")
16         protected void finalize() throws Throwable {
17                 super.finalize();
18                 if (ptr != 0) { bindings.RoutingFees_free(ptr); }
19         }
20
21         /**
22          * Flat routing fee in satoshis
23          */
24         public int get_base_msat() {
25                 int ret = bindings.RoutingFees_get_base_msat(this.ptr);
26                 return ret;
27         }
28
29         /**
30          * Flat routing fee in satoshis
31          */
32         public void set_base_msat(int val) {
33                 bindings.RoutingFees_set_base_msat(this.ptr, 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                 return ret;
43         }
44
45         /**
46          * Liquidity-based routing fee in millionths of a routed amount.
47          * In other words, 10000 is 1%.
48          */
49         public void set_proportional_millionths(int val) {
50                 bindings.RoutingFees_set_proportional_millionths(this.ptr, val);
51         }
52
53         /**
54          * Constructs a new RoutingFees given each field
55          */
56         public static RoutingFees of(int base_msat_arg, int proportional_millionths_arg) {
57                 long ret = bindings.RoutingFees_new(base_msat_arg, proportional_millionths_arg);
58                 if (ret < 1024) { return null; }
59                 RoutingFees ret_hu_conv = new RoutingFees(null, ret);
60                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
61                 return ret_hu_conv;
62         }
63
64         /**
65          * Checks if two RoutingFeess contain equal inner contents.
66          * This ignores pointers and is_owned flags and looks at the values in fields.
67          * Two objects with NULL inner values will be considered "equal" here.
68          */
69         public boolean eq(RoutingFees b) {
70                 boolean ret = bindings.RoutingFees_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
71                 this.ptrs_to.add(b);
72                 return ret;
73         }
74
75         /**
76          * Creates a copy of the RoutingFees
77          */
78         public RoutingFees clone() {
79                 long ret = bindings.RoutingFees_clone(this.ptr);
80                 if (ret < 1024) { return null; }
81                 RoutingFees ret_hu_conv = new RoutingFees(null, ret);
82                 ret_hu_conv.ptrs_to.add(this);
83                 return ret_hu_conv;
84         }
85
86         /**
87          * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read
88          */
89         public byte[] write() {
90                 byte[] ret = bindings.RoutingFees_write(this.ptr);
91                 return ret;
92         }
93
94         /**
95          * Read a RoutingFees from a byte array, created by RoutingFees_write
96          */
97         public static Result_RoutingFeesDecodeErrorZ read(byte[] ser) {
98                 long ret = bindings.RoutingFees_read(ser);
99                 if (ret < 1024) { return null; }
100                 Result_RoutingFeesDecodeErrorZ ret_hu_conv = Result_RoutingFeesDecodeErrorZ.constr_from_ptr(ret);
101                 return ret_hu_conv;
102         }
103
104 }