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 import javax.annotation.Nullable;
8
9
10 /**
11  * A wrapper on CommitmentTransaction indicating that the derived fields (the built bitcoin
12  * transaction and the transaction creation keys) are trusted.
13  * 
14  * See trust() and verify() functions on CommitmentTransaction.
15  * 
16  * This structure implements Deref.
17  */
18 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
19 public class TrustedCommitmentTransaction extends CommonBase {
20         TrustedCommitmentTransaction(Object _dummy, long ptr) { super(ptr); }
21         @Override @SuppressWarnings("deprecation")
22         protected void finalize() throws Throwable {
23                 super.finalize();
24                 if (ptr != 0) { bindings.TrustedCommitmentTransaction_free(ptr); }
25         }
26
27         /**
28          * The transaction ID of the built Bitcoin transaction
29          */
30         public byte[] txid() {
31                 byte[] ret = bindings.TrustedCommitmentTransaction_txid(this.ptr);
32                 return ret;
33         }
34
35         /**
36          * The pre-built Bitcoin commitment transaction
37          */
38         public BuiltCommitmentTransaction built_transaction() {
39                 long ret = bindings.TrustedCommitmentTransaction_built_transaction(this.ptr);
40                 if (ret >= 0 && ret <= 4096) { return null; }
41                 BuiltCommitmentTransaction ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new BuiltCommitmentTransaction(null, ret); }
42                 ret_hu_conv.ptrs_to.add(this);
43                 return ret_hu_conv;
44         }
45
46         /**
47          * The pre-calculated transaction creation public keys.
48          */
49         public TxCreationKeys keys() {
50                 long ret = bindings.TrustedCommitmentTransaction_keys(this.ptr);
51                 if (ret >= 0 && ret <= 4096) { return null; }
52                 TxCreationKeys ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new TxCreationKeys(null, ret); }
53                 ret_hu_conv.ptrs_to.add(this);
54                 return ret_hu_conv;
55         }
56
57         /**
58          * Get a signature for each HTLC which was included in the commitment transaction (ie for
59          * which HTLCOutputInCommitment::transaction_output_index.is_some()).
60          * 
61          * The returned Vec has one entry for each HTLC, and in the same order.
62          */
63         public Result_CVec_SignatureZNoneZ get_htlc_sigs(byte[] htlc_base_key, DirectedChannelTransactionParameters channel_parameters) {
64                 long ret = bindings.TrustedCommitmentTransaction_get_htlc_sigs(this.ptr, InternalUtils.check_arr_len(htlc_base_key, 32), channel_parameters == null ? 0 : channel_parameters.ptr & ~1);
65                 if (ret >= 0 && ret <= 4096) { return null; }
66                 Result_CVec_SignatureZNoneZ ret_hu_conv = Result_CVec_SignatureZNoneZ.constr_from_ptr(ret);
67                 this.ptrs_to.add(channel_parameters);
68                 return ret_hu_conv;
69         }
70
71 }