Update auto-generated bindings
[ldk-java] / src / main / java / org / ldk / structs / TrustedCommitmentTransaction.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
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 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
18 public class TrustedCommitmentTransaction extends CommonBase {
19         TrustedCommitmentTransaction(Object _dummy, long ptr) { super(ptr); }
20         @Override @SuppressWarnings("deprecation")
21         protected void finalize() throws Throwable {
22                 super.finalize();
23                 if (ptr != 0) { bindings.TrustedCommitmentTransaction_free(ptr); }
24         }
25
26         /**
27          * The transaction ID of the built Bitcoin transaction
28          */
29         public byte[] txid() {
30                 byte[] ret = bindings.TrustedCommitmentTransaction_txid(this.ptr);
31                 return ret;
32         }
33
34         /**
35          * The pre-built Bitcoin commitment transaction
36          */
37         public BuiltCommitmentTransaction built_transaction() {
38                 long ret = bindings.TrustedCommitmentTransaction_built_transaction(this.ptr);
39                 if (ret < 1024) { return null; }
40                 BuiltCommitmentTransaction ret_hu_conv = new BuiltCommitmentTransaction(null, ret);
41                 ret_hu_conv.ptrs_to.add(this);
42                 return ret_hu_conv;
43         }
44
45         /**
46          * The pre-calculated transaction creation public keys.
47          */
48         public TxCreationKeys keys() {
49                 long ret = bindings.TrustedCommitmentTransaction_keys(this.ptr);
50                 if (ret < 1024) { return null; }
51                 TxCreationKeys ret_hu_conv = new TxCreationKeys(null, ret);
52                 ret_hu_conv.ptrs_to.add(this);
53                 return ret_hu_conv;
54         }
55
56         /**
57          * Get a signature for each HTLC which was included in the commitment transaction (ie for
58          * which HTLCOutputInCommitment::transaction_output_index.is_some()).
59          * 
60          * The returned Vec has one entry for each HTLC, and in the same order.
61          */
62         public Result_CVec_SignatureZNoneZ get_htlc_sigs(byte[] htlc_base_key, DirectedChannelTransactionParameters channel_parameters) {
63                 long ret = bindings.TrustedCommitmentTransaction_get_htlc_sigs(this.ptr, htlc_base_key, channel_parameters == null ? 0 : channel_parameters.ptr & ~1);
64                 if (ret < 1024) { return null; }
65                 Result_CVec_SignatureZNoneZ ret_hu_conv = Result_CVec_SignatureZNoneZ.constr_from_ptr(ret);
66                 this.ptrs_to.add(channel_parameters);
67                 return ret_hu_conv;
68         }
69
70 }