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