[Java] Update auto-generated Java bindings
[ldk-java] / src / main / java / org / ldk / structs / FundingCreated.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_created`] message to be sent to or received from a peer.
13  * 
14  * [`funding_created`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-funding_created-message
15  */
16 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
17 public class FundingCreated extends CommonBase {
18         FundingCreated(Object _dummy, long ptr) { super(ptr); }
19         @Override @SuppressWarnings("deprecation")
20         protected void finalize() throws Throwable {
21                 super.finalize();
22                 if (ptr != 0) { bindings.FundingCreated_free(ptr); }
23         }
24
25         /**
26          * A temporary channel ID, until the funding is established
27          */
28         public byte[] get_temporary_channel_id() {
29                 byte[] ret = bindings.FundingCreated_get_temporary_channel_id(this.ptr);
30                 Reference.reachabilityFence(this);
31                 return ret;
32         }
33
34         /**
35          * A temporary channel ID, until the funding is established
36          */
37         public void set_temporary_channel_id(byte[] val) {
38                 bindings.FundingCreated_set_temporary_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
39                 Reference.reachabilityFence(this);
40                 Reference.reachabilityFence(val);
41         }
42
43         /**
44          * The funding transaction ID
45          */
46         public byte[] get_funding_txid() {
47                 byte[] ret = bindings.FundingCreated_get_funding_txid(this.ptr);
48                 Reference.reachabilityFence(this);
49                 return ret;
50         }
51
52         /**
53          * The funding transaction ID
54          */
55         public void set_funding_txid(byte[] val) {
56                 bindings.FundingCreated_set_funding_txid(this.ptr, InternalUtils.check_arr_len(val, 32));
57                 Reference.reachabilityFence(this);
58                 Reference.reachabilityFence(val);
59         }
60
61         /**
62          * The specific output index funding this channel
63          */
64         public short get_funding_output_index() {
65                 short ret = bindings.FundingCreated_get_funding_output_index(this.ptr);
66                 Reference.reachabilityFence(this);
67                 return ret;
68         }
69
70         /**
71          * The specific output index funding this channel
72          */
73         public void set_funding_output_index(short val) {
74                 bindings.FundingCreated_set_funding_output_index(this.ptr, val);
75                 Reference.reachabilityFence(this);
76                 Reference.reachabilityFence(val);
77         }
78
79         /**
80          * The signature of the channel initiator (funder) on the initial commitment transaction
81          */
82         public byte[] get_signature() {
83                 byte[] ret = bindings.FundingCreated_get_signature(this.ptr);
84                 Reference.reachabilityFence(this);
85                 return ret;
86         }
87
88         /**
89          * The signature of the channel initiator (funder) on the initial commitment transaction
90          */
91         public void set_signature(byte[] val) {
92                 bindings.FundingCreated_set_signature(this.ptr, InternalUtils.check_arr_len(val, 64));
93                 Reference.reachabilityFence(this);
94                 Reference.reachabilityFence(val);
95         }
96
97         /**
98          * Constructs a new FundingCreated given each field
99          */
100         public static FundingCreated of(byte[] temporary_channel_id_arg, byte[] funding_txid_arg, short funding_output_index_arg, byte[] signature_arg) {
101                 long ret = bindings.FundingCreated_new(InternalUtils.check_arr_len(temporary_channel_id_arg, 32), InternalUtils.check_arr_len(funding_txid_arg, 32), funding_output_index_arg, InternalUtils.check_arr_len(signature_arg, 64));
102                 Reference.reachabilityFence(temporary_channel_id_arg);
103                 Reference.reachabilityFence(funding_txid_arg);
104                 Reference.reachabilityFence(funding_output_index_arg);
105                 Reference.reachabilityFence(signature_arg);
106                 if (ret >= 0 && ret <= 4096) { return null; }
107                 org.ldk.structs.FundingCreated ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.FundingCreated(null, ret); }
108                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
109                 return ret_hu_conv;
110         }
111
112         long clone_ptr() {
113                 long ret = bindings.FundingCreated_clone_ptr(this.ptr);
114                 Reference.reachabilityFence(this);
115                 return ret;
116         }
117
118         /**
119          * Creates a copy of the FundingCreated
120          */
121         public FundingCreated clone() {
122                 long ret = bindings.FundingCreated_clone(this.ptr);
123                 Reference.reachabilityFence(this);
124                 if (ret >= 0 && ret <= 4096) { return null; }
125                 org.ldk.structs.FundingCreated ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.FundingCreated(null, ret); }
126                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
127                 return ret_hu_conv;
128         }
129
130         /**
131          * Checks if two FundingCreateds contain equal inner contents.
132          * This ignores pointers and is_owned flags and looks at the values in fields.
133          * Two objects with NULL inner values will be considered "equal" here.
134          */
135         public boolean eq(org.ldk.structs.FundingCreated b) {
136                 boolean ret = bindings.FundingCreated_eq(this.ptr, b == null ? 0 : b.ptr);
137                 Reference.reachabilityFence(this);
138                 Reference.reachabilityFence(b);
139                 if (this != null) { this.ptrs_to.add(b); };
140                 return ret;
141         }
142
143         @Override public boolean equals(Object o) {
144                 if (!(o instanceof FundingCreated)) return false;
145                 return this.eq((FundingCreated)o);
146         }
147         /**
148          * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read
149          */
150         public byte[] write() {
151                 byte[] ret = bindings.FundingCreated_write(this.ptr);
152                 Reference.reachabilityFence(this);
153                 return ret;
154         }
155
156         /**
157          * Read a FundingCreated from a byte array, created by FundingCreated_write
158          */
159         public static Result_FundingCreatedDecodeErrorZ read(byte[] ser) {
160                 long ret = bindings.FundingCreated_read(ser);
161                 Reference.reachabilityFence(ser);
162                 if (ret >= 0 && ret <= 4096) { return null; }
163                 Result_FundingCreatedDecodeErrorZ ret_hu_conv = Result_FundingCreatedDecodeErrorZ.constr_from_ptr(ret);
164                 return ret_hu_conv;
165         }
166
167 }