Update auto-generated bindings
[ldk-java] / src / main / java / org / ldk / structs / HolderCommitmentTransaction.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  * Information needed to build and sign a holder's commitment transaction.
11  * 
12  * The transaction is only signed once we are ready to broadcast.
13  */
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class HolderCommitmentTransaction extends CommonBase {
16         HolderCommitmentTransaction(Object _dummy, long ptr) { super(ptr); }
17         @Override @SuppressWarnings("deprecation")
18         protected void finalize() throws Throwable {
19                 super.finalize();
20                 if (ptr != 0) { bindings.HolderCommitmentTransaction_free(ptr); }
21         }
22
23         /**
24          * Our counterparty's signature for the transaction
25          */
26         public byte[] get_counterparty_sig() {
27                 byte[] ret = bindings.HolderCommitmentTransaction_get_counterparty_sig(this.ptr);
28                 return ret;
29         }
30
31         /**
32          * Our counterparty's signature for the transaction
33          */
34         public void set_counterparty_sig(byte[] val) {
35                 bindings.HolderCommitmentTransaction_set_counterparty_sig(this.ptr, val);
36         }
37
38         /**
39          * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
40          */
41         public void set_counterparty_htlc_sigs(byte[][] val) {
42                 bindings.HolderCommitmentTransaction_set_counterparty_htlc_sigs(this.ptr, val);
43         }
44
45         /**
46          * Creates a copy of the HolderCommitmentTransaction
47          */
48         public HolderCommitmentTransaction clone() {
49                 long ret = bindings.HolderCommitmentTransaction_clone(this.ptr);
50                 HolderCommitmentTransaction ret_hu_conv = new HolderCommitmentTransaction(null, ret);
51                 ret_hu_conv.ptrs_to.add(this);
52                 return ret_hu_conv;
53         }
54
55         /**
56          * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read
57          */
58         public byte[] write() {
59                 byte[] ret = bindings.HolderCommitmentTransaction_write(this.ptr);
60                 return ret;
61         }
62
63         /**
64          * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write
65          */
66         public static Result_HolderCommitmentTransactionDecodeErrorZ read(byte[] ser) {
67                 long ret = bindings.HolderCommitmentTransaction_read(ser);
68                 Result_HolderCommitmentTransactionDecodeErrorZ ret_hu_conv = Result_HolderCommitmentTransactionDecodeErrorZ.constr_from_ptr(ret);
69                 return ret_hu_conv;
70         }
71
72         /**
73          * Create a new holder transaction with the given counterparty signatures.
74          * The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
75          */
76         public static HolderCommitmentTransaction of(CommitmentTransaction commitment_tx, byte[] counterparty_sig, byte[][] counterparty_htlc_sigs, byte[] holder_funding_key, byte[] counterparty_funding_key) {
77                 long ret = bindings.HolderCommitmentTransaction_new(commitment_tx == null ? 0 : commitment_tx.ptr & ~1, counterparty_sig, counterparty_htlc_sigs, holder_funding_key, counterparty_funding_key);
78                 HolderCommitmentTransaction ret_hu_conv = new HolderCommitmentTransaction(null, ret);
79                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
80                 ret_hu_conv.ptrs_to.add(commitment_tx);
81                 return ret_hu_conv;
82         }
83
84 }