[C#] Check in initial auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / TrustedCommitmentTransaction.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 wrapper on CommitmentTransaction indicating that the derived fields (the built bitcoin
11  * transaction and the transaction creation keys) are trusted.
12  * 
13  * See trust() and verify() functions on CommitmentTransaction.
14  * 
15  * This structure implements Deref.
16  */
17 public class TrustedCommitmentTransaction : CommonBase {
18         internal TrustedCommitmentTransaction(object _dummy, long ptr) : base(ptr) { }
19         ~TrustedCommitmentTransaction() {
20                 if (ptr != 0) { bindings.TrustedCommitmentTransaction_free(ptr); }
21         }
22
23         /**
24          * The transaction ID of the built Bitcoin transaction
25          */
26         public byte[] txid() {
27                 byte[] ret = bindings.TrustedCommitmentTransaction_txid(this.ptr);
28                 GC.KeepAlive(this);
29                 return ret;
30         }
31
32         /**
33          * The pre-built Bitcoin commitment transaction
34          */
35         public BuiltCommitmentTransaction built_transaction() {
36                 long ret = bindings.TrustedCommitmentTransaction_built_transaction(this.ptr);
37                 GC.KeepAlive(this);
38                 if (ret >= 0 && ret <= 4096) { return null; }
39                 org.ldk.structs.BuiltCommitmentTransaction ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.BuiltCommitmentTransaction(null, ret); }
40                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
41                 return ret_hu_conv;
42         }
43
44         /**
45          * The pre-calculated transaction creation public keys.
46          */
47         public TxCreationKeys keys() {
48                 long ret = bindings.TrustedCommitmentTransaction_keys(this.ptr);
49                 GC.KeepAlive(this);
50                 if (ret >= 0 && ret <= 4096) { return null; }
51                 org.ldk.structs.TxCreationKeys ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxCreationKeys(null, ret); }
52                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
53                 return ret_hu_conv;
54         }
55
56         /**
57          * Should anchors be used.
58          */
59         public bool opt_anchors() {
60                 bool ret = bindings.TrustedCommitmentTransaction_opt_anchors(this.ptr);
61                 GC.KeepAlive(this);
62                 return ret;
63         }
64
65         /**
66          * Get a signature for each HTLC which was included in the commitment transaction (ie for
67          * which HTLCOutputInCommitment::transaction_output_index.is_some()).
68          * 
69          * The returned Vec has one entry for each HTLC, and in the same order.
70          * 
71          * This function is only valid in the holder commitment context, it always uses EcdsaSighashType::All.
72          */
73         public Result_CVec_SignatureZNoneZ get_htlc_sigs(byte[] htlc_base_key, org.ldk.structs.DirectedChannelTransactionParameters channel_parameters) {
74                 long ret = bindings.TrustedCommitmentTransaction_get_htlc_sigs(this.ptr, InternalUtils.check_arr_len(htlc_base_key, 32), channel_parameters == null ? 0 : channel_parameters.ptr);
75                 GC.KeepAlive(this);
76                 GC.KeepAlive(htlc_base_key);
77                 GC.KeepAlive(channel_parameters);
78                 if (ret >= 0 && ret <= 4096) { return null; }
79                 Result_CVec_SignatureZNoneZ ret_hu_conv = Result_CVec_SignatureZNoneZ.constr_from_ptr(ret);
80                 if (this != null) { this.ptrs_to.AddLast(channel_parameters); };
81                 return ret_hu_conv;
82         }
83
84 }
85 } } }