[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / EcdsaChannelSigner.cs
1
2 using org.ldk.impl;
3 using org.ldk.enums;
4 using org.ldk.util;
5 using System;
6
7 namespace org { namespace ldk { namespace structs {
8
9
10
11 /** An implementation of EcdsaChannelSigner */
12 public interface EcdsaChannelSignerInterface {
13         /**Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
14          * 
15          * Note that if signing fails or is rejected, the channel will be force-closed.
16          * 
17          * Policy checks should be implemented in this function, including checking the amount
18          * sent to us and checking the HTLCs.
19          * 
20          * The preimages of outbound and inbound HTLCs that were fulfilled since the last commitment
21          * are provided. A validating signer should ensure that an outbound HTLC output is removed
22          * only when the matching preimage is provided and after the corresponding inbound HTLC has
23          * been removed for forwarded payments.
24          * 
25          * Note that all the relevant preimages will be provided, but there may also be additional
26          * irrelevant or duplicate preimages.
27          */
28         Result_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ sign_counterparty_commitment(CommitmentTransaction commitment_tx, byte[][] inbound_htlc_preimages, byte[][] outbound_htlc_preimages);
29         /**Creates a signature for a holder's commitment transaction.
30          * 
31          * This will be called
32          * - with a non-revoked `commitment_tx`.
33          * - with the latest `commitment_tx` when we initiate a force-close.
34          * 
35          * This may be called multiple times for the same transaction.
36          * 
37          * An external signer implementation should check that the commitment has not been revoked.
38          */
39         Result_ECDSASignatureNoneZ sign_holder_commitment(HolderCommitmentTransaction commitment_tx);
40         /**Create a signature for the given input in a transaction spending an HTLC transaction output
41          * or a commitment transaction `to_local` output when our counterparty broadcasts an old state.
42          * 
43          * A justice transaction may claim multiple outputs at the same time if timelocks are
44          * similar, but only a signature for the input at index `input` should be signed for here.
45          * It may be called multiple times for same output(s) if a fee-bump is needed with regards
46          * to an upcoming timelock expiration.
47          * 
48          * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
49          * 
50          * `per_commitment_key` is revocation secret which was provided by our counterparty when they
51          * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
52          * not allow the spending of any funds by itself (you need our holder `revocation_secret` to do
53          * so).
54          */
55         Result_ECDSASignatureNoneZ sign_justice_revoked_output(byte[] justice_tx, long input, long amount, byte[] per_commitment_key);
56         /**Create a signature for the given input in a transaction spending a commitment transaction
57          * HTLC output when our counterparty broadcasts an old state.
58          * 
59          * A justice transaction may claim multiple outputs at the same time if timelocks are
60          * similar, but only a signature for the input at index `input` should be signed for here.
61          * It may be called multiple times for same output(s) if a fee-bump is needed with regards
62          * to an upcoming timelock expiration.
63          * 
64          * `amount` is the value of the output spent by this input, committed to in the BIP 143
65          * signature.
66          * 
67          * `per_commitment_key` is revocation secret which was provided by our counterparty when they
68          * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
69          * not allow the spending of any funds by itself (you need our holder revocation_secret to do
70          * so).
71          * 
72          * `htlc` holds HTLC elements (hash, timelock), thus changing the format of the witness script
73          * (which is committed to in the BIP 143 signatures).
74          */
75         Result_ECDSASignatureNoneZ sign_justice_revoked_htlc(byte[] justice_tx, long input, long amount, byte[] per_commitment_key, HTLCOutputInCommitment htlc);
76         /**Computes the signature for a commitment transaction's HTLC output used as an input within
77          * `htlc_tx`, which spends the commitment transaction at index `input`. The signature returned
78          * must be be computed using [`EcdsaSighashType::All`].
79          * 
80          * Note that this may be called for HTLCs in the penultimate commitment transaction if a
81          * [`ChannelMonitor`] [replica](https://github.com/lightningdevkit/rust-lightning/blob/main/GLOSSARY.md#monitor-replicas)
82          * broadcasts it before receiving the update for the latest commitment transaction.
83          * 
84          * [`EcdsaSighashType::All`]: bitcoin::sighash::EcdsaSighashType::All
85          * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
86          */
87         Result_ECDSASignatureNoneZ sign_holder_htlc_transaction(byte[] htlc_tx, long input, HTLCDescriptor htlc_descriptor);
88         /**Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
89          * transaction, either offered or received.
90          * 
91          * Such a transaction may claim multiples offered outputs at same time if we know the
92          * preimage for each when we create it, but only the input at index `input` should be
93          * signed for here. It may be called multiple times for same output(s) if a fee-bump is
94          * needed with regards to an upcoming timelock expiration.
95          * 
96          * `witness_script` is either an offered or received script as defined in BOLT3 for HTLC
97          * outputs.
98          * 
99          * `amount` is value of the output spent by this input, committed to in the BIP 143 signature.
100          * 
101          * `per_commitment_point` is the dynamic point corresponding to the channel state
102          * detected onchain. It has been generated by our counterparty and is used to derive
103          * channel state keys, which are then included in the witness script and committed to in the
104          * BIP 143 signature.
105          */
106         Result_ECDSASignatureNoneZ sign_counterparty_htlc_transaction(byte[] htlc_tx, long input, long amount, byte[] per_commitment_point, HTLCOutputInCommitment htlc);
107         /**Create a signature for a (proposed) closing transaction.
108          * 
109          * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
110          * chosen to forgo their output as dust.
111          */
112         Result_ECDSASignatureNoneZ sign_closing_transaction(ClosingTransaction closing_tx);
113         /**Computes the signature for a commitment transaction's anchor output used as an
114          * input within `anchor_tx`, which spends the commitment transaction, at index `input`.
115          */
116         Result_ECDSASignatureNoneZ sign_holder_anchor_input(byte[] anchor_tx, long input);
117         /**Signs a channel announcement message with our funding key proving it comes from one of the
118          * channel participants.
119          * 
120          * Channel announcements also require a signature from each node's network key. Our node
121          * signature is computed through [`NodeSigner::sign_gossip_message`].
122          * 
123          * Note that if this fails or is rejected, the channel will not be publicly announced and
124          * our counterparty may (though likely will not) close the channel on us for violating the
125          * protocol.
126          * 
127          * [`NodeSigner::sign_gossip_message`]: crate::sign::NodeSigner::sign_gossip_message
128          */
129         Result_ECDSASignatureNoneZ sign_channel_announcement_with_funding_key(UnsignedChannelAnnouncement msg);
130 }
131
132 /**
133  * A trait to sign Lightning channel transactions as described in
134  * [BOLT 3](https://github.com/lightning/bolts/blob/master/03-transactions.md).
135  * 
136  * Signing services could be implemented on a hardware wallet and should implement signing
137  * policies in order to be secure. Please refer to the [VLS Policy
138  * Controls](https://gitlab.com/lightning-signer/validating-lightning-signer/-/blob/main/docs/policy-controls.md)
139  * for an example of such policies.
140  */
141 public class EcdsaChannelSigner : CommonBase {
142         internal bindings.LDKEcdsaChannelSigner bindings_instance;
143         internal long instance_idx;
144
145         internal EcdsaChannelSigner(object _dummy, long ptr) : base(ptr) { bindings_instance = null; }
146         ~EcdsaChannelSigner() {
147                 if (ptr != 0) { bindings.EcdsaChannelSigner_free(ptr); }
148         }
149
150         private class LDKEcdsaChannelSignerHolder { internal EcdsaChannelSigner held; }
151         private class LDKEcdsaChannelSignerImpl : bindings.LDKEcdsaChannelSigner {
152                 internal LDKEcdsaChannelSignerImpl(EcdsaChannelSignerInterface arg, LDKEcdsaChannelSignerHolder impl_holder) { this.arg = arg; this.impl_holder = impl_holder; }
153                 private EcdsaChannelSignerInterface arg;
154                 private LDKEcdsaChannelSignerHolder impl_holder;
155                 public long sign_counterparty_commitment(long _commitment_tx, long _inbound_htlc_preimages, long _outbound_htlc_preimages) {
156                         org.ldk.structs.CommitmentTransaction _commitment_tx_hu_conv = null; if (_commitment_tx < 0 || _commitment_tx > 4096) { _commitment_tx_hu_conv = new org.ldk.structs.CommitmentTransaction(null, _commitment_tx); }
157                         int _inbound_htlc_preimages_conv_8_len = InternalUtils.getArrayLength(_inbound_htlc_preimages);
158                         byte[][] _inbound_htlc_preimages_conv_8_arr = new byte[_inbound_htlc_preimages_conv_8_len][];
159                         for (int i = 0; i < _inbound_htlc_preimages_conv_8_len; i++) {
160                                 long _inbound_htlc_preimages_conv_8 = InternalUtils.getU64ArrayElem(_inbound_htlc_preimages, i);
161                                 byte[] _inbound_htlc_preimages_conv_8_conv = InternalUtils.decodeUint8Array(_inbound_htlc_preimages_conv_8);
162                                 _inbound_htlc_preimages_conv_8_arr[i] = _inbound_htlc_preimages_conv_8_conv;
163                         }
164                         bindings.free_buffer(_inbound_htlc_preimages);
165                         int _outbound_htlc_preimages_conv_8_len = InternalUtils.getArrayLength(_outbound_htlc_preimages);
166                         byte[][] _outbound_htlc_preimages_conv_8_arr = new byte[_outbound_htlc_preimages_conv_8_len][];
167                         for (int i = 0; i < _outbound_htlc_preimages_conv_8_len; i++) {
168                                 long _outbound_htlc_preimages_conv_8 = InternalUtils.getU64ArrayElem(_outbound_htlc_preimages, i);
169                                 byte[] _outbound_htlc_preimages_conv_8_conv = InternalUtils.decodeUint8Array(_outbound_htlc_preimages_conv_8);
170                                 _outbound_htlc_preimages_conv_8_arr[i] = _outbound_htlc_preimages_conv_8_conv;
171                         }
172                         bindings.free_buffer(_outbound_htlc_preimages);
173                         Result_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ ret = arg.sign_counterparty_commitment(_commitment_tx_hu_conv, _inbound_htlc_preimages_conv_8_arr, _outbound_htlc_preimages_conv_8_arr);
174                                 GC.KeepAlive(arg);
175                         long result = ret == null ? 0 : ret.clone_ptr();
176                         return result;
177                 }
178                 public long sign_holder_commitment(long _commitment_tx) {
179                         org.ldk.structs.HolderCommitmentTransaction _commitment_tx_hu_conv = null; if (_commitment_tx < 0 || _commitment_tx > 4096) { _commitment_tx_hu_conv = new org.ldk.structs.HolderCommitmentTransaction(null, _commitment_tx); }
180                         Result_ECDSASignatureNoneZ ret = arg.sign_holder_commitment(_commitment_tx_hu_conv);
181                                 GC.KeepAlive(arg);
182                         long result = ret == null ? 0 : ret.clone_ptr();
183                         return result;
184                 }
185                 public long sign_justice_revoked_output(long _justice_tx, long _input, long _amount, long _per_commitment_key) {
186                         byte[] _justice_tx_conv = InternalUtils.decodeUint8Array(_justice_tx);
187                         byte[] _per_commitment_key_conv = InternalUtils.decodeUint8Array(_per_commitment_key);
188                         Result_ECDSASignatureNoneZ ret = arg.sign_justice_revoked_output(_justice_tx_conv, _input, _amount, _per_commitment_key_conv);
189                                 GC.KeepAlive(arg);
190                         long result = ret == null ? 0 : ret.clone_ptr();
191                         return result;
192                 }
193                 public long sign_justice_revoked_htlc(long _justice_tx, long _input, long _amount, long _per_commitment_key, long _htlc) {
194                         byte[] _justice_tx_conv = InternalUtils.decodeUint8Array(_justice_tx);
195                         byte[] _per_commitment_key_conv = InternalUtils.decodeUint8Array(_per_commitment_key);
196                         org.ldk.structs.HTLCOutputInCommitment _htlc_hu_conv = null; if (_htlc < 0 || _htlc > 4096) { _htlc_hu_conv = new org.ldk.structs.HTLCOutputInCommitment(null, _htlc); }
197                         Result_ECDSASignatureNoneZ ret = arg.sign_justice_revoked_htlc(_justice_tx_conv, _input, _amount, _per_commitment_key_conv, _htlc_hu_conv);
198                                 GC.KeepAlive(arg);
199                         long result = ret == null ? 0 : ret.clone_ptr();
200                         return result;
201                 }
202                 public long sign_holder_htlc_transaction(long _htlc_tx, long _input, long _htlc_descriptor) {
203                         byte[] _htlc_tx_conv = InternalUtils.decodeUint8Array(_htlc_tx);
204                         org.ldk.structs.HTLCDescriptor _htlc_descriptor_hu_conv = null; if (_htlc_descriptor < 0 || _htlc_descriptor > 4096) { _htlc_descriptor_hu_conv = new org.ldk.structs.HTLCDescriptor(null, _htlc_descriptor); }
205                         Result_ECDSASignatureNoneZ ret = arg.sign_holder_htlc_transaction(_htlc_tx_conv, _input, _htlc_descriptor_hu_conv);
206                                 GC.KeepAlive(arg);
207                         long result = ret == null ? 0 : ret.clone_ptr();
208                         return result;
209                 }
210                 public long sign_counterparty_htlc_transaction(long _htlc_tx, long _input, long _amount, long _per_commitment_point, long _htlc) {
211                         byte[] _htlc_tx_conv = InternalUtils.decodeUint8Array(_htlc_tx);
212                         byte[] _per_commitment_point_conv = InternalUtils.decodeUint8Array(_per_commitment_point);
213                         org.ldk.structs.HTLCOutputInCommitment _htlc_hu_conv = null; if (_htlc < 0 || _htlc > 4096) { _htlc_hu_conv = new org.ldk.structs.HTLCOutputInCommitment(null, _htlc); }
214                         Result_ECDSASignatureNoneZ ret = arg.sign_counterparty_htlc_transaction(_htlc_tx_conv, _input, _amount, _per_commitment_point_conv, _htlc_hu_conv);
215                                 GC.KeepAlive(arg);
216                         long result = ret == null ? 0 : ret.clone_ptr();
217                         return result;
218                 }
219                 public long sign_closing_transaction(long _closing_tx) {
220                         org.ldk.structs.ClosingTransaction _closing_tx_hu_conv = null; if (_closing_tx < 0 || _closing_tx > 4096) { _closing_tx_hu_conv = new org.ldk.structs.ClosingTransaction(null, _closing_tx); }
221                         Result_ECDSASignatureNoneZ ret = arg.sign_closing_transaction(_closing_tx_hu_conv);
222                                 GC.KeepAlive(arg);
223                         long result = ret == null ? 0 : ret.clone_ptr();
224                         return result;
225                 }
226                 public long sign_holder_anchor_input(long _anchor_tx, long _input) {
227                         byte[] _anchor_tx_conv = InternalUtils.decodeUint8Array(_anchor_tx);
228                         Result_ECDSASignatureNoneZ ret = arg.sign_holder_anchor_input(_anchor_tx_conv, _input);
229                                 GC.KeepAlive(arg);
230                         long result = ret == null ? 0 : ret.clone_ptr();
231                         return result;
232                 }
233                 public long sign_channel_announcement_with_funding_key(long _msg) {
234                         org.ldk.structs.UnsignedChannelAnnouncement _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.UnsignedChannelAnnouncement(null, _msg); }
235                         Result_ECDSASignatureNoneZ ret = arg.sign_channel_announcement_with_funding_key(_msg_hu_conv);
236                                 GC.KeepAlive(arg);
237                         long result = ret == null ? 0 : ret.clone_ptr();
238                         return result;
239                 }
240         }
241
242         /** Creates a new instance of EcdsaChannelSigner from a given implementation */
243         public static EcdsaChannelSigner new_impl(EcdsaChannelSignerInterface arg, ChannelSignerInterface channelSigner_impl, ChannelPublicKeys pubkeys) {
244                 LDKEcdsaChannelSignerHolder impl_holder = new LDKEcdsaChannelSignerHolder();
245                 LDKEcdsaChannelSignerImpl impl = new LDKEcdsaChannelSignerImpl(arg, impl_holder);
246                 ChannelSigner channelSigner = ChannelSigner.new_impl(channelSigner_impl, pubkeys);
247                 long[] ptr_idx = bindings.LDKEcdsaChannelSigner_new(impl, channelSigner.instance_idx, pubkeys == null ? 0 : pubkeys.clone_ptr());
248
249                 impl_holder.held = new EcdsaChannelSigner(null, ptr_idx[0]);
250                 impl_holder.held.instance_idx = ptr_idx[1];
251                 impl_holder.held.bindings_instance = impl;
252                 impl_holder.held.ptrs_to.AddLast(channelSigner);
253                 return impl_holder.held;
254         }
255
256         /**
257          * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
258          * 
259          * Note that if signing fails or is rejected, the channel will be force-closed.
260          * 
261          * Policy checks should be implemented in this function, including checking the amount
262          * sent to us and checking the HTLCs.
263          * 
264          * The preimages of outbound and inbound HTLCs that were fulfilled since the last commitment
265          * are provided. A validating signer should ensure that an outbound HTLC output is removed
266          * only when the matching preimage is provided and after the corresponding inbound HTLC has
267          * been removed for forwarded payments.
268          * 
269          * Note that all the relevant preimages will be provided, but there may also be additional
270          * irrelevant or duplicate preimages.
271          */
272         public Result_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ sign_counterparty_commitment(org.ldk.structs.CommitmentTransaction commitment_tx, byte[][] inbound_htlc_preimages, byte[][] outbound_htlc_preimages) {
273                 long ret = bindings.EcdsaChannelSigner_sign_counterparty_commitment(this.ptr, commitment_tx == null ? 0 : commitment_tx.ptr, InternalUtils.encodeUint64Array(InternalUtils.mapArray(inbound_htlc_preimages, inbound_htlc_preimages_conv_8 => InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(inbound_htlc_preimages_conv_8, 32)))), InternalUtils.encodeUint64Array(InternalUtils.mapArray(outbound_htlc_preimages, outbound_htlc_preimages_conv_8 => InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(outbound_htlc_preimages_conv_8, 32)))));
274                 GC.KeepAlive(this);
275                 GC.KeepAlive(commitment_tx);
276                 GC.KeepAlive(inbound_htlc_preimages);
277                 GC.KeepAlive(outbound_htlc_preimages);
278                 if (ret >= 0 && ret <= 4096) { return null; }
279                 Result_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ ret_hu_conv = Result_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ.constr_from_ptr(ret);
280                 if (this != null) { this.ptrs_to.AddLast(commitment_tx); };
281                 return ret_hu_conv;
282         }
283
284         /**
285          * Creates a signature for a holder's commitment transaction.
286          * 
287          * This will be called
288          * - with a non-revoked `commitment_tx`.
289          * - with the latest `commitment_tx` when we initiate a force-close.
290          * 
291          * This may be called multiple times for the same transaction.
292          * 
293          * An external signer implementation should check that the commitment has not been revoked.
294          */
295         public Result_ECDSASignatureNoneZ sign_holder_commitment(org.ldk.structs.HolderCommitmentTransaction commitment_tx) {
296                 long ret = bindings.EcdsaChannelSigner_sign_holder_commitment(this.ptr, commitment_tx == null ? 0 : commitment_tx.ptr);
297                 GC.KeepAlive(this);
298                 GC.KeepAlive(commitment_tx);
299                 if (ret >= 0 && ret <= 4096) { return null; }
300                 Result_ECDSASignatureNoneZ ret_hu_conv = Result_ECDSASignatureNoneZ.constr_from_ptr(ret);
301                 if (this != null) { this.ptrs_to.AddLast(commitment_tx); };
302                 return ret_hu_conv;
303         }
304
305         /**
306          * Create a signature for the given input in a transaction spending an HTLC transaction output
307          * or a commitment transaction `to_local` output when our counterparty broadcasts an old state.
308          * 
309          * A justice transaction may claim multiple outputs at the same time if timelocks are
310          * similar, but only a signature for the input at index `input` should be signed for here.
311          * It may be called multiple times for same output(s) if a fee-bump is needed with regards
312          * to an upcoming timelock expiration.
313          * 
314          * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
315          * 
316          * `per_commitment_key` is revocation secret which was provided by our counterparty when they
317          * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
318          * not allow the spending of any funds by itself (you need our holder `revocation_secret` to do
319          * so).
320          */
321         public Result_ECDSASignatureNoneZ sign_justice_revoked_output(byte[] justice_tx, long input, long amount, byte[] per_commitment_key) {
322                 long ret = bindings.EcdsaChannelSigner_sign_justice_revoked_output(this.ptr, InternalUtils.encodeUint8Array(justice_tx), input, amount, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(per_commitment_key, 32)));
323                 GC.KeepAlive(this);
324                 GC.KeepAlive(justice_tx);
325                 GC.KeepAlive(input);
326                 GC.KeepAlive(amount);
327                 GC.KeepAlive(per_commitment_key);
328                 if (ret >= 0 && ret <= 4096) { return null; }
329                 Result_ECDSASignatureNoneZ ret_hu_conv = Result_ECDSASignatureNoneZ.constr_from_ptr(ret);
330                 return ret_hu_conv;
331         }
332
333         /**
334          * Create a signature for the given input in a transaction spending a commitment transaction
335          * HTLC output when our counterparty broadcasts an old state.
336          * 
337          * A justice transaction may claim multiple outputs at the same time if timelocks are
338          * similar, but only a signature for the input at index `input` should be signed for here.
339          * It may be called multiple times for same output(s) if a fee-bump is needed with regards
340          * to an upcoming timelock expiration.
341          * 
342          * `amount` is the value of the output spent by this input, committed to in the BIP 143
343          * signature.
344          * 
345          * `per_commitment_key` is revocation secret which was provided by our counterparty when they
346          * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
347          * not allow the spending of any funds by itself (you need our holder revocation_secret to do
348          * so).
349          * 
350          * `htlc` holds HTLC elements (hash, timelock), thus changing the format of the witness script
351          * (which is committed to in the BIP 143 signatures).
352          */
353         public Result_ECDSASignatureNoneZ sign_justice_revoked_htlc(byte[] justice_tx, long input, long amount, byte[] per_commitment_key, org.ldk.structs.HTLCOutputInCommitment htlc) {
354                 long ret = bindings.EcdsaChannelSigner_sign_justice_revoked_htlc(this.ptr, InternalUtils.encodeUint8Array(justice_tx), input, amount, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(per_commitment_key, 32)), htlc == null ? 0 : htlc.ptr);
355                 GC.KeepAlive(this);
356                 GC.KeepAlive(justice_tx);
357                 GC.KeepAlive(input);
358                 GC.KeepAlive(amount);
359                 GC.KeepAlive(per_commitment_key);
360                 GC.KeepAlive(htlc);
361                 if (ret >= 0 && ret <= 4096) { return null; }
362                 Result_ECDSASignatureNoneZ ret_hu_conv = Result_ECDSASignatureNoneZ.constr_from_ptr(ret);
363                 if (this != null) { this.ptrs_to.AddLast(htlc); };
364                 return ret_hu_conv;
365         }
366
367         /**
368          * Computes the signature for a commitment transaction's HTLC output used as an input within
369          * `htlc_tx`, which spends the commitment transaction at index `input`. The signature returned
370          * must be be computed using [`EcdsaSighashType::All`].
371          * 
372          * Note that this may be called for HTLCs in the penultimate commitment transaction if a
373          * [`ChannelMonitor`] [replica](https://github.com/lightningdevkit/rust-lightning/blob/main/GLOSSARY.md#monitor-replicas)
374          * broadcasts it before receiving the update for the latest commitment transaction.
375          * 
376          * [`EcdsaSighashType::All`]: bitcoin::sighash::EcdsaSighashType::All
377          * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
378          */
379         public Result_ECDSASignatureNoneZ sign_holder_htlc_transaction(byte[] htlc_tx, long input, org.ldk.structs.HTLCDescriptor htlc_descriptor) {
380                 long ret = bindings.EcdsaChannelSigner_sign_holder_htlc_transaction(this.ptr, InternalUtils.encodeUint8Array(htlc_tx), input, htlc_descriptor == null ? 0 : htlc_descriptor.ptr);
381                 GC.KeepAlive(this);
382                 GC.KeepAlive(htlc_tx);
383                 GC.KeepAlive(input);
384                 GC.KeepAlive(htlc_descriptor);
385                 if (ret >= 0 && ret <= 4096) { return null; }
386                 Result_ECDSASignatureNoneZ ret_hu_conv = Result_ECDSASignatureNoneZ.constr_from_ptr(ret);
387                 if (this != null) { this.ptrs_to.AddLast(htlc_descriptor); };
388                 return ret_hu_conv;
389         }
390
391         /**
392          * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
393          * transaction, either offered or received.
394          * 
395          * Such a transaction may claim multiples offered outputs at same time if we know the
396          * preimage for each when we create it, but only the input at index `input` should be
397          * signed for here. It may be called multiple times for same output(s) if a fee-bump is
398          * needed with regards to an upcoming timelock expiration.
399          * 
400          * `witness_script` is either an offered or received script as defined in BOLT3 for HTLC
401          * outputs.
402          * 
403          * `amount` is value of the output spent by this input, committed to in the BIP 143 signature.
404          * 
405          * `per_commitment_point` is the dynamic point corresponding to the channel state
406          * detected onchain. It has been generated by our counterparty and is used to derive
407          * channel state keys, which are then included in the witness script and committed to in the
408          * BIP 143 signature.
409          */
410         public Result_ECDSASignatureNoneZ sign_counterparty_htlc_transaction(byte[] htlc_tx, long input, long amount, byte[] per_commitment_point, org.ldk.structs.HTLCOutputInCommitment htlc) {
411                 long ret = bindings.EcdsaChannelSigner_sign_counterparty_htlc_transaction(this.ptr, InternalUtils.encodeUint8Array(htlc_tx), input, amount, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(per_commitment_point, 33)), htlc == null ? 0 : htlc.ptr);
412                 GC.KeepAlive(this);
413                 GC.KeepAlive(htlc_tx);
414                 GC.KeepAlive(input);
415                 GC.KeepAlive(amount);
416                 GC.KeepAlive(per_commitment_point);
417                 GC.KeepAlive(htlc);
418                 if (ret >= 0 && ret <= 4096) { return null; }
419                 Result_ECDSASignatureNoneZ ret_hu_conv = Result_ECDSASignatureNoneZ.constr_from_ptr(ret);
420                 if (this != null) { this.ptrs_to.AddLast(htlc); };
421                 return ret_hu_conv;
422         }
423
424         /**
425          * Create a signature for a (proposed) closing transaction.
426          * 
427          * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
428          * chosen to forgo their output as dust.
429          */
430         public Result_ECDSASignatureNoneZ sign_closing_transaction(org.ldk.structs.ClosingTransaction closing_tx) {
431                 long ret = bindings.EcdsaChannelSigner_sign_closing_transaction(this.ptr, closing_tx == null ? 0 : closing_tx.ptr);
432                 GC.KeepAlive(this);
433                 GC.KeepAlive(closing_tx);
434                 if (ret >= 0 && ret <= 4096) { return null; }
435                 Result_ECDSASignatureNoneZ ret_hu_conv = Result_ECDSASignatureNoneZ.constr_from_ptr(ret);
436                 if (this != null) { this.ptrs_to.AddLast(closing_tx); };
437                 return ret_hu_conv;
438         }
439
440         /**
441          * Computes the signature for a commitment transaction's anchor output used as an
442          * input within `anchor_tx`, which spends the commitment transaction, at index `input`.
443          */
444         public Result_ECDSASignatureNoneZ sign_holder_anchor_input(byte[] anchor_tx, long input) {
445                 long ret = bindings.EcdsaChannelSigner_sign_holder_anchor_input(this.ptr, InternalUtils.encodeUint8Array(anchor_tx), input);
446                 GC.KeepAlive(this);
447                 GC.KeepAlive(anchor_tx);
448                 GC.KeepAlive(input);
449                 if (ret >= 0 && ret <= 4096) { return null; }
450                 Result_ECDSASignatureNoneZ ret_hu_conv = Result_ECDSASignatureNoneZ.constr_from_ptr(ret);
451                 return ret_hu_conv;
452         }
453
454         /**
455          * Signs a channel announcement message with our funding key proving it comes from one of the
456          * channel participants.
457          * 
458          * Channel announcements also require a signature from each node's network key. Our node
459          * signature is computed through [`NodeSigner::sign_gossip_message`].
460          * 
461          * Note that if this fails or is rejected, the channel will not be publicly announced and
462          * our counterparty may (though likely will not) close the channel on us for violating the
463          * protocol.
464          * 
465          * [`NodeSigner::sign_gossip_message`]: crate::sign::NodeSigner::sign_gossip_message
466          */
467         public Result_ECDSASignatureNoneZ sign_channel_announcement_with_funding_key(org.ldk.structs.UnsignedChannelAnnouncement msg) {
468                 long ret = bindings.EcdsaChannelSigner_sign_channel_announcement_with_funding_key(this.ptr, msg == null ? 0 : msg.ptr);
469                 GC.KeepAlive(this);
470                 GC.KeepAlive(msg);
471                 if (ret >= 0 && ret <= 4096) { return null; }
472                 Result_ECDSASignatureNoneZ ret_hu_conv = Result_ECDSASignatureNoneZ.constr_from_ptr(ret);
473                 if (this != null) { this.ptrs_to.AddLast(msg); };
474                 return ret_hu_conv;
475         }
476
477 }
478 } } }