Update auto-generated bindings
[ldk-java] / src / main / java / org / ldk / structs / HTLCUpdate.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 javax.annotation.Nullable;
8
9
10 /**
11  * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
12  * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
13  * preimage claim backward will lead to loss of funds.
14  */
15 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
16 public class HTLCUpdate extends CommonBase {
17         HTLCUpdate(Object _dummy, long ptr) { super(ptr); }
18         @Override @SuppressWarnings("deprecation")
19         protected void finalize() throws Throwable {
20                 super.finalize();
21                 if (ptr != 0) { bindings.HTLCUpdate_free(ptr); }
22         }
23
24         long clone_ptr() {
25                 long ret = bindings.HTLCUpdate_clone_ptr(this.ptr);
26                 return ret;
27         }
28
29         /**
30          * Creates a copy of the HTLCUpdate
31          */
32         public HTLCUpdate clone() {
33                 long ret = bindings.HTLCUpdate_clone(this.ptr);
34                 if (ret >= 0 && ret <= 4096) { return null; }
35                 HTLCUpdate ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new HTLCUpdate(null, ret); }
36                 ret_hu_conv.ptrs_to.add(this);
37                 return ret_hu_conv;
38         }
39
40         /**
41          * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read
42          */
43         public byte[] write() {
44                 byte[] ret = bindings.HTLCUpdate_write(this.ptr);
45                 return ret;
46         }
47
48         /**
49          * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write
50          */
51         public static Result_HTLCUpdateDecodeErrorZ read(byte[] ser) {
52                 long ret = bindings.HTLCUpdate_read(ser);
53                 if (ret >= 0 && ret <= 4096) { return null; }
54                 Result_HTLCUpdateDecodeErrorZ ret_hu_conv = Result_HTLCUpdateDecodeErrorZ.constr_from_ptr(ret);
55                 return ret_hu_conv;
56         }
57
58 }