[Java] Update auto-generated bindings to 0.0.117
[ldk-java] / src / main / java / org / ldk / structs / PaymentRelay.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  * Parameters for relaying over a given [`BlindedHop`].
13  * 
14  * [`BlindedHop`]: crate::blinded_path::BlindedHop
15  */
16 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
17 public class PaymentRelay extends CommonBase {
18         PaymentRelay(Object _dummy, long ptr) { super(ptr); }
19         @Override @SuppressWarnings("deprecation")
20         protected void finalize() throws Throwable {
21                 super.finalize();
22                 if (ptr != 0) { bindings.PaymentRelay_free(ptr); }
23         }
24
25         /**
26          * Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for this [`BlindedHop`].
27          */
28         public short get_cltv_expiry_delta() {
29                 short ret = bindings.PaymentRelay_get_cltv_expiry_delta(this.ptr);
30                 Reference.reachabilityFence(this);
31                 return ret;
32         }
33
34         /**
35          * Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for this [`BlindedHop`].
36          */
37         public void set_cltv_expiry_delta(short val) {
38                 bindings.PaymentRelay_set_cltv_expiry_delta(this.ptr, val);
39                 Reference.reachabilityFence(this);
40                 Reference.reachabilityFence(val);
41         }
42
43         /**
44          * Liquidity fee charged (in millionths of the amount transferred) for relaying a payment over
45          * this [`BlindedHop`], (i.e., 10,000 is 1%).
46          */
47         public int get_fee_proportional_millionths() {
48                 int ret = bindings.PaymentRelay_get_fee_proportional_millionths(this.ptr);
49                 Reference.reachabilityFence(this);
50                 return ret;
51         }
52
53         /**
54          * Liquidity fee charged (in millionths of the amount transferred) for relaying a payment over
55          * this [`BlindedHop`], (i.e., 10,000 is 1%).
56          */
57         public void set_fee_proportional_millionths(int val) {
58                 bindings.PaymentRelay_set_fee_proportional_millionths(this.ptr, val);
59                 Reference.reachabilityFence(this);
60                 Reference.reachabilityFence(val);
61         }
62
63         /**
64          * Base fee charged (in millisatoshi) for relaying a payment over this [`BlindedHop`].
65          */
66         public int get_fee_base_msat() {
67                 int ret = bindings.PaymentRelay_get_fee_base_msat(this.ptr);
68                 Reference.reachabilityFence(this);
69                 return ret;
70         }
71
72         /**
73          * Base fee charged (in millisatoshi) for relaying a payment over this [`BlindedHop`].
74          */
75         public void set_fee_base_msat(int val) {
76                 bindings.PaymentRelay_set_fee_base_msat(this.ptr, val);
77                 Reference.reachabilityFence(this);
78                 Reference.reachabilityFence(val);
79         }
80
81         /**
82          * Constructs a new PaymentRelay given each field
83          */
84         public static PaymentRelay of(short cltv_expiry_delta_arg, int fee_proportional_millionths_arg, int fee_base_msat_arg) {
85                 long ret = bindings.PaymentRelay_new(cltv_expiry_delta_arg, fee_proportional_millionths_arg, fee_base_msat_arg);
86                 Reference.reachabilityFence(cltv_expiry_delta_arg);
87                 Reference.reachabilityFence(fee_proportional_millionths_arg);
88                 Reference.reachabilityFence(fee_base_msat_arg);
89                 if (ret >= 0 && ret <= 4096) { return null; }
90                 org.ldk.structs.PaymentRelay ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PaymentRelay(null, ret); }
91                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
92                 return ret_hu_conv;
93         }
94
95         long clone_ptr() {
96                 long ret = bindings.PaymentRelay_clone_ptr(this.ptr);
97                 Reference.reachabilityFence(this);
98                 return ret;
99         }
100
101         /**
102          * Creates a copy of the PaymentRelay
103          */
104         public PaymentRelay clone() {
105                 long ret = bindings.PaymentRelay_clone(this.ptr);
106                 Reference.reachabilityFence(this);
107                 if (ret >= 0 && ret <= 4096) { return null; }
108                 org.ldk.structs.PaymentRelay ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PaymentRelay(null, ret); }
109                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
110                 return ret_hu_conv;
111         }
112
113         /**
114          * Serialize the PaymentRelay object into a byte array which can be read by PaymentRelay_read
115          */
116         public byte[] write() {
117                 byte[] ret = bindings.PaymentRelay_write(this.ptr);
118                 Reference.reachabilityFence(this);
119                 return ret;
120         }
121
122         /**
123          * Read a PaymentRelay from a byte array, created by PaymentRelay_write
124          */
125         public static Result_PaymentRelayDecodeErrorZ read(byte[] ser) {
126                 long ret = bindings.PaymentRelay_read(ser);
127                 Reference.reachabilityFence(ser);
128                 if (ret >= 0 && ret <= 4096) { return null; }
129                 Result_PaymentRelayDecodeErrorZ ret_hu_conv = Result_PaymentRelayDecodeErrorZ.constr_from_ptr(ret);
130                 return ret_hu_conv;
131         }
132
133 }