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