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