[Java] Update auto-generated bindings
[ldk-java] / src / main / java / org / ldk / structs / FundingLocked.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  * A funding_locked message to be sent or received from a peer
13  */
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class FundingLocked extends CommonBase {
16         FundingLocked(Object _dummy, long ptr) { super(ptr); }
17         @Override @SuppressWarnings("deprecation")
18         protected void finalize() throws Throwable {
19                 super.finalize();
20                 if (ptr != 0) { bindings.FundingLocked_free(ptr); }
21         }
22
23         /**
24          * The channel ID
25          */
26         public byte[] get_channel_id() {
27                 byte[] ret = bindings.FundingLocked_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.FundingLocked_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
37                 Reference.reachabilityFence(this);
38                 Reference.reachabilityFence(val);
39         }
40
41         /**
42          * The per-commitment point of the second commitment transaction
43          */
44         public byte[] get_next_per_commitment_point() {
45                 byte[] ret = bindings.FundingLocked_get_next_per_commitment_point(this.ptr);
46                 Reference.reachabilityFence(this);
47                 return ret;
48         }
49
50         /**
51          * The per-commitment point of the second commitment transaction
52          */
53         public void set_next_per_commitment_point(byte[] val) {
54                 bindings.FundingLocked_set_next_per_commitment_point(this.ptr, InternalUtils.check_arr_len(val, 33));
55                 Reference.reachabilityFence(this);
56                 Reference.reachabilityFence(val);
57         }
58
59         /**
60          * If set, provides a short_channel_id alias for this channel. The sender will accept payments
61          * to be forwarded over this SCID and forward them to this messages' recipient.
62          */
63         public Option_u64Z get_short_channel_id_alias() {
64                 long ret = bindings.FundingLocked_get_short_channel_id_alias(this.ptr);
65                 Reference.reachabilityFence(this);
66                 if (ret >= 0 && ret <= 4096) { return null; }
67                 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
68                 ret_hu_conv.ptrs_to.add(this);
69                 return ret_hu_conv;
70         }
71
72         /**
73          * If set, provides a short_channel_id alias for this channel. The sender will accept payments
74          * to be forwarded over this SCID and forward them to this messages' recipient.
75          */
76         public void set_short_channel_id_alias(Option_u64Z val) {
77                 bindings.FundingLocked_set_short_channel_id_alias(this.ptr, val.ptr);
78                 Reference.reachabilityFence(this);
79                 Reference.reachabilityFence(val);
80         }
81
82         /**
83          * Constructs a new FundingLocked given each field
84          */
85         public static FundingLocked of(byte[] channel_id_arg, byte[] next_per_commitment_point_arg, Option_u64Z short_channel_id_alias_arg) {
86                 long ret = bindings.FundingLocked_new(InternalUtils.check_arr_len(channel_id_arg, 32), InternalUtils.check_arr_len(next_per_commitment_point_arg, 33), short_channel_id_alias_arg.ptr);
87                 Reference.reachabilityFence(channel_id_arg);
88                 Reference.reachabilityFence(next_per_commitment_point_arg);
89                 Reference.reachabilityFence(short_channel_id_alias_arg);
90                 if (ret >= 0 && ret <= 4096) { return null; }
91                 FundingLocked ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new FundingLocked(null, ret); }
92                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
93                 return ret_hu_conv;
94         }
95
96         long clone_ptr() {
97                 long ret = bindings.FundingLocked_clone_ptr(this.ptr);
98                 Reference.reachabilityFence(this);
99                 return ret;
100         }
101
102         /**
103          * Creates a copy of the FundingLocked
104          */
105         public FundingLocked clone() {
106                 long ret = bindings.FundingLocked_clone(this.ptr);
107                 Reference.reachabilityFence(this);
108                 if (ret >= 0 && ret <= 4096) { return null; }
109                 FundingLocked ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new FundingLocked(null, ret); }
110                 ret_hu_conv.ptrs_to.add(this);
111                 return ret_hu_conv;
112         }
113
114         /**
115          * Serialize the FundingLocked object into a byte array which can be read by FundingLocked_read
116          */
117         public byte[] write() {
118                 byte[] ret = bindings.FundingLocked_write(this.ptr);
119                 Reference.reachabilityFence(this);
120                 return ret;
121         }
122
123         /**
124          * Read a FundingLocked from a byte array, created by FundingLocked_write
125          */
126         public static Result_FundingLockedDecodeErrorZ read(byte[] ser) {
127                 long ret = bindings.FundingLocked_read(ser);
128                 Reference.reachabilityFence(ser);
129                 if (ret >= 0 && ret <= 4096) { return null; }
130                 Result_FundingLockedDecodeErrorZ ret_hu_conv = Result_FundingLockedDecodeErrorZ.constr_from_ptr(ret);
131                 return ret_hu_conv;
132         }
133
134 }