[Java] Update auto-generated bindings to LDK 0.0.118
[ldk-java] / src / main / java / org / ldk / structs / ChannelDerivationParameters.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  * The parameters required to derive a channel signer via [`SignerProvider`].
13  */
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class ChannelDerivationParameters extends CommonBase {
16         ChannelDerivationParameters(Object _dummy, long ptr) { super(ptr); }
17         @Override @SuppressWarnings("deprecation")
18         protected void finalize() throws Throwable {
19                 super.finalize();
20                 if (ptr != 0) { bindings.ChannelDerivationParameters_free(ptr); }
21         }
22
23         /**
24          * The value in satoshis of the channel we're attempting to spend the anchor output of.
25          */
26         public long get_value_satoshis() {
27                 long ret = bindings.ChannelDerivationParameters_get_value_satoshis(this.ptr);
28                 Reference.reachabilityFence(this);
29                 return ret;
30         }
31
32         /**
33          * The value in satoshis of the channel we're attempting to spend the anchor output of.
34          */
35         public void set_value_satoshis(long val) {
36                 bindings.ChannelDerivationParameters_set_value_satoshis(this.ptr, val);
37                 Reference.reachabilityFence(this);
38                 Reference.reachabilityFence(val);
39         }
40
41         /**
42          * The unique identifier to re-derive the signer for the associated channel.
43          */
44         public byte[] get_keys_id() {
45                 byte[] ret = bindings.ChannelDerivationParameters_get_keys_id(this.ptr);
46                 Reference.reachabilityFence(this);
47                 return ret;
48         }
49
50         /**
51          * The unique identifier to re-derive the signer for the associated channel.
52          */
53         public void set_keys_id(byte[] val) {
54                 bindings.ChannelDerivationParameters_set_keys_id(this.ptr, InternalUtils.check_arr_len(val, 32));
55                 Reference.reachabilityFence(this);
56                 Reference.reachabilityFence(val);
57         }
58
59         /**
60          * The necessary channel parameters that need to be provided to the re-derived signer through
61          * [`ChannelSigner::provide_channel_parameters`].
62          */
63         public ChannelTransactionParameters get_transaction_parameters() {
64                 long ret = bindings.ChannelDerivationParameters_get_transaction_parameters(this.ptr);
65                 Reference.reachabilityFence(this);
66                 if (ret >= 0 && ret <= 4096) { return null; }
67                 org.ldk.structs.ChannelTransactionParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelTransactionParameters(null, ret); }
68                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
69                 return ret_hu_conv;
70         }
71
72         /**
73          * The necessary channel parameters that need to be provided to the re-derived signer through
74          * [`ChannelSigner::provide_channel_parameters`].
75          */
76         public void set_transaction_parameters(org.ldk.structs.ChannelTransactionParameters val) {
77                 bindings.ChannelDerivationParameters_set_transaction_parameters(this.ptr, val == null ? 0 : val.ptr);
78                 Reference.reachabilityFence(this);
79                 Reference.reachabilityFence(val);
80                 if (this != null) { this.ptrs_to.add(val); };
81         }
82
83         /**
84          * Constructs a new ChannelDerivationParameters given each field
85          */
86         public static ChannelDerivationParameters of(long value_satoshis_arg, byte[] keys_id_arg, org.ldk.structs.ChannelTransactionParameters transaction_parameters_arg) {
87                 long ret = bindings.ChannelDerivationParameters_new(value_satoshis_arg, InternalUtils.check_arr_len(keys_id_arg, 32), transaction_parameters_arg == null ? 0 : transaction_parameters_arg.ptr);
88                 Reference.reachabilityFence(value_satoshis_arg);
89                 Reference.reachabilityFence(keys_id_arg);
90                 Reference.reachabilityFence(transaction_parameters_arg);
91                 if (ret >= 0 && ret <= 4096) { return null; }
92                 org.ldk.structs.ChannelDerivationParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelDerivationParameters(null, ret); }
93                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
94                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(transaction_parameters_arg); };
95                 return ret_hu_conv;
96         }
97
98         long clone_ptr() {
99                 long ret = bindings.ChannelDerivationParameters_clone_ptr(this.ptr);
100                 Reference.reachabilityFence(this);
101                 return ret;
102         }
103
104         /**
105          * Creates a copy of the ChannelDerivationParameters
106          */
107         public ChannelDerivationParameters clone() {
108                 long ret = bindings.ChannelDerivationParameters_clone(this.ptr);
109                 Reference.reachabilityFence(this);
110                 if (ret >= 0 && ret <= 4096) { return null; }
111                 org.ldk.structs.ChannelDerivationParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelDerivationParameters(null, ret); }
112                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
113                 return ret_hu_conv;
114         }
115
116         /**
117          * Checks if two ChannelDerivationParameterss contain equal inner contents.
118          * This ignores pointers and is_owned flags and looks at the values in fields.
119          * Two objects with NULL inner values will be considered "equal" here.
120          */
121         public boolean eq(org.ldk.structs.ChannelDerivationParameters b) {
122                 boolean ret = bindings.ChannelDerivationParameters_eq(this.ptr, b == null ? 0 : b.ptr);
123                 Reference.reachabilityFence(this);
124                 Reference.reachabilityFence(b);
125                 if (this != null) { this.ptrs_to.add(b); };
126                 return ret;
127         }
128
129         @Override public boolean equals(Object o) {
130                 if (!(o instanceof ChannelDerivationParameters)) return false;
131                 return this.eq((ChannelDerivationParameters)o);
132         }
133         /**
134          * Serialize the ChannelDerivationParameters object into a byte array which can be read by ChannelDerivationParameters_read
135          */
136         public byte[] write() {
137                 byte[] ret = bindings.ChannelDerivationParameters_write(this.ptr);
138                 Reference.reachabilityFence(this);
139                 return ret;
140         }
141
142         /**
143          * Read a ChannelDerivationParameters from a byte array, created by ChannelDerivationParameters_write
144          */
145         public static Result_ChannelDerivationParametersDecodeErrorZ read(byte[] ser) {
146                 long ret = bindings.ChannelDerivationParameters_read(ser);
147                 Reference.reachabilityFence(ser);
148                 if (ret >= 0 && ret <= 4096) { return null; }
149                 Result_ChannelDerivationParametersDecodeErrorZ ret_hu_conv = Result_ChannelDerivationParametersDecodeErrorZ.constr_from_ptr(ret);
150                 return ret_hu_conv;
151         }
152
153 }