]> git.bitcoin.ninja Git - ldk-java/blob - src/main/java/org/ldk/structs/Splice.java
[Java] Update auto-generated bindings to LDK 0.0.123
[ldk-java] / src / main / java / org / ldk / structs / Splice.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 splice message to be sent by or received from the stfu initiator (splice initiator).
13  */
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class Splice extends CommonBase {
16         Splice(Object _dummy, long ptr) { super(ptr); }
17         @Override @SuppressWarnings("deprecation")
18         protected void finalize() throws Throwable {
19                 super.finalize();
20                 if (ptr != 0) { bindings.Splice_free(ptr); }
21         }
22
23         /**
24          * The channel ID where splicing is intended
25          */
26         public ChannelId get_channel_id() {
27                 long ret = bindings.Splice_get_channel_id(this.ptr);
28                 Reference.reachabilityFence(this);
29                 if (ret >= 0 && ret <= 4096) { return null; }
30                 org.ldk.structs.ChannelId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelId(null, ret); }
31                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
32                 return ret_hu_conv;
33         }
34
35         /**
36          * The channel ID where splicing is intended
37          */
38         public void set_channel_id(org.ldk.structs.ChannelId val) {
39                 bindings.Splice_set_channel_id(this.ptr, val.ptr);
40                 Reference.reachabilityFence(this);
41                 Reference.reachabilityFence(val);
42                 if (this != null) { this.ptrs_to.add(val); };
43         }
44
45         /**
46          * The genesis hash of the blockchain where the channel is intended to be spliced
47          */
48         public byte[] get_chain_hash() {
49                 byte[] ret = bindings.Splice_get_chain_hash(this.ptr);
50                 Reference.reachabilityFence(this);
51                 return ret;
52         }
53
54         /**
55          * The genesis hash of the blockchain where the channel is intended to be spliced
56          */
57         public void set_chain_hash(byte[] val) {
58                 bindings.Splice_set_chain_hash(this.ptr, InternalUtils.check_arr_len(val, 32));
59                 Reference.reachabilityFence(this);
60                 Reference.reachabilityFence(val);
61         }
62
63         /**
64          * The intended change in channel capacity: the amount to be added (positive value)
65          * or removed (negative value) by the sender (splice initiator) by splicing into/from the channel.
66          */
67         public long get_relative_satoshis() {
68                 long ret = bindings.Splice_get_relative_satoshis(this.ptr);
69                 Reference.reachabilityFence(this);
70                 return ret;
71         }
72
73         /**
74          * The intended change in channel capacity: the amount to be added (positive value)
75          * or removed (negative value) by the sender (splice initiator) by splicing into/from the channel.
76          */
77         public void set_relative_satoshis(long val) {
78                 bindings.Splice_set_relative_satoshis(this.ptr, val);
79                 Reference.reachabilityFence(this);
80                 Reference.reachabilityFence(val);
81         }
82
83         /**
84          * The feerate for the new funding transaction, set by the splice initiator
85          */
86         public int get_funding_feerate_perkw() {
87                 int ret = bindings.Splice_get_funding_feerate_perkw(this.ptr);
88                 Reference.reachabilityFence(this);
89                 return ret;
90         }
91
92         /**
93          * The feerate for the new funding transaction, set by the splice initiator
94          */
95         public void set_funding_feerate_perkw(int val) {
96                 bindings.Splice_set_funding_feerate_perkw(this.ptr, val);
97                 Reference.reachabilityFence(this);
98                 Reference.reachabilityFence(val);
99         }
100
101         /**
102          * The locktime for the new funding transaction
103          */
104         public int get_locktime() {
105                 int ret = bindings.Splice_get_locktime(this.ptr);
106                 Reference.reachabilityFence(this);
107                 return ret;
108         }
109
110         /**
111          * The locktime for the new funding transaction
112          */
113         public void set_locktime(int val) {
114                 bindings.Splice_set_locktime(this.ptr, val);
115                 Reference.reachabilityFence(this);
116                 Reference.reachabilityFence(val);
117         }
118
119         /**
120          * The key of the sender (splice initiator) controlling the new funding transaction
121          */
122         public byte[] get_funding_pubkey() {
123                 byte[] ret = bindings.Splice_get_funding_pubkey(this.ptr);
124                 Reference.reachabilityFence(this);
125                 return ret;
126         }
127
128         /**
129          * The key of the sender (splice initiator) controlling the new funding transaction
130          */
131         public void set_funding_pubkey(byte[] val) {
132                 bindings.Splice_set_funding_pubkey(this.ptr, InternalUtils.check_arr_len(val, 33));
133                 Reference.reachabilityFence(this);
134                 Reference.reachabilityFence(val);
135         }
136
137         /**
138          * Constructs a new Splice given each field
139          */
140         public static Splice of(org.ldk.structs.ChannelId channel_id_arg, byte[] chain_hash_arg, long relative_satoshis_arg, int funding_feerate_perkw_arg, int locktime_arg, byte[] funding_pubkey_arg) {
141                 long ret = bindings.Splice_new(channel_id_arg.ptr, InternalUtils.check_arr_len(chain_hash_arg, 32), relative_satoshis_arg, funding_feerate_perkw_arg, locktime_arg, InternalUtils.check_arr_len(funding_pubkey_arg, 33));
142                 Reference.reachabilityFence(channel_id_arg);
143                 Reference.reachabilityFence(chain_hash_arg);
144                 Reference.reachabilityFence(relative_satoshis_arg);
145                 Reference.reachabilityFence(funding_feerate_perkw_arg);
146                 Reference.reachabilityFence(locktime_arg);
147                 Reference.reachabilityFence(funding_pubkey_arg);
148                 if (ret >= 0 && ret <= 4096) { return null; }
149                 org.ldk.structs.Splice ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Splice(null, ret); }
150                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
151                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_id_arg); };
152                 return ret_hu_conv;
153         }
154
155         long clone_ptr() {
156                 long ret = bindings.Splice_clone_ptr(this.ptr);
157                 Reference.reachabilityFence(this);
158                 return ret;
159         }
160
161         /**
162          * Creates a copy of the Splice
163          */
164         public Splice clone() {
165                 long ret = bindings.Splice_clone(this.ptr);
166                 Reference.reachabilityFence(this);
167                 if (ret >= 0 && ret <= 4096) { return null; }
168                 org.ldk.structs.Splice ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Splice(null, ret); }
169                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
170                 return ret_hu_conv;
171         }
172
173         /**
174          * Checks if two Splices contain equal inner contents.
175          * This ignores pointers and is_owned flags and looks at the values in fields.
176          * Two objects with NULL inner values will be considered "equal" here.
177          */
178         public boolean eq(org.ldk.structs.Splice b) {
179                 boolean ret = bindings.Splice_eq(this.ptr, b.ptr);
180                 Reference.reachabilityFence(this);
181                 Reference.reachabilityFence(b);
182                 if (this != null) { this.ptrs_to.add(b); };
183                 return ret;
184         }
185
186         @Override public boolean equals(Object o) {
187                 if (!(o instanceof Splice)) return false;
188                 return this.eq((Splice)o);
189         }
190         /**
191          * Serialize the Splice object into a byte array which can be read by Splice_read
192          */
193         public byte[] write() {
194                 byte[] ret = bindings.Splice_write(this.ptr);
195                 Reference.reachabilityFence(this);
196                 return ret;
197         }
198
199         /**
200          * Read a Splice from a byte array, created by Splice_write
201          */
202         public static Result_SpliceDecodeErrorZ read(byte[] ser) {
203                 long ret = bindings.Splice_read(ser);
204                 Reference.reachabilityFence(ser);
205                 if (ret >= 0 && ret <= 4096) { return null; }
206                 Result_SpliceDecodeErrorZ ret_hu_conv = Result_SpliceDecodeErrorZ.constr_from_ptr(ret);
207                 return ret_hu_conv;
208         }
209
210 }