e6a95f763207bf524bcdd1695e68386e42e10c7e
[ldk-java] / src / main / java / org / ldk / structs / CounterpartyForwardingInfo.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 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
9
10
11 /**
12  * Information needed for constructing an invoice route hint for this channel.
13  */
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class CounterpartyForwardingInfo extends CommonBase {
16         CounterpartyForwardingInfo(Object _dummy, long ptr) { super(ptr); }
17         @Override @SuppressWarnings("deprecation")
18         protected void finalize() throws Throwable {
19                 super.finalize();
20                 if (ptr != 0) { bindings.CounterpartyForwardingInfo_free(ptr); }
21         }
22
23         /**
24          * Base routing fee in millisatoshis.
25          */
26         public int get_fee_base_msat() {
27                 int ret = bindings.CounterpartyForwardingInfo_get_fee_base_msat(this.ptr);
28                 Reference.reachabilityFence(this);
29                 return ret;
30         }
31
32         /**
33          * Base routing fee in millisatoshis.
34          */
35         public void set_fee_base_msat(int val) {
36                 bindings.CounterpartyForwardingInfo_set_fee_base_msat(this.ptr, val);
37                 Reference.reachabilityFence(this);
38                 Reference.reachabilityFence(val);
39         }
40
41         /**
42          * Amount in millionths of a satoshi the channel will charge per transferred satoshi.
43          */
44         public int get_fee_proportional_millionths() {
45                 int ret = bindings.CounterpartyForwardingInfo_get_fee_proportional_millionths(this.ptr);
46                 Reference.reachabilityFence(this);
47                 return ret;
48         }
49
50         /**
51          * Amount in millionths of a satoshi the channel will charge per transferred satoshi.
52          */
53         public void set_fee_proportional_millionths(int val) {
54                 bindings.CounterpartyForwardingInfo_set_fee_proportional_millionths(this.ptr, val);
55                 Reference.reachabilityFence(this);
56                 Reference.reachabilityFence(val);
57         }
58
59         /**
60          * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
61          * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
62          * `cltv_expiry_delta` for more details.
63          */
64         public short get_cltv_expiry_delta() {
65                 short ret = bindings.CounterpartyForwardingInfo_get_cltv_expiry_delta(this.ptr);
66                 Reference.reachabilityFence(this);
67                 return ret;
68         }
69
70         /**
71          * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
72          * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
73          * `cltv_expiry_delta` for more details.
74          */
75         public void set_cltv_expiry_delta(short val) {
76                 bindings.CounterpartyForwardingInfo_set_cltv_expiry_delta(this.ptr, val);
77                 Reference.reachabilityFence(this);
78                 Reference.reachabilityFence(val);
79         }
80
81         /**
82          * Constructs a new CounterpartyForwardingInfo given each field
83          */
84         public static CounterpartyForwardingInfo of(int fee_base_msat_arg, int fee_proportional_millionths_arg, short cltv_expiry_delta_arg) {
85                 long ret = bindings.CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
86                 Reference.reachabilityFence(fee_base_msat_arg);
87                 Reference.reachabilityFence(fee_proportional_millionths_arg);
88                 Reference.reachabilityFence(cltv_expiry_delta_arg);
89                 if (ret >= 0 && ret <= 4096) { return null; }
90                 CounterpartyForwardingInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new CounterpartyForwardingInfo(null, ret); }
91                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
92                 return ret_hu_conv;
93         }
94
95         long clone_ptr() {
96                 long ret = bindings.CounterpartyForwardingInfo_clone_ptr(this.ptr);
97                 Reference.reachabilityFence(this);
98                 return ret;
99         }
100
101         /**
102          * Creates a copy of the CounterpartyForwardingInfo
103          */
104         public CounterpartyForwardingInfo clone() {
105                 long ret = bindings.CounterpartyForwardingInfo_clone(this.ptr);
106                 Reference.reachabilityFence(this);
107                 if (ret >= 0 && ret <= 4096) { return null; }
108                 CounterpartyForwardingInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new CounterpartyForwardingInfo(null, ret); }
109                 ret_hu_conv.ptrs_to.add(this);
110                 return ret_hu_conv;
111         }
112
113 }