Update java bindings with new generator and new upstream code
[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                 BuiltCommitmentTransaction ret_hu_conv = new BuiltCommitmentTransaction(null, ret);
40                 ret_hu_conv.ptrs_to.add(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                 TxCreationKeys ret_hu_conv = new TxCreationKeys(null, ret);
50                 ret_hu_conv.ptrs_to.add(this);
51                 return ret_hu_conv;
52         }
53
54         /**
55          * Get a signature for each HTLC which was included in the commitment transaction (ie for
56          * which HTLCOutputInCommitment::transaction_output_index.is_some()).
57          * 
58          * The returned Vec has one entry for each HTLC, and in the same order.
59          */
60         public Result_CVec_SignatureZNoneZ get_htlc_sigs(byte[] htlc_base_key, DirectedChannelTransactionParameters channel_parameters) {
61                 long ret = bindings.TrustedCommitmentTransaction_get_htlc_sigs(this.ptr, htlc_base_key, channel_parameters == null ? 0 : channel_parameters.ptr & ~1);
62                 Result_CVec_SignatureZNoneZ ret_hu_conv = Result_CVec_SignatureZNoneZ.constr_from_ptr(ret);
63                 this.ptrs_to.add(channel_parameters);
64                 return ret_hu_conv;
65         }
66
67 }