Update auto-updated Java files
[ldk-java] / src / main / java / org / ldk / structs / UpdateAddHTLC.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  * An update_add_htlc message to be sent or received from a peer
13  */
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class UpdateAddHTLC extends CommonBase {
16         UpdateAddHTLC(Object _dummy, long ptr) { super(ptr); }
17         @Override @SuppressWarnings("deprecation")
18         protected void finalize() throws Throwable {
19                 super.finalize();
20                 if (ptr != 0) { bindings.UpdateAddHTLC_free(ptr); }
21         }
22
23         /**
24          * The channel ID
25          */
26         public byte[] get_channel_id() {
27                 byte[] ret = bindings.UpdateAddHTLC_get_channel_id(this.ptr);
28                 Reference.reachabilityFence(this);
29                 return ret;
30         }
31
32         /**
33          * The channel ID
34          */
35         public void set_channel_id(byte[] val) {
36                 bindings.UpdateAddHTLC_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
37                 Reference.reachabilityFence(this);
38                 Reference.reachabilityFence(val);
39         }
40
41         /**
42          * The HTLC ID
43          */
44         public long get_htlc_id() {
45                 long ret = bindings.UpdateAddHTLC_get_htlc_id(this.ptr);
46                 Reference.reachabilityFence(this);
47                 return ret;
48         }
49
50         /**
51          * The HTLC ID
52          */
53         public void set_htlc_id(long val) {
54                 bindings.UpdateAddHTLC_set_htlc_id(this.ptr, val);
55                 Reference.reachabilityFence(this);
56                 Reference.reachabilityFence(val);
57         }
58
59         /**
60          * The HTLC value in milli-satoshi
61          */
62         public long get_amount_msat() {
63                 long ret = bindings.UpdateAddHTLC_get_amount_msat(this.ptr);
64                 Reference.reachabilityFence(this);
65                 return ret;
66         }
67
68         /**
69          * The HTLC value in milli-satoshi
70          */
71         public void set_amount_msat(long val) {
72                 bindings.UpdateAddHTLC_set_amount_msat(this.ptr, val);
73                 Reference.reachabilityFence(this);
74                 Reference.reachabilityFence(val);
75         }
76
77         /**
78          * The payment hash, the pre-image of which controls HTLC redemption
79          */
80         public byte[] get_payment_hash() {
81                 byte[] ret = bindings.UpdateAddHTLC_get_payment_hash(this.ptr);
82                 Reference.reachabilityFence(this);
83                 return ret;
84         }
85
86         /**
87          * The payment hash, the pre-image of which controls HTLC redemption
88          */
89         public void set_payment_hash(byte[] val) {
90                 bindings.UpdateAddHTLC_set_payment_hash(this.ptr, InternalUtils.check_arr_len(val, 32));
91                 Reference.reachabilityFence(this);
92                 Reference.reachabilityFence(val);
93         }
94
95         /**
96          * The expiry height of the HTLC
97          */
98         public int get_cltv_expiry() {
99                 int ret = bindings.UpdateAddHTLC_get_cltv_expiry(this.ptr);
100                 Reference.reachabilityFence(this);
101                 return ret;
102         }
103
104         /**
105          * The expiry height of the HTLC
106          */
107         public void set_cltv_expiry(int val) {
108                 bindings.UpdateAddHTLC_set_cltv_expiry(this.ptr, val);
109                 Reference.reachabilityFence(this);
110                 Reference.reachabilityFence(val);
111         }
112
113         long clone_ptr() {
114                 long ret = bindings.UpdateAddHTLC_clone_ptr(this.ptr);
115                 Reference.reachabilityFence(this);
116                 return ret;
117         }
118
119         /**
120          * Creates a copy of the UpdateAddHTLC
121          */
122         public UpdateAddHTLC clone() {
123                 long ret = bindings.UpdateAddHTLC_clone(this.ptr);
124                 Reference.reachabilityFence(this);
125                 if (ret >= 0 && ret <= 4096) { return null; }
126                 UpdateAddHTLC ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new UpdateAddHTLC(null, ret); }
127                 ret_hu_conv.ptrs_to.add(this);
128                 return ret_hu_conv;
129         }
130
131         /**
132          * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read
133          */
134         public byte[] write() {
135                 byte[] ret = bindings.UpdateAddHTLC_write(this.ptr);
136                 Reference.reachabilityFence(this);
137                 return ret;
138         }
139
140         /**
141          * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
142          */
143         public static Result_UpdateAddHTLCDecodeErrorZ read(byte[] ser) {
144                 long ret = bindings.UpdateAddHTLC_read(ser);
145                 Reference.reachabilityFence(ser);
146                 if (ret >= 0 && ret <= 4096) { return null; }
147                 Result_UpdateAddHTLCDecodeErrorZ ret_hu_conv = Result_UpdateAddHTLCDecodeErrorZ.constr_from_ptr(ret);
148                 return ret_hu_conv;
149         }
150
151 }