[C#] Update auto-generated files
[ldk-java] / c_sharp / src / org / ldk / structs / HTLCDescriptor.cs
1 using org.ldk.impl;
2 using org.ldk.enums;
3 using org.ldk.util;
4 using System;
5
6 namespace org { namespace ldk { namespace structs {
7
8
9 /**
10  * A descriptor used to sign for a commitment transaction's HTLC output.
11  */
12 public class HTLCDescriptor : CommonBase {
13         internal HTLCDescriptor(object _dummy, long ptr) : base(ptr) { }
14         ~HTLCDescriptor() {
15                 if (ptr != 0) { bindings.HTLCDescriptor_free(ptr); }
16         }
17
18         /**
19          * The parameters required to derive the signer for the HTLC input.
20          */
21         public ChannelDerivationParameters get_channel_derivation_parameters() {
22                 long ret = bindings.HTLCDescriptor_get_channel_derivation_parameters(this.ptr);
23                 GC.KeepAlive(this);
24                 if (ret >= 0 && ret <= 4096) { return null; }
25                 org.ldk.structs.ChannelDerivationParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelDerivationParameters(null, ret); }
26                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
27                 return ret_hu_conv;
28         }
29
30         /**
31          * The parameters required to derive the signer for the HTLC input.
32          */
33         public void set_channel_derivation_parameters(org.ldk.structs.ChannelDerivationParameters val) {
34                 bindings.HTLCDescriptor_set_channel_derivation_parameters(this.ptr, val == null ? 0 : val.ptr);
35                 GC.KeepAlive(this);
36                 GC.KeepAlive(val);
37                 if (this != null) { this.ptrs_to.AddLast(val); };
38         }
39
40         /**
41          * The number of the commitment transaction in which the HTLC output lives.
42          */
43         public long get_per_commitment_number() {
44                 long ret = bindings.HTLCDescriptor_get_per_commitment_number(this.ptr);
45                 GC.KeepAlive(this);
46                 return ret;
47         }
48
49         /**
50          * The number of the commitment transaction in which the HTLC output lives.
51          */
52         public void set_per_commitment_number(long val) {
53                 bindings.HTLCDescriptor_set_per_commitment_number(this.ptr, val);
54                 GC.KeepAlive(this);
55                 GC.KeepAlive(val);
56         }
57
58         /**
59          * The key tweak corresponding to the number of the commitment transaction in which the HTLC
60          * output lives. This tweak is applied to all the basepoints for both parties in the channel to
61          * arrive at unique keys per commitment.
62          * 
63          * See <https://github.com/lightning/bolts/blob/master/03-transactions.md#keys> for more info.
64          */
65         public byte[] get_per_commitment_point() {
66                 byte[] ret = bindings.HTLCDescriptor_get_per_commitment_point(this.ptr);
67                 GC.KeepAlive(this);
68                 return ret;
69         }
70
71         /**
72          * The key tweak corresponding to the number of the commitment transaction in which the HTLC
73          * output lives. This tweak is applied to all the basepoints for both parties in the channel to
74          * arrive at unique keys per commitment.
75          * 
76          * See <https://github.com/lightning/bolts/blob/master/03-transactions.md#keys> for more info.
77          */
78         public void set_per_commitment_point(byte[] val) {
79                 bindings.HTLCDescriptor_set_per_commitment_point(this.ptr, InternalUtils.check_arr_len(val, 33));
80                 GC.KeepAlive(this);
81                 GC.KeepAlive(val);
82         }
83
84         /**
85          * The details of the HTLC as it appears in the commitment transaction.
86          */
87         public HTLCOutputInCommitment get_htlc() {
88                 long ret = bindings.HTLCDescriptor_get_htlc(this.ptr);
89                 GC.KeepAlive(this);
90                 if (ret >= 0 && ret <= 4096) { return null; }
91                 org.ldk.structs.HTLCOutputInCommitment ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.HTLCOutputInCommitment(null, ret); }
92                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
93                 return ret_hu_conv;
94         }
95
96         /**
97          * The details of the HTLC as it appears in the commitment transaction.
98          */
99         public void set_htlc(org.ldk.structs.HTLCOutputInCommitment val) {
100                 bindings.HTLCDescriptor_set_htlc(this.ptr, val == null ? 0 : val.ptr);
101                 GC.KeepAlive(this);
102                 GC.KeepAlive(val);
103                 if (this != null) { this.ptrs_to.AddLast(val); };
104         }
105
106         /**
107          * The preimage, if `Some`, to claim the HTLC output with. If `None`, the timeout path must be
108          * taken.
109          */
110         public Option_PaymentPreimageZ get_preimage() {
111                 long ret = bindings.HTLCDescriptor_get_preimage(this.ptr);
112                 GC.KeepAlive(this);
113                 if (ret >= 0 && ret <= 4096) { return null; }
114                 org.ldk.structs.Option_PaymentPreimageZ ret_hu_conv = org.ldk.structs.Option_PaymentPreimageZ.constr_from_ptr(ret);
115                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
116                 return ret_hu_conv;
117         }
118
119         /**
120          * The preimage, if `Some`, to claim the HTLC output with. If `None`, the timeout path must be
121          * taken.
122          */
123         public void set_preimage(org.ldk.structs.Option_PaymentPreimageZ val) {
124                 bindings.HTLCDescriptor_set_preimage(this.ptr, val.ptr);
125                 GC.KeepAlive(this);
126                 GC.KeepAlive(val);
127                 if (this != null) { this.ptrs_to.AddLast(val); };
128         }
129
130         /**
131          * The counterparty's signature required to spend the HTLC output.
132          */
133         public byte[] get_counterparty_sig() {
134                 byte[] ret = bindings.HTLCDescriptor_get_counterparty_sig(this.ptr);
135                 GC.KeepAlive(this);
136                 return ret;
137         }
138
139         /**
140          * The counterparty's signature required to spend the HTLC output.
141          */
142         public void set_counterparty_sig(byte[] val) {
143                 bindings.HTLCDescriptor_set_counterparty_sig(this.ptr, InternalUtils.check_arr_len(val, 64));
144                 GC.KeepAlive(this);
145                 GC.KeepAlive(val);
146         }
147
148         internal long clone_ptr() {
149                 long ret = bindings.HTLCDescriptor_clone_ptr(this.ptr);
150                 GC.KeepAlive(this);
151                 return ret;
152         }
153
154         /**
155          * Creates a copy of the HTLCDescriptor
156          */
157         public HTLCDescriptor clone() {
158                 long ret = bindings.HTLCDescriptor_clone(this.ptr);
159                 GC.KeepAlive(this);
160                 if (ret >= 0 && ret <= 4096) { return null; }
161                 org.ldk.structs.HTLCDescriptor ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.HTLCDescriptor(null, ret); }
162                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
163                 return ret_hu_conv;
164         }
165
166         /**
167          * Checks if two HTLCDescriptors contain equal inner contents.
168          * This ignores pointers and is_owned flags and looks at the values in fields.
169          * Two objects with NULL inner values will be considered "equal" here.
170          */
171         public bool eq(org.ldk.structs.HTLCDescriptor b) {
172                 bool ret = bindings.HTLCDescriptor_eq(this.ptr, b == null ? 0 : b.ptr);
173                 GC.KeepAlive(this);
174                 GC.KeepAlive(b);
175                 if (this != null) { this.ptrs_to.AddLast(b); };
176                 return ret;
177         }
178
179         public override bool Equals(object o) {
180                 if (!(o is HTLCDescriptor)) return false;
181                 return this.eq((HTLCDescriptor)o);
182         }
183         /**
184          * Returns the outpoint of the HTLC output in the commitment transaction. This is the outpoint
185          * being spent by the HTLC input in the HTLC transaction.
186          */
187         public OutPoint outpoint() {
188                 long ret = bindings.HTLCDescriptor_outpoint(this.ptr);
189                 GC.KeepAlive(this);
190                 if (ret >= 0 && ret <= 4096) { return null; }
191                 org.ldk.structs.OutPoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OutPoint(null, ret); }
192                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
193                 return ret_hu_conv;
194         }
195
196         /**
197          * Returns the UTXO to be spent by the HTLC input, which can be obtained via
198          * [`Self::unsigned_tx_input`].
199          */
200         public TxOut previous_utxo() {
201                 long ret = bindings.HTLCDescriptor_previous_utxo(this.ptr);
202                 GC.KeepAlive(this);
203                 if (ret >= 0 && ret <= 4096) { return null; }
204                 TxOut ret_conv = new TxOut(null, ret);
205                 return ret_conv;
206         }
207
208         /**
209          * Returns the unsigned transaction input spending the HTLC output in the commitment
210          * transaction.
211          */
212         public TxIn unsigned_tx_input() {
213                 long ret = bindings.HTLCDescriptor_unsigned_tx_input(this.ptr);
214                 GC.KeepAlive(this);
215                 if (ret >= 0 && ret <= 4096) { return null; }
216                 TxIn ret_conv = new TxIn(null, ret);
217                 return ret_conv;
218         }
219
220         /**
221          * Returns the delayed output created as a result of spending the HTLC output in the commitment
222          * transaction.
223          */
224         public TxOut tx_output() {
225                 long ret = bindings.HTLCDescriptor_tx_output(this.ptr);
226                 GC.KeepAlive(this);
227                 if (ret >= 0 && ret <= 4096) { return null; }
228                 TxOut ret_conv = new TxOut(null, ret);
229                 return ret_conv;
230         }
231
232         /**
233          * Returns the witness script of the HTLC output in the commitment transaction.
234          */
235         public byte[] witness_script() {
236                 byte[] ret = bindings.HTLCDescriptor_witness_script(this.ptr);
237                 GC.KeepAlive(this);
238                 return ret;
239         }
240
241         /**
242          * Returns the fully signed witness required to spend the HTLC output in the commitment
243          * transaction.
244          */
245         public byte[] tx_input_witness(byte[] signature, byte[] witness_script) {
246                 byte[] ret = bindings.HTLCDescriptor_tx_input_witness(this.ptr, InternalUtils.check_arr_len(signature, 64), witness_script);
247                 GC.KeepAlive(this);
248                 GC.KeepAlive(signature);
249                 GC.KeepAlive(witness_script);
250                 return ret;
251         }
252
253         /**
254          * Derives the channel signer required to sign the HTLC input.
255          */
256         public WriteableEcdsaChannelSigner derive_channel_signer(org.ldk.structs.SignerProvider signer_provider) {
257                 long ret = bindings.HTLCDescriptor_derive_channel_signer(this.ptr, signer_provider.ptr);
258                 GC.KeepAlive(this);
259                 GC.KeepAlive(signer_provider);
260                 if (ret >= 0 && ret <= 4096) { return null; }
261                 WriteableEcdsaChannelSigner ret_hu_conv = new WriteableEcdsaChannelSigner(null, ret);
262                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
263                 if (this != null) { this.ptrs_to.AddLast(signer_provider); };
264                 return ret_hu_conv;
265         }
266
267 }
268 } } }