Update auto-updated Java files
[ldk-java] / src / main / java / org / ldk / structs / UpdateFulfillHTLC.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_fulfill_htlc message to be sent or received from a peer
13  */
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class UpdateFulfillHTLC extends CommonBase {
16         UpdateFulfillHTLC(Object _dummy, long ptr) { super(ptr); }
17         @Override @SuppressWarnings("deprecation")
18         protected void finalize() throws Throwable {
19                 super.finalize();
20                 if (ptr != 0) { bindings.UpdateFulfillHTLC_free(ptr); }
21         }
22
23         /**
24          * The channel ID
25          */
26         public byte[] get_channel_id() {
27                 byte[] ret = bindings.UpdateFulfillHTLC_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.UpdateFulfillHTLC_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.UpdateFulfillHTLC_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.UpdateFulfillHTLC_set_htlc_id(this.ptr, val);
55                 Reference.reachabilityFence(this);
56                 Reference.reachabilityFence(val);
57         }
58
59         /**
60          * The pre-image of the payment hash, allowing HTLC redemption
61          */
62         public byte[] get_payment_preimage() {
63                 byte[] ret = bindings.UpdateFulfillHTLC_get_payment_preimage(this.ptr);
64                 Reference.reachabilityFence(this);
65                 return ret;
66         }
67
68         /**
69          * The pre-image of the payment hash, allowing HTLC redemption
70          */
71         public void set_payment_preimage(byte[] val) {
72                 bindings.UpdateFulfillHTLC_set_payment_preimage(this.ptr, InternalUtils.check_arr_len(val, 32));
73                 Reference.reachabilityFence(this);
74                 Reference.reachabilityFence(val);
75         }
76
77         /**
78          * Constructs a new UpdateFulfillHTLC given each field
79          */
80         public static UpdateFulfillHTLC of(byte[] channel_id_arg, long htlc_id_arg, byte[] payment_preimage_arg) {
81                 long ret = bindings.UpdateFulfillHTLC_new(InternalUtils.check_arr_len(channel_id_arg, 32), htlc_id_arg, InternalUtils.check_arr_len(payment_preimage_arg, 32));
82                 Reference.reachabilityFence(channel_id_arg);
83                 Reference.reachabilityFence(htlc_id_arg);
84                 Reference.reachabilityFence(payment_preimage_arg);
85                 if (ret >= 0 && ret <= 4096) { return null; }
86                 UpdateFulfillHTLC ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new UpdateFulfillHTLC(null, ret); }
87                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
88                 return ret_hu_conv;
89         }
90
91         long clone_ptr() {
92                 long ret = bindings.UpdateFulfillHTLC_clone_ptr(this.ptr);
93                 Reference.reachabilityFence(this);
94                 return ret;
95         }
96
97         /**
98          * Creates a copy of the UpdateFulfillHTLC
99          */
100         public UpdateFulfillHTLC clone() {
101                 long ret = bindings.UpdateFulfillHTLC_clone(this.ptr);
102                 Reference.reachabilityFence(this);
103                 if (ret >= 0 && ret <= 4096) { return null; }
104                 UpdateFulfillHTLC ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new UpdateFulfillHTLC(null, ret); }
105                 ret_hu_conv.ptrs_to.add(this);
106                 return ret_hu_conv;
107         }
108
109         /**
110          * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read
111          */
112         public byte[] write() {
113                 byte[] ret = bindings.UpdateFulfillHTLC_write(this.ptr);
114                 Reference.reachabilityFence(this);
115                 return ret;
116         }
117
118         /**
119          * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
120          */
121         public static Result_UpdateFulfillHTLCDecodeErrorZ read(byte[] ser) {
122                 long ret = bindings.UpdateFulfillHTLC_read(ser);
123                 Reference.reachabilityFence(ser);
124                 if (ret >= 0 && ret <= 4096) { return null; }
125                 Result_UpdateFulfillHTLCDecodeErrorZ ret_hu_conv = Result_UpdateFulfillHTLCDecodeErrorZ.constr_from_ptr(ret);
126                 return ret_hu_conv;
127         }
128
129 }